Hi all!

On Thu, 28 Sep 2000, Emmanuel Anne wrote:

> I had a look at the docs, but could not find a way to handle bad
> attachements ie : jpeg images attached as "application/octet-stream"
> insted of "image/jpeg".
> 
> Does someone know a way to view them directly instead of first saving
> them on the disk ???
Beside the script "mutt.octet.filter" I wrote a wrapper for this kind of
(M$) garbage ;-)
I defined it in my ~/.mailcap and it redefines the mime-type according
to the file extension and hand it over to mime-utils again. It could be
much more generic by reading ~/.mime.types and using this as a decision
base or you might rewrite it in a scripting lang with some mime-libs
(perl, python), but that was beyond the scope of my needs...
======================
#!/bin/sh
# handle-octstream

# Defaults
ACTION=see
TYPE="text/html"

while getopts spe param
do
  case $param in
    s) ACTION=see;;
    p) ACTION=print;;
    e) ACTION=edit;;
    *) ACTION=see;;
  esac
  continue
done 
shift

F=${1:?"No Filename given! Finished."}
WORD="application/msword"
XL="application/excel"
case $F in
  *.xls,*.XLS) TYPE=$XL;;
  *.doc,*.DOC) TYPE=$WORD;;
  *.txt,*.TXT) TYPE=$WORD;;
esac

$ACTION "$TYPE:$F"
======================

The mailcap-entry is as follows:

application/octet-stream; ~/bin/handle-octstream -s '%s';print=~/bin/handle-octstream 
-p '%s';edit=~/bin/handle-octstream -e '%s'

Ciao for now, Dirk
-- 
Dirk Ruediger, Rostock, Germany
 
When a trainstation is were a train stops what is a workstation?

Reply via email to