On Thu, Aug 24, 2000 at 05:11:31PM -0400, Ron da Silva wrote:
> Seems like mutt writes attachments to /tmp and forwards the filename
> to netscape (based on my mailcap file) and then deletes the /tmp file;
> however, seems like sometimes the file gets deleted before netscape
> finishes reading the file from /tmp.  Thus, I get a partial page or
> none at all.
> 
> Anyone seen the above?  Any ideas on fixing it?

Yep.  It's a problem for other attachment viewers as well as netscape.
I've solved it by putting the following line in my mailcap file

    text/html; mutt_netscape %s; test=RunningX

where the mutt_netscape script is the following:

    prog=${0##*/}
    tmpfile=/tmp/$LOGNAME$$${1##*/}
    test -f $tmpfile && { echo "$prog: $tmpfile already exists" >&2 ; exit 1; }
    cp $1 $tmpfile
    netscape -remote "openURL(file:$tmpfile, new-window)" 2> /dev/null ||
        netscape $tmpfile
        
(I cut out all the comments and a few checks for brevity.  I hope I
didn't cut out too much.)

For other viewers, I use a mailcap line like this example for xv:

    image/*; mutt_bgrun xv %s; test=RunningX

where mutt_bgrun is the following:

    prog=${0##*/}
    tmpfile=/tmp/$LOGNAME$$${2##*/}
    test -f $tmpfile && { echo "$prog: $tmpfile already exists" >&2 ; exit 1; }
    cp $2 $tmpfile
    (   
        $1 $tmpfile
        rm -f $tmpfile
    ) &

The word bgrun means "background run" because it runs the viewer in the
background, freeing up mutt for other tasks.

Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | RF Communications Product Generation Unit
                             | Spokane, Washington, USA

Reply via email to