252 switch (atoi(
str + 1)) {
253 case 2: force_mode =
'B';
break;
254 case 3: force_mode =
'T';
break;
255 case 8: force_mode =
'O';
break;
256 case 10: force_mode =
'I';
break;
257 case 16: force_mode =
'0';
break;
258 case 0: force_mode =
str[1];
break;
265 while (
str[1] &&
str[1] !=
' ') {
299 if (
str[1] >=
'0' &&
str[1] <=
'9') {
307 printf(
"Usage: rz-ax [options] [expr ...]\n");
323 if (*
str ==
'h' || *
str ==
'?') {
330 int n = ((strlen(
str)) >> 1) + 1;
336 fwrite(
buf,
n, 1, stdout);
351 for (
i = 0;
i <
len;
i++) {
360 for (
i = 0;
i <
n;
i++) {
377 fwrite(&
n,
sizeof(
n), 1, stdout);
380 for (
i = 0;
i < 8;
i++) {
381 printf(
"%02x", (
int)(
n & 0xff));
390 fwrite(&n32,
sizeof(n32), 1, stdout);
393 for (
i = 0;
i < 4;
i++) {
394 printf(
"%02x", n32 & 0xff);
403 for (
i = 0;
i < strlen(
str);
i++) {
419 char strbits[65] = { 0 };
420 int i = 0, set_bits_ctr = 0;
424 while (strbits[
i] !=
'\0') {
425 if (strbits[
i] ==
'1') {
429 }
else if (strbits[
i] ==
'1' && last_char ==
'0') {
433 if (strbits[
i] ==
'0' && last_char ==
'1') {
434 if (set_bits_ctr == 1) {
436 }
else if (strbits[
i + 1] ==
'\0') {
441 }
else if (strbits[
i] ==
'1' && strbits[
i + 1] ==
'\0') {
442 if (set_bits_ctr == 1) {
448 last_char = strbits[
i];
457 }
else if (
n >> 14) {
469 fwrite(&
n,
sizeof(
n), 1, stdout);
472 for (
i = 0;
i < 8;
i++) {
473 printf(
"\\x%02x", (
int)(
n & 0xff));
482 fwrite(&n32,
sizeof(n32), 1, stdout);
485 for (
i = 0;
i < 4;
i++) {
486 printf(
"\\x%02x", n32 & 0xff);
500 char *ts = rz_list_head(split)->data;
501 const char *gmt =
NULL;
502 if (
rz_list_length(split) >= 2 && strlen(rz_list_head(split)->
n->data) >= 2) {
503 gmt = (
const char *)rz_list_head(split)->n->data;
515 const int n = strlen(
str);
526 const int n = strlen(
str);
550 char *asnum, unit[8];
558 eprintf(
"RzNum ERROR: Division by Zero\n");
573 n,
n,
n, unit,
s,
a);
586 eprintf (
"%s %.01lf %ff %lf\n",
591 printf(
"unit %s\n", unit);
592 printf(
"segment %04x:%04x\n",
s,
a);
599 printf(
"string \"%s\"\n", asnum);
619 static const char start[] =
"unsigned char buf[] = {";
622 const int byte_per_col = 12;
623 for (
i = 0;
i <
len - 1;
i++) {
625 if (
i % byte_per_col == 0) {
631 if (
i % byte_per_col == 0) {
636 printf(
"unsigned int buf_len = %d;\n",
len);
652 eprintf(
"RzNum ERROR: Division by Zero\n");
661 eprintf(
"No String Possible\n");
666 if (strchr(
str,
'.')) {
668 sscanf(
str,
"%hhd.%hhd.%hhd.%hhd",
ip,
ip + 1,
ip + 2,
ip + 3);
669 ut32 ip32 =
ip[0] | (
ip[1] << 8) | (
ip[2] << 16) | (
ip[3] << 24);
673 ut8 ip[4] = { ip32 & 0xff, (ip32 >> 8) & 0xff, (ip32 >> 16) & 0xff, ip32 >> 24 };
701 str[strlen(
str) - 1] =
'b';
707 str[strlen(
str) - 2] =
't';
708 str[strlen(
str) - 1] =
'\0';
710 while ((
p = strchr(
str,
' '))) {
const lzma_allocator const uint8_t size_t uint8_t * out
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static void print_ascii_table(void)
#define RZ_AX_FLAG_BASE64_ENCODE
#define RZ_AX_FLAG_TIMESTAMP_TO_STR
#define RZ_AX_FLAG_FORCE_INTEGER
static void print_hex_from_base2(char *base2)
#define RZ_AX_FLAG_STR_TO_DJB2
#define RZ_AX_FLAG_BIN_TO_BIGNUM
#define RZ_AX_FLAG_IPADDR_TO_LONG
#define RZ_AX_FLAG_HEX_TO_RAW
static int use_stdin(RzNum *num, ut64 *flags, int *fm)
#define RZ_AX_FLAG_STR_TO_BIN
#define RZ_AX_FLAG_RIZIN_CMD
#define RZ_AX_FLAG_OCTAL_TO_RAW
#define RZ_AX_FLAG_DUMP_C_BYTES
#define RZ_AX_FLAG_NUMBER_TO_HEX
#define RZ_AX_FLAG_NUMBER_TO_HEXSTR
#define RZ_AX_FLAG_SET_BITS
#define RZ_AX_FLAG_SIGNED_WORD
#define RZ_AX_FLAG_RAW_TO_HEX
#define RZ_AX_FLAG_BIN_TO_STR
#define RZ_AX_FLAG_RAW_TO_LANGBYTES
#define RZ_AX_FLAG_FLOATING_POINT
static int format_output(RzNum *num, char mode, const char *s, int force_mode, ut64 flags)
#define RZ_AX_FLAG_BASE64_DECODE
#define RZ_AX_FLAG_KEEP_BASE
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * malloc(size_t size)
RZ_API size_t rz_base64_encode(char *bout, const ut8 *bin, size_t sz)
RZ_API int rz_base64_decode(ut8 *bout, const char *bin, int len)
RZ_API char * rz_stdin_slurp(int *sz)
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
RZ_API char * rz_hex_from_code(const char *code)
RZ_API int rz_main_version_print(const char *program)
RZ_API char * rz_num_units(char *buf, size_t len, ut64 number)
RZ_API char * rz_num_as_string(RzNum *___, ut64 n, bool printable_only)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API ut64 rz_str_djb2_hash(const char *str)
RZ_API char * rz_str_new(const char *str)
RZ_API int rz_str_binstr2bin(const char *str, ut8 *out, int outlen)
RZ_API int rz_str_bits64(char *strout, ut64 in)
RZ_API int rz_str_bits(char *strout, const ut8 *buf, int len, const char *bitz)
RZ_API size_t rz_str_nlen(const char *s, size_t n)
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API RzList * rz_str_split_list(char *str, const char *c, int n)
Split the string str according to the substring c and returns a RzList with the result.
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
RZ_API void rz_str_reverse(char *str)
#define rz_time_date_unix_to_string