aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-28 15:18:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-28 15:18:53 +0100
commite992bae6f9adf3718c6263a36c004ead1c7272a8 (patch)
treef0bc9e4fa145f58ab3f9838902e09f9cfba29648 /util-linux
parent86cfb70ca5f2bde11f2d071bc59db75291d8552f (diff)
downloadbusybox-w32-e992bae6f9adf3718c6263a36c004ead1c7272a8.tar.gz
busybox-w32-e992bae6f9adf3718c6263a36c004ead1c7272a8.tar.bz2
busybox-w32-e992bae6f9adf3718c6263a36c004ead1c7272a8.zip
*: remove a few more cases of argc usage. -89 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fdisk.c11
-rw-r--r--util-linux/freeramdisk.c8
2 files changed, 8 insertions, 11 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 6a194fd1a..c9f57c6d6 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2821,7 +2821,7 @@ unknown_command(int c)
2821#endif 2821#endif
2822 2822
2823int fdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 2823int fdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2824int fdisk_main(int argc, char **argv) 2824int fdisk_main(int argc UNUSED_PARAM, char **argv)
2825{ 2825{
2826 unsigned opt; 2826 unsigned opt;
2827 /* 2827 /*
@@ -2839,7 +2839,6 @@ int fdisk_main(int argc, char **argv)
2839 opt_complementary = "b+:C+:H+:S+"; /* numeric params */ 2839 opt_complementary = "b+:C+:H+:S+"; /* numeric params */
2840 opt = getopt32(argv, "b:C:H:lS:u" IF_FEATURE_FDISK_BLKSIZE("s"), 2840 opt = getopt32(argv, "b:C:H:lS:u" IF_FEATURE_FDISK_BLKSIZE("s"),
2841 &sector_size, &user_cylinders, &user_heads, &user_sectors); 2841 &sector_size, &user_cylinders, &user_heads, &user_sectors);
2842 argc -= optind;
2843 argv += optind; 2842 argv += optind;
2844 if (opt & OPT_b) { // -b 2843 if (opt & OPT_b) { // -b
2845 /* Ugly: this sector size is really per device, 2844 /* Ugly: this sector size is really per device,
@@ -2883,14 +2882,14 @@ int fdisk_main(int argc, char **argv)
2883 int j; 2882 int j;
2884 2883
2885 nowarn = 1; 2884 nowarn = 1;
2886 if (argc <= 0) 2885 if (!argv[0])
2887 bb_show_usage(); 2886 bb_show_usage();
2888 for (j = 0; j < argc; j++) { 2887 for (j = 0; argv[j]; j++) {
2889 unsigned long long size; 2888 unsigned long long size;
2890 fd = xopen(argv[j], O_RDONLY); 2889 fd = xopen(argv[j], O_RDONLY);
2891 size = bb_BLKGETSIZE_sectors(fd) / 2; 2890 size = bb_BLKGETSIZE_sectors(fd) / 2;
2892 close(fd); 2891 close(fd);
2893 if (argc == 1) 2892 if (argv[1])
2894 printf("%llu\n", size); 2893 printf("%llu\n", size);
2895 else 2894 else
2896 printf("%s: %llu\n", argv[j], size); 2895 printf("%s: %llu\n", argv[j], size);
@@ -2900,7 +2899,7 @@ int fdisk_main(int argc, char **argv)
2900#endif 2899#endif
2901 2900
2902#if ENABLE_FEATURE_FDISK_WRITABLE 2901#if ENABLE_FEATURE_FDISK_WRITABLE
2903 if (argc != 1) 2902 if (!argv[0] || argv[1])
2904 bb_show_usage(); 2903 bb_show_usage();
2905 2904
2906 disk_device = argv[0]; 2905 disk_device = argv[0];
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 6b9d95e69..4949056a6 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -15,16 +15,14 @@
15#define FDFLUSH _IO(2,0x4b) 15#define FDFLUSH _IO(2,0x4b)
16 16
17int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 17int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int freeramdisk_main(int argc, char **argv) 18int freeramdisk_main(int argc UNUSED_PARAM, char **argv)
19{ 19{
20 int fd; 20 int fd;
21 21
22 if (argc != 2) bb_show_usage(); 22 fd = xopen(single_argv(argv), O_RDWR);
23
24 fd = xopen(argv[1], O_RDWR);
25 23
26 // Act like freeramdisk, fdflush, or both depending on configuration. 24 // Act like freeramdisk, fdflush, or both depending on configuration.
27 ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1]=='r') 25 ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1] == 'r')
28 || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]); 26 || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]);
29 27
30 if (ENABLE_FEATURE_CLEAN_UP) close(fd); 28 if (ENABLE_FEATURE_CLEAN_UP) close(fd);