sdhcp

simple dhcp client
git clone git://git.2f30.org/sdhcp
Log | Files | Refs | LICENSE

commit 466314b9bd85e738d917df0298576e28c33eaec7
parent 2f36192032083fac6ee0200f3b32f5253ac6c221
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 26 Apr 2014 00:21:08 +0200

set default -i and -d to 1

this is useful for most people

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
Msdhcp.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sdhcp.c b/sdhcp.c @@ -95,8 +95,8 @@ static unsigned char router[4]; static unsigned char dns[4]; static unsigned long t1; -static int dflag = 0; /* set DNS: change /etc/resolv.conf ? */ -static int iflag = 0; +static int dflag = 1; /* change DNS in /etc/resolv.conf ? */ +static int iflag = 1; /* set IP ? */ #define IP(a,b,c,d) (unsigned char[4]){a,b,c,d} @@ -315,7 +315,8 @@ static void acceptlease(void) { char buf[128]; - if(iflag) + + if(iflag == 1) setip(client, mask, router); if(dflag == 1) setdns(dns); @@ -444,11 +445,11 @@ main(int argc, char *argv[]) case 'e': /* run program */ program = EARGF(usage()); break; - case 'i': /* set ip */ - iflag = 1; + case 'i': /* don't set ip */ + iflag = 0; break; - case 'd': /* DNS: update /etc/resolv.conf */ - dflag = 1; + case 'd': /* don't update DNS in/etc/resolv.conf */ + dflag = 0; break; default: usage();