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 debug option



details:   https://anonhg.NetBSD.org/src/rev/51426ac460ee
branches:  trunk
changeset: 335698:51426ac460ee
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 21 21:24:35 2015 +0000

description:
add debug option

diffstat:

 external/bsd/blacklist/bin/blacklistctl.c |  18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r 3231e678569c -r 51426ac460ee external/bsd/blacklist/bin/blacklistctl.c
--- a/external/bsd/blacklist/bin/blacklistctl.c Wed Jan 21 21:24:25 2015 +0000
+++ b/external/bsd/blacklist/bin/blacklistctl.c Wed Jan 21 21:24:35 2015 +0000
@@ -14,6 +14,13 @@
 #include "internal.h"
 #include "util.h"
 
+static __dead void
+usage(int c)
+{
+       warnx("Unknown option `%c'", (char)c);
+       fprintf(stderr, "Usage: %s [-d]\n", getprogname());
+       exit(EXIT_FAILURE);
+}
 int
 main(int argc, char *argv[])
 {
@@ -23,6 +30,17 @@
        struct sockaddr_storage ss;
        struct dbinfo dbi;
        unsigned int i;
+       int o;
+
+       while ((o = getopt(argc, argv, "d")) != -1)
+               switch (o) {
+               case 'd':
+                       debug++;
+                       break;
+               default:
+                       usage(o);
+                       break;
+               }
 
        db = state_open(dbname, O_RDONLY, 0);
        if (db == NULL)



Home | Main Index | Thread Index | Old Index