[hackers] [ubase] Print hostname as well in getty || sin

From: <git_AT_suckless.org>
Date: Tue, 11 Feb 2014 12:29:37 +0100

commit 1f783e7d96c01e9b40da81098d67a785b800a801
Author: sin <sin_AT_2f30.org>
Date: Tue Feb 11 11:09:00 2014 +0000

    Print hostname as well in getty

diff --git a/getty.c b/getty.c
index 1c8f236..33fb450 100644
--- a/getty.c
+++ b/getty.c
_AT_@ -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;
 
_AT_@ -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 */
Received on Tue Feb 11 2014 - 12:29:37 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 11 2014 - 12:36:14 CET