home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / rmail-to-mail.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1993-05-19  |  921 b   |  34 lines

  1. #!/bin/sh
  2. #
  3. # usage:    rmail-to-mail file1 file2 ...
  4. #
  5. # result:    file1~     is the original Babyl file
  6. #        file1      is an empty Babyl file
  7. #        file1.mail is a UNIX mail file with the messages from file1
  8.  
  9. cat > /tmp/$$.el << EOF
  10. ;; LCD Archive Entry:
  11. ;; rmail-to-mail|Skip Montanaro, Nate Hess|montanaro@sprite.crd.ge.com|
  12. ;; Convert an rmail babyl file to unix mail.|
  13. ;; 19-May-1993||~/functions/rmail-to-mail.el.Z|
  14.  
  15. (let ((file-to-be-converted (buffer-file-name))
  16.       (message-count 0)
  17.       (rmail-delete-after-output t)
  18.       (unix-style-file-name (concat (buffer-file-name) ".mail")))
  19.   (kill-buffer (current-buffer))
  20.   (rmail file-to-be-converted)
  21.   (rmail-show-message 1)
  22.   (while (not (rmail-output unix-style-file-name))
  23.     (setq message-count (1+ message-count)))
  24.   (rmail-quit))
  25. EOF
  26.  
  27. for f in "$@" ; do
  28.     echo ">>> Doing $f"
  29.     emacs -batch $f -l /tmp/$$.el -kill
  30.     echo ">>> Done"
  31. done
  32.  
  33. rm -f /tmp/$$.el
  34.