4 * This file contains functions which implement parts of the
5 * text-mode user interface.
16 #include <sys/types.h>
25 #ifdef HAVE_SYS_SELECT_H
26 #include <sys/select.h>
29 #ifdef THREADED_CLIENT
39 #include "citadel_decls.h"
41 #include "routines2.h"
55 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
60 int rc_allow_attachments;
61 int rc_display_message_numbers;
62 int rc_force_mail_prompts;
63 int rc_remember_passwords;
66 char urls[MAXURLS][256];
70 int next_lazy_cmd = 5;
72 int lines_printed = 0; /* line count for paginator */
73 extern int screenwidth, screenheight;
75 struct citcmd *cmdlist = NULL;
78 /* these variables are local to this module */
79 char keepalives_enabled = KA_YES; /* send NOOPs to server when idle */
80 int ok_to_interrupt = 0; /* print express msgs asynchronously */
81 time_t AnsiDetect; /* when did we send the detect code? */
82 int enable_color = 0; /* nonzero for ANSI color */
88 * If an interesting key has been pressed, return its value, otherwise 0
90 char was_a_key_pressed(void) {
100 retval = select(1, &rfds, NULL, NULL, &tv);
102 if (FD_ISSET(0, &rfds)) {
103 the_character = inkey();
108 return(the_character);
116 * Check to see if we need to pause at the end of a screen.
117 * If we do, we have to disable server keepalives during the pause because
118 * we are probably in the middle of a server operation and the NOOP command
119 * would confuse everything.
121 int checkpagin(int lp, int pagin, int height)
125 if (sigcaught) return(lp);
126 thekey = was_a_key_pressed();
127 if ( (thekey == NEXT_KEY) || (thekey == STOP_KEY)) sigcaught = thekey;
128 if (sigcaught) return(lp);
130 if (!pagin) return(0);
131 if (lp>=(height-1)) {
132 set_keepalives(KA_NO);
134 set_keepalives(KA_YES);
144 * pprintf() ... paginated version of printf()
146 void pprintf(const char *format, ...) {
148 static char buf[4096]; /* static for performance, change if needed */
151 /* If sigcaught is nonzero, a keypress has interrupted this and we
152 * should just drain output.
154 if (sigcaught) return;
156 /* Otherwise, start spewing... */
157 va_start(arg_ptr, format);
158 vsprintf(buf, format, arg_ptr);
161 for (i=0; i<strlen(buf); ++i) {
162 putc(buf[i], stdout);
165 lines_printed = checkpagin(lines_printed,
166 (userflags & US_PAGINATOR),
175 * print_express() - print express messages if there are any
177 void print_express(void)
182 if (express_msgs == 0)
190 if (strlen(rc_exp_cmd) > 0) {
191 outpipe = popen(rc_exp_cmd, "w");
192 if (outpipe != NULL) {
193 while (serv_gets(buf), strcmp(buf, "000")) {
194 fprintf(outpipe, "%s\n", buf);
200 /* fall back to built-in express message display */
206 while (serv_gets(buf), strcmp(buf, "000")) {
214 void set_keepalives(int s)
216 keepalives_enabled = (char) s;
220 * This loop handles the "keepalive" messages sent to the server when idling.
223 static time_t idlet = 0;
224 static void really_do_keepalive(void) {
228 if (keepalives_enabled != KA_NO) {
230 if (keepalives_enabled == KA_YES) {
234 if (ok_to_interrupt == 1) {
235 printf("\r%64s\r", "");
237 printf("%s%c ", room_name,
238 room_prompt(room_flags));
246 /* threaded nonblocking keepalive stuff starts here. I'm going for a simple
247 encapsulated interface; in theory there should be no need to touch these
248 globals outside of the async_ka_* functions. */
250 #ifdef THREADED_CLIENT
251 static pthread_t ka_thr_handle;
252 static int ka_thr_active = 0;
253 static int async_ka_enabled = 0;
255 static void *ka_thread(void *arg)
257 really_do_keepalive();
258 pthread_detach(ka_thr_handle);
263 /* start up a thread to handle a keepalive in the background */
264 static void async_ka_exec(void)
266 if (!ka_thr_active) {
268 if (pthread_create(&ka_thr_handle, NULL, ka_thread, NULL)) {
269 perror("pthread_create");
274 #endif /* THREADED_CLIENT */
276 static void do_keepalive(void)
281 if ((now - idlet) < ((long) S_KEEPALIVE))
284 /* Do a space-backspace to keep telnet sessions from idling out */
288 #ifdef THREADED_CLIENT
289 if (async_ka_enabled)
293 really_do_keepalive();
297 /* Now the actual async-keepalve API that we expose to higher levels:
298 async_ka_start() and async_ka_end(). These do nothing when we don't have
299 threading enabled, so we avoid sprinkling ifdef's throughout the code. */
301 /* wait for a background keepalive to complete. this must be done before
302 attempting any further server requests! */
303 void async_ka_end(void)
305 #ifdef THREADED_CLIENT
307 pthread_join(ka_thr_handle, NULL);
313 /* tell do_keepalive() that keepalives are asynchronous. */
314 void async_ka_start(void)
316 #ifdef THREADED_CLIENT
323 { /* get a character from the keyboard, with */
324 int a; /* the watchdog timer in effect if necessary */
327 time_t start_time, now;
336 /* This loop waits for keyboard input. If the keepalive
337 * timer expires, it sends a keepalive to the server if
338 * necessary and then waits again.
345 tv.tv_sec = S_KEEPALIVE;
349 if (((now - start_time) > SLEEPING)
350 && (SLEEPING != 0) && (getppid() == 1)) {
351 printf("Sleeping? Call again.\n");
354 select(1, &rfds, NULL, NULL, &tv);
355 } while (!FD_ISSET(0, &rfds));
360 /* At this point, there's input, so fetch it.
361 * (There's a hole in the bucket...)
371 if (((a != 4) && (a != 13) && (a != 8) && (a != NEXT_KEY) && (a != STOP_KEY))
372 && ((a < 32) || (a > 126)))
380 { /* Returns 1 for yes, 0 for no */
396 /* Returns 1 for yes, 0 for no, arg is default value */
419 /* Gets a line from the terminal */
420 /* string == Pointer to string buffer */
421 /* lim == Maximum length - if negative, no-show */
422 void getline(char *string, int lim)
436 if ((a == 8) && (strlen(string) == 0))
438 if ((a != 13) && (a != 8) && (strlen(string) == lim))
440 if ((a == 8) && (string[0] != 0)) {
441 string[strlen(string) - 1] = 0;
447 if ((a == 13) || (a == 10)) {
467 * strprompt() - prompt for a string, print the existing value and
468 * allow the user to press return to keep it...
470 void strprompt(char *prompt, char *str, int len)
475 printf("%s ", prompt);
478 color(BRIGHT_MAGENTA);
492 * boolprompt() - prompt for a yes/no, print the existing value and
493 * allow the user to press return to keep it...
495 int boolprompt(char *prompt, int prev_val)
500 printf("%s ", prompt);
503 color(BRIGHT_MAGENTA);
504 printf("%s", (prev_val ? "Yes" : "No"));
508 r = (yesno_d(prev_val));
514 * intprompt() - like strprompt(), except for an integer
515 * (note that it RETURNS the new value!)
517 int intprompt(char *prompt, int ival, int imin, int imax)
525 snprintf(buf, sizeof buf, "%d", i);
526 strprompt(prompt, buf, 15);
528 for (p=0; p<strlen(buf); ++p) {
529 if ( (!isdigit(buf[p]))
530 && ( (buf[p]!='-') || (p!=0) ) )
534 printf("*** Must be no less than %d.\n", imin);
536 printf("*** Must be no more than %d.\n", imax);
537 } while ((i < imin) || (i > imax));
542 * newprompt() - prompt for a string with no existing value
543 * (clears out string buffer first)
545 void newprompt(char *prompt, char *str, int len)
547 color(BRIGHT_MAGENTA);
548 printf("%s", prompt);
556 { /* returns a lower case value */
565 * parse the citadel.rc file
567 void load_command_set(void)
572 struct citcmd *lastcmd = NULL;
577 /* first, set up some defaults for non-required variables */
579 strcpy(editor_path, "");
580 strcpy(printcmd, "");
581 strcpy(rc_username, "");
582 strcpy(rc_password, "");
585 rc_allow_attachments = 0;
586 rc_remember_passwords = 0;
587 strcpy(rc_exp_cmd, "");
588 rc_display_message_numbers = 0;
589 rc_force_mail_prompts = 0;
591 strcpy(rc_url_cmd, "");
593 /* now try to open the citadel.rc file */
596 if (getenv("HOME") != NULL) {
597 snprintf(buf, sizeof buf, "%s/.citadelrc", getenv("HOME"));
598 ccfile = fopen(buf, "r");
600 if (ccfile == NULL) {
601 ccfile = fopen("/usr/local/lib/citadel.rc", "r");
603 if (ccfile == NULL) {
604 snprintf(buf, sizeof buf, "%s/citadel.rc", BBSDIR);
605 ccfile = fopen(buf, "r");
607 if (ccfile == NULL) {
608 ccfile = fopen("./citadel.rc", "r");
610 if (ccfile == NULL) {
611 perror("commands: cannot open citadel.rc");
614 while (fgets(buf, 256, ccfile) != NULL) {
615 while ((strlen(buf) > 0) ? (isspace(buf[strlen(buf) - 1])) : 0)
616 buf[strlen(buf) - 1] = 0;
618 if (!strncasecmp(buf, "editor=", 7))
619 strcpy(editor_path, &buf[7]);
621 if (!strncasecmp(buf, "printcmd=", 9))
622 strcpy(printcmd, &buf[9]);
624 if (!strncasecmp(buf, "expcmd=", 7))
625 strcpy(rc_exp_cmd, &buf[7]);
627 if (!strncasecmp(buf, "local_screen_dimensions=", 24))
628 have_xterm = (char) atoi(&buf[24]);
630 if (!strncasecmp(buf, "use_floors=", 11)) {
631 if (!strcasecmp(&buf[11], "yes"))
632 rc_floor_mode = RC_YES;
633 if (!strcasecmp(&buf[11], "no"))
634 rc_floor_mode = RC_NO;
635 if (!strcasecmp(&buf[11], "default"))
636 rc_floor_mode = RC_DEFAULT;
638 if (!strncasecmp(buf, "beep=", 5)) {
639 rc_exp_beep = atoi(&buf[5]);
641 if (!strncasecmp(buf, "allow_attachments=", 18)) {
642 rc_allow_attachments = atoi(&buf[18]);
644 if (!strncasecmp(buf, "remember_passwords=", 19)) {
645 rc_remember_passwords = atoi(&buf[19]);
647 if (!strncasecmp(buf, "display_message_numbers=", 24)) {
648 rc_display_message_numbers = atoi(&buf[24]);
650 if (!strncasecmp(buf, "force_mail_prompts=", 19)) {
651 rc_force_mail_prompts = atoi(&buf[19]);
653 if (!strncasecmp(buf, "ansi_color=", 11)) {
654 if (!strncasecmp(&buf[11], "on", 2))
656 if (!strncasecmp(&buf[11], "auto", 4))
657 rc_ansi_color = 2; /* autodetect */
658 if (!strncasecmp(&buf[11], "user", 4))
659 rc_ansi_color = 3; /* user config */
661 if (!strncasecmp(buf, "username=", 9))
662 strcpy(rc_username, &buf[9]);
664 if (!strncasecmp(buf, "password=", 9))
665 strcpy(rc_password, &buf[9]);
667 if (!strncasecmp(buf, "urlcmd=", 7))
668 strcpy(rc_url_cmd, &buf[7]);
670 if (!strncasecmp(buf, "cmd=", 4)) {
671 strcpy(buf, &buf[4]);
673 cptr = (struct citcmd *) malloc(sizeof(struct citcmd));
675 cptr->c_cmdnum = atoi(buf);
676 for (d = strlen(buf); d >= 0; --d)
679 strcpy(buf, &buf[b + 1]);
681 cptr->c_axlevel = atoi(buf);
682 for (d = strlen(buf); d >= 0; --d)
685 strcpy(buf, &buf[b + 1]);
687 for (a = 0; a < 5; ++a)
688 cptr->c_keys[a][0] = 0;
692 buf[strlen(buf) + 1] = 0;
693 while (strlen(buf) > 0) {
695 for (d = strlen(buf); d >= 0; --d)
698 strncpy(cptr->c_keys[a], buf, b);
699 cptr->c_keys[a][b] = 0;
701 strcpy(buf, &buf[b + 1]);
711 lastcmd->next = cptr;
721 * return the key associated with a command
723 char keycmd(char *cmdstr)
727 for (a = 0; a < strlen(cmdstr); ++a)
728 if (cmdstr[a] == '&')
729 return (tolower(cmdstr[a + 1]));
735 * Output the string from a key command without the ampersand
736 * "mode" should be set to 0 for normal or 1 for <C>ommand key highlighting
738 char *cmd_expand(char *strbuf, int mode)
746 for (a = 0; a < strlen(exp); ++a) {
747 if (strbuf[a] == '&') {
750 strcpy(&exp[a], &exp[a + 1]);
754 strcpy(buf, &exp[a + 2]);
760 if (!strncmp(&exp[a], "^r", 2)) {
762 strcpy(&exp[a], room_name);
763 strcat(exp, &buf[a + 2]);
765 if (!strncmp(&exp[a], "^c", 2)) {
767 strcpy(&exp[a + 1], &exp[a + 2]);
777 * Comparison function to determine if entered commands match a
778 * command loaded from the config file.
780 int cmdmatch(char *cmdbuf, struct citcmd *cptr, int ncomp)
791 for (a = 0; a < ncomp; ++a) {
792 if ((tolower(cmdbuf[a]) != keycmd(cptr->c_keys[a]))
793 || (cptr->c_axlevel > cmdax))
801 * This function returns 1 if a given command requires a string input
803 int requires_string(struct citcmd *cptr, int ncomp)
808 strcpy(buf, cptr->c_keys[ncomp - 1]);
809 for (a = 0; a < strlen(buf); ++a) {
818 * Input a command at the main prompt.
819 * This function returns an integer command number. If the command prompts
820 * for a string then it is placed in the supplied buffer.
822 int getcmd(char *argbuf)
834 * Starting a new command now, so set sigcaught to 0. This variable
835 * is set to nonzero (usually NEXT_KEY or STOP_KEY) if a command has
836 * been interrupted by a keypress.
840 /* Switch color support on or off if we're in user mode */
841 if (rc_ansi_color == 3) {
842 if (userflags & US_COLOR)
847 /* if we're running in idiot mode, display a cute little menu */
848 IFNEXPERT formout("mainmenu");
850 print_express(); /* print express messages if there are any */
853 for (a = 0; a < 5; ++a)
855 /* now the room prompt... */
858 printf("\n%s", room_name);
860 printf("%c ", room_prompt(room_flags));
867 /* Handle the backspace key, but only if there's something
868 * to backspace over...
870 if ((ch == 8) && (cmdpos > 0)) {
871 back(cmdspaces[cmdpos - 1] + 1);
875 /* Spacebar invokes "lazy traversal" commands */
876 if ((ch == 32) && (cmdpos == 0)) {
877 this_lazy_cmd = next_lazy_cmd;
878 if (this_lazy_cmd == 13)
880 if (this_lazy_cmd == 5)
882 for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) {
883 if (cptr->c_cmdnum == this_lazy_cmd) {
884 for (a = 0; a < 5; ++a)
885 if (cptr->c_keys[a][0] != 0)
886 printf("%s ", cmd_expand(
887 cptr->c_keys[a], 0));
889 return (this_lazy_cmd);
893 return (this_lazy_cmd);
895 /* Otherwise, process the command */
896 cmdbuf[cmdpos] = tolower(ch);
898 for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) {
899 if (cmdmatch(cmdbuf, cptr, cmdpos + 1)) {
901 printf("%s", cmd_expand(cptr->c_keys[cmdpos], 0));
902 cmdspaces[cmdpos] = strlen(
903 cmd_expand(cptr->c_keys[cmdpos], 0));
905 if ((cptr->c_keys[cmdpos + 1]) != 0)
911 for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) {
912 if (cmdmatch(cmdbuf, cptr, 5)) {
913 /* We've found our command. */
914 if (requires_string(cptr, cmdpos)) {
920 /* If this command is one that changes rooms,
921 * then the next lazy-command (space bar)
922 * should be "read new" instead of "goto"
924 if ((cptr->c_cmdnum == 5)
925 || (cptr->c_cmdnum == 6)
926 || (cptr->c_cmdnum == 47)
927 || (cptr->c_cmdnum == 52)
928 || (cptr->c_cmdnum == 16)
929 || (cptr->c_cmdnum == 20))
932 return (cptr->c_cmdnum);
938 printf("\rOne of ... \n");
939 for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) {
940 if (cmdmatch(cmdbuf, cptr, cmdpos)) {
941 for (a = 0; a < 5; ++a) {
942 printf("%s ", cmd_expand(cptr->c_keys[a], 1));
948 printf("\n%s%c ", room_name, room_prompt(room_flags));
950 for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) {
951 if ((got == 0) && (cmdmatch(cmdbuf, cptr, cmdpos))) {
952 for (a = 0; a < cmdpos; ++a) {
954 cmd_expand(cptr->c_keys[a], 0));
969 * set tty modes. commands are:
971 * 01- set to bbs mode
972 * 2 - save current settings for later restoral
973 * 3 - restore saved settings
975 #ifdef HAVE_TERMIOS_H
976 void sttybbs(int cmd)
977 { /* SysV version of sttybbs() */
979 static struct termios saved_settings;
980 static int last_cmd = 0;
987 if ((cmd == 0) || (cmd == 1)) {
989 live.c_iflag = ISTRIP | IXON | IXANY;
990 live.c_oflag = OPOST | ONLCR;
991 live.c_lflag = ISIG | NOFLSH;
993 live.c_cc[VINTR] = (-1);
994 live.c_cc[VQUIT] = (-1);
996 /* do we even need this stuff anymore? */
998 live.c_cc[VERASE] = 8;
999 live.c_cc[VKILL] = 24;
1000 live.c_cc[VEOF] = 1;
1001 live.c_cc[VEOL] = 255;
1002 live.c_cc[VEOL2] = 0;
1003 live.c_cc[VSTART] = 0;
1004 tcsetattr(0, TCSADRAIN, &live);
1007 tcgetattr(0, &saved_settings);
1010 tcsetattr(0, TCSADRAIN, &saved_settings);
1014 void sttybbs(int cmd)
1015 { /* BSD version of sttybbs() */
1017 static struct sgttyb saved_settings;
1019 if ((cmd == 0) || (cmd == 1)) {
1021 live.sg_flags |= CBREAK;
1022 live.sg_flags |= CRMOD;
1023 live.sg_flags |= NL1;
1024 live.sg_flags &= ~ECHO;
1026 live.sg_flags |= NOFLSH;
1030 gtty(0, &saved_settings);
1033 stty(0, &saved_settings);
1040 * display_help() - help file viewer
1042 void display_help(char *name)
1049 * fmout() - Citadel text formatter and paginator
1052 int width, /* screen width to use */
1053 FILE *fp, /* file to read from, or NULL to read from server */
1054 char pagin, /* nonzero if we should use the paginator */
1055 int height, /* screen height to use */
1056 int starting_lp,/* starting value for lines_printed, -1 for global */
1057 char subst) /* nonzero if we should use hypertext mode */
1059 int a, b, c, d, old;
1065 num_urls = 0; /* Start with a clean slate of embedded URL's */
1067 if (starting_lp >= 0) {
1068 lines_printed = starting_lp;
1073 c = 1; /* c is the current pos */
1075 FMTA: while ((eof_flag == 0) && (strlen(buffer) < 126)) {
1076 if (fp != NULL) { /* read from file */
1079 if (eof_flag == 0) {
1081 buffer[strlen(buffer) + 1] = 0;
1082 buffer[strlen(buffer)] = a;
1084 } else { /* read from server */
1086 serv_gets(&buffer[d]);
1087 while ((!isspace(buffer[d])) && (isspace(buffer[strlen(buffer) - 1])))
1088 buffer[strlen(buffer) - 1] = 0;
1089 if (!strcmp(&buffer[d], "000")) {
1092 while (isspace(buffer[strlen(buffer) - 1]))
1093 buffer[strlen(buffer) - 1] = 0;
1101 if ( (!strncasecmp(buffer, "http://", 7))
1102 || (!strncasecmp(buffer, "ftp://", 6)) ) {
1103 safestrncpy(urls[num_urls], buffer, 255);
1104 for (a=0; a<strlen(urls[num_urls]); ++a) {
1105 b = urls[num_urls][a];
1106 if ( (b==' ') || (b==')') || (b=='>') || (b==10)
1107 || (b==13) || (b==9) || (b=='\"') )
1108 urls[num_urls][a] = 0;
1113 buffer[strlen(buffer) + 1] = 0;
1115 strcpy(buffer, &buffer[1]);
1122 if (((a == 13) || (a == 10)) && (old != 13) && (old != 10))
1124 if (((old == 13) || (old == 10)) && (isspace(real))) {
1127 lines_printed = checkpagin(lines_printed, pagin, height);
1134 if (((strlen(aaa) + c) > (width - 5)) && (strlen(aaa) > (width - 5))) {
1135 printf("\n%s", aaa);
1139 lines_printed = checkpagin(lines_printed, pagin, height);
1146 if ((strlen(aaa) + c) > (width - 5)) {
1150 lines_printed = checkpagin(lines_printed, pagin, height);
1154 c = c + strlen(aaa);
1158 if ((a == 13) || (a == 10)) {
1159 printf("%s\n", aaa);
1162 lines_printed = checkpagin(lines_printed, pagin, height);
1163 if (sigcaught) goto OOPS;
1169 /* keypress caught; drain the server */
1172 } while (strcmp(aaa, "000"));
1174 FMTEND: printf("\n");
1176 lines_printed = checkpagin(lines_printed, pagin, height);
1182 * support ANSI color if defined
1184 void color(int colornum)
1186 static int is_bold = 0;
1187 static int hold_color, current_color;
1189 if (colornum == COLOR_PUSH) {
1190 hold_color = current_color;
1194 if (colornum == COLOR_POP) {
1199 current_color = colornum;
1201 /* When switching to dim white, actually output an 'original
1202 * pair' sequence -- this looks better on black-on-white
1205 if (colornum == DIM_WHITE)
1206 printf("\033[39;49m");
1208 printf("\033[3%d;40m", (colornum & 7));
1210 if ((colornum >= 8) && (is_bold == 0)) {
1213 } else if ((colornum < 8) && (is_bold == 1)) {
1221 void cls(int colornum)
1224 printf("\033[4%dm\033[2J\033[H\033[0m", colornum);
1231 * Detect whether ANSI color is available (answerback)
1233 void send_ansi_detect(void)
1235 if (rc_ansi_color == 2) {
1242 void look_for_ansi(void)
1250 if (rc_ansi_color == 0) {
1252 } else if (rc_ansi_color == 1) {
1254 } else if (rc_ansi_color == 2) {
1256 /* otherwise, do the auto-detect */
1261 if ((now - AnsiDetect) < 2)
1270 select(1, &rfds, NULL, NULL, &tv);
1271 if (FD_ISSET(0, &rfds)) {
1272 abuf[strlen(abuf) + 1] = 0;
1273 read(0, &abuf[strlen(abuf)], 1);
1275 } while (FD_ISSET(0, &rfds));
1277 for (a = 0; a < strlen(abuf); ++a) {
1278 if ((abuf[a] == 27) && (abuf[a + 1] == '[')
1279 && (abuf[a + 2] == '?')) {
1288 * Display key options (highlight hotkeys inside angle brackets)
1290 void keyopt(char *buf) {
1294 for (i=0; i<strlen(buf); ++i) {
1296 putc(buf[i], stdout);
1297 color(BRIGHT_MAGENTA);
1302 putc(buf[i], stdout);
1311 * Present a key-menu line choice type of thing
1313 char keymenu(char *menuprompt, char *menustring) {
1319 int display_prompt = 1;
1321 choices = num_tokens(menustring, '|');
1323 if (menuprompt != NULL) do_prompt = 1;
1324 if (menuprompt != NULL) if (strlen(menuprompt)==0) do_prompt = 0;
1327 if (display_prompt) {
1329 printf("%s ", menuprompt);
1332 for (i=0; i<choices; ++i) {
1333 extract(buf, menustring, i);
1343 if ( (do_prompt) && (ch=='?') ) {
1344 printf("\rOne of... ");
1346 for (i=0; i<choices; ++i) {
1347 extract(buf, menustring, i);
1356 for (i=0; i<choices; ++i) {
1357 extract(buf, menustring, i);
1358 for (c=1; c<strlen(buf); ++c) {
1359 if ( (ch == tolower(buf[c]))
1361 && (buf[c+1]=='>') ) {
1362 for (a=0; a<strlen(buf); ++a) {
1363 if ( (a!=(c-1)) && (a!=(c+1))) {
1364 putc(buf[a], stdout);