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