ubase

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

commit 1f783e7d96c01e9b40da81098d67a785b800a801
parent 894be72e6b9d42c9a17d7a14786f101e65e49c42
Author: sin <sin@2f30.org>
Date:   Tue, 11 Feb 2014 11:09:00 +0000

Print hostname as well in getty

Diffstat:
getty.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/getty.c b/getty.c @@ -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 */