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]\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);