]> git.ipfire.org Git - thirdparty/cups.git/blame - man/mime.types.5
Greatly simplify the man page handling.
[thirdparty/cups.git] / man / mime.types.5
CommitLineData
ef416fc2 1.\"
27e0d6f8 2.\" mime.types man page for CUPS.
ef416fc2 3.\"
87030afb
MS
4.\" Copyright © 2007-2019 by Apple Inc.
5.\" Copyright © 1997-2006 by Easy Software Products.
ef416fc2 6.\"
87030afb
MS
7.\" Licensed under Apache License v2.0. See the file "LICENSE" for more
8.\" information.
ef416fc2 9.\"
87030afb 10.TH mime.types 5 "CUPS" "26 April 2019" "Apple Inc."
ef416fc2 11.SH NAME
12mime.types \- mime type description file for cups
13.SH DESCRIPTION
27e0d6f8 14The \fBmime.types\fR file defines the recognized file types.
ef416fc2 15.LP
27e0d6f8 16Additional file types are specified in files with the extension \fI.types\fR in the CUPS configuration directory.
ef416fc2 17.LP
27e0d6f8
MS
18Each line in the \fBmime.types\fR file is a comment, blank, or rule line.
19Comment lines start with the # character.
20Rule lines start with the MIME media type and are optionally followed by a series of file recognition rules:
ef416fc2 21.nf
22
27e0d6f8
MS
23 \fImime/type \fR[ \fIrule \fR... \fIrule \fR]
24
25.fi
26Rules can be extended over multiple lines using the backslash character (\\):
27.nf
28
29 \fImime/type \fR[ \fIreally-really-really-long-rule \fR... \fB\\
30 \fIrule \fR]
31
ef416fc2 32.fi
27e0d6f8
MS
33MIME media types specified by the \fImime/type\fR field are case-insensitive and are sorted in ascending alphanumeric order for the purposes of matching.
34See the "TYPE MATCHING AND PRIORITY" section for more information.
68b10830 35.LP
27e0d6f8
MS
36The rules may be grouped using parenthesis, joined using "+" for a logical AND, joined using "," or whitespace for a logical OR, and negated using "!".
37.SS RULES
ef416fc2 38Rules take two forms - a filename extension by itself and functions with test
27e0d6f8
MS
39values inside parenthesis.
40The following functions are available:
ef416fc2 41.TP 5
27e0d6f8
MS
42\fBmatch("\fIpattern\fB")\fR
43True if the filename matches the given shell wildcard \fIpattern\fR.
ef416fc2 44.TP 5
27e0d6f8
MS
45\fBascii(\fIoffset\fB,\fIlength\fB)\fR
46True if the \fIlength\fR bytes starting at \fIoffset\fR are valid printable ASCII (CR, NL, TAB, BS, 32-126).
ef416fc2 47.TP 5
27e0d6f8
MS
48\fBprintable(\fIoffset\fB,\fIlength\fB)\fR
49True if the \fIlength\fR bytes starting at \fIoffset\fR are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254).
ef416fc2 50.TP 5
27e0d6f8
MS
51\fBpriority(\fInumber\fB)\fR
52Specifies the relative priority of this MIME media type.
53The default priority is 100.
dd1abb6b
MS
54Larger values have higher priority while smaller values have lower priority.
55.TP 5
27e0d6f8
MS
56\fBstring(\fIoffset\fB,"\fIstring\fB")\fR
57True if the bytes starting at \fIoffset\fR are identical to \fIstring\fR.
ef416fc2 58.TP 5
27e0d6f8
MS
59\fBistring(\fIoffset\fB,"\fIstring\fB")\fR
60True if the bytes starting at \fIoffset\fR match \fIstring\fR without respect to case.
ef416fc2 61.TP 5
27e0d6f8
MS
62\fBchar(\fIoffset\fB,\fIvalue\fB)\fR
63True if the byte at \fIoffset\fR is identical to \fIvalue\fR.
ef416fc2 64.TP 5
27e0d6f8
MS
65\fBshort(\fIoffset\fB,\fIvalue\fB)\fR
66True if the 16-bit big-endian integer at \fIoffset\fR is identical to \fIvalue\fR.
ef416fc2 67.TP 5
27e0d6f8
MS
68\fBint(\fIoffset\fB,\fIvalue\fB)\fR
69True if the 32-bit big-endian integer at \fIoffset\fR is identical to \fIvalue\fR.
ef416fc2 70.TP 5
27e0d6f8
MS
71\fBlocale("\fIstring\fB")\fR
72True if current locale matches \fIstring\fR.
ef416fc2 73.TP 5
27e0d6f8
MS
74\fBcontains(\fIoffset\fB,\fIrange\fB,"\fIstring\fB")\fR
75True if the bytes starting at \fIoffset\fR for \fIrange\fR bytes contains \fIstring\fR.
76.SS STRING CONSTANTS
77String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings.
78.SS TYPE MATCHING AND PRIORITY
79When CUPS needs to determine the MIME media type of a given file, it checks every MIME media type defined in the \fI.types\fR files.
80When 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.
81If the types have the same priority, the type names are sorted alphanumerically in ascending order and the first type is chosen.
68b10830
MS
82.LP
83For example, if two types "text/bar" and "text/foo" are defined as matching the
84extension "doc", normally the type "text/bar" will be chosen since its name is
27e0d6f8
MS
85alphanumerically smaller than "text/foo".
86However, if "text/foo" also defines a higher priority than "text/bar", "text/foo" will be chosen instead.
87.SH FILES
88\fI/etc/cups\fR - Typical CUPS configuration directory.
89.SH EXAMPLES
90Define two MIME media types for raster data, with one being a subset with higher priority:
91.nf
92
93 application/vnd.cups\-raster string(0,"RaSt") string(0,"tSaR") \\
94 string(0,"RaS2") string(0,"2SaR") \\
95 string(0,"RaS3") string(0,"3SaR")
96
97 image/pwg-raster string(0,"RaS2") + \\
98 string(4,PwgRaster<00>) priority(150)
99.fi
ef416fc2 100.SH SEE ALSO
27e0d6f8
MS
101.BR cups-files.conf (5),
102.BR cupsd.conf (5),
103.BR cupsd (8),
104.BR cupsfilter (8),
105.BR mime.convs (5),
106CUPS Online Help (http://localhost:631/help)
ef416fc2 107.SH COPYRIGHT
87030afb 108Copyright \[co] 2007-2019 by Apple Inc.