]>
Commit | Line | Data |
---|---|---|
c277f98c | 1 | <!DOCTYPE HTML> |
94436c5a MS |
2 | <html> |
3 | <!-- SECTION: Man Pages --> | |
4 | <head> | |
5 | <link rel="stylesheet" type="text/css" href="../cups-printable.css"> | |
6 | <title>mime.types(5)</title> | |
7 | </head> | |
8 | <body> | |
9 | <h1 class="title">mime.types(5)</h1> | |
10 | <h2 class="title"><a name="NAME">Name</a></h2> | |
11 | mime.types - mime type description file for cups | |
12 | <h2 class="title"><a name="DESCRIPTION">Description</a></h2> | |
27e0d6f8 MS |
13 | The <b>mime.types</b> file defines the recognized file types. |
14 | <p>Additional file types are specified in files with the extension <i>.types</i> in the CUPS configuration directory. | |
15 | <p>Each line in the <b>mime.types</b> file is a comment, blank, or rule line. | |
16 | Comment lines start with the # character. | |
17 | Rule lines start with the MIME media type and are optionally followed by a series of file recognition rules: | |
2909c66c | 18 | <pre class="man"> |
94436c5a | 19 | |
27e0d6f8 MS |
20 | <i>mime/type </i>[ <i>rule </i>... <i>rule </i>] |
21 | ||
22 | </pre> | |
23 | Rules can be extended over multiple lines using the backslash character (\): | |
24 | <pre class="man"> | |
25 | ||
26 | <i>mime/type </i>[ <i>really-really-really-long-rule </i>... <b>\ | |
27 | </b><i>rule </i>] | |
28 | ||
94436c5a | 29 | </pre> |
27e0d6f8 MS |
30 | MIME media types specified by the <i>mime/type</i> field are case-insensitive and are sorted in ascending alphanumeric order for the purposes of matching. |
31 | See the "TYPE MATCHING AND PRIORITY" section for more information. | |
32 | <p>The rules may be grouped using parenthesis, joined using "+" for a logical AND, joined using "," or whitespace for a logical OR, and negated using "!". | |
33 | <h3><a name="RULES">Rules</a></h3> | |
94436c5a | 34 | Rules take two forms - a filename extension by itself and functions with test |
27e0d6f8 MS |
35 | values inside parenthesis. |
36 | The following functions are available: | |
2909c66c | 37 | <dl class="man"> |
27e0d6f8 MS |
38 | <dt><b>match("</b><i>pattern</i><b>")</b> |
39 | <dd style="margin-left: 5.0em">True if the filename matches the given shell wildcard <i>pattern</i>. | |
40 | <dt><b>ascii(</b><i>offset</i><b>,</b><i>length</i><b>)</b> | |
41 | <dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are valid printable ASCII (CR, NL, TAB, BS, 32-126). | |
42 | <dt><b>printable(</b><i>offset</i><b>,</b><i>length</i><b>)</b> | |
43 | <dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). | |
44 | <dt><b>priority(</b><i>number</i><b>)</b> | |
45 | <dd style="margin-left: 5.0em">Specifies the relative priority of this MIME media type. | |
46 | The default priority is 100. | |
94436c5a | 47 | Larger values have higher priority while smaller values have lower priority. |
27e0d6f8 MS |
48 | <dt><b>string(</b><i>offset</i><b>,"</b><i>string</i><b>")</b> |
49 | <dd style="margin-left: 5.0em">True if the bytes starting at <i>offset</i> are identical to <i>string</i>. | |
50 | <dt><b>istring(</b><i>offset</i><b>,"</b><i>string</i><b>")</b> | |
51 | <dd style="margin-left: 5.0em">True if the bytes starting at <i>offset</i> match <i>string</i> without respect to case. | |
52 | <dt><b>char(</b><i>offset</i><b>,</b><i>value</i><b>)</b> | |
53 | <dd style="margin-left: 5.0em">True if the byte at <i>offset</i> is identical to <i>value</i>. | |
54 | <dt><b>short(</b><i>offset</i><b>,</b><i>value</i><b>)</b> | |
55 | <dd style="margin-left: 5.0em">True if the 16-bit big-endian integer at <i>offset</i> is identical to <i>value</i>. | |
56 | <dt><b>int(</b><i>offset</i><b>,</b><i>value</i><b>)</b> | |
57 | <dd style="margin-left: 5.0em">True if the 32-bit big-endian integer at <i>offset</i> is identical to <i>value</i>. | |
58 | <dt><b>locale("</b><i>string</i><b>")</b> | |
59 | <dd style="margin-left: 5.0em">True if current locale matches <i>string</i>. | |
60 | <dt><b>contains(</b><i>offset</i><b>,</b><i>range</i><b>,"</b><i>string</i><b>")</b> | |
61 | <dd style="margin-left: 5.0em">True if the bytes starting at <i>offset</i> for <i>range</i> bytes contains <i>string</i>. | |
2909c66c | 62 | </dl> |
27e0d6f8 MS |
63 | <h3><a name="STRING_CONSTANTS">String Constants</a></h3> |
64 | String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings. | |
65 | <h3><a name="TYPE_MATCHING_AND_PRIORITY">Type Matching And Priority</a></h3> | |
66 | When CUPS needs to determine the MIME media type of a given file, it checks every MIME media type defined in the <i>.types</i> files. | |
67 | When two or more types match a given file, the type chosen will depend on the type name and priority, with higher-priority types being used over lower-priority ones. | |
68 | If the types have the same priority, the type names are sorted alphanumerically in ascending order and the first type is chosen. | |
94436c5a MS |
69 | <p>For example, if two types "text/bar" and "text/foo" are defined as matching the |
70 | extension "doc", normally the type "text/bar" will be chosen since its name is | |
27e0d6f8 MS |
71 | alphanumerically smaller than "text/foo". |
72 | However, if "text/foo" also defines a higher priority than "text/bar", "text/foo" will be chosen instead. | |
73 | <h2 class="title"><a name="FILES">Files</a></h2> | |
74 | <i>/etc/cups</i> - Typical CUPS configuration directory. | |
75 | <h2 class="title"><a name="EXAMPLES">Examples</a></h2> | |
76 | Define two MIME media types for raster data, with one being a subset with higher priority: | |
77 | <pre class="man"> | |
78 | ||
79 | application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \ | |
80 | string(0,"RaS2") string(0,"2SaR") \ | |
81 | string(0,"RaS3") string(0,"3SaR") | |
82 | ||
83 | image/pwg-raster string(0,"RaS2") + \ | |
84 | string(4,PwgRaster<00>) priority(150) | |
85 | </pre> | |
94436c5a | 86 | <h2 class="title"><a name="SEE_ALSO">See Also</a></h2> |
d6395c6f MS |
87 | <a href="man-cups-files.conf.html?TOPIC=Man+Pages"><b>cups-files.conf</b>(5),</a> |
88 | <a href="man-cupsd.conf.html?TOPIC=Man+Pages"><b>cupsd.conf</b>(5),</a> | |
89 | <a href="man-cupsd.html?TOPIC=Man+Pages"><b>cupsd</b>(8),</a> | |
87030afb MS |
90 | <b>cupsfilter</b>(8), |
91 | <b>mime.convs</b>(5), | |
27e0d6f8 | 92 | CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>) |
94436c5a | 93 | <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2> |
87030afb | 94 | Copyright © 2007-2019 by Apple Inc. |
94436c5a MS |
95 | |
96 | </body> | |
97 | </html> |