svn commit: r305289 - head/usr.bin/w
Hajimu UMEMOTO
ume at FreeBSD.org
Fri Sep 2 18:28:15 UTC 2016
Author: ume
Date: Fri Sep 2 18:28:14 2016
New Revision: 305289
URL: https://svnweb.freebsd.org/changeset/base/305289
Log:
When -n is specified, don't make bogus DNS queries. Instead,
when -n is specified more than once, hostnames stored in utmp
are attempted to resolve to display them as network addresses.
PR: 212272
Modified:
head/usr.bin/w/w.1
head/usr.bin/w/w.c
Modified: head/usr.bin/w/w.1
==============================================================================
--- head/usr.bin/w/w.1 Fri Sep 2 18:22:56 2016 (r305288)
+++ head/usr.bin/w/w.1 Fri Sep 2 18:28:14 2016 (r305289)
@@ -85,6 +85,10 @@ default
Do not attempt to resolve network addresses (normally
.Nm
interprets addresses and attempts to display them as names).
+When
+.Fl n
+is specified more than once, hostnames stored in utmp are attempted to
+resolve to display them as network addresses.
.El
.Pp
If one or more
Modified: head/usr.bin/w/w.c
==============================================================================
--- head/usr.bin/w/w.c Fri Sep 2 18:22:56 2016 (r305288)
+++ head/usr.bin/w/w.c Fri Sep 2 18:28:14 2016 (r305289)
@@ -180,7 +180,7 @@ main(int argc, char *argv[])
nlistf = optarg;
break;
case 'n':
- nflag = 1;
+ nflag += 1;
break;
case 'f': case 'l': case 's': case 'u': case 'w':
warnx("[-flsuw] no longer supported");
@@ -378,12 +378,12 @@ main(int argc, char *argv[])
lsin->sin_family = AF_INET;
isaddr = 1;
}
- if (!nflag) {
+ if (nflag == 0) {
/* Attempt to change an IP address into a name */
if (isaddr && realhostname_sa(fn, sizeof(fn), sa,
sa->sa_len) == HOSTNAME_FOUND)
p = fn;
- } else if (!isaddr) {
+ } else if (!isaddr && nflag > 1) {
/*
* If a host has only one A/AAAA RR, change a
* name into an IP address
More information about the svn-src-all
mailing list