[11572] in Athena Bugs

home help back first fref pref prev next nref lref last post

emacs movemail with temp homedir

daemon@ATHENA.MIT.EDU (Calvin Clark)
Sun Jan 2 19:51:02 1994

Date: Sun, 2 Jan 94 19:50:54 EST
From: Calvin Clark <ckclark@MIT.EDU>
To: bugs@MIT.EDU

[ This is a repsonse to Ezra's suggestion; cf. [1688]
  in Athena Software Suggestions.

	-Calvin ]

> a) Create a movemail.notruncate which is based on the current movemail
> without the final QUIT command. This would get mail and leave it on the
> server.

That isn't the way it's done.  What you should do is eliminate the
DELE commands, and keep the QUIT.  Omitting the QUIT can cause
problems with some servers, and leaving the DELE commands in
in hope that the server will not execute them if something goes
wrong is, frankly, asking for trouble.

Having movemail omit these operations if it's invoked as
"movemail.notruncate" or if it is given the -notruncate option
is, of coruse, trivial.  I like the command line option better.

> b) The temp user directory should contain a .emacs which sets the
> movemail program to use the movemail.notruncate.

A reasonable solution.  Here's an implementation:

The .emacs file:

(setq rmail-notruncate t)

will have this effect if the following fix is applied; rmail.el
should be re-byte-compiled after the patch is made, of course.

I have tested this fix.

*** /source/third/common/gnu/emacs/etc/movemail.c	Wed May 19 11:33:24 1993
--- etc/movemail.c	Sun Jan  2 19:35:20 1994
***************
*** 83,88 ****
--- 83,89 ----
  
  /* Nonzero means this is name of a lock file to delete on fatal error.  */
  char *delete_lockname;
+ int notruncate = 0;
  
  main (argc, argv)
       int argc;
***************
*** 105,115 ****
    delete_lockname = 0;
  
    if (argc < 3)
!     fatal ("two arguments required");
! 
    inname = argv[1];
    outname = argv[2];
  
    /* Check access to output file.  */
    if (access (outname, F_OK) == 0 && access (outname, W_OK) != 0)
      pfatal_with_name (outname);
--- 106,125 ----
    delete_lockname = 0;
  
    if (argc < 3)
!     fatal ("usage: movemail <source> <dest> [-notruncate|-truncate]");
    inname = argv[1];
    outname = argv[2];
  
+   if (argc > 3) 
+     {
+       if (!strcmp (argv[3], "-notruncate"))
+         notruncate = 1;
+       else if (!strcmp (argv[3], "-truncate"))
+         notruncate = 0;
+       else
+         fatal ("usage: movemail <source> <dest> [-notruncate|-truncate]");
+     }  
+ 
    /* Check access to output file.  */
    if (access (outname, F_OK) == 0 && access (outname, W_OK) != 0)
      pfatal_with_name (outname);
***************
*** 485,496 ****
        return(1);
      }
  
!     for (i = 1; i <= nmsgs; i++) {
! 	if (pop_command("DELE %d", i) == NOTOK) {
! 	    error(Errmsg);
! 	    pop_command("QUIT");
! 	    return(1);
! 	}
      }
  
      pop_command("QUIT");
--- 495,508 ----
        return(1);
      }
  
!     if (!notruncate) {
!         for (i = 1; i <= nmsgs; i++) {
!             if (pop_command("DELE %d", i) == NOTOK) {
!                 error(Errmsg);
!                 pop_command("QUIT");
!                 return(1);
!             }
!         }
      }
  
      pop_command("QUIT");
*** /source/third/common/gnu/emacs/lisp/rmail.el	Thu Aug 15 09:17:39 1991
--- lisp/rmail.el	Sun Jan  2 19:37:01 1994
***************
*** 83,88 ****
--- 83,94 ----
  (defvar rmail-last-multi-labels nil)
  (defvar rmail-last-file nil)
  (defvar rmail-last-rmail-file nil)
+ 
+ ;; requires "-notruncate" extension to movemail
+ 
+ (defvar rmail-notruncate nil 
+   "*If non-nil, call movemail with -notruncate flag so
+ mail is left at Post Office.")
  
  ;;;; *** Rmail Mode ***
  
***************
*** 495,501 ****
  		     (buffer-flush-undo errors)
  		     (call-process
  		       (expand-file-name "movemail" exec-directory)
! 		       nil errors nil file tofile)
  		     (if (not (buffer-modified-p errors))
  			 ;; No output => movemail won
  			 nil
--- 501,510 ----
  		     (buffer-flush-undo errors)
  		     (call-process
  		       (expand-file-name "movemail" exec-directory)
! 		       nil errors nil file tofile
! 		       (if rmail-notruncate
! 			   "-notruncate"
! 			 "-truncate"))
  		     (if (not (buffer-modified-p errors))
  			 ;; No output => movemail won
  			 nil


home help back first fref pref prev next nref lref last post