pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-users] Re: ANNOUNCE: pan-attach and pan-attach-kd, version 0.0.2006


From: Jack Cuyler
Subject: [Pan-users] Re: ANNOUNCE: pan-attach and pan-attach-kd, version 0.0.2006.10.07.0
Date: Sun, 8 Oct 2006 16:00:17 +0000 (UTC)
User-agent: pan 0.115 (Mrs. Kerr Says Remember the Tip Jar)

On Sun, 08 Oct 2006 10:28:51 +0000, Duncan wrote:

> As for putting it elsewhere in the file, it would be possible, but more
> difficult and therefore more prone to bugs.  At present, the script simply
> appends the attachment output from uuenview to the end of the file --
> pretty simple and hard to get wrong.  To insert it in the middle, the
> script would essentially have to split the post-temp-file at the sig
> (probably by grepping the "-- " sig delimiter), probably saving the sig
> off to a second file while deleting it from the working file, then append
> the attachment, then append the other file back after the attachment.

This patch will strip out the sig and add it back in at the end (although
the latter part is commented out, as I'm not sure if that will break
anything)

--- pan-atach-kd.orig   2006-10-08 11:44:50.000000000 -0400
+++ pan-atach-kd        2006-10-08 11:57:43.000000000 -0400
@@ -8,6 +8,8 @@
 NAME="pan-attach-kd"
 VERSION="0.0.2006.10.07.0"
 BODYFILE=${1:--h}
+TMP=${TMP:-/tmp}
+TEMPFILE=${TMP}/panpost.$(date +%Y%m%d%H%M%S)
 
 
################################################################################
 # description and help
@@ -121,10 +123,21 @@
 
 
################################################################################
 # OK, we know the attach file is readable, and we know what encoding to use, 
so...
+# Copy the inital text to the temp file
+cat ${BODYFILE} > ${TEMPFILE}
+
+# Strip out the sig and overwrite the body
+sed -n -e '1,/-- /p' ${TEMPFILE} |\
+grep -v ^'-- ' > ${BODYFILE}
+
 echo >> ${BODYFILE}
 echo >> ${BODYFILE}
 uuenview -${ENCODE} ${ATFILE} >> ${BODYFILE}
 
+# Uncomment the next 2 lines to add the sig back in
+#echo >> ${BODYFILE}
+#sed -n -e '/-- /,//p' ${TEMPFILE} >> ${BODYFILE}
+rm ${TEMPFILE}
 
################################################################################
 # debugging aids
 #konsole --noclose --nohist -e echo $


-- 
Cheers,
Jack

THE BOYS ROOM IS NOT A WATER PARK
THE BOYS ROOM IS NOT A WATER PARK
THE BOYS ROOM IS NOT A WATER PARK
THE BOYS ROOM IS NOT A WATER PARK

        Bart Simpson on chalkboard in episode 3F03





reply via email to

[Prev in Thread] Current Thread [Next in Thread]