summaryrefslogtreecommitdiff
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 1172245..1200cae 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -16,19 +16,15 @@
enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int deallocvt_main(int argc, char **argv)
+int deallocvt_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
/* num = 0 deallocate all unused consoles */
int num = 0;
- switch (argc) {
- case 2:
+ if (argv[1]) {
+ if (argv[2])
+ bb_show_usage();
num = xatou_range(argv[1], 1, 63);
- /* Fallthrough */
- case 1:
- break;
- default:
- bb_show_usage();
}
/* double cast suppresses "cast to ptr from int of different size" */
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index ff16953..39b9859 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -27,9 +27,10 @@ int openvt_main(int argc, char **argv)
/* grab new one */
close(0);
xopen(vtname, O_RDWR);
- dup2(0, STDOUT_FILENO);
- dup2(0, STDERR_FILENO);
+ xdup2(0, STDOUT_FILENO);
+ xdup2(0, STDERR_FILENO);
- BB_EXECVP(argv[2], &argv[2]);
+ argv += 2;
+ BB_EXECVP(argv[0], argv);
_exit(1);
}
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index ba3d2e4..e9a0508 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -14,7 +14,7 @@
/* From <linux/kd.h> */
struct kbkeycode {
- unsigned int scancode, keycode;
+ unsigned scancode, keycode;
};
enum {
KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
@@ -33,7 +33,7 @@ int setkeycodes_main(int argc, char **argv)
fd = get_console_fd();
while (argc > 2) {
- a.keycode = xatoul_range(argv[2], 0, 127);
+ a.keycode = xatou_range(argv[2], 0, 127);
a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255);
if (a.scancode > 127) {
a.scancode -= 0xe000;
diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c
index 0f6491c..b312fa7 100644
--- a/console-tools/setlogcons.c
+++ b/console-tools/setlogcons.c
@@ -12,7 +12,7 @@
#include "libbb.h"
int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int setlogcons_main(int argc, char **argv)
+int setlogcons_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
struct {
char fn;
@@ -22,8 +22,8 @@ int setlogcons_main(int argc, char **argv)
arg.fn = 11; /* redirect kernel messages */
arg.subarg = 0; /* to specified console (current as default) */
- if (argc == 2)
- arg.subarg = xatoul_range(argv[1], 0, 63);
+ if (argv[1])
+ arg.subarg = xatou_range(argv[1], 0, 63);
xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg);