-/* $NetBSD: getinp.c,v 1.6 1997/10/12 17:45:10 christos Exp $ */
+/* $NetBSD: getinp.c,v 1.11 2003/08/07 09:37:27 agc Exp $ */
/*
* Copyright (c) 1980, 1993
* 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.
*
#if 0
static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getinp.c,v 1.6 1997/10/12 17:45:10 christos Exp $");
+__RCSID("$NetBSD: getinp.c,v 1.11 2003/08/07 09:37:27 agc Exp $");
#endif
#endif /* not lint */
#include <ctype.h>
#include "monop.ext"
-# define LINE 70
+#define LINE 70
static char buf[257];
-static int comp __P((char *));
+static int comp __P((const char *));
int
getinp(prompt, list)
-char *prompt, *list[];
+ const char *prompt, *const list[];
{
-
- int i, n_match, match = 0;
- char *sp;
- int c;
+ int i, n_match, match = 0;
+ char *sp;
+ int c;
for (;;) {
inter:
- printf(prompt);
+ printf("%s", prompt);
for (sp = buf; (c=getchar()) != '\n'; ) {
*sp = c;
- if (c == -1) /* check for interupted system call */
+ if (c == -1) /* check for interrupted system call */
goto inter;
else if (sp != buf || *sp != ' ')
sp++;
printf("<RETURN>");
}
else
- printf(list[i]);
+ printf("%s", list[i]);
if (list[i+1])
printf(", ");
else
if (n_match == 1)
return match;
else if (buf[0] != '\0')
- printf("Illegal response: \"%s\". Use '?' to get list of valid answers\n", buf);
+ printf("Illegal response: \"%s\". "
+ "Use '?' to get list of valid answers\n", buf);
}
}
static int
comp(s1)
-char *s1;
+ const char *s1;
{
-
- char *sp, *tsp, c;
+ const char *sp, *tsp;
+ char c;
if (buf[0] != '\0')
for (sp = buf, tsp = s1; *sp; ) {