taylor@hpldat.UUCP (Dave Taylor) (05/03/87)
This is Elm Patch Kit #6 of 8, and contains patches for: src/calendar.c src/elm.c src/builtin.c src/getopt.c src/Makefile.mstr src/editmsg.c src/limit.c src/save_opts.c hdrs/defs.h hdrs/headers.h Please feed this directly to 'patch'. Index: src/calendar.c *************** *** 52,57 if (can_open(calendar_file, "a") != 0) { ! dprint1(2, "Error: wrong permissions to append to calendar %s\n", ! calendar_file); ! dprint2(2, "** %s - %s **\n", ! error_name(errno), error_description(errno)); error1("Not able to append to file %s!", calendar_file); --- 52,58 ----- if (can_open(calendar_file, "a") != 0) { ! dprint(2, (debugfile, ! "Error: wrong permissions to append to calendar %s\n", ! calendar_file)); ! dprint(2, (debugfile, "** %s - %s **\n", ! error_name(errno), error_description(errno))); error1("Not able to append to file %s!", calendar_file); *************** *** 61,66 if ((calendar = fopen(calendar_file,"a")) == NULL) { ! dprint1(2, "Error: couldn't append to calendar file %s (save)\n", ! calendar_file); ! dprint2(2, "** %s - %s **\n", ! error_name(errno), error_description(errno)); error1("Couldn't append to file %s!", calendar_file); --- 62,68 ----- if ((calendar = fopen(calendar_file,"a")) == NULL) { ! dprint(2, (debugfile, ! "Error: couldn't append to calendar file %s (scan)\n", ! calendar_file)); ! dprint(2, (debugfile, "** %s - %s **\n", ! error_name(errno), error_description(errno))); error1("Couldn't append to file %s!", calendar_file); *************** *** 98,101 if (fseek(mailfile, header_table[current-1].offset, 0) == -1) { ! dprint2(1,"ERROR: Attempt to seek %d bytes into file failed (%s)", ! header_table[current-1].offset, "extract_info"); error1("ELM [seek] failed trying to read %d bytes into file", --- 100,104 ----- if (fseek(mailfile, header_table[current-1].offset, 0) == -1) { ! dprint(1,(debugfile, ! "ERROR: Attempt to seek %d bytes into file failed (%s)", ! header_table[current-1].offset, "extract_info")); error1("ELM [seek] failed trying to read %d bytes into file", *************** *** 135,137 ! dprint2(4,"Got %d calender entr%s.\n", entries, entries > 1? "ies":"y"); --- 138,141 ----- ! dprint(4,(debugfile, ! "Got %d calender entr%s.\n", entries, entries > 1? "ies":"y")); Index: src/elm.c *************** *** 21,23 char *argv[]; ! { char ch, address[SLEN], to_whom[LONG_SLEN]; --- 21,23 ----- char *argv[]; ! { char ch, address[SLEN], to_whom[LONG_SLEN]; *************** *** 30,31 last_in_mailbox; /** for when we receive new mail too... **/ --- 30,32 ----- last_in_mailbox; /** for when we receive new mail too... **/ + long num; /** another variable for fun.. **/ *************** *** 38,42 Raw(ON); ! dprint1(3,"Mail-only: mailing to\n-> \"%s\"\n", ! format_long(to_whom, 3)); ! (void) send(to_whom, "", TRUE, NO); leave(0); --- 39,43 ----- Raw(ON); ! dprint(3, (debugfile, "Mail-only: mailing to\n-> \"%s\"\n", ! format_long(to_whom, 3))); ! (void) send(to_whom, "", "", TRUE, NO); leave(0); *************** *** 59,63 nucurr = 0; ! if ((i = bytes(infile)) != mailfile_size) { ! dprint1(2,"Just received %d bytes more mail (elm)\n", ! i - mailfile_size); error("New mail has arrived! Hang on..."); --- 60,64 ----- nucurr = 0; ! if ((num = bytes(infile)) != mailfile_size) { ! dprint(2, (debugfile, "Just received %d bytes more mail (elm)\n", ! num - mailfile_size)); error("New mail has arrived! Hang on..."); *************** *** 78,80 } ! mailfile_size = i; if (cursor_control) --- 79,81 ----- } ! mailfile_size = num; if (cursor_control) *************** *** 88,90 CleartoEOS(); ! dprint1(4, "\nCommand: %c\n\n", ch); --- 89,91 ----- CleartoEOS(); ! dprint(4, (debugfile, "\nCommand: %c\n\n", ch)); *************** *** 191,193 "Change mailbox"); - define_softkeys(CHANGE); if ((file_changed = leave_mbox(FALSE)) != -1) { --- 192,193 ----- "Change mailbox"); if ((file_changed = leave_mbox(FALSE)) != -1) { *************** *** 193,194 if ((file_changed = leave_mbox(FALSE)) != -1) { redraw = newmbox(0, TRUE, TRUE); --- 193,195 ----- if ((file_changed = leave_mbox(FALSE)) != -1) { + define_softkeys(CHANGE); redraw = newmbox(0, TRUE, TRUE); *************** *** 194,197 redraw = newmbox(0, TRUE, TRUE); - dprint1(1, "** redraw returned as %d **\n", - redraw); mailfile_size = bytes(infile); --- 195,196 ----- redraw = newmbox(0, TRUE, TRUE); mailfile_size = bytes(infile); *************** *** 209,211 else { ! delete_msg((ch == 'd')); if (resolve_mode) /* move after mail resolved */ --- 208,210 ----- else { ! delete_msg((ch == 'd'), TRUE); if (resolve_mode) /* move after mail resolved */ *************** *** 271,273 filter = FALSE; ! redraw = show_msg(current); filter = i; --- 270,277 ----- filter = FALSE; ! if ((redraw = show_msg(current)) > ' ' && ! redraw < 127) { ! while ((redraw=process_showmsg_cmd(redraw) > ' ')) ! /* just keep callin' that routine */; ! redraw = 1; /* always.. */ ! } filter = i; *************** *** 306,308 case 'm' : PutLine0(LINES-3, strlen("Command: "), "Mail"); ! redraw = send("", "", TRUE, allow_forms); break; --- 310,312 ----- case 'm' : PutLine0(LINES-3, strlen("Command: "), "Mail"); ! redraw = send("", "", "", TRUE, allow_forms); break; *************** *** 313,315 define_softkeys(READ); ! redraw = show_msg(current); break; --- 317,327 ----- define_softkeys(READ); ! ! if ((redraw = show_msg(current)) > ' ' && ! redraw < 127) { ! ! while ((redraw=process_showmsg_cmd(redraw)) > ' ') ! /* keep calling process-showmsg-cmd */; ! ! redraw = 1; /* always.. */ ! } break; *************** *** 319,321 define_softkeys(READ); ! redraw = show_msg(current); current += redraw; --- 331,339 ----- define_softkeys(READ); ! ! if ((redraw = show_msg(current)) > ' ' && ! redraw < 127) { ! while ((redraw=process_showmsg_cmd(redraw)) > ' ') ! /* keep circling */; ! redraw = 1; /* always.. */ ! } current += redraw; *************** *** 336,338 else ! printmsg(); break; --- 354,356 ----- else ! print_msg(); break; *************** *** 395,397 else { ! undelete_msg(); if (resolve_mode) /* move after mail resolved */ --- 413,415 ----- else { ! undelete_msg(TRUE); if (resolve_mode) /* move after mail resolved */ *************** *** 422,424 ! case '#' : debug_message(); redraw++; break; --- 440,448 ----- ! case '#' : if (message_count) { ! debug_message(); ! redraw++; ! } ! else ! error("no mail to check"); ! break; *************** *** 557,559 ! dprint5(4,"redraw=%s, current=%d, nuhead=%s, nufoot=%s, nucurr=%s\n", onoff(redraw), current, onoff(nuhead), onoff(nufoot), --- 581,584 ----- ! dprint(4, (debugfile, ! "redraw=%s, current=%d, nuhead=%s, nufoot=%s, nucurr=%s\n", onoff(redraw), current, onoff(nuhead), onoff(nufoot), *************** *** 559,561 onoff(redraw), current, onoff(nuhead), onoff(nufoot), ! onoff(nucurr)); --- 584,586 ----- onoff(redraw), current, onoff(nuhead), onoff(nufoot), ! onoff(nucurr))); Index: src/builtin.c *************** *** 13,14 (C) Copyright 1986, Dave Taylor --- 13,17 ----- + Also added support for the "builtin+" pager (clears the screen for + each new page) including a two-line overlap for context... + (C) Copyright 1986, Dave Taylor *************** *** 28,29 total_lines_to_display, /* total number of lines in message */ lines_to_ignore = 0; /* for 'f' and 's' functions... */ --- 31,33 ----- total_lines_to_display, /* total number of lines in message */ + pages_displayed, /* for the nth page titles and all */ lines_to_ignore = 0; /* for 'f' and 's' functions... */ *************** *** 33,35 { ! /** clears that screen and resets it's internal counters... **/ --- 37,39 ----- { ! /** clears the screen and resets the internal counters... **/ *************** *** 35,38 ! dprint1(8,"displaying %d lines from message using internal pager\n", ! lines_in_message); --- 39,43 ----- ! dprint(8,(debugfile, ! "displaying %d lines from message using internal pager\n", ! lines_in_message)); *************** *** 41,42 lines_to_ignore = 0; --- 46,48 ----- lines_to_ignore = 0; + pages_displayed = 1; *************** *** 53,55 for some input. Return non-zero if the user terminates the ! paging (e.g. 'q') or zero if we should continue... **/ --- 59,64 ----- for some input. Return non-zero if the user terminates the ! paging (e.g. 'q') or zero if we should continue...Also, this ! will pass back the value of any character the user types in ! at the prompt instead, if needed... (e.g. if it can't deal with ! it at this point) **/ *************** *** 56,59 ! register int lines_needed, okay_char, ch, len = 12, iteration = 0; ! char pattern[SLEN]; --- 65,69 ----- ! register int lines_needed, okay_char, ch, len; ! char pattern[SLEN], display_buffer[SLEN], *p, *pend; ! char last_line[SLEN], line_before_that[SLEN]; *************** *** 69,72 ! for (ch = 0; ch < strlen(line); ch++) ! if (line[ch] == '\n') lines_needed++; --- 79,81 ----- ! /* the next few lines are from Greg Laskin and speed things up a lot! */ *************** *** 72,73 if (lines_needed + lines_put_on_screen > LINES-1) { --- 81,86 ----- + pend = line + strlen(line); + for (p = line; p < pend; ) + if (*p++ == '\n') lines_needed++; + if (lines_needed + lines_put_on_screen > LINES-1) { *************** *** 74,78 StartBold(); ! if (user_level == 0) { ! Write_to_screen( ! "You've read %d%%: press <space> for more, or 'q' to return", 1, (int) (100.0 * ( --- 87,91 ----- StartBold(); ! if (user_level == 0) ! sprintf(display_buffer, ! "You've read %d%%: press <space> for more, or 'q' to return", (int) (100.0 * ( *************** *** 79,85 (float) lines_displayed / (float) total_lines_to_display))); ! len = 59; ! } ! else if (user_level == 1) { ! Write_to_screen( ! "More (%d%%) Press <space> for more, 'q' to return", 1, (int) (100.0 * ( --- 92,96 ----- (float) lines_displayed / (float) total_lines_to_display))); ! else if (user_level == 1) ! sprintf(display_buffer, ! "More (%d%%) Press <space> for more, 'q' to return", (int) (100.0 * ( *************** *** 86,89 (float) lines_displayed / (float) total_lines_to_display))); - len = 49; - } else --- 97,98 ----- (float) lines_displayed / (float) total_lines_to_display))); else *************** *** 89,91 else ! Write_to_screen(" More (%d%%)", 1, (int) (100.0 * ( --- 98,100 ----- else ! sprintf(display_buffer," More (%d%%)", (int) (100.0 * ( *************** *** 93,94 EndBold(); --- 102,106 ----- + len = strlen(display_buffer); + Write_to_screen(display_buffer,0); + EndBold(); *************** *** 99,101 Raw(OFF); ! loop_top: switch (ch) { case '\n' : --- 111,113 ----- Raw(OFF); ! switch (ch) { case '\n' : *************** *** 118,134 break; - case 'f' : lines_to_ignore = ((iteration?iteration:1)*LINES)-5; - CursorLeft(len); CleartoEOLN(); - printf("...skipping %d lines...",lines_to_ignore+2); - fflush(stdout); - lines_put_on_screen = 0; - return(0); - case 's' : lines_to_ignore = (iteration?iteration-1:0); - CursorLeft(len); CleartoEOLN(); - if (lines_to_ignore) - printf("...skipping %d lines...",lines_to_ignore+1); - else - printf("...skipping one line...\n"); - fflush(stdout); - lines_put_on_screen = 0; - return(0); case 'q' : --- 130,131 ----- break; case 'q' : *************** *** 135,147 case 'Q' : return(TRUE); /* get OUTTA here! */ ! default : if (isdigit(ch)) { ! Raw(ON); ! do { ! iteration = 10*iteration + (ch - '0'); ! } while (isdigit(ch = ReadCh())); ! Raw(OFF); ! goto loop_top; ! } ! putchar(BEEP); ! fflush(stdout); ! break; } --- 132,137 ----- case 'Q' : return(TRUE); /* get OUTTA here! */ ! default : dprint(2,(debugfile, ! "builtin is outta here, returning '%c' [%d]\n", ! ch, ch)); ! return(ch); } *************** *** 149,152 ! CursorLeft(len); /* back up to the beginning of line */ ! CleartoEOLN(); } --- 139,157 ----- ! if (clear_pages && lines_put_on_screen == 0) { /* not for <ret> */ ! ClearScreen(); ! if (title_messages && filter) { ! title_for_page(++pages_displayed); ! display_line("\n"); /* blank line for fun */ ! } ! if (strlen(line_before_that) > 0) { ! display_line(line_before_that); ! display_line(last_line); ! } ! else if (strlen(last_line) > 0) ! display_line(last_line); ! } ! else { ! CursorLeft(len); /* back up to the beginning of line */ ! CleartoEOLN(); ! } } *************** *** 152,153 } --- 157,162 ----- } + else if (lines_needed + lines_put_on_screen > LINES-5) { + strcpy(line_before_that, last_line); + strcpy(last_line, line); + } *************** *** 159,160 return (FALSE); } --- 168,204 ----- return (FALSE); + } + + title_for_page(page) + int page; + { + /** output a nice title for the second thru last pages of the message + we're currently reading... **/ + + char *p, title[SLEN], title2[SLEN], from_buffer[50], from_buffer2[50]; + register int padding, sl, mail_sent; + + strncpy(from_buffer, header_table[current-1].from, 50); + + tail_of(from_buffer, from_buffer2, TRUE); + + mail_sent = (strncmp(header_table[current-1].from, "To:", 3) == 0); + + sprintf(title, "%s #%d %s %s", + header_table[current-1].status&FORM_LETTER ? "Form" : "Message", + current, + mail_sent? "to" : "from", from_buffer2); + + padding = COLUMNS - (sl = strlen(title)) - + (page < 10 ? 7 : page < 100 ? 8 : 9); + + p = title + sl; + while (padding-- > 0) + *p++ = ' '; + *p = '\0'; + + sprintf(title2, " Page %d\n", page); + + strcat(title, title2); + + display_line(title); } Index: src/getopt.c *************** *** 17,19 char *optional_arg; /* optional argument as we go */ ! int opt_index; /* argnum + 1 when we leave */ --- 17,19 ----- char *optional_arg; /* optional argument as we go */ ! int opt_index = 0; /* argnum + 1 when we leave */ Index: src/Makefile.mstr *************** *** 9,11 ! DEFINE= >os-define< LIB2 = >lib2< --- 9,11 ----- ! DEFINE= -DDEBUG >os-define< LIB2 = >lib2< *************** *** 28,30 softkeys.c sort.c string2.c strings.c syscall.c utils.c \ ! save_opts.c validname.c --- 28,30 ----- softkeys.c sort.c string2.c strings.c syscall.c utils.c \ ! save_opts.c validname.c showmsg_cmd.c *************** *** 41,43 softkeys.o sort.o string2.o strings.o syscall.o utils.o \ ! save_opts.o validname.o --- 41,43 ----- softkeys.o sort.o string2.o strings.o syscall.o utils.o \ ! save_opts.o validname.o showmsg_cmd.o Index: src/editmsg.c *************** *** 52,58 if ((stat = system_call(buffer, SH)) != 0) { ! dprint1(1,"System call failed with stat %d (edit_the_message)\n", ! stat); ! error1("Can't invoke editor '%s' for composition", editor); ! dprint2(1,"** %s - %s **\n", error_name(errno), ! error_description(errno)); ClearLine(LINES-1); --- 52,58 ----- if ((stat = system_call(buffer, SH)) != 0) { ! dprint(1,(debugfile, ! "System call failed with stat %d (edit_the_message)\n", ! stat)); ! dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), ! error_description(errno))); ClearLine(LINES-1); *************** *** 58,59 ClearLine(LINES-1); sleep(2); --- 58,60 ----- ClearLine(LINES-1); + error1("Can't invoke editor '%s' for composition", editor); sleep(2); *************** *** 102,106 sleep (2); ! dprint1(1,"Error encountered trying to open file %s;\n", filename); ! dprint2(1,"** %s - %s **\n", error_name(errno), ! error_description(errno)); Raw(ON); --- 103,108 ----- sleep (2); ! dprint(1, (debugfile, ! "Error encountered trying to open file %s;\n", filename)); ! dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), ! error_description(errno))); Raw(ON); *************** *** 112,114 printf( ! "\nPlease enter message, ^D to end, or ~? <RETURN> for help;\n\n"); --- 114,117 ----- printf( ! "\nPlease enter message, ^D to end, or %c? <RETURN> for help;\n\n", ! escape_char); *************** *** 119,121 ! more_input: --- 122,124 ----- ! raw_input : Raw(ON); *************** *** 121,123 ! while (gets(buffer) != NULL) { --- 124,126 ----- ! more_input: buffer[0] = '\0'; *************** *** 123,124 if (setjmp(edit_location) != 0) { --- 126,129 ----- + while (optionally_enter(buffer, -1,-1, FALSE) == 0) { + if (setjmp(edit_location) != 0) { *************** *** 141,143 break; /* '.' is as good as a ^D to us dumb programs :-) */ ! if (buffer[0] == TILDE) switch (tolower(buffer[1])) { --- 146,149 ----- break; /* '.' is as good as a ^D to us dumb programs :-) */ ! if (buffer[0] == escape_char) { ! Raw(OFF); switch (tolower(buffer[1])) { *************** *** 143,146 switch (tolower(buffer[1])) { ! case '?' : tilde_help(); printf("(continue)\n"); goto more_input; ! case '~' : move_left(buffer, 1); goto tilde_input; /*!!*/ --- 149,151 ----- switch (tolower(buffer[1])) { ! case '?' : tilde_help(); printf("(continue)\n"); goto raw_input; *************** *** 146,148 ! case 't' : get_with_expansion("To: ", to, expanded_to); break; #ifdef ALLOW_BCC --- 151,157 ----- ! case TILDE: move_left(buffer, 1); ! Raw(ON); goto tilde_input; /*!!*/ ! ! case 't' : get_with_expansion("\nTo: ", to, expanded_to, buffer); ! goto raw_input; #ifdef ALLOW_BCC *************** *** 148,150 #ifdef ALLOW_BCC ! case 'b' : get_with_expansion("Bcc: ", bcc,expanded_bcc); break; #endif --- 157,160 ----- #ifdef ALLOW_BCC ! case 'b' : get_with_expansion("\nBcc: ",bcc,expanded_bcc, buffer); ! goto raw_input; #endif *************** *** 150,153 #endif ! case 'c' : get_with_expansion("Cc: ", cc, expanded_cc); break; ! case 's' : get_with_expansion("Subject: ", subject,NULL); break; --- 160,165 ----- #endif ! case 'c' : get_with_expansion("\nCc: ", cc, expanded_cc, buffer); ! goto raw_input; ! case 's' : get_with_expansion("\nSubject: ", subject,NULL,buffer); ! goto raw_input; *************** *** 153,156 ! case 'h' : get_with_expansion("To: ", to, expanded_to); ! get_with_expansion("Cc: ", cc, expanded_cc); #ifdef ALLOW_BCC --- 165,168 ----- ! case 'h' : get_with_expansion("\nTo: ", to, expanded_to, NULL); ! get_with_expansion("Cc: ", cc, expanded_cc, NULL); #ifdef ALLOW_BCC *************** *** 156,158 #ifdef ALLOW_BCC ! get_with_expansion("Bcc: ", bcc,expanded_bcc); #endif --- 168,170 ----- #ifdef ALLOW_BCC ! get_with_expansion("Bcc: ", bcc,expanded_bcc, NULL); #endif *************** *** 158,160 #endif ! get_with_expansion("Subject: ", subject,NULL); break; --- 170,173 ----- #endif ! get_with_expansion("Subject: ", subject,NULL, NULL); ! goto raw_input; *************** *** 161,163 case 'r' : read_in_file(edit_fd, (char *) buffer + 2); ! goto more_input; case 'e' : if (strlen(emacs_editor) > 0) --- 174,176 ----- case 'r' : read_in_file(edit_fd, (char *) buffer + 2); ! goto raw_input; case 'e' : if (strlen(emacs_editor) > 0) *************** *** 168,170 (void) edit_the_message(filename,0); - Raw(OFF); strcpy(editor, buffer); --- 181,182 ----- (void) edit_the_message(filename,0); strcpy(editor, buffer); *************** *** 171,174 edit_fd = fopen(filename, "a"); ! printf("(continue entering message, ^D to end)\n"); ! goto more_input; } --- 183,186 ----- edit_fd = fopen(filename, "a"); ! printf("(continue entering message, ^D to end)\n"); ! goto raw_input; } *************** *** 176,178 printf( ! "(Can't find Emacs on this system! continue)\n"); else --- 188,190 ----- printf( ! "\n(Can't find Emacs on this system! continue)\n"); else *************** *** 179,182 printf( ! "(Don't know where Emacs would be...continue)\n"); ! goto more_input; --- 191,194 ----- printf( ! "\n(Don't know where Emacs would be...continue)\n"); ! goto raw_input; *************** *** 186,188 (void) edit_the_message(filename,0); - Raw(OFF); strcpy(editor, buffer); --- 198,199 ----- (void) edit_the_message(filename,0); strcpy(editor, buffer); *************** *** 190,192 printf("(continue entering message, ^D to end)\n"); ! goto more_input; --- 201,203 ----- printf("(continue entering message, ^D to end)\n"); ! goto raw_input; *************** *** 192,195 ! case 'o' : printf("Please enter the name of the editor : "); ! gets(editor_name); if (strlen(editor_name) > 0) { --- 203,207 ----- ! case 'o' : printf("\nPlease enter the name of the editor : "); ! editor_name[0] = '\0'; ! optionally_enter(editor_name,-1,-1, FALSE); if (strlen(editor_name) > 0) { *************** *** 199,201 (void) edit_the_message(filename,0); - Raw(OFF); strcpy(editor, buffer); --- 211,212 ----- (void) edit_the_message(filename,0); strcpy(editor, buffer); *************** *** 202,205 edit_fd = fopen(filename, "a"); ! printf("(continue entering message, ^D to end)\n"); ! goto more_input; } --- 213,216 ----- edit_fd = fopen(filename, "a"); ! printf("(continue entering message, ^D to end)\n"); ! goto raw_input; } *************** *** 206,209 printf("(continue)\n"); ! goto more_input; ! case '!' : if (strlen(buffer) < 3) (void) system_call(shell, USER_SHELL); --- 217,222 ----- printf("(continue)\n"); ! goto raw_input; ! ! case '!' : putchar('\n'); ! if (strlen(buffer) < 3) (void) system_call(shell, USER_SHELL); *************** *** 212,214 printf("(continue)\n"); ! goto more_input; case 'm' : /* same as 'f' but with leading prefix added */ --- 225,228 ----- printf("(continue)\n"); ! goto raw_input; ! case 'm' : /* same as 'f' but with leading prefix added */ *************** *** 214,215 case 'm' : /* same as 'f' but with leading prefix added */ case 'f' : /* this can be directly translated into a --- 228,230 ----- case 'm' : /* same as 'f' but with leading prefix added */ + case 'f' : /* this can be directly translated into a *************** *** 216,217 'readmsg' call with the same params! */ read_in_messages(edit_fd, (char *) buffer + 1); --- 231,233 ----- 'readmsg' call with the same params! */ + putchar('\n'); read_in_messages(edit_fd, (char *) buffer + 1); *************** *** 217,219 read_in_messages(edit_fd, (char *) buffer + 1); ! goto more_input; case 'p' : /* print out message so far. Soooo simple! */ --- 233,236 ----- read_in_messages(edit_fd, (char *) buffer + 1); ! goto raw_input; ! case 'p' : /* print out message so far. Soooo simple! */ *************** *** 220,222 print_message_so_far(edit_fd, filename); ! goto more_input; default : printf( --- 237,240 ----- print_message_so_far(edit_fd, filename); ! goto raw_input; ! default : printf( *************** *** 222,225 default : printf( ! "(don't know what ~%c is. Try ~? for help)\n", ! buffer[1]); } --- 240,243 ----- default : printf( ! "\n(don't know what %c%c is. Try %c? for help)\n", ! escape_char, buffer[1], escape_char); } *************** *** 225,227 } ! else tilde_input: --- 243,246 ----- } ! } ! else { tilde_input: *************** *** 228,230 fprintf(edit_fd, "%s\n", buffer); ! }; --- 247,252 ----- fprintf(edit_fd, "%s\n", buffer); ! printf("\r\n"); ! } ! buffer[0] = '\0'; ! } *************** *** 230,232 ! printf("<end-of-message>\n\n"); --- 252,254 ----- ! printf("\n<end-of-message>\n\r\n\r"); *************** *** 247,253 ! printf( ! "(Available 'tilde' commands at this point are;\n\ ! \n\ ! \t~?\tPrint this help menu\n\ ! \t~~\tAdd line prefixed by a single '~' character\n"); --- 269,271 ----- ! Raw(OFF); *************** *** 253,254 #ifdef ALLOW_BCC --- 271,278 ----- + printf("\n(Available meta-commands at this point are;\n\n"); + printf("\t%c?\tPrint this help menu\n", escape_char); + if (escape_char == TILDE) + printf("\t~~\tAdd line prefixed by a single '~' character\n"); + /* doesn't make sense otherwise... */ + #ifdef ALLOW_BCC *************** *** 255,257 printf("\ ! \t~b\tChange the addresses in the Blind-carbon-copy list\n"); #endif --- 279,281 ----- printf("\ ! \t%cb\tChange the addresses in the Blind-carbon-copy list\n", escape_char); #endif *************** *** 258,263 ! printf("\ ! \t~c\tChange the addresses in the Carbon-copy list\n\ ! \t~e\tInvoke the Emacs editor on the message, if possible\n\ ! \t~f\tadd the specified list of messages, or current\n"); #ifdef ALLOW_BCC --- 282,291 ----- ! printf("\t%cc\tChange the addresses in the Carbon-copy list\n", ! escape_char); ! printf("\t%ce\tInvoke the Emacs editor on the message, if possible\n", ! escape_char); ! printf("\t%cf\tadd the specified list of messages, or current\n", ! escape_char); ! printf("\t%ch\tchange all available headers (to,cc%s,subject)\n", ! escape_char, #ifdef ALLOW_BCC *************** *** 263,265 #ifdef ALLOW_BCC ! printf("\t~h\tchange all available headers (to,cc,bcc,subject)\n"); #endif --- 291,295 ----- #ifdef ALLOW_BCC ! ",bcc"); ! #else ! ""); #endif *************** *** 265,276 #endif ! printf("\ ! \t~m\tsame as '~f', but with the current 'prefix'\n\ ! \t~o\tInvoke a user specified editor on the message\n\ ! \t~p\tprint out message as typed in so far\n\ ! \t~r\tRead in the specified file\n\ ! \t~s\tChange the subject of the message\n\ ! \t~t\tChange the addresses in the To list\n\ ! \t~v\tInvoke the Vi visual editor on the message\n\ ! \t~!\texecute a unix command (or give a shell if no command)\n\ ! \n"); --- 295,310 ----- #endif ! printf("\t%cm\tsame as '%cf', but with the current 'prefix'\n", ! escape_char, escape_char); ! printf("\t%co\tInvoke a user specified editor on the message\n", ! escape_char); ! printf("\t%cp\tprint out message as typed in so far\n", escape_char); ! printf("\t%cr\tRead in the specified file\n", escape_char); ! printf("\t%cs\tChange the subject of the message\n", escape_char); ! printf("\t%ct\tChange the addresses in the To list\n", ! escape_char); ! printf("\t%cv\tInvoke the Vi visual editor on the message\n", ! escape_char); ! printf( ! "\t%c!\texecute a unix command (or give a shell if no command)\n\n", ! escape_char); *************** *** 276,277 } --- 310,312 ----- + Raw(ON); } *************** *** 295,297 if (strlen(myfname) == 0) { ! printf("(no filename specified for file read! Continue...)\n"); return; --- 330,332 ----- if (strlen(myfname) == 0) { ! printf("\n(no filename specified for file read! Continue...)\n"); return; *************** *** 300,302 if ((myfd = fopen(myfname,"r")) == NULL) { ! printf("(Couldn't open file '%s' for reading! Continue...)\n", myfname); --- 335,337 ----- if ((myfd = fopen(myfname,"r")) == NULL) { ! printf("\n(Couldn't open file '%s' for reading! Continue...)\n", myfname); *************** *** 315,317 ! printf("(added %d line%s from file %s. Please continue...)\n", lines, plural(lines), myfname); --- 350,352 ----- ! printf("\n(added %d line%s from file %s. Please continue...)\n", lines, plural(lines), myfname); *************** *** 343,345 ! printf("To: %s\n", format_long(to, 4)); printf("Cc: %s\n", format_long(cc, 4)); --- 378,380 ----- ! printf("\nTo: %s\n", format_long(to, 4)); printf("Cc: %s\n", format_long(cc, 4)); *************** *** 361,363 ! printf("(continue entering message, please)\n\n"); } --- 396,398 ----- ! printf("\n(continue entering message, please)\n"); } *************** *** 405,408 ! get_with_expansion(prompt, buffer, expanded_buffer) ! char *prompt, *buffer, *expanded_buffer; { --- 440,443 ----- ! get_with_expansion(prompt, buffer, expanded_buffer, sourcebuf) ! char *prompt, *buffer, *expanded_buffer, *sourcebuf; { *************** *** 410,412 If expanded_buffer == NULL then we won't bother trying to expand ! this puppy out! **/ --- 445,447 ----- If expanded_buffer == NULL then we won't bother trying to expand ! this puppy out! (sourcebuf could be an initial addition) **/ *************** *** 415,416 printf(prompt); fflush(stdout); /* output! */ --- 450,453 ----- + Raw(ON); + printf(prompt); fflush(stdout); /* output! */ *************** *** 417,418 strcpy(mybuffer, buffer); --- 454,468 ----- + if (sourcebuf != NULL) { + while (!whitespace(*sourcebuf) && *sourcebuf != '\0') + sourcebuf++; + if (*sourcebuf != '\0') { + while (whitespace(*sourcebuf)) + sourcebuf++; + if (strlen(sourcebuf) > 0) { + strcat(buffer, " "); + strcat(buffer, sourcebuf); + } + } + } + strcpy(mybuffer, buffer); *************** *** 419,421 - Raw(ON); optionally_enter(buffer, -1, -1, TRUE); /* already data! */ --- 469,470 ----- optionally_enter(buffer, -1, -1, TRUE); /* already data! */ *************** *** 421,423 optionally_enter(buffer, -1, -1, TRUE); /* already data! */ - Raw(OFF); putchar('\n'); --- 470,471 ----- optionally_enter(buffer, -1, -1, TRUE); /* already data! */ putchar('\n'); *************** *** 424,425 if (strcmp(buffer, mybuffer) != 0 && expanded_buffer != NULL) --- 472,475 ----- + /** if it's changed and we're supposed to expand addresses... **/ + if (strcmp(buffer, mybuffer) != 0 && expanded_buffer != NULL) *************** *** 427,428 return; --- 477,479 ----- + Raw(OFF); return; Index: src/limit.c *************** *** 32,34 BACKSPACE); ! ReadCh(criteria[0]); if (tolower(criteria[0]) == 'y') --- 32,34 ----- BACKSPACE); ! criteria[0] = ReadCh(); if (tolower(criteria[0]) == 'y') *************** *** 99,102 ! dprint3(2,"\n\n\n**limit on %d - '%s' - (%s) **\n\n", ! based_on, pattern, additional_criteria?"add'tl":"base"); --- 99,102 ----- ! dprint(2, (debugfile, "\n\n\n**limit on %d - '%s' - (%s) **\n\n", ! based_on, pattern, additional_criteria?"add'tl":"base")); *************** *** 112,114 count++; ! dprint3(5," Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, --- 112,115 ----- count++; ! dprint(5, (debugfile, ! " Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, *************** *** 114,116 index, header_table[index].subject, ! header_table[index].from); } --- 115,117 ----- index, header_table[index].subject, ! header_table[index].from)); } *************** *** 127,129 count++; ! dprint3(5," Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, --- 128,131 ----- count++; ! dprint(5, (debugfile, ! " Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, *************** *** 129,131 index, header_table[index].subject, ! header_table[index].from); } --- 131,133 ----- index, header_table[index].subject, ! header_table[index].from)); } *************** *** 142,144 count++; ! dprint3(5," Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, --- 144,147 ----- count++; ! dprint(5, (debugfile, ! " Message %d (%s from %s) marked as visible\n", index, header_table[index].subject, *************** *** 144,146 index, header_table[index].subject, ! header_table[index].from); } --- 147,149 ----- index, header_table[index].subject, ! header_table[index].from)); } *************** *** 148,150 ! dprint1(4,"\n** returning %d selected **\n\n\n", count); --- 151,153 ----- ! dprint(4, (debugfile, "\n** returning %d selected **\n\n\n", count)); *************** *** 160,162 **/ - int remember_for_debug; --- 163,164 ----- **/ *************** *** 162,163 remember_for_debug = index; --- 164,166 ----- + register int remember_for_debug; remember_for_debug = index; *************** *** 169,172 if (header_table[index].status & VISIBLE) { ! dprint2(9,"[Next visible: given %d returning %d]\n", ! remember_for_debug, index+1); return(index+1); --- 172,175 ----- if (header_table[index].status & VISIBLE) { ! dprint(9, (debugfile, "[Next visible: given %d returning %d]\n", ! remember_for_debug, index+1)); return(index+1); *************** *** 184,187 /** Just like 'next-visible', but backwards FIRST... */ - - int remember_for_debug; --- 187,188 ----- /** Just like 'next-visible', but backwards FIRST... */ *************** *** 187,188 remember_for_debug = index; --- 188,190 ----- + register int remember_for_debug; remember_for_debug = index; *************** *** 193,196 if (header_table[index].status & VISIBLE) { ! dprint2(9,"[previous visible: given %d returning %d]", ! remember_for_debug, index+1); return(index+1); --- 195,198 ----- if (header_table[index].status & VISIBLE) { ! dprint(9, (debugfile, "[previous visible: given %d returning %d]", ! remember_for_debug, index+1)); return(index+1); *************** *** 223,226 ! dprint2(4, "[compute-visible: displayed message %d is actually %d]\n", ! count, message); --- 225,229 ----- ! dprint(4, (debugfile, ! "[compute-visible: displayed message %d is actually %d]\n", ! count, message)); *************** *** 244,247 if (count == message) { ! dprint2(4,"visible-to-index: (up) index %d is displayed as %d\n", ! message, index); return(index); --- 247,251 ----- if (count == message) { ! dprint(4, (debugfile, ! "visible-to-index: (up) index %d is displayed as %d\n", ! message, index)); return(index); *************** *** 250,252 ! dprint1(4, "index %d is NOT displayed!\n", message); --- 254,256 ----- ! dprint(4, (debugfile, "index %d is NOT displayed!\n", message)); Index: src/save_opts.c *************** *** 20,22 ! char *error_name(), *nameof(), *sort_name(); long ftell(); --- 20,22 ----- ! char *error_name(), *sort_name(); long ftell(); *************** *** 102,104 save_option_string(FULLNAME, full_username, newelmrc, FALSE); ! save_option_string(MAILBOX, nameof(mailbox), newelmrc, FALSE); save_option_string(MAILDIR, folders, newelmrc, FALSE); --- 102,104 ----- save_option_string(FULLNAME, full_username, newelmrc, FALSE); ! save_option_string(MAILBOX, mailbox, newelmrc, FALSE); save_option_string(MAILDIR, folders, newelmrc, FALSE); *************** *** 113,115 ! save_option_sort(SORTBY, sortby, newelmrc); --- 113,115 ----- ! save_option_sort(SORTBY, newelmrc); *************** *** 118,119 save_option_on_off(ARROW, arrow_cursor, newelmrc); save_option_on_off(AUTOCOPY, auto_copy, newelmrc); --- 118,120 ----- save_option_on_off(ARROW, arrow_cursor, newelmrc); + save_option_on_off(ASK, question_me, newelmrc); save_option_on_off(AUTOCOPY, auto_copy, newelmrc); *************** *** 135,137 ! save_option_number(TIMEOUT, timeout, newelmrc); --- 136,138 ----- ! save_option_number(TIMEOUT, (int) timeout, newelmrc); *************** *** 144,146 ! save_option_weedlist(WEEDOUT, weedlist, newelmrc); save_option_alternatives(ALTERNATIVES, alternative_addresses, newelmrc); --- 145,147 ----- ! save_option_weedlist(WEEDOUT, newelmrc); save_option_alternatives(ALTERNATIVES, alternative_addresses, newelmrc); *************** *** 176,178 ! save_option_sort(index, value, fd) int index; --- 177,179 ----- ! save_option_sort(index, fd) int index; *************** *** 178,180 int index; - char *value; FILE *fd; --- 179,180 ----- int index; FILE *fd; *************** *** 211,213 ! save_option_weedlist(index, list, fd) int index; --- 211,213 ----- ! save_option_weedlist(index, fd) int index; *************** *** 213,215 int index; - char *list[]; FILE *fd; --- 213,214 ----- int index; FILE *fd; *************** *** 232,233 while (i < weedcount) { --- 231,235 ----- + while (strcmp(weedlist[i], "*end-of-defaults*") == 0) + i++; /* and get PAST it too! */ + while (i < weedcount) { *************** *** 286,289 if (fseek(elminfo, save_info[index].offset, 0)) { ! dprint2(1,"** error %s seeking to %ld in elm-info file!\n", ! error_name(errno), save_info[index].offset); } --- 288,292 ----- if (fseek(elminfo, save_info[index].offset, 0)) { ! dprint(1,(debugfile, ! "** error %s seeking to %ld in elm-info file!\n", ! error_name(errno), save_info[index].offset)); } *************** *** 314,317 if (find_and_store_loc(line_buffer, ftell(elminfo_fd))) { ! dprint1(1, "** Couldn't find and store \"%s\" **\n", ! line_buffer); } --- 317,320 ----- if (find_and_store_loc(line_buffer, ftell(elminfo_fd))) { ! dprint(1, (debugfile,"** Couldn't find and store \"%s\" **\n", ! line_buffer)); } Index: hdrs/defs.h *************** *** 8,10 ! #define VERSION "1.5" /* Version number! WHAT_STRING should agree */ --- 8,10 ----- ! #define VERSION "1.5b" /* Version number! WHAT_STRING should agree */ *************** *** 10,12 ! #define WHAT_STRING "@(#) Version 1.5, January, 1987" --- 10,12 ----- ! #define WHAT_STRING "@(#) Version 1.5b, April 1987" *************** *** 22,23 #define VERY_LONG_STRING 2500 /* huge string for group alias expansion */ --- 22,24 ----- #define VERY_LONG_STRING 2500 /* huge string for group alias expansion */ + #define MAX_LINE_LEN 5120 /* even bigger string for "filter" prog.. */ *************** *** 80,81 #define DONT_SAVE "[no save]" --- 81,83 ----- #define DONT_SAVE "[no save]" + #define DONT_SAVE2 "[nosave]" *************** *** 127,129 #define lastch(s) s[strlen(s)-1] ! #define no_ret(s) if (lastch(s) == '\n') lastch(s) = '\0' #define first_word(s,w) (strncmp(s,w, strlen(w)) == 0) --- 129,137 ----- #define lastch(s) s[strlen(s)-1] ! ! #define no_ret(s) { register int xyz; /* varname is for lint */ \ ! for (xyz=strlen(s)-1; s[xyz] == '\r' || \ ! s[xyz] == '\n'; ) \ ! s[xyz--] = '\0'; \ ! } ! #define first_word(s,w) (strncmp(s,w, strlen(w)) == 0) *************** *** 177,178 #define STATUS 6 /* the status (deleted, etc) */ --- 185,187 ----- #define STATUS 6 /* the status (deleted, etc) */ + #define MAILBOX_ORDER 7 /* the order it is in the file */ *************** *** 183,185 ! /* wouldn't it be nice to have variable argument macros... */ --- 192,194 ----- ! /** the following macro is as suggested by Larry McVoy. Thanks! **/ *************** *** 185,188 ! #define dprint0(n,s) if (debug >= n) { \ ! fprintf(debugfile, s); fflush(debugfile); } --- 194,205 ----- ! # ifdef DEBUG ! # define dprint(n,x) { \ ! if (debug >= n) { \ ! fprintf x ; \ ! fflush(debugfile); \ ! } \ ! } ! # else ! # define dprint(n,x) ! # endif *************** *** 188,209 - #define dprint1(n,s,a) if (debug >= n) { \ - fprintf(debugfile, s, a); fflush(debugfile); } - - #define dprint2(n,s,a,b) if (debug >= n) { \ - fprintf(debugfile, s, a, b); fflush(debugfile);} - - #define dprint3(n,s,a,b,c) if (debug >= n) { fprintf(debugfile, \ - s, a, b, c); fflush(debugfile); } - - #define dprint4(n,s,a,b,c,d) if (debug >= n) { fprintf(debugfile, \ - s, a, b, c, d); fflush(debugfile); } - - #define dprint5(n,s,a,b,c,d,e) if (debug >= n) { fprintf(debugfile, \ - s, a, b, c, d, e); fflush(debugfile); } - - #define dprint6(n,s,a,b,c,d,e,f) if (debug >= n) { fprintf(debugfile, \ - s, a, b, c, d, e, f); fflush(debugfile); } - - /* I guess this corrects it, though. Wretched stuff though! */ - /* some random records... */ --- 205,206 ----- /* some random records... */ *************** *** 252,252 #endif --- 249,290 ----- #endif + + /** Let's make sure that we're not going to have any annoying problems with + int pointer sizes versus char pointer sizes by guaranteeing that every- + thing vital is predefined... (Thanks go to Detlev Droege for this one) + **/ + + #include <string.h> + + char *argv_zero(); + char *bounce_off_remote(); + char *ctime(); + char *error_description(); + char *error_name(); + char *error_number(); + char *expand_address(); + char *expand_domain(); + char *expand_group(); + char *expand_logname(); + char *expand_system(); + char *find_path_to(); + char *format_long(); + char *get_alias_address(); + char *get_arpa_date(); + char *get_ctime_date(); + char *get_date(); + char *get_token(); + char *getenv(); + char *getlogin(); + char *level_name(); + char *match_and_expand_domain(); + char *shift_lower(); + char *strip_commas(); + char *strip_parens(); + char *strpbrk(); + char *strtok(); + char *tail_of_string(); + char *tgetstr(); + + long lseek(); + long times(); + long ulimit(); Index: hdrs/headers.h *************** *** 39,40 extern char backspace, /* the current backspace char */ kill_line; /* the current kill_line char */ --- 39,41 ----- extern char backspace, /* the current backspace char */ + escape_char, /* '~' or something else... */ kill_line; /* the current kill_line char */ *************** *** 87,92 extern int keep_empty_files; /* flag: keep empty files?? */ ! ! #ifdef UTS ! extern int isatube; /* flag: are we on an IBM 3270 tube? */ ! #endif --- 88,90 ----- extern int keep_empty_files; /* flag: keep empty files?? */ ! extern int clear_pages; /* flag: clear screen w/ builtin pgr? */ End of Pf Pfaceaceaf