From 8563731b02ce9d750806f6b1769af8b399d964e8 Mon Sep 17 00:00:00 2001 From: Doug Morris Date: Sun, 12 Sep 1999 13:50:11 +0000 Subject: [PATCH] Lots of little code cleanups to prevent warnings - mostly making sure some function prototypes are available at compile time. Also fixed Makefile.in so that make nmhdist will work -- it just blew up after COMPLETION-TCSH was added and ZSH-COMPLETION was changed to COMPLETION-ZSH. --- ChangeLog | 46 +++++++++++++++++++++++++++++++++++++++++----- Makefile.in | 6 +++--- h/prototypes.h | 1 + mts/smtp/hosts.c | 8 +++++--- mts/smtp/smtp.c | 13 ++++++++++--- sbr/fmt_compile.c | 11 +++++++++++ sbr/fmt_scan.c | 11 +++++++++++ sbr/lock_file.c | 11 +++++++++++ sbr/m_getfld.c | 3 ++- uip/ali.c | 1 + uip/ap.c | 1 + uip/fmtdump.c | 2 +- uip/mhbuildsbr.c | 11 +++++++++++ uip/mhcachesbr.c | 11 +++++++++++ uip/mhl.c | 3 +++ uip/mshcmds.c | 4 +++- uip/picksbr.c | 11 +++++++++++ uip/post.c | 11 +++++++++++ uip/rcvdist.c | 1 + uip/rcvstore.c | 1 + uip/rcvtty.c | 1 + uip/scan.c | 1 + uip/sendsbr.c | 11 +++++++++++ uip/show.c | 3 +++ uip/slocal.c | 1 + uip/spost.c | 1 + uip/whatnow.c | 3 +++ uip/whatnowproc.c | 4 ++++ 28 files changed, 175 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81cf02d..810b823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,21 +1,57 @@ +Sun Sep 12 15:50:34 1999 Doug Morris + + * updated Makefile.in so it recognized COMPLETION-TCSH and + COMPLETION-ZSH (only used in make nmhdist). + + * added prototype for ruserpas to . Fixes + warnings in mhparse.c and mhbuildsbr.c. + + * added include checks for and to + prevent warnings in fmt_compile.c, fmt_scan.c, lock_file.c, + sendsbr.c, mhbuildsbr.c, mhcachesbr.c, picksbr.c, and post.c. + + * added include for to ali.c, scan.c, ap.c, + rcvdist.c, rcvstore.c, rcvtty.c, and spost.c to remove + warnings about implicit definition of mts_init(). + + * added to slocal.c to prevent warnings about + function initgroups. + + * added to prevent warning about missing SIGNAL + function. + + * added function prototypes to smtp.c, whatnowproc.c, + mhbuildsbr.c, mhparse.c, mshcmds.c, show.c, whatnow.c, mhl.c + to fix warnings. + + * explicitly declared mbx_style in mshcmds.c and lused in + fmtdump.c as type static int instead of just static to + prevent warnings. + + * various code cleanups to prevent ambiguous statements + (brackets for if/thens and parens for complicated if + statements). + + Sun Sep 12 09:19:27 1999 Doug Morris * commented out _cleanup() in mf.c because it's the only - location in all of the source code where it exists. + location in all of the source code where it exists. * Added check for which is the new location where - linux systems appear to be stuffing this header file. + linux systems appear to be stuffing this header file. Thu Sep 9 23:15:49 1999 Doug Morris * fixed varous mkstmep bugs introduced in 1.0.1 by me. Whups! * added mh_profile SEGV patch from Richard Cohen - that prevents crashing when + that prevents crashing when + mh_profile doesn't end in a newline. A similar patch was + previously sent in by Andrew Bettison . - mh_profile doesn't end in a newline. * fixed bug in associated with MAILGROUP #define (group "mail" - is not universal) -- hard to believe, but true. + is not universal) -- hard to believe, but true. Tue Sep 7 16:47:03 1999 Dan Harkless diff --git a/Makefile.in b/Makefile.in index 3474570..60fb915 100644 --- a/Makefile.in +++ b/Makefile.in @@ -71,9 +71,9 @@ INSTALL_DATA = @INSTALL_DATA@ # all files in this directory included in the distribution DIST = README INSTALL MACHINES COPYRIGHT VERSION DIFFERENCES FAQ \ - TODO ZSH.COMPLETION MAIL.FILTERING ChangeLog install-sh \ - mkinstalldirs Makefile.in aclocal.m4 acconfig.h config.h.in \ - configure.in configure stamp-h.in + TODO COMPLETION-ZSH COMPLETION-TCSH MAIL.FILTERING \ + ChangeLog install-sh mkinstalldirs Makefile.in aclocal.m4 \ + acconfig.h config.h.in configure.in configure stamp-h.in # subdirectories in distribution SUBDIRS = h config sbr zotnet mts uip etc man diff --git a/h/prototypes.h b/h/prototypes.h index 5fe0b0c..59841a2 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -94,6 +94,7 @@ char *pwd (void); char *r1bindex(char *, int); void readconfig (struct node **, FILE *, char *, int); int refile (char **, char *); +int ruserpass(char *, char **, char **); int remdir (char *); int seq_addmsg (struct msgs *, char *, int, int, int); int seq_addsel (struct msgs *, char *, int, int); diff --git a/mts/smtp/hosts.c b/mts/smtp/hosts.c index 55f3393..daa59b6 100644 --- a/mts/smtp/hosts.c +++ b/mts/smtp/hosts.c @@ -55,14 +55,16 @@ OfficialName (char *name) strncpy (buffer, hp->h_name, sizeof(buffer)); return buffer; } - if (hosts.h_name || init_hs ()) + if (hosts.h_name || init_hs ()) { for (h = hosts.h_next; h; h = h->h_next) - if (!strcasecmp (h->h_name, q)) + if (!strcasecmp (h->h_name, q)) { return h->h_name; - else + } else { for (r = h->h_aliases; *r; r++) if (!strcasecmp (*r, q)) return h->h_name; + } + } strncpy (buffer, site, sizeof(buffer)); return buffer; diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 90b37a8..a0d84d5 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -9,10 +9,13 @@ #include "smtp.h" #include #include +#include #ifdef MPOP #include #endif + + /* * This module implements an interface to SendMail very similar * to the MMDF mm_(3) routines. The sm_() routines herein talk @@ -104,6 +107,8 @@ static int smail_brkany (char, char *); char **smail_copyip (char **, char **, int); #endif +/* from zotnet/mts/client.c */ +int client (char *, char *, char *, int, char *, int); int sm_init (char *client, char *server, int watch, int verbose, @@ -125,11 +130,13 @@ sm_init (char *client, char *server, int watch, int verbose, if (sm_rfp != NULL && sm_wfp != NULL) goto send_options; - if (client == NULL || *client == '\0') - if (clientname) + if (client == NULL || *client == '\0') { + if (clientname) { client = clientname; - else + } else { client = LocalName(); /* no clientname -> LocalName */ + } + } #ifdef ZMAILER if (client == NULL || *client == '\0') diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 339ac0a..d3e5ea9 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -11,6 +11,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + /* * hash table for deciding if a component is "interesting" */ diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 0af69ab..ae31162 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -11,6 +11,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + #define NFMTS MAXARGS extern char *formataddr (); /* hook for custom address formatting */ diff --git a/sbr/lock_file.c b/sbr/lock_file.c index fe42196..a99c681 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -8,6 +8,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + #ifdef HAVE_ERRNO_H # include #endif diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 4752893..cddf362 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -390,7 +390,8 @@ m_getfld (int state, unsigned char *name, unsigned char *buf, *cp++ = j = *(iob->_ptr + c); c = _filbuf(iob); #endif - if (c == EOF || (j == '\0' || j == '\n') && c != ' ' && c != '\t') { + if (c == EOF || + ((j == '\0' || j == '\n') && c != ' ' && c != '\t')) { if (c != EOF) { #ifdef LINUX_STDIO --iob->_IO_read_ptr; diff --git a/uip/ali.c b/uip/ali.c index 54c8b05..d03d717 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -8,6 +8,7 @@ #include #include #include +#include /* * maximum number of names diff --git a/uip/ap.c b/uip/ap.c index 11381f3..2abba4b 100644 --- a/uip/ap.c +++ b/uip/ap.c @@ -8,6 +8,7 @@ #include #include #include +#include #define NADDRS 100 diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 9ae23b4..87e22bf 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -24,7 +24,7 @@ static struct swit switches[] = { /* for assignlabel */ static struct format *lvec[128]; -static lused = 0; +static int lused = 0; /* * static prototypes diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index a65736f..7e80565 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -24,6 +24,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + #ifdef HAVE_SYS_WAIT_H # include #endif diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index b372f95..c1af218 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -18,6 +18,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + #ifdef HAVE_SYS_WAIT_H # include #endif diff --git a/uip/mhl.c b/uip/mhl.c index 6ef30fb..33e9f3f 100644 --- a/uip/mhl.c +++ b/uip/mhl.c @@ -7,6 +7,9 @@ #include +/* prototype from mhlsbr.c */ +int mhl (int, char **); + int main (int argc, char **argv) diff --git a/uip/mshcmds.c b/uip/mshcmds.c index 3d6e260..13ad356 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -68,6 +68,8 @@ static int process (int, char *, int, char **); static void copy_message (int, FILE *); static void copy_digest (int, FILE *); +/* from mhlsbr.c */ +int mhlsbr (int, char **, FILE *(*)()); void forkcmd (char **args, char *pgm) @@ -1456,7 +1458,7 @@ static struct swit packswit[] = { { NULL, 0 } }; -static mbx_style = MMDF_FORMAT; +static int mbx_style = MMDF_FORMAT; void packcmd (char **args) diff --git a/uip/picksbr.c b/uip/picksbr.c index 36ca695..b13ea66 100644 --- a/uip/picksbr.c +++ b/uip/picksbr.c @@ -9,6 +9,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + static struct swit parswit[] = { #define PRAND 0 { "and", 0 }, diff --git a/uip/post.c b/uip/post.c index 8eb3b77..ffd460e 100644 --- a/uip/post.c +++ b/uip/post.c @@ -20,6 +20,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + #ifdef MMDFMTS # include # include diff --git a/uip/rcvdist.c b/uip/rcvdist.c index 922670b..5fca8ec 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -9,6 +9,7 @@ #include #include #include +#include static struct swit switches[] = { #define FORMSW 0 diff --git a/uip/rcvstore.c b/uip/rcvstore.c index 5a3dcbe..43d3889 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -10,6 +10,7 @@ #include #include #include +#include static struct swit switches[] = { #define CRETSW 0 diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 464a027..f922012 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/uip/scan.c b/uip/scan.c index cbd9277..b40537c 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* diff --git a/uip/sendsbr.c b/uip/sendsbr.c index b7c4cf2..2c2e3a6 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -12,6 +12,17 @@ #include #include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef TM_IN_SYS_TIME +# include +# else +# include +# endif +#endif + int debugsw = 0; /* global */ int forwsw = 1; int inplace = 1; diff --git a/uip/show.c b/uip/show.c index 7927ac5..d656bf9 100644 --- a/uip/show.c +++ b/uip/show.c @@ -49,6 +49,9 @@ static struct swit switches[] = { */ static int is_nontext(char *); +/* prototype from mhlsbr.c */ +int mhl (int, char **); + #define SHOW 0 #define NEXT 1 #define PREV 2 diff --git a/uip/slocal.c b/uip/slocal.c index c6aa286..03dea14 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef HAVE_DB1_NDBM_H #include diff --git a/uip/spost.c b/uip/spost.c index f2d6311..1f3b014 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -14,6 +14,7 @@ #include #include #include +#include #define uptolow(c) ((isalpha(c) && isupper (c)) ? tolower (c) : c) diff --git a/uip/whatnow.c b/uip/whatnow.c index 34c560e..0033f8b 100644 --- a/uip/whatnow.c +++ b/uip/whatnow.c @@ -7,6 +7,9 @@ #include +/* from whatnowsbr.c */ +int WhatNow (int, char **); + int main (int argc, char **argv) diff --git a/uip/whatnowproc.c b/uip/whatnowproc.c index caeeec2..7f88fc4 100644 --- a/uip/whatnowproc.c +++ b/uip/whatnowproc.c @@ -17,6 +17,10 @@ * it will call this routine directly without exec'ing it. */ +/* from whatnowsbr.c */ +int WhatNow (int, char **); + + int what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist, struct msgs *mp, char *text, int inplace, char *cwd) -- 1.7.10.4