diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-15 11:50:19 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-15 11:50:19 +0000 |
commit | 17b4a20a9c4dc7ec9fdf91cea34b35bc4ef6e070 (patch) | |
tree | 5ee138c7d40112a6c36ef0c8e276e122d5ddf24c | |
parent | 67285965f3d2c266ee37fec17d339b717752f8b0 (diff) | |
download | busybox-w32-17b4a20a9c4dc7ec9fdf91cea34b35bc4ef6e070.tar.gz busybox-w32-17b4a20a9c4dc7ec9fdf91cea34b35bc4ef6e070.tar.bz2 busybox-w32-17b4a20a9c4dc7ec9fdf91cea34b35bc4ef6e070.zip |
Patch by Tito, reduce size of deallocvt, also make the usage message
clearer (from N to [N]) and indirectly (through bb_xgetlarg) adds support
for -h ;-)
-rw-r--r-- | console-tools/deallocvt.c | 38 | ||||
-rw-r--r-- | include/usage.h | 7 |
2 files changed, 20 insertions, 25 deletions
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index b89249b87..363ecdf12 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -34,33 +34,23 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ | |||
34 | 34 | ||
35 | int deallocvt_main(int argc, char *argv[]) | 35 | int deallocvt_main(int argc, char *argv[]) |
36 | { | 36 | { |
37 | int fd, num = 0; | 37 | /* num = 0 deallocate all unused consoles */ |
38 | int num = 0; | ||
38 | 39 | ||
39 | if (argc > 2) { | 40 | switch(argc) |
40 | bb_show_usage(); | 41 | { |
41 | } | 42 | case 2: |
42 | 43 | if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) | |
43 | fd = get_console_fd(); | 44 | bb_error_msg_and_die("0: illegal VT number"); |
44 | 45 | /* Falltrough */ | |
45 | /* num=0 deallocate all unused consoles */ | ||
46 | if (argc == 1) { | ||
47 | goto disallocate_all; | ||
48 | } | ||
49 | |||
50 | num = bb_xgetlarg(argv[1], 10, 0, INT_MAX); | ||
51 | switch (num) { | ||
52 | case 0: | ||
53 | bb_error_msg("0: illegal VT number"); | ||
54 | break; | ||
55 | case 1: | 46 | case 1: |
56 | bb_error_msg("VT 1 cannot be deallocated"); | ||
57 | break; | 47 | break; |
58 | default: | 48 | default: |
59 | disallocate_all: | 49 | bb_show_usage(); |
60 | if (ioctl(fd, VT_DISALLOCATE, num)) { | 50 | } |
61 | bb_perror_msg_and_die("VT_DISALLOCATE"); | 51 | |
62 | } | 52 | if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) { |
63 | return EXIT_SUCCESS; | 53 | bb_perror_msg_and_die("VT_DISALLOCATE"); |
64 | } | 54 | } |
65 | return EXIT_FAILURE; | 55 | return EXIT_SUCCESS; |
66 | } | 56 | } |
diff --git a/include/usage.h b/include/usage.h index b1bc010c7..f4897e4c0 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -324,7 +324,7 @@ | |||
324 | "4+0 records out\n" | 324 | "4+0 records out\n" |
325 | 325 | ||
326 | #define deallocvt_trivial_usage \ | 326 | #define deallocvt_trivial_usage \ |
327 | "N" | 327 | "[N]" |
328 | #define deallocvt_full_usage \ | 328 | #define deallocvt_full_usage \ |
329 | "Deallocate unused virtual terminal /dev/ttyN" | 329 | "Deallocate unused virtual terminal /dev/ttyN" |
330 | 330 | ||
@@ -438,6 +438,11 @@ | |||
438 | #define dpkg_deb_example_usage \ | 438 | #define dpkg_deb_example_usage \ |
439 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" | 439 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |
440 | 440 | ||
441 | #define dpkg_divert_trivial_usage \ | ||
442 | "blah" | ||
443 | #define dpkg_divert_full_usage \ | ||
444 | "blah blah" | ||
445 | |||
441 | #ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K | 446 | #ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K |
442 | #define USAGE_DU_DEFALT_BLOCKSIZE_1k(a) a | 447 | #define USAGE_DU_DEFALT_BLOCKSIZE_1k(a) a |
443 | #define USAGE_NOT_DU_DEFALT_BLOCKSIZE_1k(a) | 448 | #define USAGE_NOT_DU_DEFALT_BLOCKSIZE_1k(a) |