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

This commit is contained in:
sin 2014-02-11 10:36:23 +00:00
parent 48b505fad3
commit 5d06ac4688

View File

@ -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);