[BusyBox-cvs] busybox/console-tools openvt.c,1.6,1.7

Glenn McGrath bug1 at busybox.net
Tue Jan 13 10:12:18 UTC 2004


Update of /var/cvs/busybox/console-tools
In directory nail:/tmp/cvs-serv12358/console-tools

Modified Files:
	openvt.c 
Log Message:
Patch by Tito, remove some unneeded variables to save some space.


Index: openvt.c
===================================================================
RCS file: /var/cvs/busybox/console-tools/openvt.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- openvt.c	20 Dec 2003 06:00:08 -0000	1.6
+++ openvt.c	13 Jan 2004 10:12:16 -0000	1.7
@@ -32,31 +32,22 @@
 
 #include "busybox.h"
 
-#define VTNAME "/dev/tty%d"
-
 int openvt_main(int argc, char **argv)
 {
-	int pid;
 	int fd;
-	int vtno;
-	char vtname[sizeof VTNAME + 2];
+	char vtname[sizeof VC_FORMAT + 2];
 
 
 	if (argc < 3)
         bb_show_usage();
 
-	if (!isdigit(argv[1][0]))
-	        bb_show_usage();
-
-	/* check for Illegal vt number */
-	vtno=bb_xgetlarg(argv[1], 10, 1, 12);
-
-	sprintf(vtname, VTNAME, vtno);
+	/* check for Illegal vt number: < 1 or > 12 */
+	sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
 
 	argv+=2;
 	argc-=2;
 
-	if((pid = fork()) == 0) {
+	if(fork() == 0) {
 		/* leave current vt */
 
 #ifdef   ESIX_5_3_2_D




More information about the busybox-cvs mailing list