More shell features.... if-then-else-fi is now basically usable (disable
[oweals/busybox.git] / chvt.c
diff --git a/chvt.c b/chvt.c
index 37fd21ae96634eb4843722cc8c3ccf849676e8cc..87a1248fd70f105799c7de11cc6d8f403a775b15 100644 (file)
--- a/chvt.c
+++ b/chvt.c
@@ -5,24 +5,22 @@
  * busyboxed by Erik Andersen
  */
 #include "internal.h"
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <linux/vt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+/* From <linux/vt.h> */
+#define VT_ACTIVATE     0x5606  /* make vt active */
+#define VT_WAITACTIVE   0x5607  /* wait for vt active */
 
 int chvt_main(int argc, char **argv)
 {
        int fd, num;
 
-       if ((argc != 2) || (**(argv + 1) == '-')) {
-               usage ("chvt N\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
-                               "\nChanges the foreground virtual terminal to /dev/ttyN\n"
-#endif
-                               );
-       }
+       if ((argc != 2) || (**(argv + 1) == '-'))
+               usage (chvt_usage);
        fd = get_console_fd("/dev/console");
        num = atoi(argv[1]);
        if (ioctl(fd, VT_ACTIVATE, num)) {
@@ -33,7 +31,7 @@ int chvt_main(int argc, char **argv)
                perror("VT_WAITACTIVE");
                exit(FALSE);
        }
-       exit(TRUE);
+       return(TRUE);
 }