From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:21:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0860A57D7F4; Fri, 19 Mar 2021 18:21:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2BzN6rjYz3Pph; Fri, 19 Mar 2021 18:21:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDEEF194FD; Fri, 19 Mar 2021 18:21:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12JIL4iG028912; Fri, 19 Mar 2021 18:21:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIL4Ch028911; Fri, 19 Mar 2021 18:21:04 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:21:04 GMT Message-Id: <202103191821.12JIL4Ch028911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d76f6b8e7389 - main - pfilctl: improve formatting of "hooks" and "heads" command output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:21:05 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 commit d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Author: Gleb Smirnoff AuthorDate: 2021-03-19 18:18:05 +0000 Commit: Gleb Smirnoff CommitDate: 2021-03-19 18:18:05 +0000 pfilctl: improve formatting of "hooks" and "heads" command output. In "heads" output just improve the header to describe all of the columns. In "hooks" print filter name and hook name delimited with colon, so that it matches "heads" output and also can be copy-and-pasted straight into the command line for future "link" command. --- sbin/pfilctl/pfilctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/pfilctl/pfilctl.c b/sbin/pfilctl/pfilctl.c index e360c73cb279..2a56009b35b8 100644 --- a/sbin/pfilctl/pfilctl.c +++ b/sbin/pfilctl/pfilctl.c @@ -132,8 +132,8 @@ retry: } #define FMTHD "%16s %8s\n" -#define FMTHK "%29s %16s %16s\n" - printf(FMTHD, "Intercept point", "Type"); +#define FMTHK "%29s %16s:%s\n" + printf("%16s %8s %3s %16s\n", "Intercept point", "Type", "Dir", "Hook"); for (i = 0, h = 0; i < plh.pio_nheads; i++) { printf(FMTHD, plh.pio_heads[i].pio_name, typenames[plh.pio_heads[i].pio_type]); @@ -170,9 +170,9 @@ retry: goto retry; } - printf("Available hooks:\n"); + printf("%16s %16s %8s\n", "Hook", "", "Type"); for (i = 0; i < plh.pio_nhooks; i++) { - printf("\t%s:%s %s\n", plh.pio_hooks[i].pio_module, + printf("%16s:%-16s %8s\n", plh.pio_hooks[i].pio_module, plh.pio_hooks[i].pio_ruleset, typenames[plh.pio_hooks[i].pio_type]); }