[BusyBox] [PATCH] for console-tools
Tito
farmatito at tiscali.it
Sun Oct 19 13:46:52 UTC 2003
Hi to the list,
attached is a patch that saves a few bytes for some of the console-tools applets .
Please apply , if you like it.
Thanks in advance and Ciao,
Tito
-------------- next part --------------
diff -urN busybox_orig/console-tools/dumpkmap.c busybox/console-tools/dumpkmap.c
--- busybox_orig/console-tools/dumpkmap.c 2003-10-19 14:27:52.000000000 +0100
+++ busybox/console-tools/dumpkmap.c 2003-10-19 14:31:23.000000000 +0100
@@ -51,11 +51,7 @@
bb_show_usage();
}
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0) {
- bb_perror_msg("Error opening " CURRENT_VC);
- return EXIT_FAILURE;
- }
+ fd=bb_xopen(CURRENT_VC, O_RDWR);
write(1, magic, 7);
diff -urN busybox_orig/console-tools/loadacm.c busybox/console-tools/loadacm.c
--- busybox_orig/console-tools/loadacm.c 2003-10-19 14:28:21.000000000 +0100
+++ busybox/console-tools/loadacm.c 2003-10-19 14:31:38.000000000 +0100
@@ -37,10 +37,7 @@
bb_show_usage();
}
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0) {
- bb_perror_msg_and_die("Error opening " CURRENT_VC);
- }
+ fd = bb_xopen(CURRENT_VC, O_RDWR);
if (screen_map_load(fd, stdin)) {
bb_perror_msg_and_die("Error loading acm");
diff -urN busybox_orig/console-tools/loadfont.c busybox/console-tools/loadfont.c
--- busybox_orig/console-tools/loadfont.c 2003-10-19 14:28:42.000000000 +0100
+++ busybox/console-tools/loadfont.c 2003-10-19 14:32:01.000000000 +0100
@@ -46,9 +46,7 @@
if (argc != 1)
bb_show_usage();
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0)
- bb_perror_msg_and_die("Error opening " CURRENT_VC);
+ fd = bb_xopen(CURRENT_VC, O_RDWR);
loadnewfont(fd);
return EXIT_SUCCESS;
diff -urN busybox_orig/console-tools/loadkmap.c busybox/console-tools/loadkmap.c
--- busybox_orig/console-tools/loadkmap.c 2003-10-19 14:29:01.000000000 +0100
+++ busybox/console-tools/loadkmap.c 2003-10-19 14:32:14.000000000 +0100
@@ -53,9 +53,7 @@
if (argc != 1)
bb_show_usage();
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0)
- bb_perror_msg_and_die("Error opening " CURRENT_VC);
+ fd = bb_xopen(CURRENT_VC, O_RDWR);
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
diff -urN busybox_orig/console-tools/openvt.c busybox/console-tools/openvt.c
--- busybox_orig/console-tools/openvt.c 2003-10-19 14:29:40.000000000 +0100
+++ busybox/console-tools/openvt.c 2003-10-19 14:40:26.000000000 +0100
@@ -48,11 +48,8 @@
if (!isdigit(argv[1][0]))
bb_show_usage();
- vtno = (int) atol(argv[1]);
-
- /* if (vtno <= 0 || vtno > 63) */
- if (vtno <= 0 || vtno > 12)
- bb_error_msg_and_die("Illegal vt number (%d)", vtno);
+ /* check for Illegal vt number */
+ vtno=bb_xgetlarg(argv[1], 10, 1, 12);
sprintf(vtname, VTNAME, vtno);
@@ -73,8 +70,7 @@
close(0); /* so that new vt becomes stdin */
/* and grab new one */
- if ((fd = open(vtname, O_RDWR)) == -1)
- bb_perror_msg_and_die("could not open %s", vtname);
+ fd = bb_xopen(vtname, O_RDWR);
/* Reassign stdout and sterr */
close(1);
More information about the busybox
mailing list