3 * getans.c -- get an answer from the user and return a string array
13 static char ansbuf[BUFSIZ];
14 static jmp_buf sigenv;
19 static RETSIGTYPE intrser (int);
23 getans (char *prompt, struct swit *ansp)
29 if (!(setjmp (sigenv))) {
30 istat = SIGNAL (SIGINT, intrser);
32 SIGNAL (SIGINT, istat);
37 printf ("%s", prompt);
40 while ((i = getchar ()) != '\n') {
43 if (cp < &ansbuf[sizeof ansbuf - 1])
47 if (ansbuf[0] == '?' || cp == ansbuf) {
48 printf ("Options are:\n");
49 print_sw (ALL, ansp, "");
52 cpp = brkstring (ansbuf, " ", NULL);
53 switch (smatch (*cpp, ansp)) {
58 printf (" -%s unknown. Hit <CR> for help.\n", *cpp);
61 SIGNAL (SIGINT, istat);
72 * should this be siglongjmp?