lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV My mail changes as a patch to 2.6FM


From: Eli's redistribution point
Subject: LYNX-DEV My mail changes as a patch to 2.6FM
Date: Mon, 27 Jan 97 14:15 EST

A while ago I mentioned here that I had modified LYMail.c to allow
editing of the headers and to archive all outgoing mail in the
same way as trn(1).

Today I went off and got the latest copy of Fote's sources and
added my changes to them in much nicer c this time.

The patch is below.

diff -c ../lynx2.6FM-original/CHANGES CHANGES
*** ../lynx2.6FM-original/CHANGES       Mon Jan 27 13:53:02 1997
--- CHANGES     Mon Jan 27 13:57:47 1997
***************
*** 1,4 ****
--- 1,8 ----
  01-27-97
+ * Added support for a trn(1) style record of outgoing mail via MAILRECORD
+   environment variable giving a file mail will be appended to. -- Elijah
+ * Changed LYMail.c to allow editing of mail headers as a compile time
+   option controlled by MAIL_HEADER_EDIT in userdefs.h. -- Elijah
  * Made ALT a synonym for VALUE in INPUTs with TYPE="image" to cooperate
    with well-intentioned (though misinformed) providers who use ALT instead
    of VALUE for the benefit of text clients or GUIs with image handling
diff -c ../lynx2.6FM-original/userdefs.h userdefs.h
*** ../lynx2.6FM-original/userdefs.h    Mon Jan 20 12:37:12 1997
--- userdefs.h  Mon Jan 27 13:50:19 1997
***************
*** 1133,1138 ****
--- 1133,1144 ----
  #define TRAVERSE_REJECT_FILE "reject.dat"
  #define TRAVERSE_ERRORS "traverse.errors"
  
+ /********************************
+  * If MAIL_HEADER_EDIT is defined then users will be able to edit 
+  * mail headers as they edit the body. (Meaningful only in Unix.)
+  */
+ #define MAIL_HEADER_EDIT
+ 
  
  /****************************************************************
   *   Section 3.   Things that you should not change until you
diff -c ../lynx2.6FM-original/src/LYMail.c src/LYMail.c
*** ../lynx2.6FM-original/src/LYMail.c  Mon Jan 13 17:20:02 1997
--- src/LYMail.c        Mon Jan 27 13:24:57 1997
***************
*** 452,457 ****
--- 452,459 ----
  {
      char user_input[1000];
      FILE *fd;
+     FILE *omfd = NULL;
+     char *outmail = NULL;
      char *address = NULL;
      char *searchpart = NULL;
      char *body = NULL;
***************
*** 892,897 ****
--- 894,903 ----
         */
        char *editor_arg = "";
  
+ #ifdef MAIL_HEADER_EDIT 
+         fputs(header, fd);
+ #endif /* MAIL_HEADER_EDIT */
+ 
        if (body) {
            cp1 = body;
            while((cp = strchr(cp1, '\n')) != NULL) {
***************
*** 1106,1116 ****
        pclose(fp);
        goto cleanup;
      }
      fputs(header, fp);
!     while ((n = fread(buf, 1, sizeof(buf), fd)) != 0)
        fwrite(buf, 1, n, fp);
      pclose(fp);
      fclose(fd);       /* Close the tmpfile. */
  
      if (TRACE)
        printf("%s\n",cmd);
--- 1112,1149 ----
        pclose(fp);
        goto cleanup;
      }
+     /*
+      * If MAILRECORD is defined, append all outgoing mail to it. Conf. trn(1) 
(eli)
+      */
+     outmail=getenv("MAILRECORD");
+     if (*outmail) {
+       omfd=fopen(outmail, "a");
+ #ifndef MAIL_HEADER_EDIT
+       /*
+        * Silent on open failure. (eli)
+        */
+       if (omfd) {
+         fputs(header omfd);
+       }
+ #endif /* MAIL_HEADER_EDIT */
+     }
+ #ifndef MAIL_HEADER_EDIT
      fputs(header, fp);
! #endif /* MAIL_HEADER_EDIT */
!     while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) {
        fwrite(buf, 1, n, fp);
+       /*
+        * Silent on open failure. (eli)
+        */
+         if (omfd) {
+           fwrite(buf, 1, n, omfd);
+         }
+     }
      pclose(fp);
      fclose(fd);       /* Close the tmpfile. */
+     if (omfd) {
+       fclose(omfd);   /* Close the mailrecord file. */
+     }
  
      if (TRACE)
        printf("%s\n",cmd);

Elijah
------
please do not CC me when replying to the list

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]