Next: , Previous: mail.remote, Up: Programs


2.12 mimeview

For each file given in its command line, mimeview attempts to autodetect its type and invoke an appropriate file viewer.

To detect the file type, mimeview uses mime.types file. This file is a part of Common UNIX Printing System, see man mime.types for the description of its syntax. [FIXME: provide an xref to CUPS]. By default mimeview searches for mime.types in $prefix/etc/cups/1, however its exact location can be specified at runtime as well (see --mimetypes below).

Once file MIME type is successfully determined, mimeview consults mailcap files in order to determine how to display the file. It does so essentially in the same manner as metamail utility, i.e., it scans all files specified in METAMAIL environment variable until it finds an entry describing the desired file format or until the list of files is exhausted. If METAMAIL variable is not set, mimeview uses the following default path instead:

     $HOME/.mailcap:/usr/local/etc/mailcap:\
      /usr/etc/mailcap:/etc/mailcap:\
      /etc/mail/mailcap:/usr/public/lib/mailcap

The following table summarizes options specific for mimeview:

-a[type-list]
--no-ask[=type-list]
By default mimeview asks for comnfirmation before running interpreter to view a message. If this option is used without argument, it disables the default behavior for all message types. Otherwise, if argument type-list is given, it specifies a comma-separated list of MIME types for which no questions should be asked. Elements of this list may include shell-style globbing patterns, e.g. setting
          --no-ask='text/*,image/jpeg'
     

will disable prompting before displaying any textual files, no matter what their subtype is, and before displaying files with type ‘image/jpeg’.

Notice, that when the long form is used, its argument must be separated from the option by a single equal sign, as shown in the example above. When the short form (-a) is used, its argument must follow the option immediately, without any intervening whitespace, e.g. -a'text/*').

-d[flags]
--debug[=flags]
Enables debugging output. Flags is a sequence of characters specifying the desired debugging level. Following characters are meaningful in flags:
g
Enables debugging of mime.types parser
l
Enables debugging of mime.types lexical analyzer (warning: produces very copious output)
1
Prints basic information about actions to be executed and reports about exit status of executed commands.
2
Additionally displays each file name along with its MIME type
3
Additionally traces the process of looking up the matching entry in mailcap files.
digits from 4 to 9
The same as 3, currently.

If flags are not given, the default ‘9’ is assumed.

--metamail[=file]
Run metamail to display files, instead of using the internal mechanisms. If file is specified, it is taken as metamail command line.
-h
--no-interactive
--print
This options tells mimeview that it should run in non-interactive mode. In this mode prompting is disabled, and the normal mailcap command field is not executed. Instead mimeview will execute the command specified in the print field. If there is nothing in the print field, the mailcap entry is ignored and the search continues for a matching mailcap entry that does have a print field.

Notice, that unlike in metamail -h, this option does not force mimeview to send the output to the printer daemon.

When used with --metamail option, this option passes -h flag to the invocation of metamail.

By default mimeview behaves as if given --no-interactive option whenever its standard input is not a tty device.

-n
--dry-run
Do not do anything, just print what whould be done. Implies --debug=1, unless the debugging level is set up explicitely.
-t file
--mimetypes file
Use file as mime.types file. If file is a directory, use file/mime.types

Footnotes

[1] The exact location is determined at configuration time by setting environment variable DEFAULT_CUPS_CONFDIR. On most sites running

     ./configure DEFAULT_CUPS_CONFDIR=/etc/cups

should be recommended.