From 9a4970c8ef77bcfd31ae3e0672adf4ce023bab6c Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Tue, 29 Aug 2006 17:22:01 +0000 Subject: allow a numeric argument to "carpdemote" to in-/decrease the demotion counter by more than one. manpage help by jmc, ok mcbride mpf deraadt --- sbin/ifconfig/ifconfig.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sbin/ifconfig/ifconfig.c') diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index d44ffa3ebfb..8ef266fdb72 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.173 2006/08/18 08:21:08 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.174 2006/08/29 17:22:00 henning Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -761,6 +761,7 @@ printgroupattribs(char *groupname) void setgroupattribs(char *groupname, int argc, char *argv[]) { + const char *errstr; char *p = argv[0]; int neg = 1; @@ -769,8 +770,15 @@ setgroupattribs(char *groupname, int argc, char *argv[]) getsock(AF_INET); bzero(&ifgr, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, groupname, sizeof(ifgr.ifgr_name)); + + if (argc > 1) { + neg = strtonum(argv[1], 0, 128, &errstr); + if (errstr) + errx(1, "invalid carp demotion: %s", errstr); + } + if (p[0] == '-') { - neg = -1; + neg = neg * -1; p++; } if (!strcmp(p, "carpdemote")) -- cgit v1.2.3