ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

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

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

Diffstat:
Mgetty.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/getty.c b/getty.c @@ -13,7 +13,7 @@ static void usage(void) { - eprintf("usage: %s [tty] [term]\n", argv0); + eprintf("usage: %s [tty] [term] [cmd] [args...]\n", 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);