]>
diplodocus.org Git - nmh/blob - sbr/mime_type.h
1 /* mime_type.h -- determine the MIME Content-Type of a file.
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.
8 /* Return a MIME content-type string for the specified file.
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.
18 * filename - The name of the file to determine the MIME type of.
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
25 char *mime_type(const char *filename
);