Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!ace.ee.lbl.gov!leres From: leres@ace.ee.lbl.gov (Craig Leres) Newsgroups: comp.mail.mh Subject: Re: fill subject field in 'forw' Message-ID: <4312@helios.ee.lbl.gov> Date: 29 Nov 89 10:46:48 GMT References: <3060001@hpgnd.HP.COM> <3060001@hpgnd.HP.COM> Sender: usenet@helios.ee.lbl.gov Reply-To: leres@helios.ee.lbl.gov (Craig Leres) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 112 Christian LOTITO writes: > i'd like the cmd 'forw' to fill the subject field automatically > with the subject of the message to be forwarded. Here's what Jef Poskanzer and I came up with; a script that uses repl in a novel manner. It only works when your forwarding one message. Crude, but effective. Craig ------ #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # forw # forw1.comps # forw1.mhl # This archive created: Wed Nov 29 02:44:37 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'forw'" '(549 characters)' if test -f 'forw' then echo shar: will not over-write existing file "'forw'" else sed 's/^X//' << \SHAR_EOF > 'forw' X#!/bin/csh -f X# X# forw - use repl to forward a single message, otherwise fall back on forw X# X# v01b - 18Jan89 - Craig Leres X# v01a - 29jul87 - Jef Poskanzer X Xset realforw=/usr/new/mh/forw X Xforeach a ( $* ) X switch ( "$a" ) X case *-*: X case *:*: X case all: X case -dashmunging: X $realforw $* X exit 0 X case +*: X case -*: X breaksw X default: X if ( $?foundsingle ) then X $realforw $* X exit 0 X endif X set foundsingle X breaksw X endsw Xend X X# Only one message, handle specially. Xrepl -form forw1.comps -filter forw1.mhl $* SHAR_EOF if test 549 -ne "`wc -c < 'forw'`" then echo shar: error transmitting "'forw'" '(should have been 549 characters)' fi chmod +x 'forw' fi # end of overwriting check echo shar: extracting "'forw1.comps'" '(59 characters)' if test -f 'forw1.comps' then echo shar: will not over-write existing file "'forw1.comps'" else sed 's/^X//' << \SHAR_EOF > 'forw1.comps' XTo: XSubject: %<{subject}Re: %67(trim)%(putstr)%> X-------- SHAR_EOF if test 59 -ne "`wc -c < 'forw1.comps'`" then echo shar: error transmitting "'forw1.comps'" '(should have been 59 characters)' fi fi # end of overwriting check echo shar: extracting "'forw1.mhl'" '(603 characters)' if test -f 'forw1.mhl' then echo shar: will not over-write existing file "'forw1.mhl'" else sed 's/^X//' << \SHAR_EOF > 'forw1.mhl' X: X:------- Forwarded Message X: Xignores=approved,date-received,distribution,followup-to,in-reply-to,keywords,lines,message-id,newsgroups,nf-id,organization,original-date,path,posting-version,received,relay-version,resent-message-id,status,x-mailer,x-orig-date,x-orig-from,x-orig-message-id,x-st-status,x-st-vmsmail-to,x-sun-spots-digest,xref XDate:leftadjust XFrom:leftadjust XSubject:leftadjust XTo:leftadjust XCc:leftadjust XResent-Date:leftadjust XResent-From:leftadjust XResent-To:leftadjust Xextras:nocomponent,leftadjust,compress,overflowtext=" " X: Xbody:nocomponent X: X:------- End of Forwarded Message X: SHAR_EOF if test 603 -ne "`wc -c < 'forw1.mhl'`" then echo shar: error transmitting "'forw1.mhl'" '(should have been 603 characters)' fi fi # end of overwriting check # End of shell archive exit 0