Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/w Compute a value for domain before comparing agains...



details:   https://anonhg.NetBSD.org/src/rev/d31f17d255b0
branches:  trunk
changeset: 935334:d31f17d255b0
user:      kim <kim%NetBSD.org@localhost>
date:      Tue Jun 30 14:57:25 2020 +0000

description:
Compute a value for domain before comparing against it

diffstat:

 usr.bin/w/w.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (56 lines):

diff -r d98a117c36ee -r d31f17d255b0 usr.bin/w/w.c
--- a/usr.bin/w/w.c     Tue Jun 30 14:30:49 2020 +0000
+++ b/usr.bin/w/w.c     Tue Jun 30 14:57:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: w.c,v 1.84 2018/10/30 21:15:09 kre Exp $       */
+/*     $NetBSD: w.c,v 1.85 2020/06/30 14:57:25 kim Exp $       */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)w.c        8.6 (Berkeley) 6/30/94";
 #else
-__RCSID("$NetBSD: w.c,v 1.84 2018/10/30 21:15:09 kre Exp $");
+__RCSID("$NetBSD: w.c,v 1.85 2020/06/30 14:57:25 kim Exp $");
 #endif
 #endif /* not lint */
 
@@ -205,6 +205,18 @@
                        curtain = 0;
        }
 
+       if (!nflag) {
+               int     rv;
+               char    *p;
+
+               rv = gethostname(domain, sizeof(domain));
+               domain[sizeof(domain) - 1] = '\0';
+               if (rv < 0 || (p = strchr(domain, '.')) == 0)
+                       domain[0] = '\0';
+               else
+                       memmove(domain, p, strlen(p) + 1);
+       }
+
 #ifdef SUPPORT_UTMPX
        setutxent();
 #endif
@@ -388,18 +400,6 @@
        }
 #endif
 
-       if (!nflag) {
-               int     rv;
-               char    *p;
-
-               rv = gethostname(domain, sizeof(domain));
-               domain[sizeof(domain) - 1] = '\0';
-               if (rv < 0 || (p = strchr(domain, '.')) == 0)
-                       domain[0] = '\0';
-               else
-                       memmove(domain, p, strlen(p) + 1);
-       }
-
        for (ep = ehead; ep != NULL; ep = ep->next) {
                if (ep->tp != NULL)
                        kp = ep->tp;



Home | Main Index | Thread Index | Old Index