diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-05-14 01:34:36 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-05-14 01:34:36 +0000 |
commit | 78d690b47a336b8bcd3499e23f5dea0c6ed41974 (patch) | |
tree | cafaae88066e64d99b18606b48ea90621aab6fb3 /usr.bin/rdist/lookup.c | |
parent | 968f100607f98e659a5ce90c71e5949d09d4898a (diff) |
o Sync w/ freerdist 0.92 minus the compress option
o KNF and ANSIfy the function headers
Sparse file support is currently a no-op since it didn't work.
Proper sparse file support will be added later.
Diffstat (limited to 'usr.bin/rdist/lookup.c')
-rw-r--r-- | usr.bin/rdist/lookup.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/usr.bin/rdist/lookup.c b/usr.bin/rdist/lookup.c index 3d5c9560bd6..5b959d3b4a2 100644 --- a/usr.bin/rdist/lookup.c +++ b/usr.bin/rdist/lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lookup.c,v 1.10 2002/05/27 03:14:22 deraadt Exp $ */ +/* $OpenBSD: lookup.c,v 1.11 2003/05/14 01:34:35 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -33,24 +33,25 @@ * SUCH DAMAGE. */ +#include "defs.h" + #ifndef lint #if 0 -static char RCSid[] = -"$From: lookup.c,v 6.8 1996/07/19 16:49:55 michaelc Exp $"; +static char RCSid[] __attribute__((__unused__)) = +"$From: lookup.c,v 1.4 1999/08/04 15:57:33 christos Exp $"; #else -static char RCSid[] = -"$OpenBSD: lookup.c,v 1.10 2002/05/27 03:14:22 deraadt Exp $"; +static char RCSid[] __attribute__((__unused__)) = +"$OpenBSD: lookup.c,v 1.11 2003/05/14 01:34:35 millert Exp $"; #endif -static char sccsid[] = "@(#)lookup.c 5.1 (Berkeley) 6/6/85"; +static char sccsid[] __attribute__((__unused__)) = +"@(#)lookup.c 5.1 (Berkeley) 6/6/85"; -static char copyright[] = +static char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ -#include "defs.h" - /* symbol types */ #define VAR 1 #define CONST 2 @@ -68,8 +69,7 @@ static struct syment *hashtab[HASHSIZE]; * Define a variable from a command line argument. */ void -define(name) - char *name; +define(char *name) { char *cp, *s; struct namelist *nl; @@ -132,10 +132,7 @@ define(name) */ struct namelist * -lookup(name, action, value) /* %% in name. Ignore quotas in name */ - char *name; - int action; - struct namelist *value; +lookup(char *name, int action, struct namelist *value) { unsigned int n; char *cp; @@ -155,7 +152,9 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */ if (action != LOOKUP) { if (action != INSERT || s->s_type != CONST) { (void) snprintf(ebuf, sizeof(ebuf), - "%s redefined", name); + "%.*s redefined", + (int)(sizeof(ebuf) - + sizeof(" redefined")), name); yyerror(ebuf); } } @@ -163,7 +162,9 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */ } if (action == LOOKUP) { - (void) snprintf(ebuf, sizeof(ebuf), "%s undefined", name); + (void) snprintf(ebuf, sizeof(ebuf), "%.*s undefined", + (int)(sizeof(ebuf) - sizeof(" undefined")), + name); yyerror(ebuf); return(NULL); } |