From wugate!wucs1!uunet!cbmvax!vu-vlsi!dsinc!syd Mon May 1 12:04:25 CDT 1989 Article 646 of comp.mail.elm: Path: wubios!wugate!wucs1!uunet!cbmvax!vu-vlsi!dsinc!syd >From: syd@dsinc.DSI.COM (Syd Weinstein) Newsgroups: comp.sources.bugs,comp.mail.elm Subject: elm 2.2 Patch #4 Keywords: elm patch Message-ID: <117@dsinc.DSI.COM> Date: 26 Apr 89 20:51:05 GMT Followup-To: comp.mail.elm Organization: Datacomp Systems, Inc., Huntingdon Valley, PA Lines: 873 Xref: wubios comp.sources.bugs:22 comp.mail.elm:646 Summary: This is an official patch for elm 2.2 system. Please apply it. Priority: Medium Fix the pattern-matching feature of ~f/~m in the builtin editor and fix the documentation for the builtin editor in the Reference Guide. >From: Rob Bernardo This fixes bug EB13, whereby if there was a Status: header for a message, elm would lose track of status information (such as Priority:), because a variable was reset with the Status info, rather than just or'ed with it. >From: Rob Bernardo This patch corrects some duplicate, unnecessary and conflicting declarations of some curses functions, which show up when compiling with gcc. These corrections were pointed out by Steve Simmons. >From: Rob Bernardo Fixed not having newmail print the "sender's" id/address >From bpa!att!hocpa!rusty Tue Apr 25 15:59:42 1989 One variable was used in place of another >From: Rob Bernardo This enables elm to properly expand ~/[path] and ~logname/[path]; formerly "~" and "~/" were both expanded as the current user's home directory. Also fixes a bug in the expansion of environmental variables in user-entered paths. >From: Rob Bernardo Fix: From rn, say "| patch -p -N -d DIR", where DIR is your elm source directory. Outside of rn, say "cd DIR; patch -p -N + \" \" Revision 2.23 89/03/31 11:19:34 syd \" Release 2.2 checkin \" *************** *** 1353,1371 **** Invoke the Emacs editor on the message, if possible. .lp \h'16p'~f .5i ! add the specified list of messages, or current. .lp \h'16p'~h .5i ! Change all the available headers (To, Cc, Bcc, and Subject) .lp \h'16p'~m .5i ! same as `~f', but with the current `prefix'. .lp \h'16p'~o .5i Invoke a user specified editor on the message. .lp \h'16p'~p .5i ! print out the message as typed in so far. .lp \h'16p'~r .5i Include (read in) the contents of the specified file. --- 1358,1376 ---- Invoke the Emacs editor on the message, if possible. .lp \h'16p'~f .5i ! Add the specified message or current message. .lp \h'16p'~h .5i ! Change all the available headers (To, Cc, Bcc, and Subject). .lp \h'16p'~m .5i ! Same as `~f', but with the current `prefix'. .lp \h'16p'~o .5i Invoke a user specified editor on the message. .lp \h'16p'~p .5i ! Print out the message as typed in so far. .lp \h'16p'~r .5i Include (read in) the contents of the specified file. *************** *** 1380,1392 **** Invoke the Vi visual editor on the message. .lp \h'16p'~< .5i ! execute the specified unix command, entering the output of the command into the editor buffer upon completion. ! (for example ``~< who'' will include the output of ! the \f2who\f1 command in your message) .lp \h'16p'~! .5i ! execute a unix command if one is given (as in ``~!ls'') or give the user a shell (either from their shell setting in their \f2.elm/elmrc\f1 file or the default). --- 1385,1397 ---- Invoke the Vi visual editor on the message. .lp \h'16p'~< .5i ! Execute the specified unix command, entering the output of the command into the editor buffer upon completion. ! (For example ``~< who'' will include the output of ! the \f2who\f1 command in your message.) .lp \h'16p'~! .5i ! Execute a unix command if one is given (as in ``~!ls'') or give the user a shell (either from their shell setting in their \f2.elm/elmrc\f1 file or the default). Index: hdrs/curses.h Prereq: 2.4 *** ../elm2.2/hdrs/curses.h Thu Mar 30 10:34:24 1989 --- hdrs/curses.h Wed Apr 26 11:43:03 1989 *************** *** 1,8 **** ! /* $Id: curses.h,v 2.4 89/03/25 21:45:22 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 2.4 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! /* $Id: curses.h,v 2.5 89/04/26 11:43:02 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 2.5 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,25 ---- * ******************************************************************************* * $Log: curses.h,v $ + * Revision 2.5 89/04/26 11:43:02 syd + * This patch corrects some duplicate, unnecessary and conflicting declarations + * of some curses functions, which show up when compiling with gcc. + * These corrections were pointed out by Steve Simmons. + * From: Rob Bernardo + * * Revision 2.4 89/03/25 21:45:22 syd * Initial 2.2 Release checkin * *************** *** 30,37 **** ClearScreen(), CleartoEOLN(), MoveCursor(), - CursorUp(), CursorDown(), - CursorLeft(), CursorRight(), StartBold(), EndBold(), StartUnderline(), EndUnderline(), --- 36,41 ---- Index: src/curses.c Prereq: 2.17 *** ../elm2.2/src/curses.c Mon Apr 24 21:25:17 1989 --- src/curses.c Wed Apr 26 11:43:06 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: curses.c,v 2.17 89/04/24 21:18:29 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.17 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: curses.c,v 2.18 89/04/26 11:43:03 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.18 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,25 ---- * ******************************************************************************* * $Log: curses.c,v $ + * Revision 2.18 89/04/26 11:43:03 syd + * This patch corrects some duplicate, unnecessary and conflicting declarations + * of some curses functions, which show up when compiling with gcc. + * These corrections were pointed out by Steve Simmons. + * From: Rob Bernardo + * * Revision 2.17 89/04/24 21:18:29 syd * This fixes a number of bugs with the builtin editor. (1) It used to use * stdio functions and not curses functions to write to the screen causing *************** *** 293,298 **** --- 299,371 ---- } static + CursorUp(n) + int n; + { + /** move the cursor up 'n' lines **/ + /** Calling function must check that _up is not null before calling **/ + + _line = (_line-n > 0? _line - n: 0); /* up 'n' lines... */ + + while (n-- > 0) + tputs(_up, 1, outchar); + + fflush(stdout); + return(0); + } + + + static + CursorDown(n) + int n; + { + /** move the cursor down 'n' lines **/ + /** Caller must check that _down is not null before calling **/ + + _line = (_line+n < LINES? _line + n: LINES); /* down 'n' lines... */ + + while (n-- > 0) + tputs(_down, 1, outchar); + + fflush(stdout); + return(0); + } + + + static + CursorLeft(n) + int n; + { + /** move the cursor 'n' characters to the left **/ + /** Caller must check that _left is not null before calling **/ + + _col = (_col - n> 0? _col - n: 0); /* left 'n' chars... */ + + while (n-- > 0) + tputs(_left, 1, outchar); + + fflush(stdout); + return(0); + } + + + static + CursorRight(n) + int n; + { + /** move the cursor 'n' characters to the right (nondestructive) **/ + /** Caller must check that _right is not null before calling **/ + + _col = (_col+n < COLUMNS? _col + n: COLUMNS); /* right 'n' chars... */ + + while (n-- > 0) + tputs(_right, 1, outchar); + + fflush(stdout); + return(0); + } + + static moveabsolute(col, row) { *************** *** 385,458 **** Writechar('\n'); Writechar('\r'); } - - static - CursorUp(n) - int n; - { - /** move the cursor up 'n' lines **/ - /** Calling function must check that _up is not null before calling **/ - - _line = (_line-n > 0? _line - n: 0); /* up 'n' lines... */ - - while (n-- > 0) - tputs(_up, 1, outchar); - - fflush(stdout); - return(0); - } - - - static - CursorDown(n) - int n; - { - /** move the cursor down 'n' lines **/ - /** Caller must check that _down is not null before calling **/ - - _line = (_line+n < LINES? _line + n: LINES); /* down 'n' lines... */ - - while (n-- > 0) - tputs(_down, 1, outchar); - - fflush(stdout); - return(0); - } - - - static - CursorLeft(n) - int n; - { - /** move the cursor 'n' characters to the left **/ - /** Caller must check that _left is not null before calling **/ - - _col = (_col - n> 0? _col - n: 0); /* left 'n' chars... */ - - while (n-- > 0) - tputs(_left, 1, outchar); - - fflush(stdout); - return(0); - } - - - static - CursorRight(n) - int n; - { - /** move the cursor 'n' characters to the right (nondestructive) **/ - /** Caller must check that _right is not null before calling **/ - - _col = (_col+n < COLUMNS? _col + n: COLUMNS); /* right 'n' chars... */ - - while (n-- > 0) - tputs(_right, 1, outchar); - - fflush(stdout); - return(0); - } - StartBold() { --- 458,463 ---- Index: src/editmsg.c Prereq: 2.14 *** ../elm2.2/src/editmsg.c Mon Apr 24 21:25:19 1989 --- src/editmsg.c Wed Apr 26 11:39:12 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: editmsg.c,v 2.14 89/04/24 21:18:36 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.14 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: editmsg.c,v 2.15 89/04/26 11:39:10 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.15 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,24 ---- * ******************************************************************************* * $Log: editmsg.c,v $ + * Revision 2.15 89/04/26 11:39:10 syd + * Fix the pattern-matching feature of ~f/~m in the builtin editor + * and fix the documentation for the builtin editor in the Reference Guide. + * From: Rob Bernardo + * * Revision 2.14 89/04/24 21:18:36 syd * This fixes a number of bugs with the builtin editor. (1) It used to use * stdio functions and not curses functions to write to the screen causing *************** *** 522,528 **** /* if no argument or begins with a digit, then retrieve the * appropriate message from the current folder, else ! * just take the arguments literally for readmsg. */ if(isdigit(*arg) || *arg == '\0') { if(message_count < 1) { --- 527,534 ---- /* if no argument or begins with a digit, then retrieve the * appropriate message from the current folder, else ! * just take the arguments as a pattern for readmsg to match in ! * the current folder. */ if(isdigit(*arg) || *arg == '\0') { if(message_count < 1) { *************** *** 543,549 **** headers[mindex-1]->index_number); } else ! sprintf(local_buffer, "%s %s", readmsg, arg); /* now get output of readmsg */ --- 549,555 ---- headers[mindex-1]->index_number); } else ! sprintf(local_buffer, "%s -f %s %s", readmsg, cur_folder, arg); /* now get output of readmsg */ Index: src/file.c Prereq: 2.19 *** ../elm2.2/src/file.c Thu Mar 30 10:35:51 1989 --- src/file.c Wed Apr 26 16:43:59 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: file.c,v 2.19 89/03/25 21:46:17 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.19 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: file.c,v 2.21 89/04/26 16:43:56 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.21 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: file.c,v $ + * Revision 2.21 89/04/26 16:43:56 syd + * This enables elm to properly expand ~/[path] and ~logname/[path]; + * formerly "~" and "~/" were both expanded as the current user's home + * directory. Also fixes a bug in the expansion of environmental variables in + * user-entered paths. + * From: Rob Bernardo + * + * Revision 2.20 89/04/26 16:43:30 syd + * One variable was used in place of another + * From: Rob Bernardo + * * Revision 2.19 89/03/25 21:46:17 syd * Initial 2.2 Release checkin * *************** *** 24,29 **** --- 35,46 ---- **/ + #ifdef PWDINSYS + # include + #else + # include + #endif + #include "headers.h" #include #include *************** *** 245,251 **** char *filename; int use_cursor_control; { ! /** Expands ~ to the user's home directory =,+,% to the user's folder's directory ! to the user's incoming mailbox > to the user's received folder --- 262,269 ---- char *filename; int use_cursor_control; { ! /** Expands ~/ to the current user's home directory ! ~user/ to the home directory of "user" =,+,% to the user's folder's directory ! to the user's incoming mailbox > to the user's received folder *************** *** 256,263 **** 0 upon failed expansions **/ ! char temp_filename[SLEN], varname[SLEN], env_value[SLEN], *ptr; ! register int i = 1, iindex = 0; char *getenv(); ptr = filename; --- 274,283 ---- 0 upon failed expansions **/ ! char temp_filename[SLEN], varname[SLEN], ! env_value[SLEN], logname[SLEN], *ptr; ! register int i, iindex; ! struct passwd *pass, *getpwnam(); char *getenv(); ptr = filename; *************** *** 269,277 **** lastch(temp_filename) = '\0'; if (temp_filename[0] == '~') { ! sprintf(filename, "%s%s%s", home, ! (temp_filename[1] != '/' && lastch(folders) != '/')? "/" : "", ! &temp_filename[1]); } else if (temp_filename[0] == '=' || temp_filename[0] == '+' || temp_filename[0] == '%') { --- 289,317 ---- lastch(temp_filename) = '\0'; if (temp_filename[0] == '~') { ! if(temp_filename[1] == '/') ! sprintf(filename, "%s%s%s", ! home, (lastch(home) != '/' ? "/" : ""), &temp_filename[2]); ! else { ! for(i = 1, iindex = 0; temp_filename[i] != '/'; i++, iindex++) ! logname[iindex] = temp_filename[i]; ! logname[iindex] = '\0'; ! if((pass = getpwnam(logname)) == NULL) { ! dprint(3,(debugfile, ! "Error: Can't get home directory for %s (%s)\n", ! logname, "expand_filename")); ! if(use_cursor_control) ! error1("Don't know what the home directory of \"%s\" is!", ! logname); ! else ! printf( ! "\n\rDon't know what the home directory of \"%s\" is!\n\r", ! logname); ! return(0); ! } ! sprintf(filename, "%s%s", pass->pw_dir, &temp_filename[i]); ! } ! } else if (temp_filename[0] == '=' || temp_filename[0] == '+' || temp_filename[0] == '%') { *************** *** 280,287 **** &temp_filename[1]); } else if (temp_filename[0] == '$') { /* env variable! */ ! while (isalnum(temp_filename[i])) ! varname[iindex++] = temp_filename[i++]; varname[iindex] = '\0'; env_value[0] = '\0'; /* null string for strlen! */ --- 320,327 ---- &temp_filename[1]); } else if (temp_filename[0] == '$') { /* env variable! */ ! for(i = 1, iindex = 0; isalnum(temp_filename[i]); i++, iindex++) ! varname[iindex] = temp_filename[i]; varname[iindex] = '\0'; env_value[0] = '\0'; /* null string for strlen! */ *************** *** 301,307 **** sprintf(filename, "%s%s%s", env_value, (temp_filename[i] != '/' && lastch(env_value) != '/')? "/" : "", ! &temp_filename[1]); } else if (strcmp(temp_filename, "!") == 0) { strcpy(filename, defaultfile); --- 341,347 ---- sprintf(filename, "%s%s%s", env_value, (temp_filename[i] != '/' && lastch(env_value) != '/')? "/" : "", ! &temp_filename[i]); } else if (strcmp(temp_filename, "!") == 0) { strcpy(filename, defaultfile); Index: src/newmbox.c Prereq: 2.36 *** ../elm2.2/src/newmbox.c Mon Apr 24 20:04:04 1989 --- src/newmbox.c Wed Apr 26 11:41:13 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: newmbox.c,v 2.36 89/04/24 19:05:59 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.36 $ $State: Exp $ * * Copyright (c) 1988, USENET Community Trust * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: newmbox.c,v 2.37 89/04/26 11:41:10 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.37 $ $State: Exp $ * * Copyright (c) 1988, USENET Community Trust * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,25 ---- * ******************************************************************************* * $Log: newmbox.c,v $ + * Revision 2.37 89/04/26 11:41:10 syd + * This fixes bug EB13, whereby if there was a Status: header for a message, + * elm would lose track of status information (such as Priority:), because + * a variable was reset with the Status info, rather than just or'ed with it. + * From: Rob Bernardo + * * Revision 2.36 89/04/24 19:05:59 syd * Fix bug in limit mode when we really cannot keep limit over a resync * *************** *** 415,438 **** current_header->offset = (long) fbytes; current_header->index_number = count+1; ! if (! add_new_only || count >= message_count) { ! /* set default status - always 'visible' - and ! * if a spool file, presume 'new', otherwise ! * 'read', for the time being until overridden ! * by a Status: header. ! * We presume 'read' for nonspool mailfile messages ! * to be compatible messages stored with older versions of elm, ! * which didn't support a Status: header. ! */ ! if(folder_type == SPOOL) ! current_header->status = VISIBLE | NEW | UNREAD; ! else ! current_header->status = VISIBLE; ! } strcpy(current_header->subject, ""); /* clear subj */ strcpy(current_header->to, ""); /* clear to */ ! strcpy(current_header->mailx_status, ""); /* clear status flags */ current_header->encrypted = 0; /* clear encrypted */ current_header->exit_disposition = UNSET; current_header->status_chgd = FALSE; --- 421,442 ---- current_header->offset = (long) fbytes; current_header->index_number = count+1; ! /* set default status - always 'visible' - and ! * if a spool file, presume 'new', otherwise ! * 'read', for the time being until overridden ! * by a Status: header. ! * We presume 'read' for nonspool mailfile messages ! * to be compatible messages stored with older versions of elm, ! * which didn't support a Status: header. ! */ ! if(folder_type == SPOOL) ! current_header->status = VISIBLE | NEW | UNREAD; ! else ! current_header->status = VISIBLE; strcpy(current_header->subject, ""); /* clear subj */ strcpy(current_header->to, ""); /* clear to */ ! strcpy(current_header->mailx_status, ""); /* clear status flags */ current_header->encrypted = 0; /* clear encrypted */ current_header->exit_disposition = UNSET; current_header->status_chgd = FALSE; *************** *** 537,545 **** * wouldn't have a Status: header. */ if (strchr(current_header->mailx_status, 'R') != NULL) ! current_header->status = VISIBLE; ! else if (strchr(current_header->mailx_status, 'O') != NULL) ! current_header->status = VISIBLE | UNREAD; } else if (buffer[0] == LINE_FEED || buffer[0] == '\0') { --- 541,551 ---- * wouldn't have a Status: header. */ if (strchr(current_header->mailx_status, 'R') != NULL) ! current_header->status &= ~(NEW | UNREAD); ! else if (strchr(current_header->mailx_status, 'O') != NULL) { ! current_header->status &= ~NEW; ! current_header->status |= UNREAD; ! } } else if (buffer[0] == LINE_FEED || buffer[0] == '\0') { Index: utils/newmail.c Prereq: 2.16 *** ../elm2.2/utils/newmail.c Thu Mar 30 10:38:23 1989 --- utils/newmail.c Wed Apr 26 12:05:59 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: newmail.c,v 2.16 89/03/25 21:47:55 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.16 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: newmail.c,v 2.18 89/04/26 12:05:52 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.18 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,26 ---- * ******************************************************************************* * $Log: newmail.c,v $ + * Revision 2.18 89/04/26 12:05:52 syd + * add better from_whom controls + * + * Revision 2.17 89/04/26 11:57:53 syd + * Fixed not having newmail print the "sender's" id/address + * From bpa!att!hocpa!rusty Tue Apr 25 15:59:42 1989 + * * Revision 2.16 89/03/25 21:47:55 syd * Initial 2.2 Release checkin * *************** *** 273,278 **** --- 280,287 ---- char buffer[SLEN], from_whom[SLEN], subject[SLEN]; register int subj = 0, in_header = 1, count = 0, priority=0; + from_whom[0] = '\0'; + while (fgets(buffer, SLEN, folders[current_folder].fd) != NULL) { if (first_word(buffer,"From ")) { if (real_from(buffer, from_whom)) { *************** *** 280,286 **** priority = 0; in_header = 1; subject[0] ='\0'; - from_whom[0] ='\0'; } } else if (in_header) { --- 289,294 ---- *************** *** 301,306 **** --- 309,315 ---- in_header = 0; /* in body of message! */ show_header(priority, from_whom, subject, current_folder); count++; + from_whom[0] = '\0'; } } } *************** *** 431,441 **** /***** returns true iff 's' has the seven 'from' fields, initializing the who to the sender *****/ ! char junk[SLEN]; junk[0] = '\0'; sscanf(buffer, "%*s %s %*s %*s %*s %*s %s", who, junk); return(junk[0] != '\0'); } --- 440,456 ---- /***** returns true iff 's' has the seven 'from' fields, initializing the who to the sender *****/ ! char junk[SLEN], who_tmp[SLEN]; junk[0] = '\0'; + who_tmp[0] = '\0'; + sscanf(buffer, "%*s %s %*s %*s %*s %*s %s", who, junk); + + if (junk[0] != '\0') + strcpy(who, who_tmp); + return(junk[0] != '\0'); } -- ===================================================================== Sydney S. Weinstein, CDP, CCP Elm Coordinator Datacomp Systems, Inc. Voice: (215) 947-9900 syd@DSI.COM or {bpa,vu-vlsi}!dsinc!syd FAX: (215) 938-0235