svn commit: trunk/busybox/util-linux
vapier at busybox.net
vapier at busybox.net
Fri Sep 16 04:41:23 UTC 2005
Author: vapier
Date: 2005-09-15 21:41:20 -0700 (Thu, 15 Sep 2005)
New Revision: 11474
Log:
accept unlimited number of swap arguments like the real swap{on,off} and shrink do_em_all a little
Modified:
trunk/busybox/util-linux/swaponoff.c
Changeset:
Modified: trunk/busybox/util-linux/swaponoff.c
===================================================================
--- trunk/busybox/util-linux/swaponoff.c 2005-09-16 04:21:25 UTC (rev 11473)
+++ trunk/busybox/util-linux/swaponoff.c 2005-09-16 04:41:20 UTC (rev 11474)
@@ -38,10 +38,10 @@
if (status != 0) {
bb_perror_msg("%s", device);
- return EXIT_FAILURE;
+ return 1;
}
- return EXIT_SUCCESS;
+ return 0;
}
static int do_em_all(void)
@@ -57,8 +57,7 @@
err = 0;
while ((m = getmntent(f)) != NULL)
if (strcmp(m->mnt_type, MNTTYPE_SWAP) == 0)
- if (swap_enable_disable(m->mnt_fsname) == EXIT_FAILURE)
- ++err;
+ err += swap_enable_disable(m->mnt_fsname);
endmntent(f);
@@ -69,13 +68,17 @@
extern int swap_on_off_main(int argc, char **argv)
{
- unsigned long opt = bb_getopt_ulflags(argc, argv, "a");
+ int ret;
- if (argc != 2)
+ if (argc == 1)
bb_show_usage();
- if (opt & DO_ALL)
+ ret = bb_getopt_ulflags(argc, argv, "a");
+ if (ret & DO_ALL)
return do_em_all();
- return swap_enable_disable(argv[1]);
+ ret = 0;
+ while (*++argv)
+ ret += swap_enable_disable(*argv);
+ return ret;
}
More information about the busybox-cvs
mailing list