commit 5d06ac46883b787dc7f4c6e889bb4b7d442b28bb
Author: sin <s...@2f30.org>
Date:   Tue Feb 11 10:36:23 2014 +0000

    Allow getty to execute another program instead of /bin/login

diff --git a/getty.c b/getty.c
index ad15279..6e658cd 100644
--- a/getty.c
+++ b/getty.c
@@ -13,7 +13,7 @@
 static void
 usage(void)
 {
-       eprintf("usage: %s [tty] [term]
", argv0);
+       eprintf("usage: %s [tty] [term] [cmd] [args...]
", argv0);
 }
 
 static char *tty = "/dev/tty1";
@@ -33,9 +33,6 @@ main(int argc, char *argv[])
                usage();
        } ARGEND;
 
-       if (argc > 2)
-               usage();
-
        strlcpy(term, defaultterm, sizeof(term));
        if (argc > 0) {
                tty = argv[0];
@@ -77,6 +74,9 @@ main(int argc, char *argv[])
        sigemptyset(&sa.sa_mask);
        sigaction(SIGHUP, &sa, NULL);
 
+       if (argc > 2)
+               return execvp(argv[2], argv + 2);
+
        printf("Login: ");
        fflush(stdout);
 


Reply via email to