From owner-svn-src-all@freebsd.org Tue Jan 23 14:23:04 2018 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 3DC0BED661D; Tue, 23 Jan 2018 14:23:04 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DFCDD7DE15; Tue, 23 Jan 2018 14:23:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qt0-x22e.google.com with SMTP id o35so1587745qtj.13; Tue, 23 Jan 2018 06:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=OEaAf2hzWI0rTM515ys7Tr8uYRjBqmOqXaRPimgrGNo=; b=M60OguaIaohu+qKfOwKL8Iosec2eHa2MRDZKpZ31xrDD9EL2nZvGJy8Ne5hjQm+fbe 3Q2jSFHGUKiDHIsXHWgDwVgwbJSvRVh6yI760PkEakdv6q1uIGiS04F1T/R6i4I1dbA+ /q5GmGOEZ1qCtXe+U6ZJjMPpwOfspMUCF7eEOMK7kfUn1hbxCpWlCk/vnDym5yRVzQBw 8d0j26e3wXaXlxQEJa5Iw8e+EOHllVdzOwb85DFwYrBmj/sb/TJ1eQtNJs0KzlGJQ1xv 4R+L7UyO9cbEjyYbMBP0CYAhoODokqecwaIw4i6GBjPuMsw/U/rZrqa+fi+eGYylarIk ZKMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OEaAf2hzWI0rTM515ys7Tr8uYRjBqmOqXaRPimgrGNo=; b=dDboiMEbuV5jHo9dOX/YqDA7lqZ87vn0BAs9gGstdIwtkPbsTxJD+gvCbe7zFxADvV lOGhGLGFwjtmsqvfumG4OxcGr8uM//NJBsUmtI/jEQIHjcLFGuKFlKVPQo+5uhVBWubv QIdkWP9Ce7cMvwtXM8nfuuPEdkvMzo3oTaUEqqdMMAIV9QfgPhNgQS72TNXrJB5Lg36t zlNQWLAUIcfRl6+3wb+4FFcDiLsslH8CIC18RwPMohicEeltDMXF97xPBm1z1T5d3ZyP 8NA744vxSbWgixhfVeigc0w3Gx2B9X0CYbbbaRzDDWknQh6BvsydbW0HH6Fi0BOxjJtQ 9p5g== X-Gm-Message-State: AKwxyteEFZLySJZEZH4M1PlRMwCqAKp7fZCq2JPNviwe/RcuLalavX6e GQBpHQpYVJcYjSgjBX2jU4qb3oAD X-Google-Smtp-Source: AH8x225dXWwrOtFm49yYTSaq+2QoU3WLzh6SemN5RJJ0Er7JWHv7Ty23t7e64bt/8FK2YUaen367IQ== X-Received: by 10.237.58.226 with SMTP id o89mr3841046qte.207.1516717382710; Tue, 23 Jan 2018 06:23:02 -0800 (PST) Received: from MacBook-Pro-3.local ([152.249.225.88]) by smtp.gmail.com with ESMTPSA id d76sm11853216qkb.84.2018.01.23.06.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 06:23:01 -0800 (PST) Subject: Re: svn commit: r328279 - head/usr.bin/sockstat To: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801231303.w0ND3lTa052955@repo.freebsd.org> From: Renato Botelho Message-ID: <6f80ba97-945c-7617-b520-614e54375ae6@gmail.com> Date: Tue, 23 Jan 2018 12:22:58 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801231303.w0ND3lTa052955@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Tue, 23 Jan 2018 14:23:04 -0000 On 23/01/18 11:03, Emmanuel Vadot wrote: > Author: manu > Date: Tue Jan 23 13:03:47 2018 > New Revision: 328279 > URL: https://svnweb.freebsd.org/changeset/base/328279 > > Log: > sockstat: Add -q option to suppress the header line > > MFC after: 1 week > Sponsored by: Gandi.net > > Modified: > head/usr.bin/sockstat/sockstat.1 > head/usr.bin/sockstat/sockstat.c > > Modified: head/usr.bin/sockstat/sockstat.1 > ============================================================================== > --- head/usr.bin/sockstat/sockstat.1 Tue Jan 23 08:07:00 2018 (r328278) > +++ head/usr.bin/sockstat/sockstat.1 Tue Jan 23 13:03:47 2018 (r328279) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 12, 2017 > +.Dd January 23, 2018 > .Dt SOCKSTAT 1 > .Os > .Sh NAME > @@ -83,6 +83,8 @@ The > argument is a comma-separated list of protocol names, > as they are defined in > .Xr protocols 5 . > +.It Fl q > +Quiet mode, do not print the header line. > .It Fl S > Display the protocol stack, if applicable. > This is currently only implemented for TCP. > > Modified: head/usr.bin/sockstat/sockstat.c > ============================================================================== > --- head/usr.bin/sockstat/sockstat.c Tue Jan 23 08:07:00 2018 (r328278) > +++ head/usr.bin/sockstat/sockstat.c Tue Jan 23 13:03:47 2018 (r328279) > @@ -76,6 +76,7 @@ static int opt_c; /* Show connected sockets */ > static int opt_j; /* Show specified jail */ > static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ > static int opt_l; /* Show listening sockets */ > +static int opt_q; /* Don't show header */ > static int opt_S; /* Show protocol stack if applicable */ > static int opt_s; /* Show protocol state if applicable */ > static int opt_U; /* Show remote UDP encapsulation port number */ > @@ -1155,19 +1156,21 @@ display(void) > struct sock *s; > int hash, n, pos; > > - printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > - "USER", "COMMAND", "PID", "FD", "PROTO", > - opt_w ? 45 : 21, "LOCAL ADDRESS", > - opt_w ? 45 : 21, "FOREIGN ADDRESS"); > - if (opt_U) > - printf(" %-6s", "ENCAPS"); > - if (opt_s) { > - printf(" %-12s", "PATH STATE"); > - printf(" %-12s", "CONN STATE"); > + if (opt_q != 1) { > + printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > + "USER", "COMMAND", "PID", "FD", "PROTO", > + opt_w ? 45 : 21, "LOCAL ADDRESS", > + opt_w ? 45 : 21, "FOREIGN ADDRESS"); > + if (opt_U) > + printf(" %-6s", "ENCAPS"); > + if (opt_s) { > + printf(" %-12s", "PATH STATE"); > + printf(" %-12s", "CONN STATE"); > + } > + if (opt_S) > + printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > + printf("\n"); > } > - if (opt_S) > - printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > - printf("\n"); > setpassent(1); > for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { > if (xf->xf_data == NULL) > @@ -1248,7 +1251,7 @@ main(int argc, char *argv[]) > int o, i; > > opt_j = -1; > - while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1) > + while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1) > switch (o) { > case '4': > opt_4 = 1; > @@ -1274,6 +1277,8 @@ main(int argc, char *argv[]) > case 'P': > protos_defined = parse_protos(optarg); > break; > + case 'q': > + opt_q = 1; Isn't it missing a break here? > case 'S': > opt_S = 1; > break; > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > -- Renato Botelho