]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/api-mime.html
Move CGI, PPD compiler, and MIME heades to the private headers directory.
[thirdparty/cups.git] / doc / help / api-mime.html
CommitLineData
f11a948a
MS
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- SECTION: Programming -->
4<head>
0268488e
MS
5 <title>MIME API </title>
6 <meta name="keywords" content="Programming">
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
dd3fdd2c 8 <meta name="creator" content="Mini-XML v2.7">
f11a948a
MS
9<style type="text/css"><!--
10BODY {
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
12}
13
14H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
16}
17
18KBD {
19 font-family: monaco, courier, monospace;
20 font-weight: bold;
21}
22
23PRE {
24 font-family: monaco, courier, monospace;
25}
26
27PRE.command {
10d09e33 28 border: dotted thin #7f7f7f;
f11a948a 29 margin-left: 36pt;
10d09e33 30 padding: 10px;
f11a948a
MS
31}
32
33P.compact {
34 margin: 0;
35}
36
37P.example {
38 font-style: italic;
39 margin-left: 36pt;
40}
ca6b43fc 41
240214ef
MS
42DL.man DD {
43 margin-left: 5em;
44}
45
46DL.man DT {
47 margin-left: 0;
48}
49
50PRE.man {
51 margin: 0;
52}
53
f11a948a
MS
54PRE.example {
55 background: #eeeeee;
56 border: dotted thin #999999;
57 margin-left: 36pt;
178cb736 58 padding: 10pt;
f11a948a
MS
59}
60
61PRE.command EM, PRE.example EM {
62 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
63}
64
65P.command {
66 font-family: monaco, courier, monospace;
67 margin-left: 36pt;
68}
69
70P.formula {
71 font-style: italic;
72 margin-left: 36pt;
73}
74
75BLOCKQUOTE {
178cb736 76 background: #eeeeee;
f11a948a
MS
77 border: solid thin #999999;
78 padding: 10pt;
79}
80
81A IMG {
82 border: none;
83}
84
85A:link:hover IMG {
86 background: #f0f0f0;
87 border-radius: 10px;
88 -moz-border-radius: 10px;
89}
90
91A:link, A:visited {
ca6b43fc 92 font-weight: inherit;
f11a948a
MS
93 text-decoration: none;
94}
95
96A:link:hover, A:visited:hover, A:active {
97 text-decoration: underline;
98}
99
100SUB, SUP {
101 font-size: 50%;
102}
103
104TR.data, TD.data, TR.data TD {
105 margin-top: 10pt;
106 padding: 5pt;
107 border-bottom: solid 1pt #999999;
108}
109
110TR.data TH {
111 border-bottom: solid 1pt #999999;
112 padding-top: 10pt;
113 padding-left: 5pt;
114 text-align: left;
115}
116
117DIV.table TABLE {
118 border: solid thin #999999;
119 border-collapse: collapse;
120 border-spacing: 0;
121 margin-left: auto;
122 margin-right: auto;
123}
124
125DIV.table CAPTION {
126 caption-side: top;
127 font-size: 120%;
128 font-style: italic;
129 font-weight: bold;
130 margin-left: auto;
131 margin-right: auto;
132}
133
134DIV.table TABLE TD {
135 border: solid thin #cccccc;
136 padding-top: 5pt;
137}
138
139DIV.table TABLE TH {
140 background: #cccccc;
141 border: none;
142 border-bottom: solid thin #999999;
143}
144
145DIV.figure TABLE {
146 margin-left: auto;
147 margin-right: auto;
148}
149
150DIV.figure CAPTION {
151 caption-side: bottom;
152 font-size: 120%;
153 font-style: italic;
154 font-weight: bold;
155 margin-left: auto;
156 margin-right: auto;
157}
158
159TH.label {
160 text-align: right;
161 vertical-align: top;
162}
163
164TH.sublabel {
165 text-align: right;
166 font-weight: normal;
167}
168
169HR {
170 border: solid thin;
171}
172
173SPAN.info {
174 background: black;
175 border: thin solid black;
176 color: white;
177 font-size: 80%;
178 font-style: italic;
179 font-weight: bold;
180 white-space: nowrap;
181}
182
183H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
184 float: right;
185 font-size: 100%;
186}
187
178cb736
MS
188H1.title {
189}
190
f11a948a
MS
191H2.title, H3.title {
192 border-bottom: solid 2pt #000000;
193}
194
195DIV.indent, TABLE.indent {
196 margin-top: 2em;
197 margin-left: auto;
198 margin-right: auto;
199 width: 90%;
200}
201
202TABLE.indent {
203 border-collapse: collapse;
204}
205
206TABLE.indent TD, TABLE.indent TH {
207 padding: 0;
208}
209
210TABLE.list {
211 border-collapse: collapse;
212 margin-left: auto;
213 margin-right: auto;
214 width: 90%;
215}
216
217TABLE.list TH {
218 background: white;
219 border-bottom: solid thin #cccccc;
220 color: #444444;
221 padding-top: 10pt;
222 padding-left: 5pt;
223 text-align: left;
224 vertical-align: bottom;
225 white-space: nowrap;
226}
227
228TABLE.list TH A {
229 color: #4444cc;
230}
231
232TABLE.list TD {
233 border-bottom: solid thin #eeeeee;
234 padding-top: 5pt;
235 padding-left: 5pt;
236}
237
238TABLE.list TR:nth-child(even) {
239 background: #f8f8f8;
240}
241
242TABLE.list TR:nth-child(odd) {
243 background: #f4f4f4;
244}
245
246DT {
247 margin-left: 36pt;
248 margin-top: 12pt;
249}
250
251DD {
252 margin-left: 54pt;
253}
254
255DL.category DT {
256 font-weight: bold;
257}
258
259P.summary {
260 margin-left: 36pt;
261 font-family: monaco, courier, monospace;
262}
263
264DIV.summary TABLE {
265 border: solid thin #999999;
266 border-collapse: collapse;
267 border-spacing: 0;
268 margin: 10px;
269}
270
271DIV.summary TABLE TD, DIV.summary TABLE TH {
272 border: solid thin #999999;
273 padding: 5px;
274 text-align: left;
275 vertical-align: top;
276}
277
278DIV.summary TABLE THEAD TH {
279 background: #eeeeee;
280}
281
282/* API documentation styles... */
283div.body h1 {
284 margin: 0;
285}
286div.body h2 {
287 margin-top: 1.5em;
288}
289div.body h3, div.body h4, div.body h5 {
290 margin-bottom: 0.5em;
291 margin-top: 1.5em;
292}
293.class, .enumeration, .function, .struct, .typedef, .union {
294 border-bottom: solid thin #999999;
295 margin-bottom: 0;
296 margin-top: 2em;
297}
298.description {
299 margin-top: 0.5em;
300}
301code, p.code, pre, ul.code li {
302 font-family: monaco, courier, monospace;
303 font-size: 90%;
304}
305ul.code, ul.contents, ul.subcontents {
306 list-style-type: none;
307 margin: 0;
308 padding-left: 0;
309}
310ul.code li {
311 margin: 0;
312}
313ul.contents > li {
314 margin-top: 1em;
315}
316ul.contents li ul.code, ul.contents li ul.subcontents {
317 padding-left: 2em;
318}
319div.body dl {
320 margin-left: 0;
321 margin-top: 0;
322}
323div.body dt {
324 font-style: italic;
325 margin-left: 0;
326 margin-top: 0;
327}
328div.body dd {
329 margin-bottom: 0.5em;
330}
331
332/* This is just for the HTML files generated with the framedhelp target */
333div.contents {
334 background: #e8e8e8;
335 border: solid thin black;
336 padding: 10px;
337}
338div.contents h1 {
339 font-size: 110%;
340}
341div.contents h2 {
342 font-size: 100%;
343}
344div.contents ul.contents {
345 font-size: 80%;
346}
347div.contents ul.subcontents li {
348 margin-left: 1em;
349 text-indent: -1em;
350}
351--></style>
352</head>
353<body>
354<div class='body'>
178cb736 355<!--
178cb736
MS
356 MIME API header for CUPS.
357
358 Copyright 2009 by Apple Inc.
359
360 These coded instructions, statements, and computer programs are the
361 property of Apple Inc. and are protected by Federal copyright
362 law. Distribution and use rights are outlined in the file "LICENSE.txt"
363 which should have been included with this file. If this file is
364 file is missing or damaged, see the license at "http://www.cups.org/".
365-->
366
367<h1 class='title'>MIME API</h1>
368
369<div class='summary'><table summary='General Information'>
370<thead>
371<tr>
372 <th>Header</th>
373 <th>cups/mime.h</th>
374</tr>
375</thead>
376<tbody>
377<tr>
378 <th>Library</th>
379 <td>-lcupsmime</td>
380</tr>
381<tr>
382 <th>See Also</th>
383 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
384</tr>
385</tbody>
386</table></div>
f11a948a
MS
387<h2 class="title">Contents</h2>
388<ul class="contents">
178cb736 389<li><a href="#OVERVIEW">Overview</a></li>
f11a948a 390<li><a href="#FUNCTIONS">Functions</a><ul class="code">
0268488e
MS
391 <li><a href="#mimeAddFilter" title="Add a filter to the current MIME database.">mimeAddFilter</a></li>
392 <li><a href="#mimeAddType" title="Add a MIME type to a database.">mimeAddType</a></li>
393 <li><a href="#mimeAddTypeRule" title="Add a detection rule for a file type.">mimeAddTypeRule</a></li>
394 <li><a href="#mimeDelete" title="Delete (free) a MIME database.">mimeDelete</a></li>
395 <li><a href="#mimeDeleteFilter" title="Delete a filter from the MIME database.">mimeDeleteFilter</a></li>
396 <li><a href="#mimeDeleteType" title="Delete a type from the MIME database.">mimeDeleteType</a></li>
397 <li><a href="#mimeFileType" title="Determine the type of a file.">mimeFileType</a></li>
398 <li><a href="#mimeFilter" title="Find the fastest way to convert from one type to another.">mimeFilter</a></li>
22c9029b
MS
399 <li><a href="#mimeFilter2" title="Find the fastest way to convert from one type to another,
400including file size.">mimeFilter2</a></li>
401 <li><a href="#mimeFilterLookup" title="Lookup a filter.">mimeFilterLookup</a></li>
0268488e
MS
402 <li><a href="#mimeFirstFilter" title="Get the first filter in the MIME database.">mimeFirstFilter</a></li>
403 <li><a href="#mimeFirstType" title="Get the first type in the MIME database.">mimeFirstType</a></li>
404 <li><a href="#mimeLoad" title="Create a new MIME database from disk.">mimeLoad</a></li>
405 <li><a href="#mimeLoadFilters" title="Load filter definitions from disk.">mimeLoadFilters</a></li>
406 <li><a href="#mimeLoadTypes" title="Load type definitions from disk.">mimeLoadTypes</a></li>
321d8d57 407 <li><a href="#mimeNew" title="Create a new, empty MIME database.">mimeNew</a></li>
0268488e
MS
408 <li><a href="#mimeNextFilter" title="Get the next filter in the MIME database.">mimeNextFilter</a></li>
409 <li><a href="#mimeNextType" title="Get the next type in the MIME database.">mimeNextType</a></li>
22c9029b 410 <li><a href="#mimeNumFilters" title="Next type">mimeNumFilters</a></li>
0268488e 411 <li><a href="#mimeNumTypes" title="MIME database">mimeNumTypes</a></li>
321d8d57 412 <li><a href="#mimeSetErrorCallback" title="Set the callback for error messages.">mimeSetErrorCallback</a></li>
0268488e 413 <li><a href="#mimeType" title="Lookup a file type.">mimeType</a></li>
f11a948a
MS
414</ul></li>
415<li><a href="#TYPES">Data Types</a><ul class="code">
321d8d57 416 <li><a href="#const" title="MIME Database">const</a></li>
f11a948a
MS
417 <li><a href="#mime_filter_t" title="MIME Conversion Filter Data">mime_filter_t</a></li>
418 <li><a href="#mime_magic_t" title="MIME Magic Data">mime_magic_t</a></li>
419 <li><a href="#mime_op_t" title="Types/structures...">mime_op_t</a></li>
420 <li><a href="#mime_t" title="MIME Database">mime_t</a></li>
421 <li><a href="#mime_type_t" title="MIME Type Data">mime_type_t</a></li>
422</ul></li>
0268488e 423</ul>
178cb736 424<!--
178cb736
MS
425 MIME API introduction for CUPS.
426
427 Copyright 2009 by Apple Inc.
428
429 These coded instructions, statements, and computer programs are the
430 property of Apple Inc. and are protected by Federal copyright
431 law. Distribution and use rights are outlined in the file "LICENSE.txt"
432 which should have been included with this file. If this file is
433 file is missing or damaged, see the license at "http://www.cups.org/".
434-->
435
436<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
437
438<p>The MIME API provides file typing and conversion services for CUPS.</p>
f11a948a
MS
439<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
440<h3 class="function"><a name="mimeAddFilter">mimeAddFilter</a></h3>
441<p class="description">Add a filter to the current MIME database.</p>
442<p class="code">
443<a href="#mime_filter_t">mime_filter_t</a> *mimeAddFilter (<br>
444&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
445&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
446&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
447&nbsp;&nbsp;&nbsp;&nbsp;int cost,<br>
321d8d57 448&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filter<br>
f11a948a
MS
449);</p>
450<h4 class="parameters">Parameters</h4>
451<dl>
452<dt>mime</dt>
453<dd class="description">MIME database</dd>
454<dt>src</dt>
455<dd class="description">Source type</dd>
456<dt>dst</dt>
457<dd class="description">Destination type</dd>
458<dt>cost</dt>
459<dd class="description">Relative time/resource cost</dd>
460<dt>filter</dt>
461<dd class="description">Filter program to run</dd>
462</dl>
463<h4 class="returnvalue">Return Value</h4>
464<p class="description">New filter</p>
465<h3 class="function"><a name="mimeAddType">mimeAddType</a></h3>
466<p class="description">Add a MIME type to a database.</p>
467<p class="code">
468<a href="#mime_type_t">mime_type_t</a> *mimeAddType (<br>
469&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
321d8d57
MS
470&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *super,<br>
471&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *type<br>
f11a948a
MS
472);</p>
473<h4 class="parameters">Parameters</h4>
474<dl>
475<dt>mime</dt>
476<dd class="description">MIME database</dd>
477<dt>super</dt>
478<dd class="description">Super-type name</dd>
479<dt>type</dt>
480<dd class="description">Type name</dd>
481</dl>
482<h4 class="returnvalue">Return Value</h4>
483<p class="description">New (or existing) MIME type</p>
484<h3 class="function"><a name="mimeAddTypeRule">mimeAddTypeRule</a></h3>
485<p class="description">Add a detection rule for a file type.</p>
486<p class="code">
487int mimeAddTypeRule (<br>
488&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *mt,<br>
321d8d57 489&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *rule<br>
f11a948a
MS
490);</p>
491<h4 class="parameters">Parameters</h4>
492<dl>
493<dt>mt</dt>
494<dd class="description">Type to add to</dd>
495<dt>rule</dt>
496<dd class="description">Rule to add</dd>
497</dl>
498<h4 class="returnvalue">Return Value</h4>
499<p class="description">0 on success, -1 on failure</p>
500<h3 class="function"><a name="mimeDelete">mimeDelete</a></h3>
501<p class="description">Delete (free) a MIME database.</p>
502<p class="code">
503void mimeDelete (<br>
504&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
505);</p>
506<h4 class="parameters">Parameters</h4>
507<dl>
508<dt>mime</dt>
509<dd class="description">MIME database</dd>
510</dl>
511<h3 class="function"><a name="mimeDeleteFilter">mimeDeleteFilter</a></h3>
512<p class="description">Delete a filter from the MIME database.</p>
513<p class="code">
514void mimeDeleteFilter (<br>
515&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
516&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_filter_t">mime_filter_t</a> *filter<br>
517);</p>
518<h4 class="parameters">Parameters</h4>
519<dl>
520<dt>mime</dt>
521<dd class="description">MIME database</dd>
522<dt>filter</dt>
523<dd class="description">Filter</dd>
524</dl>
525<h3 class="function"><a name="mimeDeleteType">mimeDeleteType</a></h3>
526<p class="description">Delete a type from the MIME database.</p>
527<p class="code">
528void mimeDeleteType (<br>
529&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
530&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *mt<br>
531);</p>
532<h4 class="parameters">Parameters</h4>
533<dl>
534<dt>mime</dt>
535<dd class="description">MIME database</dd>
536<dt>mt</dt>
537<dd class="description">Type</dd>
538</dl>
539<h3 class="function"><a name="mimeFileType">mimeFileType</a></h3>
540<p class="description">Determine the type of a file.</p>
541<p class="code">
542<a href="#mime_type_t">mime_type_t</a> *mimeFileType (<br>
543&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
321d8d57
MS
544&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
545&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filename,<br>
f11a948a
MS
546&nbsp;&nbsp;&nbsp;&nbsp;int *compression<br>
547);</p>
548<h4 class="parameters">Parameters</h4>
549<dl>
550<dt>mime</dt>
551<dd class="description">MIME database</dd>
552<dt>pathname</dt>
553<dd class="description">Name of file to check on disk</dd>
554<dt>filename</dt>
555<dd class="description">Original filename or NULL</dd>
556<dt>compression</dt>
557<dd class="description">Is the file compressed?</dd>
558</dl>
559<h4 class="returnvalue">Return Value</h4>
560<p class="description">Type of file</p>
561<h3 class="function"><a name="mimeFilter">mimeFilter</a></h3>
562<p class="description">Find the fastest way to convert from one type to another.</p>
563<p class="code">
564cups_array_t *mimeFilter (<br>
565&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
566&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
567&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
568&nbsp;&nbsp;&nbsp;&nbsp;int *cost<br>
569);</p>
570<h4 class="parameters">Parameters</h4>
571<dl>
572<dt>mime</dt>
573<dd class="description">MIME database</dd>
574<dt>src</dt>
575<dd class="description">Source file type</dd>
576<dt>dst</dt>
577<dd class="description">Destination file type</dd>
578<dt>cost</dt>
579<dd class="description">Cost of filters</dd>
580</dl>
581<h4 class="returnvalue">Return Value</h4>
582<p class="description">Array of filters to run</p>
22c9029b
MS
583<h3 class="function"><a name="mimeFilter2">mimeFilter2</a></h3>
584<p class="description">Find the fastest way to convert from one type to another,
585including file size.</p>
586<p class="code">
587cups_array_t *mimeFilter2 (<br>
588&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
589&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
590&nbsp;&nbsp;&nbsp;&nbsp;size_t srcsize,<br>
591&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
592&nbsp;&nbsp;&nbsp;&nbsp;int *cost<br>
593);</p>
594<h4 class="parameters">Parameters</h4>
595<dl>
596<dt>mime</dt>
597<dd class="description">MIME database</dd>
598<dt>src</dt>
599<dd class="description">Source file type</dd>
600<dt>srcsize</dt>
601<dd class="description">Size of source file</dd>
602<dt>dst</dt>
603<dd class="description">Destination file type</dd>
604<dt>cost</dt>
605<dd class="description">Cost of filters</dd>
606</dl>
607<h4 class="returnvalue">Return Value</h4>
608<p class="description">Array of filters to run</p>
f11a948a 609<h3 class="function"><a name="mimeFilterLookup">mimeFilterLookup</a></h3>
22c9029b 610<p class="description">Lookup a filter.</p>
f11a948a
MS
611<p class="code">
612<a href="#mime_filter_t">mime_filter_t</a> *mimeFilterLookup (<br>
613&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
614&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
615&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst<br>
616);</p>
617<h4 class="parameters">Parameters</h4>
618<dl>
619<dt>mime</dt>
620<dd class="description">MIME database</dd>
621<dt>src</dt>
622<dd class="description">Source type</dd>
623<dt>dst</dt>
624<dd class="description">Destination type</dd>
625</dl>
626<h4 class="returnvalue">Return Value</h4>
627<p class="description">Filter for src-&gt;dst</p>
628<h3 class="function"><a name="mimeFirstFilter">mimeFirstFilter</a></h3>
629<p class="description">Get the first filter in the MIME database.</p>
630<p class="code">
631<a href="#mime_filter_t">mime_filter_t</a> *mimeFirstFilter (<br>
632&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
633);</p>
634<h4 class="parameters">Parameters</h4>
635<dl>
636<dt>mime</dt>
637<dd class="description">MIME database</dd>
638</dl>
639<h4 class="returnvalue">Return Value</h4>
640<p class="description">Filter or NULL</p>
641<h3 class="function"><a name="mimeFirstType">mimeFirstType</a></h3>
642<p class="description">Get the first type in the MIME database.</p>
643<p class="code">
644<a href="#mime_type_t">mime_type_t</a> *mimeFirstType (<br>
645&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
646);</p>
647<h4 class="parameters">Parameters</h4>
648<dl>
649<dt>mime</dt>
650<dd class="description">MIME database</dd>
651</dl>
652<h4 class="returnvalue">Return Value</h4>
653<p class="description">Type or NULL</p>
654<h3 class="function"><a name="mimeLoad">mimeLoad</a></h3>
655<p class="description">Create a new MIME database from disk.</p>
656<p class="code">
657<a href="#mime_t">mime_t</a> *mimeLoad (<br>
321d8d57
MS
658&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
659&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filterpath<br>
f11a948a
MS
660);</p>
661<h4 class="parameters">Parameters</h4>
662<dl>
663<dt>pathname</dt>
664<dd class="description">Directory to load</dd>
665<dt>filterpath</dt>
666<dd class="description">Directory to load</dd>
667</dl>
668<h4 class="returnvalue">Return Value</h4>
669<p class="description">New MIME database</p>
670<h4 class="discussion">Discussion</h4>
671<p class="discussion">This function uses <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> and <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to
672create a MIME database from a single directory.</p>
673<h3 class="function"><a name="mimeLoadFilters">mimeLoadFilters</a></h3>
674<p class="description">Load filter definitions from disk.</p>
675<p class="code">
676<a href="#mime_t">mime_t</a> *mimeLoadFilters (<br>
677&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
321d8d57
MS
678&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
679&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filterpath<br>
f11a948a
MS
680);</p>
681<h4 class="parameters">Parameters</h4>
682<dl>
683<dt>mime</dt>
684<dd class="description">MIME database</dd>
685<dt>pathname</dt>
686<dd class="description">Directory to load from</dd>
687<dt>filterpath</dt>
688<dd class="description">Default filter program directory</dd>
689</dl>
690<h4 class="returnvalue">Return Value</h4>
691<p class="description">MIME database</p>
692<h4 class="discussion">Discussion</h4>
693<p class="discussion">This function loads all of the .convs files from the specified directory.
694Use <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to load all types before you load the filters.</p>
695<h3 class="function"><a name="mimeLoadTypes">mimeLoadTypes</a></h3>
696<p class="description">Load type definitions from disk.</p>
697<p class="code">
698<a href="#mime_t">mime_t</a> *mimeLoadTypes (<br>
699&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
321d8d57 700&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname<br>
f11a948a
MS
701);</p>
702<h4 class="parameters">Parameters</h4>
703<dl>
704<dt>mime</dt>
705<dd class="description">MIME database or <code>NULL</code> to create a new one</dd>
706<dt>pathname</dt>
707<dd class="description">Directory to load from</dd>
708</dl>
709<h4 class="returnvalue">Return Value</h4>
710<p class="description">MIME database</p>
711<h4 class="discussion">Discussion</h4>
712<p class="discussion">This function loads all of the .types files from the specified directory.
713Use <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> to load all filters after you load the types.</p>
321d8d57
MS
714<h3 class="function"><a name="mimeNew">mimeNew</a></h3>
715<p class="description">Create a new, empty MIME database.</p>
716<p class="code">
717<a href="#mime_t">mime_t</a> *mimeNew (void);</p>
718<h4 class="returnvalue">Return Value</h4>
719<p class="description">MIME database</p>
f11a948a
MS
720<h3 class="function"><a name="mimeNextFilter">mimeNextFilter</a></h3>
721<p class="description">Get the next filter in the MIME database.</p>
722<p class="code">
723<a href="#mime_filter_t">mime_filter_t</a> *mimeNextFilter (<br>
724&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
725);</p>
726<h4 class="parameters">Parameters</h4>
727<dl>
728<dt>mime</dt>
729<dd class="description">MIME database</dd>
730</dl>
731<h4 class="returnvalue">Return Value</h4>
732<p class="description">Filter or NULL</p>
733<h3 class="function"><a name="mimeNextType">mimeNextType</a></h3>
734<p class="description">Get the next type in the MIME database.</p>
735<p class="code">
736<a href="#mime_type_t">mime_type_t</a> *mimeNextType (<br>
737&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
738);</p>
739<h4 class="parameters">Parameters</h4>
740<dl>
741<dt>mime</dt>
742<dd class="description">MIME database</dd>
743</dl>
744<h4 class="returnvalue">Return Value</h4>
745<p class="description">Type or NULL</p>
746<h3 class="function"><a name="mimeNumFilters">mimeNumFilters</a></h3>
22c9029b 747<p class="description">Next type</p>
f11a948a
MS
748<p class="code">
749int mimeNumFilters (<br>
750&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
751);</p>
752<h4 class="parameters">Parameters</h4>
753<dl>
754<dt>mime</dt>
755<dd class="description">MIME database</dd>
756</dl>
757<h4 class="returnvalue">Return Value</h4>
758<p class="description">Get the number of filters in a MIME database.</p>
759<h3 class="function"><a name="mimeNumTypes">mimeNumTypes</a></h3>
760<p class="description">MIME database</p>
761<p class="code">
762int mimeNumTypes (<br>
763&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
764);</p>
765<h4 class="parameters">Parameters</h4>
766<dl>
767<dt>mime</dt>
768<dd class="description">MIME database</dd>
769</dl>
770<h4 class="returnvalue">Return Value</h4>
771<p class="description">Get the number of types in a MIME database.</p>
321d8d57
MS
772<h3 class="function"><a name="mimeSetErrorCallback">mimeSetErrorCallback</a></h3>
773<p class="description">Set the callback for error messages.</p>
774<p class="code">
775void mimeSetErrorCallback (<br>
776&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
777&nbsp;&nbsp;&nbsp;&nbsp;mime_error_cb_t cb,<br>
778&nbsp;&nbsp;&nbsp;&nbsp;void *ctx<br>
779);</p>
780<h4 class="parameters">Parameters</h4>
781<dl>
782<dt>mime</dt>
783<dd class="description">MIME database</dd>
784<dt>cb</dt>
785<dd class="description">Callback function</dd>
786<dt>ctx</dt>
787<dd class="description">Context pointer for callback</dd>
788</dl>
f11a948a
MS
789<h3 class="function"><a name="mimeType">mimeType</a></h3>
790<p class="description">Lookup a file type.</p>
791<p class="code">
792<a href="#mime_type_t">mime_type_t</a> *mimeType (<br>
793&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
321d8d57
MS
794&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *super,<br>
795&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *type<br>
f11a948a
MS
796);</p>
797<h4 class="parameters">Parameters</h4>
798<dl>
799<dt>mime</dt>
800<dd class="description">MIME database</dd>
801<dt>super</dt>
802<dd class="description">Super-type name</dd>
803<dt>type</dt>
804<dd class="description">Type name</dd>
805</dl>
806<h4 class="returnvalue">Return Value</h4>
807<p class="description">Matching file type definition</p>
808<h2 class="title"><a name="TYPES">Data Types</a></h2>
321d8d57
MS
809<h3 class="typedef"><a name="const">const</a></h3>
810<p class="description">MIME Database</p>
811<p class="code">
812typedef void (*constmime_error_cb_t)(void *;
813</p>
f11a948a
MS
814<h3 class="typedef"><a name="mime_filter_t">mime_filter_t</a></h3>
815<p class="description">MIME Conversion Filter Data</p>
816<p class="code">
817typedef struct _mime_filter_s mime_filter_t;
818</p>
819<h3 class="typedef"><a name="mime_magic_t">mime_magic_t</a></h3>
820<p class="description">MIME Magic Data</p>
821<p class="code">
822typedef struct _mime_magic_s mime_magic_t;
823</p>
824<h3 class="typedef"><a name="mime_op_t">mime_op_t</a></h3>
825<p class="description">Types/structures...</p>
826<p class="code">
827typedef enum mime_op_t;
828</p>
829<h3 class="typedef"><a name="mime_t">mime_t</a></h3>
830<p class="description">MIME Database</p>
831<p class="code">
832typedef struct _mime_s mime_t;
833</p>
834<h3 class="typedef"><a name="mime_type_t">mime_type_t</a></h3>
835<p class="description">MIME Type Data</p>
836<p class="code">
837typedef struct _mime_type_s mime_type_t;
838</p>
839</div>
840</body>
841</html>