#! /bin/sh # $Id: recomp,v 1.9 1993/04/22 08:33:46 jerry book3 $ ### recomp - re-compose a draft mesage in MH draft folder ### Usage: recomp [msgnum] ## ## WHEN YOU TYPE q AT A What now? PROMPT, IT LEAVES THE DRAFT MESSAGE ## WITHOUT SENDING IT. IF YOU HAVE A DRAFT FOLDER, THE COMMAND LINE ## YOU'D TYPE TO RE-COMPOSE THE DRAFT IS LONG, LIKE: ## comp -use -draftm 3 -draftf +drafts -editor vi. ## ALSO, IT CAN BE HARD TO REMEMBER THE DRAFT NUMBER--SO YOU HAVE TO ## scan THE DRAFT FOLDER, THEN REMEMBER TO CHANGE YOUR FOLDER BACK. ## ## THIS SCRIPT HELPS WITH THAT. IF YOU GIVE IT A MESSAGE NUMBER IN THE ## DRAFT FOLDER, IT STARTS comp -use ON THAT MESSAGE WITH YOUR FAVORITE ## EDITOR PROGRAM. WITHOUT A MESSAGE NUMBER, recomp scanS THE DRAFT ## FOLDER, THEN LETS YOU ENTER THE NUMBER OF THE MESSAGE YOU WANT TO ## RE-COMPOSE AND STARTS comp -use. ## ## WHEN YOU EXIT YOUR EDITOR, YOU GET THE USUAL What now? PROMPT. # # NOTE TO HACKERS: TABSTOPS ARE SET AT 4 IN THIS CODE draftf=+drafts # NAME OF DRAFT FOLDER folopts="-fast -norecurse -nolist -nototal -nopack" mh=/usr/local/mh # WHERE MH PROGRAMS LIVE # THIS SCRIPT CHANGES CURRENT FOLDER TO THE $draftf FOLDER. # SET TEMPORARY CONTEXT FILE SO OTHER MH PROCESSES WON'T NOTICE CHANGE: tempctx=/tmp/RECOMP$$ MHCONTEXT=$tempctx; export MHCONTEXT stat=1 # DEFAULT EXIT STATUS; RESET TO 0 FOR NORMAL EXITS trap '/bin/rm -f $tempctx; exit $stat' 0 trap 'echo "`basename $0`: Interrupt! Cleaning up..." 1>&2' 1 2 15 $mh/folder $folopts $draftf >/dev/null || { echo "`basename $0`: quitting: problem with draft folder '$draftf'." 1>&2 exit 1 } case $# in 0) # THEY DIDN'T GIVE MESSAGE NUMBER; SHOW THEM FOLDER: if $mh/scan then echo -n "Which draft message number do you want to re-edit? " read msgnum else echo "`basename $0`: quitting: no messages in your $draftf folder?" 1>&2 exit fi ;; 1) msgnum="$1" ;; *) echo "I don't understand '$*'. I need the draft message number, if you know it... otherwise, nothing. Usage: `basename $0` [msgnum]" 1>&2 exit ;; esac $mh/comp -use -e ${VISUAL-${EDITOR-${EDIT-vi}}} -draftm $msgnum -draftf $draftf stat=$? # SAVE comp'S STATUS (IT'S USUALLY 0) FOR OUR exit
[Table of Contents] [Index] [Return to Explanation of recomp]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Jerry Peek <jerry@ora.com>
HIVE: All information for read only. Please respect copyright! |