Generalize how RMAIL looks for the spool directory and the movemail
authorChris Hanson <org/chris-hanson/cph>
Thu, 10 Oct 1996 10:30:00 +0000 (10:30 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 10 Oct 1996 10:30:00 +0000 (10:30 +0000)
program.

v7/src/edwin/dos.scm
v7/src/edwin/edwin.pkg
v7/src/edwin/notify.scm
v7/src/edwin/os2.scm
v7/src/edwin/rmail.scm
v7/src/edwin/unix.scm

index bd2e485892c56c64fe7770b44eb54b3001f3de97..0c6a53616d40e60941f0111236b593bd7f1e2029 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: dos.scm,v 1.40 1996/10/09 15:44:28 cph Exp $
+;;;    $Id: dos.scm,v 1.41 1996/10/10 10:29:20 cph Exp $
 ;;;
 ;;;    Copyright (c) 1992-96 Massachusetts Institute of Technology
 ;;;
 (define (os/write-file-methods) '())
 (define (os/alternate-pathnames group pathname) group pathname '())
 
+(define (os/rmail-spool-directory) #f)
+(define (os/rmail-primary-inbox-list system-mailboxes) system-mailboxes '())
 (define (os/sendmail-program) "sendmail.exe")
 (define (os/rmail-pop-procedure) #f)
 (define (os/hostname) (error "OS/HOSTNAME procedure unimplemented."))
index 5255b524fedbef603bbdcd5880f5667968a92131..84a68a0a46bb2a032cf8387aa6b1074b318b1b05 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: edwin.pkg,v 1.198 1996/10/07 18:20:31 cph Exp $
+$Id: edwin.pkg,v 1.199 1996/10/10 10:30:00 cph Exp $
 
 Copyright (c) 1989-96 Massachusetts Institute of Technology
 
@@ -1559,6 +1559,7 @@ MIT in each case. |#
          fetch-all-fields
          fetch-first-field
          fetch-last-field
+         guarantee-rmail-variables-initialized
          make-in-reply-to-field
          prompt-for-rmail-output-filename
          rfc822-addresses->string
index eb67da4fee3b664f4833cdfc273a59f4fe0cc30b..e0648e4dce1f746acfd2cd627ae26f894f47ff95 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: notify.scm,v 1.16 1995/04/09 22:33:28 cph Exp $
+;;;    $Id: notify.scm,v 1.17 1996/10/10 10:29:52 cph Exp $
 ;;;
 ;;;    Copyright (c) 1992-95 Massachusetts Institute of Technology
 ;;;
@@ -118,10 +118,14 @@ Ignored if notify-show-mail is false."
 
 (define-variable mail-notify-directory
   "Directory in which MAIL-NOTIFY checks for mail."
-  (pathname-as-directory "/usr/mail/")
-  file-directory?)
+  #f
+  (lambda (object) (or (not object) (file-directory? object))))
 
 (define (notifier:mail-present)
+  (if (not (ref-variable mail-notify-directory))
+      (begin
+       (guarantee-rmail-variables-initialized)
+       (set-variable! mail-notify-directory rmail-spool-directory)))
   (if (let ((pathname
             (merge-pathnames (ref-variable mail-notify-directory)
                              (current-user-name))))
index a158d59e309e75e1f7bd4e11e3aad9d9d36ee8cd..cddc8c0a7163f562251962714dc63cf64f53e805 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: os2.scm,v 1.34 1996/10/09 15:44:46 cph Exp $
+;;;    $Id: os2.scm,v 1.35 1996/10/10 10:29:08 cph Exp $
 ;;;
 ;;;    Copyright (c) 1994-96 Massachusetts Institute of Technology
 ;;;
 (define (os/quit dir)
   dir
   (error "Can't quit."))
+
+(define (os/hostname)
+  (if (not os2/cached-hostname)
+      (let ((buffer (temporary-buffer "*hostname*")))
+       (let ((status.reason
+              (run-synchronous-process #f (buffer-end buffer) #f #f
+                                       "hostname")))
+         (if (not (equal? status.reason '(EXITED . 0)))
+             (begin
+               (pop-up-buffer buffer)
+               (error "Error running HOSTNAME program:" status.reason))))
+       (set! os2/cached-hostname (string-trim (buffer-string buffer)))
+       (kill-buffer buffer)))
+  os2/cached-hostname)
+
+(define os2/cached-hostname #f)
+(add-event-receiver! event:after-restore
+  (lambda ()
+    (set! os2/cached-hostname #f)
+    unspecific))
 \f
 ;;;; OS/2 Clipboard Interface
 
@@ -305,6 +325,19 @@ filename suffix \".gz\"."
 (define (os/sendmail-program)
   "sendmail")
 
+(define (os/rmail-spool-directory)
+  (or (let ((etc (get-environment-variable "ETC")))
+       (and etc
+            (file-directory? etc)
+            (let ((mail
+                   (merge-pathnames "mail/" (pathname-as-directory etc))))
+              (and (file-directory? mail)
+                   (->namestring mail)))))
+      "c:\\mptn\\etc\\mail\\"))
+
+(define (os/rmail-primary-inbox-list system-mailboxes)
+  system-mailboxes)
+
 (define (os/rmail-pop-procedure)
   (and (dos/find-program "popclient" (ref-variable exec-path) #f)
        (lambda (server user-name password directory)
@@ -356,24 +389,4 @@ filename suffix \".gz\"."
   "If true, messages are deleted from the POP server after being retrieved.
 Otherwise, messages remain on the server and will be re-fetched later."
   #t
-  boolean?)
-
-(define (os/hostname)
-  (if (not os2/cached-hostname)
-      (let ((buffer (temporary-buffer "*hostname*")))
-       (let ((status.reason
-              (run-synchronous-process #f (buffer-end buffer) #f #f
-                                       "hostname")))
-         (if (not (equal? status.reason '(EXITED . 0)))
-             (begin
-               (pop-up-buffer buffer)
-               (error "Error running HOSTNAME program:" status.reason))))
-       (set! os2/cached-hostname (string-trim (buffer-string buffer)))
-       (kill-buffer buffer)))
-  os2/cached-hostname)
-
-(define os2/cached-hostname #f)
-(add-event-receiver! event:after-restore
-  (lambda ()
-    (set! os2/cached-hostname #f)
-    unspecific))
\ No newline at end of file
+  boolean?)
\ No newline at end of file
index f09fe59d4dd3f41c98078a483c26c366ae9c683c..8916bbda552f9a726b9c1bc6e11ce4c58d9fd883 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: rmail.scm,v 1.52 1996/09/30 01:01:39 cph Exp $
+;;;    $Id: rmail.scm,v 1.53 1996/10/10 10:28:22 cph Exp $
 ;;;
 ;;;    Copyright (c) 1991-96 Massachusetts Institute of Technology
 ;;;
@@ -47,7 +47,7 @@
 (declare (usual-integrations))
 \f
 (define rmail-spool-directory
-  "/usr/mail/")
+  #f)
 
 (define-variable rmail-file-name
   ""
@@ -164,7 +164,7 @@ C-M-r   Like h only just messages with particular recipient(s) are summarized.
 t      Toggle header, show Rmail header if unformatted or vice versa.
 w      Edit the current message.  C-c C-c to return to Rmail."
   (lambda (buffer)
-    (guarantee-variables-initialized)
+    (guarantee-rmail-variables-initialized)
     (define-variable-local-value! buffer
        (ref-variable-object mode-line-modified)
       "--- ")
@@ -203,20 +203,22 @@ together with two commands to return to regular RMAIL:
   (lambda (buffer)
     (enable-group-undo! (buffer-group buffer))))
 
-(define (guarantee-variables-initialized)
+(define (guarantee-rmail-variables-initialized)
+  (if (not rmail-spool-directory)
+      (set! rmail-spool-directory (os/rmail-spool-directory)))
   (if (not (ref-variable rmail-pop-procedure))
       (set-variable! rmail-pop-procedure (os/rmail-pop-procedure)))
   (if (null? (ref-variable rmail-primary-inbox-list))
-      (set-variable!
-       rmail-primary-inbox-list
-       (list "~/mbox"
-            (let ((server
-                   (and (ref-variable rmail-pop-procedure)
-                        (ref-variable rmail-primary-pop-server))))
-              (if server
-                  (string-append "pop:" server)
-                  (string-append rmail-spool-directory
-                                 (current-user-name)))))))
+      (set-variable! rmail-primary-inbox-list
+                    (os/rmail-primary-inbox-list
+                     (list
+                      (let ((server
+                             (and (ref-variable rmail-pop-procedure)
+                                  (ref-variable rmail-primary-pop-server))))
+                        (if server
+                            (string-append "pop:" server)
+                            (string-append rmail-spool-directory
+                                           (current-user-name))))))))
   (if (not (ref-variable rmail-dont-reply-to-names))
       (set-variable!
        rmail-dont-reply-to-names
@@ -525,8 +527,8 @@ and use that file as the inbox."
            (let ((start (buffer-start error-buffer))
                  (end (buffer-end error-buffer)))
              (run-synchronous-process false start false false
-                                      (->namestring
-                                       (edwin-etc-pathname "movemail"))
+                                      (os/find-program "movemail"
+                                                       (edwin-etc-directory))
                                       (->namestring source)
                                       (->namestring target))
              (if (mark< start end)
index 68482e672df02422670dd4b99e8a9b2fbfbd5a9c..0d7f37bc36cdcd6e086f0f9a231b906505123a95 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: unix.scm,v 1.72 1996/10/02 17:00:35 cph Exp $
+;;;    $Id: unix.scm,v 1.73 1996/10/10 10:28:48 cph Exp $
 ;;;
 ;;;    Copyright (c) 1989-96 Massachusetts Institute of Technology
 ;;;
@@ -788,9 +788,19 @@ option, instead taking -P <filename>."
 (define os/restore-modes-to-updated-file!
   set-file-modes!)
 
+(define (os/rmail-spool-directory)
+  (or (list-search-positive
+         '("/var/spool/mail/" "/var/mail/" "/usr/spool/mail/" "/usr/mail/")
+       file-directory?)
+      "/usr/spool/mail/"))
+
+(define (os/rmail-primary-inbox-list system-mailboxes)
+  (cons "~/mbox" system-mailboxes))
+
 (define (os/sendmail-program)
-  (if (file-exists? "/usr/lib/sendmail")
-      "/usr/lib/sendmail"
+  (or (list-search-positive
+         '("/usr/lib/sendmail" "/usr/sbin/sendmail" "/usr/ucblib/sendmail")
+       file-executable?)
       "fakemail"))
 
 (define (os/hostname)