Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Mar 2021 18:21:04 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d76f6b8e7389 - main - pfilctl: improve formatting of "hooks" and "heads" command output.
Message-ID:  <202103191821.12JIL4Ch028911@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90

commit d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-03-19 18:18:05 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
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]);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103191821.12JIL4Ch028911>