getty_show_issue.patch (723B)
1 diff --git a/getty.c b/getty.c 2 index cef5c4e..aa63c92 100644 3 --- a/getty.c 4 +++ b/getty.c 5 @@ -17,6 +17,7 @@ 6 7 static char *tty = "/dev/tty1"; 8 static char *defaultterm = "linux"; 9 +static char *issue_file = "/etc/issue"; 10 11 static void 12 usage(void) 13 @@ -24,6 +25,23 @@ usage(void) 14 eprintf("usage: %s [tty] [term] [cmd] [args...]\n", argv0); 15 } 16 17 +static void 18 +show_issue() 19 +{ 20 + FILE *f = fopen(issue_file, "r"); 21 + char c; 22 + 23 + if (!f) 24 + return; 25 + 26 + while ((c = getc(f)) != EOF) { 27 + putc(c, stdout); 28 + } 29 + fflush(stdout); 30 + 31 + fclose(f); 32 +} 33 + 34 int 35 main(int argc, char *argv[]) 36 { 37 @@ -109,6 +127,8 @@ main(int argc, char *argv[]) 38 fclose(fp); 39 } 40 41 + show_issue(); 42 + 43 if (argc > 2) 44 return execvp(argv[2], argv + 2); 45