From: Ralph Corderoy Date: Sat, 11 Nov 2017 16:12:02 +0000 (+0000) Subject: getcpy.c: Move interface to own file. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/d79618303ff42aa5e0bc2dba51fdd7b385bc97d4 getcpy.c: Move interface to own file. --- diff --git a/Makefile.am b/Makefile.am index a467d256..54d342b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -384,6 +384,7 @@ noinst_HEADERS = \ sbr/folder_pack.h \ sbr/folder_read.h \ sbr/folder_realloc.h \ + sbr/getcpy.h \ sbr/geteditor.h \ sbr/getfolder.h \ sbr/lock_file.h \ diff --git a/h/prototypes.h b/h/prototypes.h index f12bf371..c0a12b58 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -110,9 +110,6 @@ char **getarguments (char *, int, char **, int); */ char *get_charset(void); -/* Return malloc'd copy of str, or of "" if NULL, exit on failure. */ -char *getcpy(const char *str); - 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 *); diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index 7f961c48..62abfb99 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "context_find.h" #include "error.h" #include "h/addrsbr.h" diff --git a/sbr/context_replace.c b/sbr/context_replace.c index 96ce05e9..eccb472a 100644 --- a/sbr/context_replace.c +++ b/sbr/context_replace.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "context_replace.h" #include "error.h" #include "h/utils.h" diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 27af937e..e8a80279 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -40,6 +40,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "error.h" #include "h/addrsbr.h" #include "h/tws.h" diff --git a/sbr/fmt_new.c b/sbr/fmt_new.c index 97e2a7ad..c78e62d4 100644 --- a/sbr/fmt_new.c +++ b/sbr/fmt_new.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "error.h" #include "h/utils.h" diff --git a/sbr/getcpy.c b/sbr/getcpy.c index 7182c7c7..42779e02 100644 --- a/sbr/getcpy.c +++ b/sbr/getcpy.c @@ -10,6 +10,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "h/utils.h" /* Return malloc'd copy of str, or of "" if NULL, exit on failure. */ diff --git a/sbr/getcpy.h b/sbr/getcpy.h new file mode 100644 index 00000000..c98146e1 --- /dev/null +++ b/sbr/getcpy.h @@ -0,0 +1,12 @@ +/* getcpy.h -- copy a string in managed memory + * + * THIS IS OBSOLETE. NEED TO REPLACE ALL OCCURRENCES + * OF GETCPY WITH STRDUP. BUT THIS WILL REQUIRE + * CHANGING PARTS OF THE CODE TO DEAL WITH NULL VALUES. + * + * 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 malloc'd copy of str, or of "" if NULL, exit on failure. */ +char *getcpy(const char *str); diff --git a/sbr/netsec.c b/sbr/netsec.c index 6a72495b..98a221a2 100644 --- a/sbr/netsec.c +++ b/sbr/netsec.c @@ -7,6 +7,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "brkstring.h" #include "h/utils.h" #include "h/netsec.h" diff --git a/sbr/oauth.c b/sbr/oauth.c index 718a6884..8061c287 100755 --- a/sbr/oauth.c +++ b/sbr/oauth.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "error.h" #ifdef OAUTH_SUPPORT diff --git a/sbr/oauth_prof.c b/sbr/oauth_prof.c index 5bedadcb..4d91b8b2 100644 --- a/sbr/oauth_prof.c +++ b/sbr/oauth_prof.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "context_find.h" #ifdef OAUTH_SUPPORT diff --git a/sbr/readconfig.c b/sbr/readconfig.c index c744a3e5..2df4c8e1 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -7,6 +7,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "readconfig.h" #include "error.h" #include "h/utils.h" diff --git a/sbr/refile.c b/sbr/refile.c index 15f016d0..de6bd92c 100644 --- a/sbr/refile.c +++ b/sbr/refile.c @@ -7,6 +7,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "context_save.h" #include "arglist.h" #include "error.h" diff --git a/sbr/seq_read.c b/sbr/seq_read.c index c4f11a6a..1670aacc 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -7,6 +7,7 @@ */ #include "h/mh.h" +#include "getcpy.h" #include "m_atoi.h" #include "brkstring.h" #include "error.h" diff --git a/uip/ali.c b/uip/ali.c index d7ce4920..229831b9 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/context_find.h" #include "sbr/brkstring.h" #include "sbr/ambigsw.h" diff --git a/uip/aliasbr.c b/uip/aliasbr.c index 754a4d18..b5935f60 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "h/aliasbr.h" #include "h/addrsbr.h" #include "h/utils.h" diff --git a/uip/ap.c b/uip/ap.c index fa2b871f..b9a49cd7 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/ambigsw.h" #include "sbr/print_version.h" #include "sbr/print_help.h" diff --git a/uip/fmttest.c b/uip/fmttest.c index 46137944..8d5423fa 100644 --- a/uip/fmttest.c +++ b/uip/fmttest.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_convert.h" #include "sbr/getfolder.h" #include "sbr/folder_read.h" diff --git a/uip/folder.c b/uip/folder.c index 2b231bb1..98006072 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -8,6 +8,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_convert.h" #include "sbr/getfolder.h" #include "sbr/folder_read.h" diff --git a/uip/forwsbr.c b/uip/forwsbr.c index 6978d183..7e86244e 100644 --- a/uip/forwsbr.c +++ b/uip/forwsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/error.h" #include #include "h/fmt_scan.h" diff --git a/uip/imaptest.c b/uip/imaptest.c index 6c5d0046..7a119cd4 100644 --- a/uip/imaptest.c +++ b/uip/imaptest.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/brkstring.h" #include "sbr/ambigsw.h" #include "sbr/print_version.h" diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 9730e60b..309f298a 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -14,6 +14,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_convert.h" #include "sbr/getfolder.h" #include "sbr/folder_read.h" diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 8224980e..b35d3667 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/brkstring.h" #include "sbr/ambigsw.h" #include "sbr/pidstatus.h" diff --git a/uip/mhparse.c b/uip/mhparse.c index 9b8eb973..efa47fab 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/context_find.h" #include "sbr/pidstatus.h" #include "sbr/arglist.h" diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 7716de41..92c20974 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/context_find.h" #include "sbr/pidstatus.h" #include "sbr/arglist.h" diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index f2164e30..a48d4b64 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/getfolder.h" #include "sbr/folder_read.h" #include "sbr/folder_free.h" diff --git a/uip/new.c b/uip/new.c index 5de05d48..2d7c0708 100644 --- a/uip/new.c +++ b/uip/new.c @@ -12,6 +12,7 @@ #include #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_atoi.h" #include "sbr/context_save.h" #include "sbr/context_replace.h" diff --git a/uip/scansbr.c b/uip/scansbr.c index b82c3c56..e7cad884 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/error.h" #include "h/addrsbr.h" #include "h/fmt_scan.h" diff --git a/uip/sendsbr.c b/uip/sendsbr.c index 8bb04fab..ec7b4415 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_convert.h" #include "sbr/m_backup.h" #include "sbr/folder_read.h" diff --git a/uip/slocal.c b/uip/slocal.c index 9f784f8d..6cace00f 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -20,6 +20,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/ambigsw.h" #include "sbr/pidstatus.h" #include "sbr/print_version.h" diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index c4549f18..f4057211 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -38,6 +38,7 @@ */ #include "h/mh.h" +#include "sbr/getcpy.h" #include "sbr/m_draft.h" #include "sbr/m_backup.h" #include "sbr/geteditor.h"