-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreadme.mdoc
68 lines (67 loc) · 1.48 KB
/
readme.mdoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.Dd $Mdocdate$
.Dt libdsbmime 3
.Sh NAME
.Nm libdsbmime
.Nd "Library to determine file types"
.Sh SYNOPSIS
.In dsbmime.h
.Ft int
.Fn dsbmime_init "void"
.Ft char *
.Fn dsbmime_get_type "const char *file"
.Ft void
.Fn dsbmime_cleanup "void"
.Sh DESCRIPTION
.Nm
is a C library to identify a file's MIME type by using
freedesktop.org's Shared MIME database package.
.Pp
Before using any other function of the library,
.Fn dsbmime_init
must be called. The function
.Fn dsbmime_get_type
returns the MIME type of the given
.Em file
as a string stored in a static buffer. Subsequent calls
to the same function will modify that buffer. In order to free memory used
by the library, the function
.Fn dsbmime_cleanup
can be called.
.Sh RETURN VALUES
.Fn dsbmime_init
returns -1 if an error has occurred, else 0.
.Fn dsbmime_get_type
returns a pointer to a string containing the
.Em file Ns 's
MIME type, or
.Dv NULL
if the file type could not be determined. If
an error has occurred,
.Dv NULL
is returned and
.Em errno
is set.
.Sh INSTALLATION
.Bd -literal
# make install
.Ed
.Pp
or if you're not happy with the predefined PREFIX:
.Bd -literal
# make PREFIX=/somewhere/else install
.Ed
.Ss DEPENDENCIES
.Nm
needs freedsktop.org's Shared MIME database package.
.Sh INSTALLED FILES
.Bl -tag -width ${PREFIX}/man/man3/libdsbmime.3.gz -compact
.It Pa ${PREFIX}/include/dsbmime.h
Include file
.It Pa ${PREFIX}/lib/libdsbmime.a
Static library file
.It Pa ${PREFIX}/man/man3/libdsbmime.3.gz
Manunal page
.El
.Sh EXAMPLES
See
.Em test.c