Print hostname as well in getty

This commit is contained in:
sin 2014-02-11 11:09:00 +00:00
parent 894be72e6b
commit 1f783e7d96
1 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ main(int argc, char *argv[])
int fd;
struct sigaction sa;
char term[128], logname[LOGIN_NAME_MAX], c;
char hostname[HOST_NAME_MAX + 1];
int i = 0;
ssize_t n;
@ -78,7 +79,9 @@ main(int argc, char *argv[])
if (argc > 2)
return execvp(argv[2], argv + 2);
printf("Login: ");
if (gethostname(hostname, sizeof(hostname)) == 0)
printf("%s ", hostname);
printf("login: ");
fflush(stdout);
/* Flush pending input */