aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
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