home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / gnus / 1519 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.5 KB

  1. Path: sparky!uunet!europa.eng.gtefsd.com!emory!sol.ctr.columbia.edu!howland.reston.ans.net!spool.mu.edu!agate!stanford.edu!rock!concert!duke!khera
  2. From: khera@cs.duke.edu (Vivek Khera)
  3. Newsgroups: gnu.emacs.gnus
  4. Subject: Re: converting rmail format to mh format
  5. Message-ID: <KHERA.93Jan28134318@thneed.cs.duke.edu>
  6. Date: 28 Jan 93 18:43:18 GMT
  7. References: <SSAMMY.93Jan28130131@hunter-03.cs.strath.ac.uk>
  8. Sender: news@duke.cs.duke.edu
  9. Distribution: gnu
  10. Organization: Duke University CS Dept., Durham, NC
  11. Lines: 62
  12. Nntp-Posting-Host: thneed.cs.duke.edu
  13. To: ssammy@cs.strath.ac.uk (Paul Sammy 4th Year iE/CES)
  14. In-reply-to: ssammy@cs.strath.ac.uk's message of 28 Jan 93 13:01:31 GMT
  15. X-Md4-Signature: 1caae3a28707db81fb74abb895e03205
  16.  
  17. In article <SSAMMY.93Jan28130131@hunter-03.cs.strath.ac.uk> ssammy@cs.strath.ac.uk (Paul Sammy 4th Year iE/CES) writes:
  18.  
  19.    I've just changed my default-article saver to save articles in the MH 
  20.    format.
  21.    However, I've got quite a lot of articles in the rmail format that I'd
  22.    like to be able to view from the MH folder.
  23.  
  24. here's my program to do this.  written in Perl.  i call it babyl2mh.
  25. after conversion, you must manually delete the rmail files you no
  26. longer need.
  27.  
  28. --cut here--
  29. #!/usr/gnu/bin/perl
  30.  
  31. # incorporate an RMAIL babyl file into an MH folder
  32. #
  33. # usage: babyl2mh +folder babyl-file
  34. #
  35. # V. Khera 17-JUL-1991
  36. # $Id: babyl2mh,v 1.1 1991/07/17 18:23:39 khera Exp $
  37.  
  38. # where to find rcvstore
  39. $rcvstore = "/usr/local/lib/mh/rcvstore";
  40.  
  41. #
  42. # pull out command line args
  43. #
  44. die "usage: babyl2mh +folder babyl-file\n" unless @ARGV == 2;
  45.  
  46. $folder = shift;
  47. # make sure folder name starts with a "+"
  48. (substr($folder,0,1) eq "+") || (substr($folder,0,0) = "+");
  49. $bfname = shift;
  50.  
  51. print "Incorporating RMAIL file $bfname into MH folder $folder\n";
  52.  
  53. #
  54. # read in babyl file.
  55. #
  56. $/ = "\037";    # this separates the records in a babyl file
  57. $* = 1;        # records are multi-lines
  58.  
  59. open(BABYL,$bfname) || die "Couldn't open $bfname\n";
  60.  
  61. $_ = <BABYL>;    # discard header.
  62.  
  63. $msgnum = 0;
  64.  
  65. while (<BABYL>) {
  66.   chop;        # get rid of delimeter
  67.   s/\f(.|\n)*\*\*\* EOOH \*\*\*\n//;    # remove duplicate header information
  68.   open(RCVSTORE,"|" . $rcvstore . " $folder");
  69.   print RCVSTORE $_;
  70.   $msgnum++;
  71.   print "Message $msgnum done.\n";
  72. }
  73. --cut here--
  74. --
  75. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  76. Vivek Khera, Gradual Student/Systems Guy  Department of Computer Science
  77. Internet:   khera@cs.duke.edu             Box 90129
  78.             (MIME mail accepted)          Durham, NC 27708-0129 (919)660-6528
  79.