aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:09:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:09:09 +0000
commit1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2 (patch)
tree7ec8969fc2b07a2b7dc37f96435e5eddf7daf7fd /console-tools
parent62a90cdd7435f09f4bb8673e8b7b213067f9d5cc (diff)
downloadbusybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.tar.gz
busybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.tar.bz2
busybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.zip
*: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function old new delta getopt32 1370 1385 +15 sulogin_main 490 494 +4 realpath_main 84 86 +2 sleep_main 76 77 +1 mt_main 256 257 +1 printenv_main 75 74 -1 fdformat_main 546 545 -1 usleep_main 44 42 -2 setlogcons_main 77 75 -2 ed_main 2654 2649 -5 deallocvt_main 69 64 -5 addgroup_main 373 368 -5 mkfs_minix_main 2989 2982 -7 tail_main 1221 1213 -8 sv_main 1254 1241 -13 du_main 348 328 -20 tftp_main 325 302 -23 split_main 581 558 -23 nc_main 1000 977 -23 diff_main 891 868 -23 arping_main 1797 1770 -27 ls_main 893 847 -46 od_main 2797 2750 -47 readprofile_main 1944 1895 -49 tcpudpsvd_main 1973 1922 -51 udhcpc_main 2590 2513 -77 grep_main 824 722 -102 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560) Total: -537 bytes text data bss dec hex filename 796973 658 7428 805059 c48c3 busybox_old 796479 662 7420 804561 c46d1 busybox_unstripped
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/deallocvt.c12
-rw-r--r--console-tools/openvt.c7
-rw-r--r--console-tools/setkeycodes.c4
-rw-r--r--console-tools/setlogcons.c6
4 files changed, 13 insertions, 16 deletions
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 117224560..1200cae1d 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -16,19 +16,15 @@
16enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */ 16enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
17 17
18int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 18int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int deallocvt_main(int argc, char **argv) 19int deallocvt_main(int argc ATTRIBUTE_UNUSED, char **argv)
20{ 20{
21 /* num = 0 deallocate all unused consoles */ 21 /* num = 0 deallocate all unused consoles */
22 int num = 0; 22 int num = 0;
23 23
24 switch (argc) { 24 if (argv[1]) {
25 case 2: 25 if (argv[2])
26 bb_show_usage();
26 num = xatou_range(argv[1], 1, 63); 27 num = xatou_range(argv[1], 1, 63);
27 /* Fallthrough */
28 case 1:
29 break;
30 default:
31 bb_show_usage();
32 } 28 }
33 29
34 /* double cast suppresses "cast to ptr from int of different size" */ 30 /* double cast suppresses "cast to ptr from int of different size" */
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index ff169530d..39b985995 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -27,9 +27,10 @@ int openvt_main(int argc, char **argv)
27 /* grab new one */ 27 /* grab new one */
28 close(0); 28 close(0);
29 xopen(vtname, O_RDWR); 29 xopen(vtname, O_RDWR);
30 dup2(0, STDOUT_FILENO); 30 xdup2(0, STDOUT_FILENO);
31 dup2(0, STDERR_FILENO); 31 xdup2(0, STDERR_FILENO);
32 32
33 BB_EXECVP(argv[2], &argv[2]); 33 argv += 2;
34 BB_EXECVP(argv[0], argv);
34 _exit(1); 35 _exit(1);
35} 36}
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index ba3d2e44e..e9a050862 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -14,7 +14,7 @@
14 14
15/* From <linux/kd.h> */ 15/* From <linux/kd.h> */
16struct kbkeycode { 16struct kbkeycode {
17 unsigned int scancode, keycode; 17 unsigned scancode, keycode;
18}; 18};
19enum { 19enum {
20 KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */ 20 KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
@@ -33,7 +33,7 @@ int setkeycodes_main(int argc, char **argv)
33 fd = get_console_fd(); 33 fd = get_console_fd();
34 34
35 while (argc > 2) { 35 while (argc > 2) {
36 a.keycode = xatoul_range(argv[2], 0, 127); 36 a.keycode = xatou_range(argv[2], 0, 127);
37 a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255); 37 a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255);
38 if (a.scancode > 127) { 38 if (a.scancode > 127) {
39 a.scancode -= 0xe000; 39 a.scancode -= 0xe000;
diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c
index 0f6491c72..b312fa76e 100644
--- a/console-tools/setlogcons.c
+++ b/console-tools/setlogcons.c
@@ -12,7 +12,7 @@
12#include "libbb.h" 12#include "libbb.h"
13 13
14int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 14int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int setlogcons_main(int argc, char **argv) 15int setlogcons_main(int argc ATTRIBUTE_UNUSED, char **argv)
16{ 16{
17 struct { 17 struct {
18 char fn; 18 char fn;
@@ -22,8 +22,8 @@ int setlogcons_main(int argc, char **argv)
22 arg.fn = 11; /* redirect kernel messages */ 22 arg.fn = 11; /* redirect kernel messages */
23 arg.subarg = 0; /* to specified console (current as default) */ 23 arg.subarg = 0; /* to specified console (current as default) */
24 24
25 if (argc == 2) 25 if (argv[1])
26 arg.subarg = xatoul_range(argv[1], 0, 63); 26 arg.subarg = xatou_range(argv[1], 0, 63);
27 27
28 xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg); 28 xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg);
29 29