aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-27 14:51:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-27 14:51:27 +0000
commit956a5693603be076a7a2b0bacc22eea4a3b93cbe (patch)
treec0554cf92ffc22ad9bfea1b36aa7fffc1dcc298e /util-linux
parent0bb628f4f3fbd0fc0a96d257830fcbbb14db2bd1 (diff)
downloadbusybox-w32-956a5693603be076a7a2b0bacc22eea4a3b93cbe.tar.gz
busybox-w32-956a5693603be076a7a2b0bacc22eea4a3b93cbe.tar.bz2
busybox-w32-956a5693603be076a7a2b0bacc22eea4a3b93cbe.zip
losetup: with no arguments lists all /dev/loopN. Corrected help text.
(patch by Vladimir Dronnikov <dronnikov@gmail.ru>)
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/losetup.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index af0b03a53..6b9a810f2 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -22,7 +22,8 @@ int losetup_main(int argc, char **argv)
22 argc -= optind; 22 argc -= optind;
23 argv += optind; 23 argv += optind;
24 24
25 if (opt == 0x3) bb_show_usage(); // -d and -o (illegal) 25 if (opt == 0x3) // -d + -o (illegal)
26 bb_show_usage();
26 27
27 if (opt == 0x1) { // -d 28 if (opt == 0x1) { // -d
28 /* detach takes exactly one argument */ 29 /* detach takes exactly one argument */
@@ -46,7 +47,18 @@ int losetup_main(int argc, char **argv)
46 if (!s) bb_perror_nomsg_and_die(); 47 if (!s) bb_perror_nomsg_and_die();
47 printf("%s: %s\n", argv[0], s); 48 printf("%s: %s\n", argv[0], s);
48 if (ENABLE_FEATURE_CLEAN_UP) free(s); 49 if (ENABLE_FEATURE_CLEAN_UP) free(s);
49 } else 50 } else {
50 bb_show_usage(); 51 char dev[11] = "/dev/loop0";
52 char c;
53 for (c = '0'; c <= '9'; ++c) {
54 char *s;
55 dev[9] = c;
56 s = query_loop(dev);
57 if (s) {
58 printf("%s: %s\n", dev, s);
59 if (ENABLE_FEATURE_CLEAN_UP) free(s);
60 }
61 }
62 }
51 return EXIT_SUCCESS; 63 return EXIT_SUCCESS;
52} 64}