od: code shrink, fix "od --traditional FILE"
[oweals/busybox.git] / console-tools / openvt.c
index 7bd6072a4675f4d584e8ca051e218ecfb1361f65..de5cf93fe85c75e54dd76db0e11d01a5346cd57c 100644 (file)
@@ -5,9 +5,22 @@
  *  busyboxed by Quy Tonthat <quy@signal3.com>
  *  hacked by Tito <farmatito@tiscali.it>
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
+//usage:#define openvt_trivial_usage
+//usage:       "[-c N] [-sw] [PROG ARGS]"
+//usage:#define openvt_full_usage "\n\n"
+//usage:       "Start PROG on a new virtual terminal\n"
+//usage:     "\nOptions:"
+//usage:     "\n       -c N    Use specified VT"
+//usage:     "\n       -s      Switch to the VT"
+/* //usage:     "\n    -l      Run PROG as login shell (by prepending '-')" */
+//usage:     "\n       -w      Wait for PROG to exit"
+//usage:
+//usage:#define openvt_example_usage
+//usage:       "openvt 2 /bin/ash\n"
+
 #include <linux/vt.h>
 #include "libbb.h"
 
@@ -97,8 +110,7 @@ static NOINLINE void vfork_child(char **argv)
                //bb_error_msg("our pgrp %d", getpgrp());
                //bb_error_msg("VT's sid %d", tcgetsid(0));
                //bb_error_msg("VT's pgrp %d", tcgetpgrp(0));
-               BB_EXECVP(argv[0], argv);
-               bb_perror_msg_and_die("exec %s", argv[0]);
+               BB_EXECVP_or_die(argv);
        }
 }
 
@@ -145,9 +157,7 @@ int openvt_main(int argc UNUSED_PARAM, char **argv)
 
        if (!argv[0]) {
                argv--;
-               argv[0] = getenv("SHELL");
-               if (!argv[0])
-                       argv[0] = (char *) DEFAULT_SHELL;
+               argv[0] = (char *) get_shell_name();
                /*argv[1] = NULL; - already is */
        }