Subject: filename when downloading an attachment

From: Scott Evans <[email-masked]>
Date: Thu, 25 Apr 2002 13:41:55 -0400 (EDT)

Hi... I'm a long-time pine user and I'm finally about to have pine on
a non-restricted machine (i.e. where I have a shell account), which
means I get to configure pine to send attachments with 'sz'.
This feature rocks but I have the same problem mentioned in the
below message from 2 years ago.

Downloading a wrongly-named file sort of negates the convenience of
the "download" command.  I have to find the file and rename it to the
right name (this is amplified by the fact that I'm downloading to
Windows, where keeping the file extension intact has nice benefits).

Has anything come of this?  Any plans to modify 'download-command'
so that it uses the attachment's real filename?

| To: Pine Discussion Forum <[email-masked]>
| Subject: Downloading Attachments
| From: "Sean Gurevich" <[email-masked]>
| Date: Mon, 17 Jul 2000 21:03:23 -0500
|
| 	I use 'sz' as my 'download-command' option. This works fine for
| downloading the attachment through my telnet app which internally
supports
| zmodem downloading; however, the downloaded file is saved with the temp
| name rather than the attachment name. I'm using Pine v4.05L on UNIX. Is
| there anyway I can change this behavior by modifying the
| 'download-command' property? I'm hoping to get a solution to this
problem
| that doesn't require upgrading to a new version of Pine because I don't
| have control over the server I'm using.

--
 scott evans :: www.antisleep.com

-- 
-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Bob Rasmussen <[email-masked]>
Date: Thu, 25 Apr 2002 22:00:16 -0700 (PDT)

> so that it uses the attachment's real filename?

I do this very thing. I'll show you my setup, although I don't remember why
everything works the way it does.

The key is a file named ".mailcap", in your home directory. If it's not there,
create it. Here's part of mine:

############ .mailcap ##########
# Note: Pine apparently needs enable-mailcap-param-substitution flag set in
# order to do parameter substitution
image/*;            ~/downstart %s %t; needsterminal
# Note: following depends on entry in /etc/mime.types
Application/PDF;    ~/downstart %s app/pdf; needsterminal
Application/MSWORD; ~/downstart %s app/doc; needsterminal
Application/PCX;          ~/downstart %s app/pcx; needsterminal
###### end .mailcap #####

Pine uses this file to know how to different types. All these entries
reference a shell script in my root directory called downstart. Here it is:

### downstart ###
# format is:
#   parameter 1 is temporary file name
#   parameter 2 is MIME type
#   optional parameter 3 is name
#
# figure out extension based on MIME type
echo "File name is " $1
echo "Data type is " $2
ext=`echo $2 | cut -d"/" -f2`
echo "extension is " $ext
echo "filename should be " $1.$ext
ONAME=$1.$ext;export ONAME
# if we have a name, use it
if [ "$3" != "" ]; then
   ONAME=$3; export ONAME
   echo "filename should NOW be " $3
fi
echo "file name on UNIX is " $1
cat $1 | sz -y -
printf "\n\n\034winstart \${anz_last_recd}\035"
### end downstart ###

The 2nd to the last line actually does the "sz" (send zmodem) command. The
environment variable ONAME is used by sz to name the output name, when the
input name is a pipe.

The last line is specific to our telnet program, Anzio. It tells Anzio to do
the equivalent of a Windows "start" command on the last file received.

The net result is that, for instance, an attachment of type
"Application/MSWORD" will get a ".doc" stuck on it, downloaded, and then the
doc file will get STARTed in Windows, which causes Windows to open it with the
associated program.

Hope this helps.

Regards,
....Bob Rasmussen,   President,   Rasmussen Software, Inc.

personal e-mail: [email-masked]
 company e-mail: [email-masked]
          voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
            fax: (US) 503-624-0760
            web: http://www.anzio.com

---

From: Scott Evans <[email-masked]>
Date: Fri, 26 Apr 2002 09:22:47 -0700 (PDT)

Thanks Bob, that's cool.  I tweaked it a little for my usage and it's
working well.  It's too bad that there's no way to preserve the original 
filename; after reading the .mailcap RFC I don't see a way to do it.

I guess for a clean solution pine could have a "save attachment with real 
name" option or some such.

scott