Sync hdparm -t and -T options with hdparm-5.3, which seems
[oweals/busybox.git] / console-tools / chvt.c
index f2e6d5f1776c77300b9fbfe5246313b502c43e93..11e1078b7773999d8786fc015fadadfe59088366 100644 (file)
@@ -4,12 +4,15 @@
  *
  * busyboxed by Erik Andersen
  */
-#include "busybox.h"
+
+/* getopt not needed */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
+#include "busybox.h"
 
 /* From <linux/vt.h> */
 static const int VT_ACTIVATE = 0x5606;  /* make vt active */
@@ -20,13 +23,13 @@ int chvt_main(int argc, char **argv)
        int fd, num;
 
        if ((argc != 2) || (**(argv + 1) == '-'))
-               show_usage();
-       fd = get_console_fd("/dev/console");
+               bb_show_usage();
+       fd = get_console_fd();
        num = atoi(argv[1]);
        if (ioctl(fd, VT_ACTIVATE, num))
-               perror_msg_and_die("VT_ACTIVATE");
+               bb_perror_msg_and_die("VT_ACTIVATE");
        if (ioctl(fd, VT_WAITACTIVE, num))
-               perror_msg_and_die("VT_WAITACTIVE");
+               bb_perror_msg_and_die("VT_WAITACTIVE");
        return EXIT_SUCCESS;
 }