-/* $NetBSD: getpar.c,v 1.15 2009/05/24 23:20:22 dholland Exp $ */
+/* $NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getpar.c,v 1.15 2009/05/24 23:20:22 dholland Exp $");
+__RCSID("$NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** get yes/no parameter
**/
-const struct cvntab Yntab[] = {
+static const struct cvntab Yntab[] = {
{ "y", "es", (cmdfun)1, 1 },
{ "n", "o", (cmdfun)0, 0 },
{ NULL, NULL, NULL, 0 }
/* if command list, print four per line */
if (input[0] == '?' && input[1] == 0) {
c = 4;
- for (r = tab; r->abrev; r++) {
- strcpy(input, r->abrev);
+ for (r = tab; r->abbrev; r++) {
+ strcpy(input, r->abbrev);
strcat(input, r->full);
printf("%14.14s", input);
if (--c > 0)
}
/* search for in table */
- for (r = tab; r->abrev; r++) {
+ for (r = tab; r->abbrev; r++) {
p = input;
- for (q = r->abrev; *q; q++)
+ for (q = r->abbrev; *q; q++)
if (*p++ != *q)
break;
if (!*q) {
}
/* check for not found */
- if (!r->abrev) {
+ if (!r->abbrev) {
printf("invalid input; ? for valid inputs\n");
skiptonl(0);
} else
if (t == 0)
t = " \t\n;";
- (void)sprintf(format, "%%%d[^%s]", l, t);
+ (void)snprintf(format, sizeof(format), "%%%d[^%s]", l, t);
while (1) {
if ((f = testnl()) && s)
printf("%s: ", s);