xev@hstbme.mit.edu (Xev Gittler) (01/11/88)
Has anyone used the builtin editor, and have they had problems with it? Here's my symptoms: It works fine when I go in and enter text and end with a control-d. However, when I try and use a ~ command, it says ~ whatever, command not recognized, and from then on it repeats every line that I type in, and when I try and end with a control-d, it scrolls seemingly infinitely. Any ideas? Xev Gittler xev@hstbme.mit.edu, or xev@athena.it.edu
jimp@cognos.uucp (Jim Patterson) (01/18/88)
In article <2233@bloom-beacon.MIT.EDU> xev@hstbme.mit.edu (Xev Gittler) writes: >Has anyone used the builtin editor, and have they had problems with >it? It works fine when I go in and enter text and end with a >control-d. However, when I try and use a ~ command, it says ~ >whatever, command not recognized, and from then on it repeats every >line that I type in, and when I try and end with a control-d, it >scrolls seemingly infinitely. Any ideas? We had this problem, and it was traced down to a number of i/o calls which didn't clear errors upon return. Here's some patches I put into version 1.5 of elm, which fixed some instances of this problem. ------- input_utils.c ------- *** old/input_utils.c Mon Jan 18 09:20:28 1988 --- new/input_utils.c Mon Jan 18 09:15:21 1988 *************** *** 82,90 **** Also added that if x and y are < 0 don't try any cursor stuff **/ ! char ch; register int index = 0, use_cursor_control; use_cursor_control = ((! mail_only) && x >= 0 && y >= 0); if (use_cursor_control) --- 82,92 ---- Also added that if x and y are < 0 don't try any cursor stuff **/ ! int ch; register int index = 0, use_cursor_control; + clearerr(stdin); /* Clear any end-of-file status */ + use_cursor_control = ((! mail_only) && x >= 0 && y >= 0); if (use_cursor_control) *************** *** 105,111 **** ch = getchar(); ! if (ch == '\n' || ch == '\r') { if (cursor_control) transmit_functions(ON); return(0); /* we're done. No change needed */ --- 107,113 ---- ch = getchar(); ! if (ch == EOF || ch == '\n' || ch == '\r') { if (cursor_control) transmit_functions(ON); return(0); /* we're done. No change needed */ *************** *** 157,163 **** fflush(stdout); } } ! else if (ch == '\n' || ch == '\r') { string[index] = '\0'; if (cursor_control) transmit_functions(ON); --- 159,165 ---- fflush(stdout); } } ! else if (ch == EOF || ch == '\n' || ch == '\r') { string[index] = '\0'; if (cursor_control) transmit_functions(ON); ------- hdrconfg.c ------- *** old/hdrconfg.c Mon Jan 18 09:21:27 1988 --- new/hdrconfg.c Mon Jan 18 09:17:35 1988 *************** *** 50,65 **** #ifdef ALLOW_BCC int unexpanded_bcc = TRUE; #endif ! char c; if (mail_only) goto outta_here; /* how did we get HERE??? */ display_headers(); while (TRUE) { /* forever */ PutLine0(LINES-1,0,"Choice: "); CleartoEOLN(); c = toupper(getchar()); clear_error(); switch (c) { case RETURN: --- 50,68 ---- #ifdef ALLOW_BCC int unexpanded_bcc = TRUE; #endif ! int c; /* Changed to int to allow EOF checks - JP */ if (mail_only) goto outta_here; /* how did we get HERE??? */ display_headers(); + clearerr(stdin); while (TRUE) { /* forever */ PutLine0(LINES-1,0,"Choice: "); CleartoEOLN(); c = toupper(getchar()); + if (c == EOF) + break; clear_error(); switch (c) { case RETURN: ************************ I hope this helps. -- Jim Patterson Cognos Incorporated UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707 PHONE:(613)738-1440 3755 Riverside Drive Ottawa, Ont K1G 3Z4