From a1f79aa7a083e74292c0f0654010179082da7a94 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Sat, 11 Nov 2017 16:16:14 +0000 Subject: [PATCH] check_charset.c: Move interface to own file. --- Makefile.am | 1 + h/prototypes.h | 27 --------------------------- sbr/check_charset.c | 1 + sbr/check_charset.h | 31 +++++++++++++++++++++++++++++++ sbr/encode_rfc2047.c | 1 + sbr/fmt_rfc2047.c | 1 + uip/mhbuildsbr.c | 1 + uip/mhlsbr.c | 1 + uip/mhparse.c | 1 + uip/mhshowsbr.c | 1 + uip/show.c | 1 + 11 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 sbr/check_charset.h diff --git a/Makefile.am b/Makefile.am index 54d342b8..4a00aacc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -367,6 +367,7 @@ noinst_HEADERS = \ sbr/atooi.h \ sbr/base64.h \ sbr/brkstring.h \ + sbr/check_charset.h \ sbr/context_del.h \ sbr/context_find.h \ sbr/context_foil.h \ diff --git a/h/prototypes.h b/h/prototypes.h index c0a12b58..40037652 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -15,18 +15,6 @@ char *etcpath(char *) NONNULL(1); struct msgs_array; -/* - * Check to see if we can display a given character set natively. - * Arguments include: - * - * str - Name of character set to check against - * len - Length of "str" - * - * Returns 1 if the specified character set can be displayed natively, - * 0 otherwise. - */ - -int check_charset (char *, int); int client(char *, char *, char *, int, int); void closefds(int); char *concat (const char *, ...) ENDNULL; @@ -102,14 +90,6 @@ char **read_switch_multiword_via_readline (char *, struct swit *); char **getarguments (char *, int, char **, int); -/* - * Returns the MIME character set indicated by the current locale setting. - * Should be used by routines that want to convert to/from the local - * character set, or if you want to check to see if you can display content - * in the local character set. - */ -char *get_charset(void); - m_getfld_state_t m_getfld_state_init(FILE *iob); void m_getfld_state_reset (m_getfld_state_t *); void m_getfld_state_destroy (m_getfld_state_t *); @@ -213,13 +193,6 @@ char *trimcpy (char *); int uprf (const char *, const char *) PURE; int vfgets (FILE *, char **); -/* - * Output the local character set name, but make sure it is suitable for - * 8-bit characters. - */ -char *write_charset_8bit (void); - - /* * prototypes for some routines in uip */ diff --git a/sbr/check_charset.c b/sbr/check_charset.c index fcd8cc1c..6c42b75b 100644 --- a/sbr/check_charset.c +++ b/sbr/check_charset.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "check_charset.h" #include #include diff --git a/sbr/check_charset.h b/sbr/check_charset.h new file mode 100644 index 00000000..bed70d70 --- /dev/null +++ b/sbr/check_charset.h @@ -0,0 +1,31 @@ +/* check_charset.h -- routines for character sets + * + * 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. */ + +/* + * Returns the MIME character set indicated by the current locale setting. + * Should be used by routines that want to convert to/from the local + * character set, or if you want to check to see if you can display content + * in the local character set. + */ +char *get_charset(void); + +/* + * Check to see if we can display a given character set natively. + * Arguments include: + * + * str - Name of character set to check against + * len - Length of "str" + * + * Returns 1 if the specified character set can be displayed natively, + * 0 otherwise. + */ +int check_charset(char *, int); + +/* + * Output the local character set name, but make sure it is suitable for + * 8-bit characters. + */ +char *write_charset_8bit(void); diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c index f4689723..823fd824 100644 --- a/sbr/encode_rfc2047.c +++ b/sbr/encode_rfc2047.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "check_charset.h" #include "error.h" #include "h/mhparse.h" #include "h/addrsbr.h" diff --git a/sbr/fmt_rfc2047.c b/sbr/fmt_rfc2047.c index 45374765..66093898 100644 --- a/sbr/fmt_rfc2047.c +++ b/sbr/fmt_rfc2047.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "check_charset.h" #include "h/utils.h" #ifdef HAVE_ICONV # include diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 309f298a..54f763af 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -14,6 +14,7 @@ */ #include "h/mh.h" +#include "sbr/check_charset.h" #include "sbr/getcpy.h" #include "sbr/m_convert.h" #include "sbr/getfolder.h" diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index b35d3667..7ab08636 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/check_charset.h" #include "sbr/getcpy.h" #include "sbr/brkstring.h" #include "sbr/ambigsw.h" diff --git a/uip/mhparse.c b/uip/mhparse.c index efa47fab..fde0e2c3 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/check_charset.h" #include "sbr/getcpy.h" #include "sbr/context_find.h" #include "sbr/pidstatus.h" diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 92c20974..59f6f437 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/check_charset.h" #include "sbr/getcpy.h" #include "sbr/context_find.h" #include "sbr/pidstatus.h" diff --git a/uip/show.c b/uip/show.c index 7753c831..b3c8303d 100644 --- a/uip/show.c +++ b/uip/show.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/check_charset.h" #include "sbr/m_draft.h" #include "sbr/m_convert.h" #include "sbr/getfolder.h" -- 2.56.0