#!/bin/sh # # em # Script to edit MH mail messages # Copyright (C) 1999 Frederick Barnes # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # if [ -f $HOME/.mh_profile ] then unset MAILPATH MAILPATH=`cat $HOME/.mh_profile | grep '^[pP]ath:' | awk '{print($2)}'` if [ "$MAILPATH" = "" ] then echo "no Path entry in $HOME/.mh_profile" exit 1 fi else echo "No .mh_profile file" exit 1 fi if [ -f $HOME/$MAILPATH/context ] then CUR_FOLDER=`cat $HOME/$MAILPATH/context | grep '^Current-Folder' | awk '{print($2)}'` else echo "No MH context in $HOME/$MAILPATH/context" exit 1 fi unset CUR_MESG while [ "$#" != "0" ] do echo $1 | grep '^\+' > /dev/null if [ "$?" = "0" ] then CUR_FOLDER=`echo $1 | awk -F+ '{print($2)}'` shift continue fi echo $1 | grep '^-' > /dev/null if [ "$?" = "0" ] then echo "Options not supported yet.. go away" shift continue fi CUR_MESG=$1 shift done if [ "$CUR_FOLDER" = "" ] then echo "No folder specified" exit 1 fi if [ ! -d $HOME/$MAILPATH/$CUR_FOLDER ] then echo "$CUR_FOLDER is not an MH folder" exit 1 fi if [ "$CUR_MESG" = "" ] then # We can have a go at extracting from the .mh_sequences file CUR_MESG=`cat $HOME/$MAILPATH/$CUR_FOLDER/.mh_sequences | grep '^cur' | awk '{print($2)}'` fi if [ "$CUR_MESG" = "" ] then # Might be a funny one stored in $MAILPATH CUR_MESG=`cat $HOME/$MAILPATH/context | grep '^atr-cur-.*/'$MAILPATH'/'$CUR_FOLDER':' | awk '{print($2)}'` if [ "$CUR_MESG" = "" ] then echo "No current message" exit 1 fi fi /bin/sh -c "$EDITOR $HOME/$MAILPATH/$CUR_FOLDER/$CUR_MESG"