X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/634cb6ceab3191623a3daed5e953821e3f37a4cb..5b76eed8435d83619f278cc1584ca5751e2804f6:/trek/getpar.c diff --git a/trek/getpar.c b/trek/getpar.c index 0250a4db..5d568323 100644 --- a/trek/getpar.c +++ b/trek/getpar.c @@ -1,4 +1,4 @@ -/* $NetBSD: getpar.c,v 1.5 1997/10/12 21:24:50 christos Exp $ */ +/* $NetBSD: getpar.c,v 1.12 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,16 +34,17 @@ #if 0 static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getpar.c,v 1.5 1997/10/12 21:24:50 christos Exp $"); +__RCSID("$NetBSD: getpar.c,v 1.12 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ #include +#include #include #include "getpar.h" #include "trek.h" -static int testterm __P((void)); +static int testterm(void); /** ** get integer parameter @@ -55,7 +52,7 @@ static int testterm __P((void)); int getintpar(s) -char *s; + const char *s; { int i; int n; @@ -79,7 +76,7 @@ char *s; **/ double getfltpar(s) -char *s; + const char *s; { int i; double d; @@ -102,21 +99,21 @@ char *s; ** get yes/no parameter **/ -struct cvntab Yntab[] = +const struct cvntab Yntab[] = { - { "y", "es", (cmdfun)1, 0 }, + { "y", "es", (cmdfun)1, 1 }, { "n", "o", (cmdfun)0, 0 }, { NULL, NULL, NULL, 0 } }; int getynpar(s) -char *s; + const char *s; { - struct cvntab *r; + const struct cvntab *r; r = getcodpar(s, Yntab); - return (int) r->value; + return r->value2; } @@ -124,14 +121,14 @@ char *s; ** get coded parameter **/ -struct cvntab *getcodpar(s, tab) -char *s; -struct cvntab tab[]; +const struct cvntab *getcodpar(s, tab) + const char *s; + const struct cvntab tab[]; { char input[100]; - struct cvntab *r; + const struct cvntab *r; int flag; - char *p, *q; + const char *p, *q; int c; int f; @@ -144,7 +141,7 @@ struct cvntab tab[]; if (f) cgetc(0); /* throw out the newline */ scanf("%*[ \t;]"); - if ((c = scanf("%[^ \t;\n]", input)) < 0) + if ((c = scanf("%99[^ \t;\n]", input)) < 0) exit(1); if (c == 0) continue; @@ -204,10 +201,10 @@ struct cvntab tab[]; void getstrpar(s, r, l, t) -char *s; -char *r; -int l; -char *t; + const char *s; + char *r; + int l; + const char *t; { int i; char format[20]; @@ -290,7 +287,7 @@ testterm() /* -** TEST FOR SPECIFIED DELIMETER +** TEST FOR SPECIFIED DELIMITER ** ** The standard input is scanned for the parameter. If found, ** it is thrown away and non-zero is returned. If not found,