[comp.mail.mush] mush & nn

teexnma@ioe.lon.ac.uk (Nino Margetic) (05/23/91)

Hi,

Some time ago, someone explained how to use mush for posting articles
within rn. Since I'm not an expert on either mush or nn (but use both), can
anyone out there shed some light on how to use mush when posting/replying
within nn. There must be a way to do it (there usually is :-)!!!

Thanks in advance.

--Nino

-- 
Janet: nino@uk.ac.ucl.sm.mph                    \    Nino Margetic
Earn/Bitnet: nino@mph.sm.ucl.ac.uk               \   Dept. of Medical Physics
Internet: nino%mph.sm.ucl.ac.uk@nsfnet-relay.ac.uk\  University College London
Bang-path: ....!mcvax!ukc!ucl-mph!nino             \ Tel:+44-71-380-9300/x5313

rock@warp.Eng.Sun.COM (Bill Petro) (05/23/91)

teexnma@ioe.lon.ac.uk (Nino Margetic) writes:

>Hi,

>Some time ago, someone explained how to use mush for posting articles
>within rn. Since I'm not an expert on either mush or nn (but use both), can
>anyone out there shed some light on how to use mush when posting/replying
>within nn. There must be a way to do it (there usually is :-)!!!


In your nn init file (probably ~/.nn/init) put these lines:

set mailer /home/speedway/rock/bin/mush_script
set mailer-pipe-input

(of course, replace the pathname with yours)

In your ~/bin directory, place the mush_script:


#!/bin/csh -f
# set recipient=`grep "To:" $1`
##/home/speedway/rock/bin/mush -h $1 >& /dev/null
/home/speedway/rock/bin/zmail -send -draft - >& /dev/null
exit 0


--
     Bill Petro  {decwrl,hplabs,ucbvax}!sun!Eng!rock
"UNIX for the sake of the kingdom of heaven"  Matthew 19:12

teexnma@ioe.lon.ac.uk (Nino Margetic) (05/23/91)

In <9105230149.AA29634@cse.ogi.edu> schaefer@cse.ogi.EDU writes:

>On May 22,  9:01pm, Bill Petro wrote:
>} Subject: Re: mush & nn
>}
>} In your nn init file (probably ~/.nn/init) put these lines:
>} 
>} set mailer /home/speedway/rock/bin/mush_script
>} set mailer-pipe-input
>} 
>} (of course, replace the pathname with yours)
>} 
>} In your ~/bin directory, place the mush_script:
>} 
>} 
>} #!/bin/csh -f
>} # set recipient=`grep "To:" $1`
>} ##/home/speedway/rock/bin/mush -h $1 >& /dev/null
>} /home/speedway/rock/bin/zmail -send -draft - >& /dev/null
>} exit 0
>} 

>Of course, those of you who  aren't fortunate enough to have zmail
>will have to do something a bit different. :-)  This should work:

>#!/bin/csh -f
># change /usr/local/bin to whatever your path to mush is ...
>/usr/local/bin/mush -send -draft - >& /dev/null

>The reason nn has problems with mush is that nn assumes that the send
>failed if there is any output from the program.  Mush helpfully reports
>how many lines it read from the input, which nn interprets as an error.

*** Thanks. I hope it works (since I've just made the neccessary changes to
the init file, it better be OK :-)!!! But, I'm not sure the solution as 
proposed actually does what I wanted it to do. Namely, my original posting
was inspired by the my_hdr option available in mush. However, the same
.mushrc file which works nicely in mail, doesn't seem to have any effect
when mush is used from the news reader! Is that due to the fact that mush
is used with -send and -draft, while the input messg comes from the
stdin??

Is there a way of overcoming this problem (ie not being able to use
my_hdr option /and, for that matter, other goodies which mush provides/),
or am I (yet again :-) missing something important??

--Nino

-- 
Janet: nino@uk.ac.ucl.sm.mph                    \    Nino Margetic
Earn/Bitnet: nino@mph.sm.ucl.ac.uk               \   Dept. of Medical Physics
Internet: nino%mph.sm.ucl.ac.uk@nsfnet-relay.ac.uk\  University College London
Bang-path: ....!mcvax!ukc!ucl-mph!nino             \ Tel:+44-71-380-9300/x5313

teexnma@ioe.lon.ac.uk (Nino Margetic) (05/23/91)

In <1991May23.123004.11369@ioe.lon.ac.uk> I write:

[*** old stuff deleted ***]

>*** Thanks. I hope it works (since I've just made the neccessary changes to
>the init file, it better be OK :-)!!! But, I'm not sure the solution as 
>proposed actually does what I wanted it to do. Namely, my original posting
>was inspired by the my_hdr option available in mush. However, the same
>.mushrc file which works nicely in mail, doesn't seem to have any effect
>when mush is used from the news reader! Is that due to the fact that mush
>is used with -send and -draft, while the input messg comes from the
>stdin??

>Is there a way of overcoming this problem (ie not being able to use
>my_hdr option /and, for that matter, other goodies which mush provides/),
>or am I (yet again :-) missing something important??

**** Yup. TFM. It says that mush will only add Date: and From: fields if
they are missing... Waiting for suggestions how to add/change a field
(awk, sed, perl)???

