[hackers] [ubase] Allow getty to execute another program instead of /bin/login || sin

From: <git_AT_suckless.org>
Date: Tue, 11 Feb 2014 11:47:07 +0100

commit 5d06ac46883b787dc7f4c6e889bb4b7d442b28bb
Author: sin <sin_AT_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
_AT_@ -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";
_AT_@ -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];
_AT_@ -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);
 
Received on Tue Feb 11 2014 - 11:47:07 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 11 2014 - 11:48:17 CET