From e31c5df7d2b6ff1f84a2016a332dd8781e23892e Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 13 Sep 1999 11:07:52 +0000 Subject: [PATCH] sync with recent KAME code. - bark if extra argument is specified. --- usr.sbin/route6d/route6d.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 5793f4f7a01f..f7b7909106ea 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,7 +1,5 @@ -/* $NetBSD: route6d.c,v 1.8 1999/09/03 04:04:22 itojun Exp $ */ - /* - * KAME Header: /cvsroot/kame/kame/kame/kame/route6d/route6d.c,v 1.4 1999/09/02 12:18:10 itojun Exp + * KAME Header: /cvsroot/kame/kame/kame/kame/route6d/route6d.c,v 1.6 1999/09/10 08:20:59 itojun Exp */ /* @@ -35,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: route6d.c,v 1.8 1999/09/03 04:04:22 itojun Exp $"); +__RCSID("$NetBSD: route6d.c,v 1.9 1999/09/13 11:07:52 itojun Exp $"); #endif #include @@ -52,6 +50,7 @@ __RCSID("$NetBSD: route6d.c,v 1.8 1999/09/03 04:04:22 itojun Exp $"); #endif #include #include +#include #include #include @@ -196,6 +195,8 @@ time_t sup_trig_update = 0; FILE *rtlog = NULL; +int logopened = 0; + static u_long seq = 0; #define RTF_AGGREGATE 0x08000000 @@ -273,8 +274,15 @@ main(argc, argv) sigset_t mask, omask; FILE *pidfile; extern char *optarg; + extern int optind; char *progname; + progname = strrchr(*argv, '/'); + if (progname) + progname++; + else + progname = *argv; + pid = getpid(); while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnqsS")) != EOF) { switch (ch) { @@ -311,21 +319,20 @@ main(argc, argv) FLAG('S', Sflag, 1); #undef FLAG default: - fprintf(stderr, - "Invalid option specified, terminating\n"); - exit(1); + fatal("Invalid option specified, terminating"); } } + argc -= optind; + argv += optind; + if (argc > 0) + fatal("bogus extra arguments"); + if (geteuid()) { nflag = 1; fprintf(stderr, "No kernel update is allowed\n"); } - progname = strrchr(*argv, '/'); - if (progname) - progname++; - else - progname = *argv; openlog(progname, LOG_NDELAY|LOG_PID, LOG_DAEMON); + logopened++; init(); ifconfig(); for (ifcp = ifc; ifcp; ifcp = ifcp->ifc_next) {