]> diplodocus.org Git - nmh/blob - sbr/mime_type.h
Fix invalid pointer arithmetic.
[nmh] / sbr / mime_type.h
1 /* mime_type.h -- determine the MIME Content-Type of a file.
2 *
3 * This code is Copyright (c) 2017, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 /* Return a MIME content-type string for the specified file.
9 *
10 * If the system supports it, will use the "file" command to determine
11 * the appropriate content-type. Otherwise it will try to determine the
12 * content-type from the suffix. If that fails, the file will be scanned
13 * and either assigned a MIME type of text/plain or application/octet-stream
14 * depending if binary content is present.
15 *
16 * Arguments:
17 *
18 * filename - The name of the file to determine the MIME type of.
19 *
20 * Returns a pointer to a content-type string (which may include MIME
21 * parameters, such as charset). Returns a NULL if it cannot determine
22 * the MIME type of the file. Returns allocated storage that must be
23 * free'd.
24 */
25 char *mime_type(const char *filename);