diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-27 14:51:27 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-27 14:51:27 +0000 |
commit | 57d5aa1bc80f12b1e6da099fba25a63bc8689b7b (patch) | |
tree | c0554cf92ffc22ad9bfea1b36aa7fffc1dcc298e /util-linux | |
parent | 562b7f61bb3da63466658e68249fa20973b883f0 (diff) | |
download | busybox-w32-57d5aa1bc80f12b1e6da099fba25a63bc8689b7b.tar.gz busybox-w32-57d5aa1bc80f12b1e6da099fba25a63bc8689b7b.tar.bz2 busybox-w32-57d5aa1bc80f12b1e6da099fba25a63bc8689b7b.zip |
losetup: with no arguments lists all /dev/loopN. Corrected help text.
(patch by Vladimir Dronnikov <dronnikov@gmail.ru>)
git-svn-id: svn://busybox.net/trunk/busybox@16236 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/losetup.c | 18 |
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 | } |