[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Mailcap question: should %s be quoted?

This is something that catches me once in a while -- mostly when using
mutt.  And in fact, I discussed this once on the Mutt list[1], last
month and the recommendation was to NOT use quotes around the %s in
the mailcap file.

What's the mailcap specification?  Should there be quotes or not?

The problem is when there's a script front-end for running a program
via mailcap that a parameter with spaces (like a file name) ends up as
two parameters later on.

For example, I have two mailcap files: /etc/mailcap and ~/.mailcap.
Notice how there's entries for application/vnd.ms-excel in each one --
but only one has %s quoted:

$ fgrep ms-excel /etc/mailcap
application/vnd.ms-excel; openoffice '%s'; edit=openoffice '%s'; test=test "$DISPLAY" != ""; nametemplate=%s.xls; description="Microsoft Excel Document"

$ fgrep ms-excel ~/.mailcap
application/vnd.ms-excel;/home/moseley/.openoffice/1.1.1/soffice %s

So what happens is this works:

    edit 'test doc.xls'

but this fails

    see 'test doc.xls'

(edit and see are symlinks to the run-mailcap perl script).

Enable debug in the /usr/bin/{edit,see} script and you can see the
"edit" command generates:

    - executing: openoffice 'test doc.xls'

where the "see" command does:

    - executing: /home/moseley/.openoffice/1.1.1/soffice test doc.xls

which ends up trying to edit two files: "test" and "doc.xls".

[1] http://www.df7cb.de/mutt/thread/20050308.012522.47e8d041.en.html#20050308.012522.47e8d041

Bill Moseley

Reply to: