1.fp 5 CW
2.de Af
3.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5..
6.de aF
7.ie \\$3 .ft \\$1
8.el \{\
9.ds ;G \&
10.nr ;G \\n(.f
11.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12\\*(;G
13.ft \\n(;G \}
14..
15.de L
16.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17..
18.de LR
19.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20..
21.de RL
22.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23..
24.de EX		\" start example
25.ta 1i 2i 3i 4i 5i 6i
26.PP
27.RS 
28.PD 0
29.ft 5
30.nf
31..
32.de EE		\" end example
33.fi
34.ft
35.PD
36.RE
37.PP
38..
39.TH MIME 3
40.SH NAME
41mime \- mime/mailcap interface
42.SH SYNOPSIS
43.EX
44#include <mime.h>
45
46Mime_t
47{
48	unsigned long	flags;
49};
50
51Mime_t*   mimeopen(unsigned long \fIflags\fP);
52void      mimeclose(Mime_t* \fImime\fP);
53
54int       mimeload(Mime_t* \fImime\fP, const char* \fIpath\fP, unsigned long \fIflags\fP);
55int       mimelist(Mime_t* \fImime\fP, Sfio_t* \fIsp\fP, const char* \fIpattern\fP);
56
57char*     mimeview(Mime_t* \fImime\fP, const char* \fIview\fP, const char* \fIname\fP, const char* \fItype\fP, const char* \fIopts\fP);
58int       mimeset(Mime_t* \fImime\fP, char* \fIline\fP, unsigned long \fIflags\fP);
59.EE
60.SH DESCRIPTION
61These routines provide an interface to the MIME type database.
62.L mimeopen
63returns a mime session handle that is passed to all of the other routines.
64The
65.I flags 
66argument is currently unused.
67.PP
68.L mimeclose
69closes the mime session.
70.PP
71.L mimeload
72loads the mime file named by
73.I path
74into the mime session.
75.I flags
76may be one of:
77.TP
78.L MIME_LIST
79The
80.I path
81argument is a
82.B :
83separated list of pathnames, each of which is loaded.
84Non-existent files are ignored
85.L MIME_LIST
86set.
87.TP
88.L MIME_REPLACE
89Replace existing entries by new entries with the same type.
90Otherwise original entries take precedence.
91.PP
92More than one mime file can be loaded into a session;
93the files are searched in load order.
94If
95.I path
96is 
97.L 0
98then the default mime file is loaded.
99.PP
100.L mimelist
101lists the mime file contents on the
102.IR sfio (3)
103stream
104.IR sp .
105This is used for debugging mime entries.
106.PP
107.L mimetype
108returns the type string for
109.IR path .
110.L mimetype
111always returns a non-null string.
112If errors are encounterd on
113.I path
114then the return value will be
115.LR "error" .
116.SH "SEE ALSO"
117file(1), mime(4)
118