diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 21:00:06 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 21:00:06 +0000 |
commit | 67b23e6043d8e2b30b0bf3bc105b8583c2a26db5 (patch) | |
tree | edb58560b444979051b42ab7f0c0c718f7459754 /miscutils | |
parent | 40920825d59874cf285390434486e88c8498d2d8 (diff) | |
download | busybox-w32-67b23e6043d8e2b30b0bf3bc105b8583c2a26db5.tar.gz busybox-w32-67b23e6043d8e2b30b0bf3bc105b8583c2a26db5.tar.bz2 busybox-w32-67b23e6043d8e2b30b0bf3bc105b8583c2a26db5.zip |
getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/adjtimex.c | 4 | ||||
-rw-r--r-- | miscutils/crond.c | 8 | ||||
-rw-r--r-- | miscutils/eject.c | 4 | ||||
-rw-r--r-- | miscutils/hdparm.c | 44 | ||||
-rw-r--r-- | miscutils/less.c | 2 | ||||
-rw-r--r-- | miscutils/makedevs.c | 2 | ||||
-rw-r--r-- | miscutils/mountpoint.c | 2 | ||||
-rw-r--r-- | miscutils/strings.c | 4 | ||||
-rw-r--r-- | miscutils/watchdog.c | 4 |
9 files changed, 37 insertions, 37 deletions
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 9662bbea9..47af1a5d2 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c | |||
@@ -47,14 +47,14 @@ int adjtimex_main(int argc, char **argv) | |||
47 | enum { | 47 | enum { |
48 | OPT_quiet = 0x1 | 48 | OPT_quiet = 0x1 |
49 | }; | 49 | }; |
50 | unsigned long opt; | 50 | unsigned opt; |
51 | char *opt_o, *opt_f, *opt_p, *opt_t; | 51 | char *opt_o, *opt_f, *opt_p, *opt_t; |
52 | struct timex txc; | 52 | struct timex txc; |
53 | int i, ret, sep; | 53 | int i, ret, sep; |
54 | const char *descript; | 54 | const char *descript; |
55 | txc.modes=0; | 55 | txc.modes=0; |
56 | 56 | ||
57 | opt = bb_getopt_ulflags(argc, argv, "qo:f:p:t:", | 57 | opt = getopt32(argc, argv, "qo:f:p:t:", |
58 | &opt_o, &opt_f, &opt_p, &opt_t); | 58 | &opt_o, &opt_f, &opt_p, &opt_t); |
59 | //if (opt & 0x1) // -q | 59 | //if (opt & 0x1) // -q |
60 | if (opt & 0x2) { // -o | 60 | if (opt & 0x2) { // -o |
diff --git a/miscutils/crond.c b/miscutils/crond.c index 3e12fedc8..4f25486dd 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -133,19 +133,19 @@ static void crondlog(const char *ctl, ...) | |||
133 | 133 | ||
134 | int crond_main(int ac, char **av) | 134 | int crond_main(int ac, char **av) |
135 | { | 135 | { |
136 | unsigned long opt; | 136 | unsigned opt; |
137 | char *lopt, *Lopt, *copt; | 137 | char *lopt, *Lopt, *copt; |
138 | 138 | ||
139 | #if ENABLE_DEBUG_CROND_OPTION | 139 | #if ENABLE_DEBUG_CROND_OPTION |
140 | char *dopt; | 140 | char *dopt; |
141 | 141 | ||
142 | bb_opt_complementally = "f-b:b-f:S-L:L-S:d-l"; | 142 | opt_complementary = "f-b:b-f:S-L:L-S:d-l"; |
143 | #else | 143 | #else |
144 | bb_opt_complementally = "f-b:b-f:S-L:L-S"; | 144 | opt_complementary = "f-b:b-f:S-L:L-S"; |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | opterr = 0; /* disable getopt 'errors' message. */ | 147 | opterr = 0; /* disable getopt 'errors' message. */ |
148 | opt = bb_getopt_ulflags(ac, av, "l:L:fbSc:" | 148 | opt = getopt32(ac, av, "l:L:fbSc:" |
149 | #if ENABLE_DEBUG_CROND_OPTION | 149 | #if ENABLE_DEBUG_CROND_OPTION |
150 | "d:" | 150 | "d:" |
151 | #endif | 151 | #endif |
diff --git a/miscutils/eject.c b/miscutils/eject.c index 272d95980..d49396be6 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c | |||
@@ -31,8 +31,8 @@ int eject_main(int argc, char **argv) | |||
31 | struct mntent *m; | 31 | struct mntent *m; |
32 | int dev; | 32 | int dev; |
33 | 33 | ||
34 | /*bb_opt_complementally = "t--T:T--t";*/ | 34 | /*opt_complementary = "t--T:T--t";*/ |
35 | flags = bb_getopt_ulflags(argc, argv, "tT"); | 35 | flags = getopt32(argc, argv, "tT"); |
36 | device = argv[optind] ? : DEFAULT_CDROM; | 36 | device = argv[optind] ? : DEFAULT_CDROM; |
37 | 37 | ||
38 | m = find_mount_point(device, bb_path_mtab_file); | 38 | m = find_mount_point(device, bb_path_mtab_file); |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index b90142362..6c46f6a92 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -575,18 +575,18 @@ static void identify(uint16_t *id_supplied) | |||
575 | 575 | ||
576 | /* check if we recognise the device type */ | 576 | /* check if we recognise the device type */ |
577 | printf("\n"); | 577 | printf("\n"); |
578 | if(!(val[GEN_CONFIG] & NOT_ATA)) | 578 | if (!(val[GEN_CONFIG] & NOT_ATA)) |
579 | { | 579 | { |
580 | dev = ATA_DEV; | 580 | dev = ATA_DEV; |
581 | printf("ATA device, with "); | 581 | printf("ATA device, with "); |
582 | } | 582 | } |
583 | else if(val[GEN_CONFIG]==CFA_SUPPORT_VAL) | 583 | else if (val[GEN_CONFIG]==CFA_SUPPORT_VAL) |
584 | { | 584 | { |
585 | dev = ATA_DEV; | 585 | dev = ATA_DEV; |
586 | like_std = 4; | 586 | like_std = 4; |
587 | printf("CompactFlash ATA device, with "); | 587 | printf("CompactFlash ATA device, with "); |
588 | } | 588 | } |
589 | else if(!(val[GEN_CONFIG] & NOT_ATAPI)) | 589 | else if (!(val[GEN_CONFIG] & NOT_ATAPI)) |
590 | { | 590 | { |
591 | dev = ATAPI_DEV; | 591 | dev = ATAPI_DEV; |
592 | eqpt = (val[GEN_CONFIG] & EQPT_TYPE) >> SHIFT_EQPT; | 592 | eqpt = (val[GEN_CONFIG] & EQPT_TYPE) >> SHIFT_EQPT; |
@@ -609,9 +609,9 @@ static void identify(uint16_t *id_supplied) | |||
609 | (val[CONFIG]==PWRD_NID_VAL) || (val[CONFIG]==PWRD_ID_VAL) ) | 609 | (val[CONFIG]==PWRD_NID_VAL) || (val[CONFIG]==PWRD_ID_VAL) ) |
610 | { | 610 | { |
611 | like_std = 5; | 611 | like_std = 5; |
612 | if((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL)) | 612 | if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL)) |
613 | printf("powers-up in standby; SET FEATURES subcmd spins-up.\n"); | 613 | printf("powers-up in standby; SET FEATURES subcmd spins-up.\n"); |
614 | if(((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) | 614 | if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) |
615 | printf("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n\n"); | 615 | printf("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n\n"); |
616 | } | 616 | } |
617 | 617 | ||
@@ -629,9 +629,9 @@ static void identify(uint16_t *id_supplied) | |||
629 | { | 629 | { |
630 | if (val[MINOR] && (val[MINOR] <= MINOR_MAX)) | 630 | if (val[MINOR] && (val[MINOR] <= MINOR_MAX)) |
631 | { | 631 | { |
632 | if(like_std < 3) like_std = 3; | 632 | if (like_std < 3) like_std = 3; |
633 | std = actual_ver[val[MINOR]]; | 633 | std = actual_ver[val[MINOR]]; |
634 | if(std) printf("\n\tUsed: %s ",minor_str[val[MINOR]]); | 634 | if (std) printf("\n\tUsed: %s ",minor_str[val[MINOR]]); |
635 | 635 | ||
636 | } | 636 | } |
637 | /* looks like when they up-issue the std, they obsolete one; | 637 | /* looks like when they up-issue the std, they obsolete one; |
@@ -652,17 +652,17 @@ static void identify(uint16_t *id_supplied) | |||
652 | like_std = ii; | 652 | like_std = ii; |
653 | kk = like_std >4 ? like_std-4: 0; | 653 | kk = like_std >4 ? like_std-4: 0; |
654 | } | 654 | } |
655 | if(min_std > ii) min_std = ii; | 655 | if (min_std > ii) min_std = ii; |
656 | } | 656 | } |
657 | jj <<= 1; | 657 | jj <<= 1; |
658 | } | 658 | } |
659 | if(like_std < 3) like_std = 3; | 659 | if (like_std < 3) like_std = 3; |
660 | } | 660 | } |
661 | /* Figure out what standard the device is using if it hasn't told | 661 | /* Figure out what standard the device is using if it hasn't told |
662 | * us. If we know the std, check if the device is using any of | 662 | * us. If we know the std, check if the device is using any of |
663 | * the words from the next level up. It happens. | 663 | * the words from the next level up. It happens. |
664 | */ | 664 | */ |
665 | if(like_std < std) like_std = std; | 665 | if (like_std < std) like_std = std; |
666 | 666 | ||
667 | if (((std == 5) || (!std && (like_std < 6))) && | 667 | if (((std == 5) || (!std && (like_std < 6))) && |
668 | ((((val[CMDS_SUPP_1] & VALID) == VALID_VAL) && | 668 | ((((val[CMDS_SUPP_1] & VALID) == VALID_VAL) && |
@@ -724,7 +724,7 @@ static void identify(uint16_t *id_supplied) | |||
724 | jj = val[CDR_MAJOR] >> 1; | 724 | jj = val[CDR_MAJOR] >> 1; |
725 | for (ii = 1; ii <15; ii++) | 725 | for (ii = 1; ii <15; ii++) |
726 | { | 726 | { |
727 | if(jj & 0x0001) printf("-%u ", ii); | 727 | if (jj & 0x0001) printf("-%u ", ii); |
728 | jj >>= 1; | 728 | jj >>= 1; |
729 | } | 729 | } |
730 | } | 730 | } |
@@ -743,7 +743,7 @@ static void identify(uint16_t *id_supplied) | |||
743 | jj = val[GEN_CONFIG] >> 1; | 743 | jj = val[GEN_CONFIG] >> 1; |
744 | for (ii = 1; ii < 15; ii++) | 744 | for (ii = 1; ii < 15; ii++) |
745 | { | 745 | { |
746 | if(jj & 0x0001) printf("\t%s\n",ata1_cfg_str[ii]); | 746 | if (jj & 0x0001) printf("\t%s\n",ata1_cfg_str[ii]); |
747 | jj >>=1; | 747 | jj >>=1; |
748 | } | 748 | } |
749 | } | 749 | } |
@@ -1018,7 +1018,7 @@ static void identify(uint16_t *id_supplied) | |||
1018 | } | 1018 | } |
1019 | } | 1019 | } |
1020 | /* Removable Media Status Notification feature set */ | 1020 | /* Removable Media Status Notification feature set */ |
1021 | if((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP) | 1021 | if ((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP) |
1022 | printf("\t%s supported\n", cmd_feat_str[27]); | 1022 | printf("\t%s supported\n", cmd_feat_str[27]); |
1023 | 1023 | ||
1024 | 1024 | ||
@@ -1196,7 +1196,7 @@ static void dump_identity(const struct hd_driveid *id) | |||
1196 | } | 1196 | } |
1197 | printf("\n"); | 1197 | printf("\n"); |
1198 | 1198 | ||
1199 | if(!(id->field_valid&1)) | 1199 | if (!(id->field_valid&1)) |
1200 | printf(" (maybe):"); | 1200 | printf(" (maybe):"); |
1201 | 1201 | ||
1202 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, | 1202 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, |
@@ -1589,7 +1589,7 @@ static void interpret_xfermode(unsigned int xfermode) | |||
1589 | 1589 | ||
1590 | static void print_flag(unsigned long flag, char *s, unsigned long value) | 1590 | static void print_flag(unsigned long flag, char *s, unsigned long value) |
1591 | { | 1591 | { |
1592 | if(flag) | 1592 | if (flag) |
1593 | printf(" setting %s to %ld\n", s, value); | 1593 | printf(" setting %s to %ld\n", s, value); |
1594 | } | 1594 | } |
1595 | 1595 | ||
@@ -2078,18 +2078,18 @@ static void parse_xfermode(int flag, unsigned long *get, unsigned long *set, int | |||
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | /*------- getopt short options --------*/ | 2080 | /*------- getopt short options --------*/ |
2081 | static const char hdparm_options[]= "gfu::n::p:r::m::c::k::a::B:tTh"\ | 2081 | static const char hdparm_options[] = "gfu::n::p:r::m::c::k::a::B:tTh" |
2082 | USE_FEATURE_HDPARM_GET_IDENTITY("iI") | 2082 | USE_FEATURE_HDPARM_GET_IDENTITY("iI") |
2083 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") | 2083 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") |
2084 | #ifdef HDIO_DRIVE_CMD | 2084 | #ifdef HDIO_DRIVE_CMD |
2085 | "S:D:P:X:K:A:L:W:CyYzZ" | 2085 | "S:D:P:X:K:A:L:W:CyYzZ" |
2086 | #endif | 2086 | #endif |
2087 | USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("U:") | 2087 | USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("U:") |
2088 | #ifdef HDIO_GET_QDMA | 2088 | #ifdef HDIO_GET_QDMA |
2089 | #ifdef HDIO_SET_QDMA | 2089 | #ifdef HDIO_SET_QDMA |
2090 | "Q:" | 2090 | "Q:" |
2091 | #else | 2091 | #else |
2092 | "Q" | 2092 | "Q" |
2093 | #endif | 2093 | #endif |
2094 | #endif | 2094 | #endif |
2095 | USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("w") | 2095 | USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("w") |
@@ -2154,8 +2154,8 @@ int hdparm_main(int argc, char **argv) | |||
2154 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF | 2154 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF |
2155 | if (c == 'R') { | 2155 | if (c == 'R') { |
2156 | parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX); | 2156 | parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX); |
2157 | hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX); | 2157 | hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX); |
2158 | hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX); | 2158 | hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX); |
2159 | /* Move past the 2 additional arguments */ | 2159 | /* Move past the 2 additional arguments */ |
2160 | argv += 2; | 2160 | argv += 2; |
2161 | argc -= 2; | 2161 | argc -= 2; |
@@ -2163,7 +2163,7 @@ int hdparm_main(int argc, char **argv) | |||
2163 | #endif | 2163 | #endif |
2164 | } | 2164 | } |
2165 | /* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */ | 2165 | /* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */ |
2166 | if (!flagcount){ | 2166 | if (!flagcount) { |
2167 | get_mult = get_io32bit = get_unmask = get_keep = get_readonly = get_readahead = get_geom = 1; | 2167 | get_mult = get_io32bit = get_unmask = get_keep = get_readonly = get_readahead = get_geom = 1; |
2168 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1); | 2168 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1); |
2169 | } | 2169 | } |
diff --git a/miscutils/less.c b/miscutils/less.c index bde2a4527..63389dcd7 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1102,7 +1102,7 @@ int less_main(int argc, char **argv) { | |||
1102 | 1102 | ||
1103 | int keypress; | 1103 | int keypress; |
1104 | 1104 | ||
1105 | flags = bb_getopt_ulflags(argc, argv, "EMmN~"); | 1105 | flags = getopt32(argc, argv, "EMmN~"); |
1106 | 1106 | ||
1107 | argc -= optind; | 1107 | argc -= optind; |
1108 | argv += optind; | 1108 | argv += optind; |
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 66b4ce00d..4619e4dd5 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
@@ -76,7 +76,7 @@ int makedevs_main(int argc, char **argv) | |||
76 | int linenum = 0; | 76 | int linenum = 0; |
77 | int ret = EXIT_SUCCESS; | 77 | int ret = EXIT_SUCCESS; |
78 | 78 | ||
79 | bb_getopt_ulflags(argc, argv, "d:", &line); | 79 | getopt32(argc, argv, "d:", &line); |
80 | if (line) | 80 | if (line) |
81 | table = xfopen(line, "r"); | 81 | table = xfopen(line, "r"); |
82 | 82 | ||
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 3e5fb4b46..dbc8fe0e9 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | int mountpoint_main(int argc, char **argv) | 14 | int mountpoint_main(int argc, char **argv) |
15 | { | 15 | { |
16 | int opt = bb_getopt_ulflags(argc, argv, "qdx"); | 16 | int opt = getopt32(argc, argv, "qdx"); |
17 | #define OPT_q (1) | 17 | #define OPT_q (1) |
18 | #define OPT_d (2) | 18 | #define OPT_d (2) |
19 | #define OPT_x (4) | 19 | #define OPT_x (4) |
diff --git a/miscutils/strings.c b/miscutils/strings.c index e9f335ebd..36bcf8b17 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -21,14 +21,14 @@ | |||
21 | int strings_main(int argc, char **argv) | 21 | int strings_main(int argc, char **argv) |
22 | { | 22 | { |
23 | int n, c, i = 0, status = EXIT_SUCCESS; | 23 | int n, c, i = 0, status = EXIT_SUCCESS; |
24 | unsigned long opt; | 24 | unsigned opt; |
25 | unsigned long count; | 25 | unsigned long count; |
26 | FILE *file = stdin; | 26 | FILE *file = stdin; |
27 | char *string; | 27 | char *string; |
28 | const char *fmt = "%s: "; | 28 | const char *fmt = "%s: "; |
29 | char *n_arg = "4"; | 29 | char *n_arg = "4"; |
30 | 30 | ||
31 | opt = bb_getopt_ulflags(argc, argv, "afon:", &n_arg); | 31 | opt = getopt32(argc, argv, "afon:", &n_arg); |
32 | /* -a is our default behaviour */ | 32 | /* -a is our default behaviour */ |
33 | 33 | ||
34 | argc -= optind; | 34 | argc -= optind; |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index ebbab2df3..ae51aba7b 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -25,11 +25,11 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused) | |||
25 | 25 | ||
26 | int watchdog_main(int argc, char **argv) | 26 | int watchdog_main(int argc, char **argv) |
27 | { | 27 | { |
28 | unsigned long opts; | 28 | unsigned opts; |
29 | unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */ | 29 | unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */ |
30 | char *t_arg; | 30 | char *t_arg; |
31 | 31 | ||
32 | opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg); | 32 | opts = getopt32(argc, argv, "Ft:", &t_arg); |
33 | 33 | ||
34 | if (opts & OPT_TIMER) | 34 | if (opts & OPT_TIMER) |
35 | timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); | 35 | timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); |