--- sbr/getans.c.orig 2007-04-29 17:34:04.000000000 -0500 +++ sbr/getans.c 2010-12-19 10:33:30.000000000 -0600 @@ -14,6 +14,9 @@ #include #include +#include +#include + static char ansbuf[BUFSIZ]; static jmp_buf sigenv; @@ -54,6 +57,7 @@ continue; } cpp = brkstring (ansbuf, " ", NULL); +printf("brkstring said \"%s\"\n", *cpp); switch (smatch (*cpp, ansp)) { case AMBIGSW: ambigsw (*cpp, ansp); @@ -69,6 +73,39 @@ } +char ** +getans_via_readline (char *prompt, struct swit *ansp) +{ + SIGNAL_HANDLER istat = NULL; + char *ans, **cpp; + + for (;;) { + ans = readline (prompt); + if (ans[0] == '?' || ans[0] == 0 ) { + printf ("Options are:\n"); + print_sw (ALL, ansp, ""); + free(ans); + continue; + } + strcpy (ansbuf,ans); /* not sure why--but it makes brkstring() work */ + cpp = brkstring (ansbuf, " ", NULL); + switch (smatch (*cpp, ansp)) { + case AMBIGSW: + ambigsw (*cpp, ansp); + continue; + case UNKWNSW: + printf (" -%s unknown. Hit for help.\n", *cpp); + continue; + default: + SIGNAL (SIGINT, istat); + free(ans); + return cpp; + } + free(ans); + } + +} + static RETSIGTYPE intrser (int i) { --- uip/whatnowsbr.c.orig 2008-05-22 05:42:10.000000000 -0500 +++ uip/whatnowsbr.c 2010-12-19 10:34:28.000000000 -0600 @@ -243,7 +243,7 @@ snprintf (prompt, sizeof(prompt), myprompt, invo_name); for (;;) { - if (!(argp = getans (prompt, aleqs))) { + if (!(argp = getans_via_readline (prompt, aleqs))) { unlink (LINK); done (1); }