summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-03 21:00:06 +0000
committerDenis Vlasenko2006-10-03 21:00:06 +0000
commit67b23e6043d8e2b30b0bf3bc105b8583c2a26db5 (patch)
treeedb58560b444979051b42ab7f0c0c718f7459754 /miscutils
parent40920825d59874cf285390434486e88c8498d2d8 (diff)
downloadbusybox-67b23e6043d8e2b30b0bf3bc105b8583c2a26db5.zip
busybox-67b23e6043d8e2b30b0bf3bc105b8583c2a26db5.tar.gz
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.c4
-rw-r--r--miscutils/crond.c8
-rw-r--r--miscutils/eject.c4
-rw-r--r--miscutils/hdparm.c44
-rw-r--r--miscutils/less.c2
-rw-r--r--miscutils/makedevs.c2
-rw-r--r--miscutils/mountpoint.c2
-rw-r--r--miscutils/strings.c4
-rw-r--r--miscutils/watchdog.c4
9 files changed, 37 insertions, 37 deletions
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 9662bbe..47af1a5 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -47,14 +47,14 @@ int adjtimex_main(int argc, char **argv)
enum {
OPT_quiet = 0x1
};
- unsigned long opt;
+ unsigned opt;
char *opt_o, *opt_f, *opt_p, *opt_t;
struct timex txc;
int i, ret, sep;
const char *descript;
txc.modes=0;
- opt = bb_getopt_ulflags(argc, argv, "qo:f:p:t:",
+ opt = getopt32(argc, argv, "qo:f:p:t:",
&opt_o, &opt_f, &opt_p, &opt_t);
//if (opt & 0x1) // -q
if (opt & 0x2) { // -o
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 3e12fed..4f25486 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -133,19 +133,19 @@ static void crondlog(const char *ctl, ...)
int crond_main(int ac, char **av)
{
- unsigned long opt;
+ unsigned opt;
char *lopt, *Lopt, *copt;
#if ENABLE_DEBUG_CROND_OPTION
char *dopt;
- bb_opt_complementally = "f-b:b-f:S-L:L-S:d-l";
+ opt_complementary = "f-b:b-f:S-L:L-S:d-l";
#else
- bb_opt_complementally = "f-b:b-f:S-L:L-S";
+ opt_complementary = "f-b:b-f:S-L:L-S";
#endif
opterr = 0; /* disable getopt 'errors' message. */
- opt = bb_getopt_ulflags(ac, av, "l:L:fbSc:"
+ opt = getopt32(ac, av, "l:L:fbSc:"
#if ENABLE_DEBUG_CROND_OPTION
"d:"
#endif
diff --git a/miscutils/eject.c b/miscutils/eject.c
index 272d959..d49396b 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -31,8 +31,8 @@ int eject_main(int argc, char **argv)
struct mntent *m;
int dev;
- /*bb_opt_complementally = "t--T:T--t";*/
- flags = bb_getopt_ulflags(argc, argv, "tT");
+ /*opt_complementary = "t--T:T--t";*/
+ flags = getopt32(argc, argv, "tT");
device = argv[optind] ? : DEFAULT_CDROM;
m = find_mount_point(device, bb_path_mtab_file);
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index b901423..6c46f6a 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -575,18 +575,18 @@ static void identify(uint16_t *id_supplied)
/* check if we recognise the device type */
printf("\n");
- if(!(val[GEN_CONFIG] & NOT_ATA))
+ if (!(val[GEN_CONFIG] & NOT_ATA))
{
dev = ATA_DEV;
printf("ATA device, with ");
}
- else if(val[GEN_CONFIG]==CFA_SUPPORT_VAL)
+ else if (val[GEN_CONFIG]==CFA_SUPPORT_VAL)
{
dev = ATA_DEV;
like_std = 4;
printf("CompactFlash ATA device, with ");
}
- else if(!(val[GEN_CONFIG] & NOT_ATAPI))
+ else if (!(val[GEN_CONFIG] & NOT_ATAPI))
{
dev = ATAPI_DEV;
eqpt = (val[GEN_CONFIG] & EQPT_TYPE) >> SHIFT_EQPT;
@@ -609,9 +609,9 @@ static void identify(uint16_t *id_supplied)
(val[CONFIG]==PWRD_NID_VAL) || (val[CONFIG]==PWRD_ID_VAL) )
{
like_std = 5;
- if((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL))
+ if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL))
printf("powers-up in standby; SET FEATURES subcmd spins-up.\n");
- if(((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE))
+ if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE))
printf("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n\n");
}
@@ -629,9 +629,9 @@ static void identify(uint16_t *id_supplied)
{
if (val[MINOR] && (val[MINOR] <= MINOR_MAX))
{
- if(like_std < 3) like_std = 3;
+ if (like_std < 3) like_std = 3;
std = actual_ver[val[MINOR]];
- if(std) printf("\n\tUsed: %s ",minor_str[val[MINOR]]);
+ if (std) printf("\n\tUsed: %s ",minor_str[val[MINOR]]);
}
/* looks like when they up-issue the std, they obsolete one;
@@ -652,17 +652,17 @@ static void identify(uint16_t *id_supplied)
like_std = ii;
kk = like_std >4 ? like_std-4: 0;
}
- if(min_std > ii) min_std = ii;
+ if (min_std > ii) min_std = ii;
}
jj <<= 1;
}
- if(like_std < 3) like_std = 3;
+ if (like_std < 3) like_std = 3;
}
/* Figure out what standard the device is using if it hasn't told
* us. If we know the std, check if the device is using any of
* the words from the next level up. It happens.
*/
- if(like_std < std) like_std = std;
+ if (like_std < std) like_std = std;
if (((std == 5) || (!std && (like_std < 6))) &&
((((val[CMDS_SUPP_1] & VALID) == VALID_VAL) &&
@@ -724,7 +724,7 @@ static void identify(uint16_t *id_supplied)
jj = val[CDR_MAJOR] >> 1;
for (ii = 1; ii <15; ii++)
{
- if(jj & 0x0001) printf("-%u ", ii);
+ if (jj & 0x0001) printf("-%u ", ii);
jj >>= 1;
}
}
@@ -743,7 +743,7 @@ static void identify(uint16_t *id_supplied)
jj = val[GEN_CONFIG] >> 1;
for (ii = 1; ii < 15; ii++)
{
- if(jj & 0x0001) printf("\t%s\n",ata1_cfg_str[ii]);
+ if (jj & 0x0001) printf("\t%s\n",ata1_cfg_str[ii]);
jj >>=1;
}
}
@@ -1018,7 +1018,7 @@ static void identify(uint16_t *id_supplied)
}
}
/* Removable Media Status Notification feature set */
- if((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP)
+ if ((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP)
printf("\t%s supported\n", cmd_feat_str[27]);
@@ -1196,7 +1196,7 @@ static void dump_identity(const struct hd_driveid *id)
}
printf("\n");
- if(!(id->field_valid&1))
+ if (!(id->field_valid&1))
printf(" (maybe):");
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)
static void print_flag(unsigned long flag, char *s, unsigned long value)
{
- if(flag)
+ if (flag)
printf(" setting %s to %ld\n", s, value);
}
@@ -2078,18 +2078,18 @@ static void parse_xfermode(int flag, unsigned long *get, unsigned long *set, int
}
/*------- getopt short options --------*/
-static const char hdparm_options[]= "gfu::n::p:r::m::c::k::a::B:tTh"\
+static const char hdparm_options[] = "gfu::n::p:r::m::c::k::a::B:tTh"
USE_FEATURE_HDPARM_GET_IDENTITY("iI")
USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
#ifdef HDIO_DRIVE_CMD
- "S:D:P:X:K:A:L:W:CyYzZ"
+ "S:D:P:X:K:A:L:W:CyYzZ"
#endif
USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("U:")
#ifdef HDIO_GET_QDMA
#ifdef HDIO_SET_QDMA
- "Q:"
+ "Q:"
#else
- "Q"
+ "Q"
#endif
#endif
USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("w")
@@ -2154,8 +2154,8 @@ int hdparm_main(int argc, char **argv)
#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
if (c == 'R') {
parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX);
- hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX);
- hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX);
+ hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX);
+ hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX);
/* Move past the 2 additional arguments */
argv += 2;
argc -= 2;
@@ -2163,7 +2163,7 @@ int hdparm_main(int argc, char **argv)
#endif
}
/* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */
- if (!flagcount){
+ if (!flagcount) {
get_mult = get_io32bit = get_unmask = get_keep = get_readonly = get_readahead = get_geom = 1;
USE_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1);
}
diff --git a/miscutils/less.c b/miscutils/less.c
index bde2a45..63389dc 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -1102,7 +1102,7 @@ int less_main(int argc, char **argv) {
int keypress;
- flags = bb_getopt_ulflags(argc, argv, "EMmN~");
+ flags = getopt32(argc, argv, "EMmN~");
argc -= optind;
argv += optind;
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 66b4ce0..4619e4d 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -76,7 +76,7 @@ int makedevs_main(int argc, char **argv)
int linenum = 0;
int ret = EXIT_SUCCESS;
- bb_getopt_ulflags(argc, argv, "d:", &line);
+ getopt32(argc, argv, "d:", &line);
if (line)
table = xfopen(line, "r");
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index 3e5fb4b..dbc8fe0 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -13,7 +13,7 @@
int mountpoint_main(int argc, char **argv)
{
- int opt = bb_getopt_ulflags(argc, argv, "qdx");
+ int opt = getopt32(argc, argv, "qdx");
#define OPT_q (1)
#define OPT_d (2)
#define OPT_x (4)
diff --git a/miscutils/strings.c b/miscutils/strings.c
index e9f335e..36bcf8b 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -21,14 +21,14 @@
int strings_main(int argc, char **argv)
{
int n, c, i = 0, status = EXIT_SUCCESS;
- unsigned long opt;
+ unsigned opt;
unsigned long count;
FILE *file = stdin;
char *string;
const char *fmt = "%s: ";
char *n_arg = "4";
- opt = bb_getopt_ulflags(argc, argv, "afon:", &n_arg);
+ opt = getopt32(argc, argv, "afon:", &n_arg);
/* -a is our default behaviour */
argc -= optind;
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index ebbab2d..ae51aba 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -25,11 +25,11 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused)
int watchdog_main(int argc, char **argv)
{
- unsigned long opts;
+ unsigned opts;
unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
char *t_arg;
- opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg);
+ opts = getopt32(argc, argv, "Ft:", &t_arg);
if (opts & OPT_TIMER)
timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);