Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!HPLABS.HP.COM!marvit%hplpm
From: marvit%hplpm@HPLABS.HP.COM (Peter Marvit)
Newsgroups: comp.mail.mh
Subject: rmm[proc] replacement
Message-ID: <22799.583436802@hplpm>
Date: 27 Jun 88 17:46:42 GMT
References: <8806262201.AA28641@intrepid.ecn.purdue.edu>
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 73

Continuing the drift, the "aliasing" of rmm is fine for csh and ksh folks
who execute MH only from the shell, but unfortunately won't work for the
programmatic interfaces and various uses of rmmproc.  The most general
solution I've come up with so far is this.  Combine with the previous
unrmm's and you're cooking with gas...

OK, here's my proven solution (tested for at least one hour).  In your
.mh_profile, include the line:

	rmmproc: /users/marvit/bin/my-rmm

or some suitable pathname to the following shell script:

-------------------------------CUT HERE------------------------------
:
# my-rmm.  The : at the beginning forces /bin/sh.  This version puts all
# deleted messages into the +wastebasket folder.  Be sure to expunge with
#      rm `mhpath +wastebasket`
# every so often

until [ -z "$1" ]
do
	/bin/mv $1 `mhpath +waste new`
	shift
done
-------------------------------END HERE------------------------------

If you just wanted to use a new name in the same folder, edit the following
script to use your favorite prefix, if you don't like "#" or "," as the
prepended "deleted" character:

-------------------------------CUT HERE------------------------------
:
# my-rmm.  The : at the beginning forces /bin/sh.  This version puts all
# deleted messages into the +wastebasket folder.  Be sure to expunge each
# folder with 
#      rm `mhpath`/.D
# every so often.  In fact, you could loop thourgh all the folders, with the
# script mh-expunge 

PREFIX=.D.

until [ -z "$1" ]
do
	/bin/mv $1 `dirname $1`${PREFIX}`basename $1`
	shift
done
-------------------------------END HERE------------------------------

And this may be your mh-expunge:

-------------------------------CUT HERE------------------------------
:
# mh-expunge. The : at the beginning forces /bin/sh.  Be sure that the
# $PREFIX is the same as in my-rmm.

PREFIX=.D.

for folder in `folders -fast -all -recurse -noheader -nototal -nopack -print`
do
	rm `mhpath +folder`/${PREFIX}*
-------------------------------END HERE------------------------------

Voila, you are ready to conquer the world.  Note, however, that "rmm" will
also execute "my-rmm" so that if you try to do a "rmm +wastebasket all",
you'll just copy all the messages to a higher number.

This solution appears to work both from within programs which need rmmproc
and from the shell.  Added bonus: This way forms like "rmm all" and "rmm 3
5 6" work properly!

-Peter Marvit
 HP Labs