From owner-svn-src-all@freebsd.org Fri Sep 2 18:28:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8ABABCDB2B; Fri, 2 Sep 2016 18:28:15 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 863A9E96; Fri, 2 Sep 2016 18:28:15 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u82ISEAr043136; Fri, 2 Sep 2016 18:28:14 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u82ISEXF043133; Fri, 2 Sep 2016 18:28:14 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201609021828.u82ISEXF043133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 2 Sep 2016 18:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305289 - head/usr.bin/w X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2016 18:28:15 -0000 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