[BusyBox] [PATCH] size optimisation for chvt.c

Tito farmatito at tiscali.it
Tue Jan 13 22:11:47 UTC 2004


Hi to all,
this patch reduces size of chvt.o from:
   text    data     bss     dec     hex filename
    141       0       0        141     8d  chvt_orig.o
-rw-r--r--    1 root     root         1280 Jan 11 19:20 chvt_orig.o

to:

   text    data     bss     dec     hex filename
    138       0       0       138      8a  chvt.o
-rw-r--r--    1 root     root         1268 Jan 13 15:27 chvt.o

Please apply.
Ciao,
Tito


-------------- next part --------------
--- busybox-1.00-pre5/console-tools/chvt.c	2003-10-22 10:30:53.000000000 +0000
+++ busybox-1.00-pre5_new/console-tools/chvt.c	2004-01-13 15:27:02.000000000 +0000
@@ -36,12 +36,12 @@
 {
 	int fd, num;
 
-	if ((argc != 2) || (**(argv + 1) == '-')) {
+	if (argc != 2) {
 		bb_show_usage();
 	}
 
 	fd = get_console_fd();
-	num = atoi(argv[1]);
+	num =  bb_xgetlarg(argv[1], 10, 0, INT_MAX);
 	if (ioctl(fd, VT_ACTIVATE, num)) {
 		bb_perror_msg_and_die("VT_ACTIVATE");
 	}


More information about the busybox mailing list