#!/bin/ksh ############################################################################### # emacs.comp - editor front end for the MH comp command # # Gregory F. March (march@nynexst.com) # #------------------------------------------------------------------------------ # # NOTE: This is brute force and not that great of a coding job... # ############################################################################### DRAFT=~/Mail/draft touch /tmp/mh-gfm.$$ IFS_save=$IFS IFS= if [ `grep -c "^To:" $DRAFT` -le 0 ] then read ADDRESS?'To: ' print "To: $ADDRESS" > /tmp/mh-gfm.$$ # always need a To: fi if [ `grep -c "^Subject:" $DRAFT` -le 0 ] then read SUBJECT?'Subject: ' if [ ${SUBJECT:-""} != "" ] then print "Subject: $SUBJECT" >> /tmp/mh-gfm.$$ fi fi if [ `grep -c "^Cc:" $DRAFT` -le 0 ] then read CCFIELD?'Cc: ' if [ ${CCFIELD:-""} != "" ] then print "Cc: $CCFIELD" >> /tmp/mh-gfm.$$ fi fi if [ `grep -c "^Bcc:" $DRAFT` -le 0 ] then read BCCFIELD?'Bcc: ' if [ ${BCCFIELD:-""} != "" ] then print "Bcc: $BCCFIELD" >> /tmp/mh-gfm.$$ fi fi IFS=$IFS_save cat /tmp/mh-gfm.$$ $DRAFT > /tmp/mh-gfm2.$$ cp /tmp/mh-gfm2.$$ $DRAFT rm -f /tmp/mh-gfm.$$ /tmp/mh-gfm2.$$ emacs $DRAFT -f end-of-buffer rm -f $DRAFT*~