545 |
|
|
546 |
c = *s++; |
c = *s++; |
547 |
p = strchr(CSIL, *s); |
p = strchr(CSIL, *s); |
548 |
if (!p) { |
/* if *s == NUL, p != NULL! Testcase: "od -tx" */ |
549 |
|
if (!p || *p == '\0') { |
550 |
size = sizeof(int); |
size = sizeof(int); |
551 |
if (isdigit(s[0])) { |
if (isdigit(s[0])) { |
552 |
size = bb_strtou(s, &end, 0); |
size = bb_strtou(s, &end, 0); |
808 |
} |
} |
809 |
|
|
810 |
if (n_skip) |
if (n_skip) |
811 |
bb_error_msg_and_die("cannot skip past end of combined input"); |
bb_error_msg_and_die("can't skip past end of combined input"); |
812 |
} |
} |
813 |
|
|
814 |
|
|
833 |
printf(address_fmt, address); |
printf(address_fmt, address); |
834 |
} |
} |
835 |
|
|
836 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
837 |
/* only used with --traditional */ |
/* only used with --traditional */ |
838 |
static void |
static void |
839 |
format_address_paren(off_t address, char c) |
format_address_paren(off_t address, char c) |
954 |
return l_c_m; |
return l_c_m; |
955 |
} |
} |
956 |
|
|
957 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
958 |
/* If S is a valid traditional offset specification with an optional |
/* If S is a valid traditional offset specification with an optional |
959 |
leading '+' return nonzero and set *OFFSET to the offset it denotes. */ |
leading '+' return nonzero and set *OFFSET to the offset it denotes. */ |
960 |
|
|
964 |
static const struct suffix_mult Bb[] = { |
static const struct suffix_mult Bb[] = { |
965 |
{ "B", 1024 }, |
{ "B", 1024 }, |
966 |
{ "b", 512 }, |
{ "b", 512 }, |
967 |
{ } |
{ "", 0 } |
968 |
}; |
}; |
969 |
char *p; |
char *p; |
970 |
int radix; |
int radix; |
1179 |
{ "b", 512 }, |
{ "b", 512 }, |
1180 |
{ "k", 1024 }, |
{ "k", 1024 }, |
1181 |
{ "m", 1024*1024 }, |
{ "m", 1024*1024 }, |
1182 |
{ } |
{ "", 0 } |
1183 |
}; |
}; |
1184 |
enum { |
enum { |
1185 |
OPT_A = 1 << 0, |
OPT_A = 1 << 0, |
1200 |
OPT_s = 1 << 15, |
OPT_s = 1 << 15, |
1201 |
OPT_S = 1 << 16, |
OPT_S = 1 << 16, |
1202 |
OPT_w = 1 << 17, |
OPT_w = 1 << 17, |
1203 |
OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, |
OPT_traditional = (1 << 18) * ENABLE_LONG_OPTS, |
1204 |
}; |
}; |
1205 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
1206 |
static const char od_longopts[] ALIGN1 = |
static const char od_longopts[] ALIGN1 = |
1207 |
"skip-bytes\0" Required_argument "j" |
"skip-bytes\0" Required_argument "j" |
1208 |
"address-radix\0" Required_argument "A" |
"address-radix\0" Required_argument "A" |
1236 |
|
|
1237 |
/* Parse command line */ |
/* Parse command line */ |
1238 |
opt_complementary = "w+:t::"; /* -w N, -t is a list */ |
opt_complementary = "w+:t::"; /* -w N, -t is a list */ |
1239 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
1240 |
applet_long_options = od_longopts; |
applet_long_options = od_longopts; |
1241 |
#endif |
#endif |
1242 |
opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:" |
opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:" |
1307 |
* FIXME: POSIX 1003.1-2001 with XSI requires support for the |
* FIXME: POSIX 1003.1-2001 with XSI requires support for the |
1308 |
* traditional syntax even if --traditional is not given. */ |
* traditional syntax even if --traditional is not given. */ |
1309 |
|
|
1310 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
1311 |
if (opt & OPT_traditional) { |
if (opt & OPT_traditional) { |
1312 |
off_t o1, o2; |
off_t o1, o2; |
1313 |
|
|