From: Ralph Corderoy Date: Tue, 16 May 2017 09:59:07 +0000 (+0100) Subject: sbr/mime_type.c: Move prototype from h/prototypes.h to new header. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/9218e2cd90aabd1d559b2bd0a594a92f72e92447?ds=sidebyside;hp=--cc sbr/mime_type.c: Move prototype from h/prototypes.h to new header. --- 9218e2cd90aabd1d559b2bd0a594a92f72e92447 diff --git a/Makefile.am b/Makefile.am index dfcd6885..53eb99e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -365,6 +365,7 @@ noinst_HEADERS = \ sbr/m_rand.h \ sbr/makedir.h \ sbr/message_id.h \ + sbr/mime_type.h \ thirdparty/jsmn/jsmn.h \ uip/mhfree.h \ uip/mhoutsbr.h \ diff --git a/h/prototypes.h b/h/prototypes.h index 89ba298f..9a2b41a4 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -234,26 +234,6 @@ char *m_name (int); void m_unknown(m_getfld_state_t *, FILE *); -/* - * Return a MIME content-type string for the specified file. - * - * If the system supports it, will use the "file" command to determine - * the appropriate content-type. Otherwise it will try to determine the - * content-type from the suffix. If that fails, the file will be scanned - * and either assigned a MIME type of text/plain or application/octet-stream - * depending if binary content is present. - * - * Arguments: - * - * filename - The name of the file to determine the MIME type of. - * - * Returns a pointer to a content-type string (which may include MIME - * parameters, such as charset). Returns a NULL if it cannot determine - * the MIME type of the file. Returns allocated storage that must be - * free'd. - */ -char *mime_type(const char *filename); - /* * Clear the screen, using the appropriate entry from the terminfo database */ diff --git a/sbr/mime_type.c b/sbr/mime_type.c index 379c248d..f1b96fe5 100644 --- a/sbr/mime_type.c +++ b/sbr/mime_type.c @@ -8,6 +8,7 @@ #include #include #include +#include "mime_type.h" #ifdef MIMETYPEPROC static char *get_file_info(const char *, const char *); diff --git a/sbr/mime_type.h b/sbr/mime_type.h new file mode 100644 index 00000000..242125f9 --- /dev/null +++ b/sbr/mime_type.h @@ -0,0 +1,25 @@ +/* mime_type.h -- determine the MIME Content-Type of a file. + * + * This code is Copyright (c) 2017, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. + */ + +/* Return a MIME content-type string for the specified file. + * + * If the system supports it, will use the "file" command to determine + * the appropriate content-type. Otherwise it will try to determine the + * content-type from the suffix. If that fails, the file will be scanned + * and either assigned a MIME type of text/plain or application/octet-stream + * depending if binary content is present. + * + * Arguments: + * + * filename - The name of the file to determine the MIME type of. + * + * Returns a pointer to a content-type string (which may include MIME + * parameters, such as charset). Returns a NULL if it cannot determine + * the MIME type of the file. Returns allocated storage that must be + * free'd. + */ +char *mime_type(const char *filename); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 7fabd2cb..982d1047 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -24,6 +24,7 @@ #include #include "../sbr/m_mktemp.h" #include "../sbr/message_id.h" +#include "../sbr/mime_type.h" #include "mhfree.h" #include "mhshowsbr.h" diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 4b880b47..aed480ea 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -13,6 +13,7 @@ #include #include "../sbr/m_maildir.h" #include "../sbr/m_mktemp.h" +#include "../sbr/mime_type.h" #include "mhfree.h" #include "mhoutsbr.h" #include "mhshowsbr.h" diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index cd7011c0..164a552a 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -46,6 +46,7 @@ #endif #include "../sbr/m_maildir.h" #include "../sbr/m_mktemp.h" +#include "../sbr/mime_type.h" #define WHATNOW_SWITCHES \ X("draftfolder +folder", 0, DFOLDSW) \