Furthermore, in the meantime, I discovered that something funny is going on.
On follow-ups, there are no problems, but mush is not invoked at all.
On replies and mailings, something funny is going on... Here is the
output from ps -x:

  PID TTY STAT  TIME COMMAND
12018 p1  S     0:00 -h -i (tcsh)
12020 p1  R     0:00 ps -x
10835 x6  S     0:11 -tcsh (tcsh)
11921 x6  I     0:00 nnaux /usr/local/lib/nn/aux reply
11932 x6  I     0:00 nnaux /usr/local/lib/nn/aux reply
11934 x6  I     0:00 /common/teexnma/bin/mush_script -f /common/teexnma/bin/mus
11935 x6  R     5:50 /common/teexnma/bin/mush -U -h -
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12017 x6  S     0:00 script
12019 x6  S     0:00 script


The mush has been running for 5 (!!!) mins, and in the end I had to
kill it. Needless to say, the message never got delivered...
Furthermore, I had to change -send to -U, and -draft to -h, since the
former produced odd results in ps -x (i.e., mush was running with
params: -U end -h aft - ). BTW, I'm running mush v7.2.0 (which I can
upgrade if needed) and nn 6.4.0 #3 (which I can't upgrade easily).

Now I'm thoroughly confused :-)

--Nino

-- 
Janet: nino@uk.ac.ucl.sm.mph                    \    Nino Margetic
Earn/Bitnet: nino@mph.sm.ucl.ac.uk               \   Dept. of Medical Physics
Internet: nino%mph.sm.ucl.ac.uk@nsfnet-relay.ac.uk\  University College London
Bang-path: ....!mcvax!ukc!ucl-mph!nino             \ Tel:+44-71-380-9300/x5313

schaefer@cse.ogi.EDU (Barton E. Schaefer) (05/24/91)

On May 23,  1:44pm, Nino Margetic wrote:
} Subject: Re: mush & nn
}
} >.mushrc file which works nicely in mail, doesn't seem to have any effect
} >when mush is used from the news reader! Is that due to the fact that mush
} >is used with -send and -draft, while the input messg comes from the
} >stdin??
} 
} >Is there a way of overcoming this problem (ie not being able to use
} >my_hdr option /and, for that matter, other goodies which mush provides/),
} >or am I (yet again :-) missing something important??
} 
} **** Yup. TFM. It says that mush will only add Date: and From: fields if
} they are missing... Waiting for suggestions how to add/change a field
} (awk, sed, perl)???

What you want to do is to use mush to actually *edit* the outgoing
message, not just to send it.  I don't know if nn provides a way to
do that.  You can certainly add or change fields with sed or perl;
change your script to do something like

    perl perl_script | mush -send -draft -

where perl_script modifies the headers.

} Furthermore, in the meantime, I discovered that something funny is going on.
} On follow-ups, there are no problems, but mush is not invoked at all.

Correct.  Mush doesn't know how to post news, just how to send mail.

} output from ps -x:
} 
}   PID TTY STAT  TIME COMMAND
} 11935 x6  R     5:50 /common/teexnma/bin/mush -U -h -
}           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} 
} The mush has been running for 5 (!!!) mins, and in the end I had to
} kill it. Needless to say, the message never got delivered...

Looks like mush is never seeing end-of-file on its standard input.
I suggest you first upgrade to 7.2.3, then see what happens.

} Furthermore, I had to change -send to -U, and -draft to -h, since the
} former produced odd results in ps -x (i.e., mush was running with
} params: -U end -h aft - ).

That's because mush's argument parser converts -send to -U and -draft
to -h by strcpying into the elements of argv.  The only thing that is
messed up is your ps output, because it doesn't print the argv as an
array of nul-terminated strings, it just prints literally what is in
the block of memory where the argv was stored.


-- 
Bart Schaefer                                           schaefer@zipcode.com
Z-Code Software Corporation                             schaefer@cse.ogi.edu

teexnma@ioe.lon.ac.uk (Nino Margetic) (05/24/91)

In <9105232226.AA09465@cse.ogi.edu> schaefer@cse.ogi.EDU (Barton E. Schaefer) writes:

>On May 23,  1:44pm, Nino Margetic wrote:
>} Subject: Re: mush & nn
>}

	[*** stuff deleted ***]

>} output from ps -x:
>} 
>}   PID TTY STAT  TIME COMMAND
>} 11935 x6  R     5:50 /common/teexnma/bin/mush -U -h -
>}           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>} 
>} The mush has been running for 5 (!!!) mins, and in the end I had to
>} kill it. Needless to say, the message never got delivered...

>Looks like mush is never seeing end-of-file on its standard input.
>I suggest you first upgrade to 7.2.3, then see what happens.

*** I just did, but the problem is still there :-(
Oh, well, there are other things in life besides mush (are there???) :-)

--Nino

-- 
Janet: nino@uk.ac.ucl.sm.mph                    \    Nino Margetic
Earn/Bitnet: nino@mph.sm.ucl.ac.uk               \   Dept. of Medical Physics
Internet: nino%mph.sm.ucl.ac.uk@nsfnet-relay.ac.uk\  University College London
Bang-path: ....!mcvax!ukc!ucl-mph!nino             \ Tel:+44-71-380-9300/x5313