Module Name:    src
Committed By:   christos
Date:           Mon Jan 26 02:31:52 UTC 2015

Modified Files:
        src/external/bsd/blacklist/bin: blacklistctl.8 blacklistctl.c

Log Message:
prettier display


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/blacklist/bin/blacklistctl.8
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/blacklist/bin/blacklistctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/blacklist/bin/blacklistctl.8
diff -u src/external/bsd/blacklist/bin/blacklistctl.8:1.3 src/external/bsd/blacklist/bin/blacklistctl.8:1.4
--- src/external/bsd/blacklist/bin/blacklistctl.8:1.3	Sun Jan 25 18:07:16 2015
+++ src/external/bsd/blacklist/bin/blacklistctl.8	Sun Jan 25 21:31:52 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: blacklistctl.8,v 1.3 2015/01/25 23:07:16 wiz Exp $
+.\" $NetBSD: blacklistctl.8,v 1.4 2015/01/26 02:31:52 christos Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 24, 2015
+.Dd January 25, 2015
 .Dt BLACKLISTCTL 8
 .Os
 .Sh NAME
@@ -35,8 +35,13 @@
 .Nd display and change the state of blacklistd
 .Sh SYNOPSIS
 .Nm
+<<<<<<< blacklistctl.8
+dump 
+.Op Fl abdnrw
+=======
 .Cm dump
 .Op Fl abdr
+>>>>>>> 1.3
 .Sh DESCRIPTION
 .Nm
 is a program used to display the state of
@@ -50,8 +55,14 @@ Show all database entries, by default it
 Show only the blocked entries.
 .It Fl d
 Increase debugging level.
+.It Fl n
+Don't display a header.
 .It Fl r
 Show the remaining blocked time instead of the last activity time.
+.It Fl w
+Normally the width of addresses is good for IPv4, the
+.Fl w
+flag, makes the display wide enough for IPv6 addresses.
 .El
 .Sh SEE ALSO
 .Xr blacklistd 8

Index: src/external/bsd/blacklist/bin/blacklistctl.c
diff -u src/external/bsd/blacklist/bin/blacklistctl.c:1.14 src/external/bsd/blacklist/bin/blacklistctl.c:1.15
--- src/external/bsd/blacklist/bin/blacklistctl.c:1.14	Sat Jan 24 10:33:03 2015
+++ src/external/bsd/blacklist/bin/blacklistctl.c	Sun Jan 25 21:31:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: blacklistctl.c,v 1.14 2015/01/24 15:33:03 christos Exp $	*/
+/*	$NetBSD: blacklistctl.c,v 1.15 2015/01/26 02:31:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistctl.c,v 1.14 2015/01/24 15:33:03 christos Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.15 2015/01/26 02:31:52 christos Exp $");
 
 #include <stdio.h>
 #include <time.h>
@@ -60,7 +60,7 @@ usage(int c)
 		warnx("Missing/unknown command");
 	else
 		warnx("Unknown option `%c'", (char)c);
-	fprintf(stderr, "Usage: %s dump [-abdr]\n", getprogname());
+	fprintf(stderr, "Usage: %s dump [-abdnrw]\n", getprogname());
 	exit(EXIT_FAILURE);
 }
 
@@ -74,10 +74,10 @@ main(int argc, char *argv[])
 	struct dbinfo dbi;
 	unsigned int i;
 	struct timespec ts;
-	int all, blocked, remain;
+	int all, blocked, remain, wide, noheader;
 	int o;
 
-	blocked = all = remain = 0;
+	noheader = wide = blocked = all = remain = 0;
 	lfun = dlog;
 
 	if (argc == 1 || strcmp(argv[1], "dump") != 0)
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
 	argc--;
 	argv++;
 
-	while ((o = getopt(argc, argv, "abdr")) != -1)
+	while ((o = getopt(argc, argv, "abdrw")) != -1)
 		switch (o) {
 		case 'a':
 			all = 1;
@@ -98,9 +98,14 @@ main(int argc, char *argv[])
 		case 'd':
 			debug++;
 			break;
+		case 'n':
+			noheader = 1;
 		case 'r':
 			remain = 1;
 			break;
+		case 'w':
+			wide = 1;
+			break;
 		default:
 			usage(o);
 			break;
@@ -111,6 +116,10 @@ main(int argc, char *argv[])
 		err(EXIT_FAILURE, "Can't open `%s'", dbname);
 
 	clock_gettime(CLOCK_REALTIME, &ts);
+	wide = wide ? 8 * 4 + 7 : 4 * 3 + 3;
+	if (!noheader)
+		printf("%*.*s:port\tid\tnfail\t%s\n", wide, wide,
+		    "address", remain ? "remaining time" : "last access");
 	for (i = 1; state_iterate(db, &ss, &c, &dbi, i) != 0; i = 0) {
 		char buf[BUFSIZ];
 		if (!all) {
@@ -123,7 +132,7 @@ main(int argc, char *argv[])
 			}
 		}
 		sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&ss);
-		printf("%15.15s:%d\t", buf, c.c_port);
+		printf("%*.*s:%d\t", wide, wide, buf, c.c_port);
 		if (remain)
 			fmtydhms(buf, sizeof(buf),
 			    c.c_duration - (ts.tv_sec - dbi.last));

Reply via email to