Re: piping message thru demime

Christian Ebert <[email protected]>
Newsgroups gmane.network.slrn.user
Organization Black Trash Productions <http://www.blacktrash.org/>
Message-ID <[email protected]>
* Troy Piggins on Friday, February 17, 2006 at 08:08:47 +1000:
> 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!?

Might be the seconde issue discussed on
<http://scifi.squawk.com/demime.html>.

> Both messages are by the same author.  I'll have to tinker
> some more.

Save the message separately and run demime on it from the command
line.

> The error message spreads text all over the screen so it's hard to
> make out what the error is.

I guess the error is:

unexpected EOF while looking for matching `''

and 'echo' is the problem.

So, a rather clumsy way of doing this might be to save the
article to a file and run demime on that file:

(I replaced article_as_string with raw_article_as_string)

define demime ()
{
  variable demime_tmp, raw_art, fp, art_demime;
  demime_tmp = "/tmp/slrn_demime."+ string (getpid () );
  raw_art = raw_article_as_string ();
  fp = fopen (demime_tmp, "w");
  if (fp == NULL)
    error (_function_name () +": could not open "+demime_tmp);
  fputs (raw_art, fp);
  fclose (fp);
  fp = popen ("/usr/local/bin/demime - < "+demime_tmp, "r");
  if (fp == NULL)
    error (_function_name () +": demime pipe failed" );
  art_demime = strjoin (fgetslines (fp), "");
  pclose (fp);
  if (art_demime != "") replace_article (art_demime);
  else error (_function_name () +": failed");
  system ("rm "+demime_tmp);
}

I'm sure this can be done much better, I'm not good at this slang
stuff.

If you are pulling from a local server you could also run demime
on the 'original' article after detecting its location by
disecting the Xref header.

c
-- 
_B A U S T E L L E N_ lesen!  --->> <http://www.blacktrash.org/baustellen.html>


-------------------------------------------------------
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.