9 date 92.10.26.22.50.52; author jromine; state Exp;
14 date 92.10.26.22.50.08; author jromine; state Exp;
28 @/* gans.c - get an answer from the user */
30 static char ident[] = "@@(#)$Id: m_getfld.c,v 1.12 1992/05/12 21:49:37 jromine Exp $";
38 register char *prompt;
39 register struct swit *ansp;
43 register struct swit *ap;
47 printf ("%s", prompt);
48 (void) fflush (stdout);
50 while ((i = getchar ()) != '\n') {
53 if (cp < &ansbuf[sizeof ansbuf - 1]) {
55 i = (isalpha(i) && isupper(i)) ? tolower(i) : i;
57 if (i >= 'A' && i <= 'Z')
64 if (ansbuf[0] == '?' || cp == ansbuf) {
65 printf ("Options are:\n");
66 for (ap = ansp; ap -> sw; ap++)
67 printf (" %s\n", ap -> sw);
70 if ((i = smatch (ansbuf, ansp)) < 0) {
71 printf ("%s: %s.\n", ansbuf, i == -1 ? "unknown" : "ambiguous");