From: Ralph Corderoy Date: Thu, 16 Nov 2017 00:14:35 +0000 (+0000) Subject: fmt_new.c: Move interface to own file. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/8f802697c8d9c4fc52e4d0ce4facf643358aac1a?hp=e99caef6d3e09d481849d3bdc51871f4c7bb574a fmt_new.c: Move interface to own file. --- diff --git a/Makefile.am b/Makefile.am index 865b70a6..1b7c2862 100644 --- a/Makefile.am +++ b/Makefile.am @@ -387,6 +387,7 @@ noinst_HEADERS = \ sbr/ext_hook.h \ sbr/fdcompare.h \ sbr/fmt_addr.h \ + sbr/fmt_new.h \ sbr/fmt_rfc2047.h \ sbr/folder_addmsg.h \ sbr/folder_delmsgs.h \ diff --git a/h/fmt_scan.h b/h/fmt_scan.h index dc945ef3..40ef9c03 100644 --- a/h/fmt_scan.h +++ b/h/fmt_scan.h @@ -96,28 +96,6 @@ struct fmt_callbacks { void * trace_context; }; -/* - * Create a new format string. Arguments are: - * - * form - Name of format file. Will be searched by etcpath(), see that - * function for details. - * format - The format string to be used if no format file is given - * default_fs - The default format string to be used if neither form nor - * format is given - * - * This function also takes care of processing \ escapes like \n, \t, etc. - * - * Returns an allocated format string. - */ - -char *new_fs (char *form, char *format, char *default_fs); - -/* - * Free memory allocated by new_fs(). It allocates to a static so - * no argument is necessary. - */ -void free_fs(void); - /* * Compile a format string into a set of format instructions. Arguments are: * diff --git a/sbr/fmt_new.c b/sbr/fmt_new.c index c78e62d4..2407cc62 100644 --- a/sbr/fmt_new.c +++ b/sbr/fmt_new.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "fmt_new.h" #include "getcpy.h" #include "error.h" #include "h/utils.h" diff --git a/sbr/fmt_new.h b/sbr/fmt_new.h new file mode 100644 index 00000000..08603659 --- /dev/null +++ b/sbr/fmt_new.h @@ -0,0 +1,26 @@ +/* fmt_new.h -- read format file/string and normalize + * + * 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. */ + +/* + * Create a new format string. Arguments are: + * + * form - Name of format file. Will be searched by etcpath(), see that + * function for details. + * format - The format string to be used if no format file is given + * default_fs - The default format string to be used if neither form nor + * format is given + * + * This function also takes care of processing \ escapes like \n, \t, etc. + * + * Returns an allocated format string. + */ +char *new_fs(char *, char *, char *); + +/* + * Free memory allocated by new_fs(). It allocates to a static so + * no argument is necessary. + */ +void free_fs(void); diff --git a/uip/ap.c b/uip/ap.c index 83295af9..8be42a02 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/getarguments.h" #include "sbr/smatch.h" #include "sbr/getcpy.h" diff --git a/uip/comp.c b/uip/comp.c index 759d0050..00aa1c2c 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "whatnowproc.h" #include "sbr/m_name.h" #include "sbr/m_gmprot.h" diff --git a/uip/dp.c b/uip/dp.c index 00edef02..7b6ad83b 100644 --- a/uip/dp.c +++ b/uip/dp.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/getarguments.h" #include "sbr/smatch.h" #include "sbr/context_save.h" diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 9f1f162e..b5a4660c 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "scansbr.h" #include "sbr/getarguments.h" #include "sbr/smatch.h" diff --git a/uip/fmttest.c b/uip/fmttest.c index 72f60f91..db16ae74 100644 --- a/uip/fmttest.c +++ b/uip/fmttest.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "scansbr.h" #include "sbr/m_name.h" #include "sbr/m_getfld.h" diff --git a/uip/forwsbr.c b/uip/forwsbr.c index 005bc9ca..2cdfb303 100644 --- a/uip/forwsbr.c +++ b/uip/forwsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/dtime.h" #include "sbr/m_getfld.h" #include "sbr/getcpy.h" diff --git a/uip/inc.c b/uip/inc.c index 7484d34d..03443077 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -31,6 +31,7 @@ #endif #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/dtime.h" #include "scansbr.h" #include "sbr/m_name.h" diff --git a/uip/mhical.c b/uip/mhical.c index 9618b2b2..8025c02f 100644 --- a/uip/mhical.c +++ b/uip/mhical.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/getarguments.h" #include "sbr/concat.h" #include "sbr/smatch.h" diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 9af4b8e6..86bae544 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "mhlsbr.h" #include "sbr/m_getfld.h" #include "sbr/getarguments.h" diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 909506e0..fccf3c18 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/concat.h" #include "sbr/trimcpy.h" #include "sbr/check_charset.h" diff --git a/uip/rcvdist.c b/uip/rcvdist.c index c8a1d957..f065ad1d 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "distsbr.h" #include "sbr/m_gmprot.h" #include "sbr/m_getfld.h" diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 90994bff..4098d709 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -11,6 +11,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "scansbr.h" #include "sbr/getarguments.h" #include "sbr/smatch.h" diff --git a/uip/replsbr.c b/uip/replsbr.c index a76444b1..55bcd6ce 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/m_name.h" #include "sbr/m_gmprot.h" #include "sbr/m_getfld.h" diff --git a/uip/scan.c b/uip/scan.c index 8a2e8dc0..b682ddd9 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sbr/dtime.h" #include "scansbr.h" #include "sbr/m_name.h" diff --git a/uip/sendsbr.c b/uip/sendsbr.c index a044a620..f369f08b 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/fmt_new.h" #include "sendsbr.h" #include "distsbr.h" #include "annosbr.h"