Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/blacklist/bin add dump command



details:   https://anonhg.NetBSD.org/src/rev/8f53ed16a166
branches:  trunk
changeset: 335801:8f53ed16a166
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 24 15:33:03 2015 +0000

description:
add dump command

diffstat:

 external/bsd/blacklist/bin/blacklistctl.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 0eff801217a7 -r 8f53ed16a166 external/bsd/blacklist/bin/blacklistctl.c
--- a/external/bsd/blacklist/bin/blacklistctl.c Sat Jan 24 07:46:20 2015 +0000
+++ b/external/bsd/blacklist/bin/blacklistctl.c Sat Jan 24 15:33:03 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: blacklistctl.c,v 1.13 2015/01/24 06:20:21 christos Exp $       */
+/*     $NetBSD: blacklistctl.c,v 1.14 2015/01/24 15:33:03 christos Exp $       */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistctl.c,v 1.13 2015/01/24 06:20:21 christos Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.14 2015/01/24 15:33:03 christos Exp $");
 
 #include <stdio.h>
 #include <time.h>
@@ -41,6 +41,7 @@
 #include <util.h>
 #endif
 #include <fcntl.h>
+#include <string.h>
 #include <syslog.h>
 #include <err.h>
 #include <stdlib.h>
@@ -55,8 +56,11 @@
 static __dead void
 usage(int c)
 {
-       warnx("Unknown option `%c'", (char)c);
-       fprintf(stderr, "Usage: %s [-abdr]\n", getprogname());
+       if (c == 0)
+               warnx("Missing/unknown command");
+       else
+               warnx("Unknown option `%c'", (char)c);
+       fprintf(stderr, "Usage: %s dump [-abdr]\n", getprogname());
        exit(EXIT_FAILURE);
 }
 
@@ -75,6 +79,13 @@
 
        blocked = all = remain = 0;
        lfun = dlog;
+
+       if (argc == 1 || strcmp(argv[1], "dump") != 0)
+               usage(0);
+
+       argc--;
+       argv++;
+
        while ((o = getopt(argc, argv, "abdr")) != -1)
                switch (o) {
                case 'a':



Home | Main Index | Thread Index | Old Index