Re: piping message thru demime

Troy Piggins <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
* Troy Piggins <[email protected]> :
> * Christian Ebert <[email protected]> :
> > * Troy Piggins on Thursday, February 16, 2006 at 15:37:48 +1000:
> > > I'm working on a macro to convert MIME messages not handled
> > > correctly by slrn.
> > > 
> > > I'm using the perl script 'demime' if anyone knows it.  When I have
> > > the macro working I'll post it so others can use, along with demime
> > > installation instructions etc.
> [snip]
>  
> > I don't know 'demime' so the following is completely untested and
> > perhaps broken, but I use something along this structure with a
> > python script, so perhaps it gives you some ideas:
> > 
> > define demime ()
> > {
> >   variable art_as_string = article_as_string ();
> >   variable fp = popen ("echo '"+art_as_string+"' | /usr/local/bin/demime", "r");
> >   variable art_demime = strjoin (fgetslines (fp), "");
> >   pclose (fp);
> >   if (art_demime != "") replace_article (art_demime);
> >   else error (_function_name () +": failed");
> > }
> 
> Oh you little beauty!  I got it working with one slight modification
> to the above.
> 
> 'demime' complains if you don't tell it where to output, so I just
> changed the second line to :
> 
> variable fp = popen ("echo '"+art_as_string+"' |
>                         /usr/local/bin/demime -", "r");
> 
> and it works.  The "-" tells demime to send to stdout.
> 
> Thankyou!

Looks like I spoke too soon.  It worked on the test message I was
using, but running the macro on other signed messages it doesn't
work!?  Both messages are by the same author.  I'll have to tinker
some more.

The error message spreads text all over the screen so it's hard to
make out what the error is.  I think this means the error is from
the pipe, and have to ctrl-l to refresh the display.

Do you know how to catch what the error is?

-- 
Troy Piggins
Ubuntu 5.10  pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22
Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i
                      vim 6.4


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.