to save disk space. Here is a patch for mhonarc perl script (against 2.0.1)
to handle such a setup.
For example, if you choose to do a 'gzip msg[0-9]*.html' in list
directory after processing income, the patched version should correctly
interpret msg*.html.gz files decompressing/compressing them if needed.
We use GNU gzip 1.2.4.
Be sure your scripts can find gzip in their PATH variables!
Please CC: me to iko(_at_)crec(_dot_)mipt(_dot_)ru, as I'm not on mailing
list.
PS: I have a little experience in perl programming, so don't blame me
a lot about it.
-------------------CUT HERE-----------------------------------------------
--- mhonarc-old Sat May 24 22:14:38 1997
+++ mhonarc Sun May 25 00:38:10 1997
@@ -580,7 +580,7 @@
foreach $mbox (@ARGV) {
if (-d $mbox) { # MH mail folder
if (!opendir(MAILDIR, $mbox)) {
- warn "\nWarning: Unable to open $mbox\n";
+ warn "\nWarning: Unable to open directory $mbox\n";
next;
}
$MBOX = 0; $MH = 1;
@@ -591,7 +591,7 @@
foreach (@files) {
$mesgfile = "${mbox}${DIRSEP}${_}";
if (!open(FILE, $mesgfile)) {
- warn "\nWarning: Unable to open message $mesgfile\n";
+ warn "\nWarning: Unable to open message file
$mesgfile\n";
next;
}
print STDOUT "." unless $QUIET;
@@ -627,7 +627,7 @@
if ($mbox eq "-") {
$fh = 'STDIN';
} elsif (!open(FILE, $mbox)) {
- warn "\nWarning: Unable to open $mbox\n";
+ warn "\nWarning: Unable to open file $mbox\n";
next;
} else {
$fh = 'FILE';
@@ -1458,24 +1458,52 @@
local($msgi, $tmp, $tmp2, $template, @array2);
local($filepathname, $tmppathname, $i_p0, $filename, $msghandle);
local($adding) = ($ADD && !$force && !$SINGLE);
+ local($gzip_process) = 0;
+ local($test_pathname);
$i_p0 = &fmt_msgnum($IndexNum{$index});
$filename = &msgnum_filename($IndexNum{$index});
- $filepathname = $OUTDIR . $DIRSEP . $filename;
+ $testpathname = $OUTDIR . $DIRSEP . $filename;
$tmppathname = $OUTDIR . $DIRSEP . "msgtmp.$$";
+ $gzip_process = (!stat($testpathname)&&stat($testpathname . ".gz"));
+
+ if ($gzip_process) {
+ print STDERR "\nTrying gzip pipe processing.\n" unless $QUIET;
+ $filepathname = $testpathname . ".gz";
+ } else {
+ print STDERR "\nTrying normal processing.\n" unless $QUIET;
+ $filepathname = $testpathname;
+ }
+## stat($filepathname)
+## || warn ("Stat failed for $filepathname...\n");
+
+ print STDERR "\nProcessing file $filename (actual file $filepathname)\n"
+ unless $QUIET;
+
if ($adding) {
return ($i_p0,$filename) unless $Update{$IndexNum{$index}};
&cp($filepathname, $tmppathname);
- open(MSGFILEIN, $tmppathname)
- || die("ERROR: Unable to open $tmppathname\n");
+
+ if ($gzip_process) {
+ open(MSGFILEIN, "gzip -cd '$tmppathname'|")
+ || die("ERROR: Unable to open gzip pipe from file
$tmppathname\n");
+ } else {
+ open(MSGFILEIN, $tmppathname)
+ || die("ERROR: Unable to open file $tmppathname\n");
+ }
}
if ($SINGLE) {
$msghandle = 'STDOUT';
} else {
- open(MSGFILE, "> $filepathname")
- || die("ERROR: Unable to create $filepathname\n");
+ if ($gzip_process) {
+ open(MSGFILE, "|gzip -9 > $filepathname")
+ || die("ERROR: Unable to create output gzip pipe to file
$filepathname\n");
+ } else {
+ open(MSGFILE, "> $filepathname")
+ || die("ERROR: Unable to create output file $filepathname\n");
+ }
$msghandle = 'MSGFILE';
}
-------------------CUT HERE-----------------------------------------------
--
Igor V. Kovalenko mailto:iko(_at_)crec(_dot_)mipt(_dot_)ru