diff options
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/dmesg.c | 4 | ||||
-rw-r--r-- | util-linux/fbset.c | 30 | ||||
-rw-r--r-- | util-linux/fdisk.c | 13 | ||||
-rw-r--r-- | util-linux/hexdump.c | 4 | ||||
-rw-r--r-- | util-linux/ipcs.c | 2 | ||||
-rw-r--r-- | util-linux/losetup.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 2 | ||||
-rw-r--r-- | util-linux/readprofile.c | 6 |
8 files changed, 32 insertions, 33 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 277415a2d..658cddc38 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -19,13 +19,13 @@ int dmesg_main(int argc, char *argv[]) int flags = getopt32(argc, argv, "cs:n:", &size, &level); if (flags & 4) { - if (klogctl(8, NULL, bb_xgetlarg(level, 10, 0, 10))) + if (klogctl(8, NULL, xatoul_range(level, 0, 10))) bb_perror_msg_and_die("klogctl"); } else { int len; char *buf; - len = (flags & 2) ? bb_xgetlarg(size, 10, 2, INT_MAX) : 16384; + len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : 16384; buf = xmalloc(len); if (0 > (len = klogctl(3 + (flags & 1), buf, len))) bb_perror_msg_and_die("klogctl"); diff --git a/util-linux/fbset.c b/util-linux/fbset.c index bc8ec1806..1aa0a0ac1 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -338,20 +338,20 @@ int fbset_main(int argc, char **argv) modefile = argv[1]; break; case CMD_GEOMETRY: - varset.xres = strtoul(argv[1], 0, 0); - varset.yres = strtoul(argv[2], 0, 0); - varset.xres_virtual = strtoul(argv[3], 0, 0); - varset.yres_virtual = strtoul(argv[4], 0, 0); - varset.bits_per_pixel = strtoul(argv[5], 0, 0); + varset.xres = xatou32(argv[1]); + varset.yres = xatou32(argv[2]); + varset.xres_virtual = xatou32(argv[3]); + varset.yres_virtual = xatou32(argv[4]); + varset.bits_per_pixel = xatou32(argv[5]); break; case CMD_TIMING: - varset.pixclock = strtoul(argv[1], 0, 0); - varset.left_margin = strtoul(argv[2], 0, 0); - varset.right_margin = strtoul(argv[3], 0, 0); - varset.upper_margin = strtoul(argv[4], 0, 0); - varset.lower_margin = strtoul(argv[5], 0, 0); - varset.hsync_len = strtoul(argv[6], 0, 0); - varset.vsync_len = strtoul(argv[7], 0, 0); + varset.pixclock = xatou32(argv[1]); + varset.left_margin = xatou32(argv[2]); + varset.right_margin = xatou32(argv[3]); + varset.upper_margin = xatou32(argv[4]); + varset.lower_margin = xatou32(argv[5]); + varset.hsync_len = xatou32(argv[6]); + varset.vsync_len = xatou32(argv[7]); break; case CMD_ALL: g_options |= OPT_ALL; @@ -361,13 +361,13 @@ int fbset_main(int argc, char **argv) break; #ifdef CONFIG_FEATURE_FBSET_FANCY case CMD_XRES: - varset.xres = strtoul(argv[1], 0, 0); + varset.xres = xatou32(argv[1]); break; case CMD_YRES: - varset.yres = strtoul(argv[1], 0, 0); + varset.yres = xatou32(argv[1]); break; case CMD_DEPTH: - varset.bits_per_pixel = strtoul(argv[1], 0, 0); + varset.bits_per_pixel = xatou32(argv[1]); break; #endif } diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 85acaa4aa..3bf78ee04 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -1222,8 +1222,7 @@ edit_int(int def, char *mesg) printf(" (%d): ", def); if (!read_line()) return def; - } - while (!isdigit(*line_ptr)); /* FIXME: ?!! */ + } while (!isdigit(*line_ptr)); return atoi(line_ptr); } @@ -5664,14 +5663,14 @@ int fdisk_main(int argc, char **argv) #ifdef CONFIG_FEATURE_FDISK_BLKSIZE "s" #endif - )) != -1) { + )) != -1) { switch (c) { case 'b': /* Ugly: this sector size is really per device, so cannot be combined with multiple disks, and te same goes for the C/H/S options. */ - sector_size = atoi(optarg); + sector_size = xatoi_u(optarg); if (sector_size != 512 && sector_size != 1024 && sector_size != 2048) bb_show_usage(); @@ -5679,15 +5678,15 @@ int fdisk_main(int argc, char **argv) user_set_sector_size = 1; break; case 'C': - user_cylinders = atoi(optarg); + user_cylinders = xatoi_u(optarg); break; case 'H': - user_heads = atoi(optarg); + user_heads = xatoi_u(optarg); if (user_heads <= 0 || user_heads >= 256) user_heads = 0; break; case 'S': - user_sectors = atoi(optarg); + user_sectors = xatoi_u(optarg); if (user_sectors <= 0 || user_sectors >= 64) user_sectors = 0; break; diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index e038005f5..03b222dd0 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -79,10 +79,10 @@ int hexdump_main(int argc, char **argv) bb_dump_addfile(optarg); } /* else */ if (ch == 'n') { - bb_dump_length = bb_xgetularg10_bnd(optarg, 0, INT_MAX); + bb_dump_length = xatoi_u(optarg); } /* else */ if (ch == 's') { - bb_dump_skip = bb_xgetularg_bnd_sfx(optarg, 10, 0, LONG_MAX, suffixes); + bb_dump_skip = xatoul_range_sfx(optarg, 0, LONG_MAX, suffixes); } /* else */ if (ch == 'v') { bb_dump_vflag = ALL; diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 5e58e81da..ba81ea97c 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -581,7 +581,7 @@ int ipcs_main(int argc, char **argv) opt = getopt32(argc, argv, "i:aqsmtcplu", &opt_i); if (opt & 0x1) { // -i - id = atoi(opt_i); + id = xatoi(opt_i); flags |= flag_print; } if (opt & 0x2) flags |= flag_msg | flag_sem | flag_shm; // -a diff --git a/util-linux/losetup.c b/util-linux/losetup.c index 8882ee4da..c7eb85a91 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -16,7 +16,7 @@ int losetup_main(int argc, char **argv) { unsigned opt; char *opt_o; - int offset = 0; + unsigned long long offset = 0; opt = getopt32(argc, argv, "do:", &opt_o); argc -= optind; @@ -35,7 +35,7 @@ int losetup_main(int argc, char **argv) } if (opt == 0x2) // -o - offset = bb_xparse_number(opt_o, NULL); + offset = xatoull(opt_o); /* -o or no option */ diff --git a/util-linux/mount.c b/util-linux/mount.c index 141517ba0..531fb4520 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -856,7 +856,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { char *opteq = strchr(opt, '='); if (opteq) { - int val = atoi(opteq + 1); + int val = xatoi_u(opteq + 1); *opteq = '\0'; if (!strcmp(opt, "rsize")) data.rsize = val; diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index ff70bf79b..b368067ef 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -38,8 +38,8 @@ #define S_LEN 128 /* These are the defaults */ -static const char defaultmap[]="/boot/System.map"; -static const char defaultpro[]="/proc/profile"; +static const char defaultmap[] = "/boot/System.map"; +static const char defaultpro[] = "/proc/profile"; int readprofile_main(int argc, char **argv) { @@ -78,7 +78,7 @@ int readprofile_main(int argc, char **argv) * not sizeof(int), the multiplier is not changed */ if (mult) { - multiplier = strtoul(mult, 0, 10); + multiplier = xatoi_u(mult); to_write = sizeof(int); } else { multiplier = 0; |