procmail
[Top] [All Lists]

Re: Modified forwarding

1996-05-23 06:47:23
Das Devaraj <das(_at_)netcom(_dot_)com> writes:
On Wed, 22 May 1996, Guy Geens wrote:

Let's give it a try: change the second recipe to:
:0 b
| { cat ./$HEADERFILE ;                               \
echo "User $FROM\nOn $DATE\nsent a message to me.\n"\
"Please process and reply to $TO\n"                 \
"The message received is given below\n"             \
"-------------------------------------\n" ;         \
cat - } | formail ... | $SENDMAIL -oi -t

Thanks for your response.  After :0 b, isn't the body of 
the email on stdout (or stdin, depending on how you want to
look at it).  If that is true, after the the first `cat` it
is lost and the last `cat` would be expecting an input from
stdin.  Since procmail execution is not tied to any terminal,
that might cause an error/automatic EOF(?)

Am I missing something here?

cat only reads stdin if
a)      there are no file arguments given; or
b)      if the '-' argument is given.

As for the last bit, since all the processes in the braces share stdin,
if the first _had_ read the message, then the last cat would have simply
tried to read from the (now empty) pipe and gotten EOF.  If the first had
read the first 100 bytes then the last process would have started reading
where the first left off (discounting stdio buffering).

<Prev in Thread] Current Thread [Next in Thread>