From 340ff9deaea2a7258d3ee1eca65487b4cd8dd305 Mon Sep 17 00:00:00 2001 From: "David J. MacKenzie" Date: Wed, 12 Oct 1994 20:21:51 +0000 Subject: [PATCH] Eliminate some -Wall warnings. --- lib-src/b2m.c | 2 ++ lib-src/cvtmail.c | 45 ++++++++++++++++++++++++------------------ lib-src/digest-doc.c | 2 ++ lib-src/emacsclient.c | 3 ++- lib-src/etags.c | 4 ++++ lib-src/fakemail.c | 2 ++ lib-src/hexl.c | 4 ++++ lib-src/make-docfile.c | 13 ++++++++++-- lib-src/movemail.c | 2 ++ lib-src/profile.c | 2 +- lib-src/sorted-doc.c | 26 +++++++++++++----------- lib-src/test-distrib.c | 4 ++-- lib-src/timer.c | 1 - lib-src/wakeup.c | 1 + lib-src/yow.c | 3 ++- 15 files changed, 75 insertions(+), 39 deletions(-) diff --git a/lib-src/b2m.c b/lib-src/b2m.c index b6e027590a..ededf304f0 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c @@ -40,6 +40,7 @@ int header = FALSE, printing; time_t ltoday; char from[MAX_DATA_LEN], labels[MAX_DATA_LEN], data[MAX_DATA_LEN], *p, *today; +int main (argc, argv) int argc; char **argv; @@ -117,4 +118,5 @@ main (argc, argv) if (printing) puts (data); } + return 0; } diff --git a/lib-src/cvtmail.c b/lib-src/cvtmail.c index c1fec8792c..b6e0c58ceb 100644 --- a/lib-src/cvtmail.c +++ b/lib-src/cvtmail.c @@ -36,10 +36,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ char *malloc (); char *realloc (); +char *getenv (); + char *xmalloc (); char *xrealloc (); -char *getenv (); +void skip_to_lf (); +int main (argc, argv) int argc; char *argv[]; @@ -53,7 +56,7 @@ main (argc, argv) FILE *mddf; FILE *mfilef; FILE *cff; - char pre[10], post[100]; + char pre[10]; char name[14]; int c; @@ -103,6 +106,7 @@ main (argc, argv) return 0; } +void skip_to_lf (stream) FILE *stream; { @@ -111,6 +115,26 @@ skip_to_lf (stream) ; } + +void +error (s1, s2) + char *s1, *s2; +{ + fprintf (stderr, "cvtmail: "); + fprintf (stderr, s1, s2); + fprintf (stderr, "\n"); +} + +/* Print error message and exit. */ + +void +fatal (s1, s2) + char *s1, *s2; +{ + error (s1, s2); + exit (1); +} + char * xmalloc (size) unsigned size; @@ -131,20 +155,3 @@ xrealloc (ptr, size) fatal ("virtual memory exhausted"); return result; } - -/* Print error message and exit. */ - -fatal (s1, s2) - char *s1, *s2; -{ - error (s1, s2); - exit (1); -} - -error (s1, s2) - char *s1, *s2; -{ - fprintf (stderr, "cvtmail: "); - fprintf (stderr, s1, s2); - fprintf (stderr, "\n"); -} diff --git a/lib-src/digest-doc.c b/lib-src/digest-doc.c index d7764c08a6..1d47ce0a0c 100644 --- a/lib-src/digest-doc.c +++ b/lib-src/digest-doc.c @@ -6,6 +6,8 @@ but in texinfo format and sorted by function/variable name. */ #include + +int main () { register int ch; diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 76d0b4e54d..303ad65403 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -55,6 +55,7 @@ main (argc, argv) extern char *strerror (); extern int errno; +int main (argc, argv) int argc; char **argv; @@ -167,7 +168,7 @@ main (argc, argv) while (str = fgets (string, BUFSIZ, out)) printf ("%s", str); - exit (0); + return 0; } #else /* This is the SYSV IPC section */ diff --git a/lib-src/etags.c b/lib-src/etags.c index f893111f8e..3be430c111 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -55,6 +55,7 @@ char pot_etags_version[] = "@(#) pot revision number is 10.32"; #include "getopt.h" extern char *getenv (); +char *malloc (), *realloc (); /* Define CTAGS to make the program "ctags" compatible with the usual one. Let it undefined to make the program "etags", which makes emacs-style @@ -161,6 +162,9 @@ char *etags_getcwd (); char *relative_filename (), *absolute_filename (), *absolute_dirname (); char *xmalloc (), *xrealloc (); int total_size_of_entries (); +int string_numeric_p (); +int substr (); +int prestr (); long readline (); void Asm_labels (); diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 59bf2d661a..5adcf66fbc 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -23,11 +23,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #if defined (BSD) && !defined (BSD4_1) && !defined (USE_FAKEMAIL) /* This program isnot used in BSD, so just avoid loader complaints. */ +void main () { } #else /* not BSD 4.2 (or newer) */ #ifdef MSDOS +void main () { } diff --git a/lib-src/hexl.c b/lib-src/hexl.c index bd6220e0ba..b090dae335 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -16,6 +16,9 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1; int group_by = DEFAULT_GROUPING; char *progname; +void usage(); + +int main (argc, argv) int argc; char *argv[]; @@ -231,6 +234,7 @@ main (argc, argv) return 0; } +void usage () { fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 58062efeee..72be211f86 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -44,8 +44,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define READ_BINARY "r" #endif /* not MSDOS */ +int scan_file (); +int scan_lisp_file (); +int scan_c_file (); + FILE *outfile; +int main (argc, argv) int argc; char **argv; @@ -83,11 +88,13 @@ main (argc, argv) #ifndef VMS exit (err_count); /* see below - shane */ #endif /* VMS */ + return err_count; } /* Read file FILENAME and output its doc strings to outfile. */ /* Return 1 if file is not found, 0 if it is found. */ +int scan_file (filename) char *filename; { @@ -109,6 +116,7 @@ char buf[128]; Convert escape sequences \n and \t to newline and tab; discard \ followed by newline. */ +int read_c_string (infile, printflag) FILE *infile; int printflag; @@ -156,6 +164,7 @@ read_c_string (infile, printflag) /* Write to file OUT the argument names of function FUNC, whose text is in BUF. MINARGS and MAXARGS are the minimum and maximum number of arguments. */ +void write_c_args (out, func, buf, minargs, maxargs) FILE *out; char *func, *buf; @@ -240,6 +249,7 @@ write_c_args (out, func, buf, minargs, maxargs) Looks for DEFUN constructs such as are defined in ../src/lisp.h. Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ +int scan_c_file (filename, mode) char *filename, *mode; { @@ -486,7 +496,7 @@ read_lisp_symbol (infile, buffer) skip_white (infile); } - +int scan_lisp_file (filename, mode) char *filename, *mode; { @@ -504,7 +514,6 @@ scan_lisp_file (filename, mode) while (!feof (infile)) { char buffer [BUFSIZ]; - char *fillp = buffer; char type; if (c != '\n') diff --git a/lib-src/movemail.c b/lib-src/movemail.c index c971c9f2b1..283aca21c1 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -546,11 +546,13 @@ popmail (user, outfile) * directories have lost mail when over quota because these checks were * not made in previous versions of movemail. */ +#ifdef BSD if (fsync (mbfi) < 0) { error ("Error in fsync: %s", strerror (errno)); return (1); } +#endif if (close (mbfi) == -1) { diff --git a/lib-src/profile.c b/lib-src/profile.c index 16a74b7135..09b094ce93 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -39,7 +39,7 @@ static char time_string[30]; /* Reset the stopwatch to zero. */ -int +void reset_watch () { EMACS_GET_TIME (TV1); diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index 129ce9c83b..0ba419d490 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -35,17 +35,9 @@ struct docstr /* Allocated thing for an entry. */ }; -/* Print error message and exit. */ - -fatal (s1, s2) - char *s1, *s2; -{ - error (s1, s2); - exit (1); -} - /* Print error message. `s1' is printf control string, `s2' is arg for it. */ +void error (s1, s2) char *s1, *s2; { @@ -54,6 +46,16 @@ error (s1, s2) fprintf (stderr, "\n"); } +/* Print error message and exit. */ + +void +fatal (s1, s2) + char *s1, *s2; +{ + error (s1, s2); + exit (1); +} + /* Like malloc but get fatal error if memory is exhausted. */ char * @@ -67,7 +69,7 @@ xmalloc (size) } char * -strsav (str) +xstrdup (str) char * str; { char *buf = xmalloc (strlen (str) + 1); @@ -98,12 +100,12 @@ char *states[] = "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" }; +int main () { register DOCSTR *dp = NULL; /* allocated DOCSTR */ register LINE *lp = NULL; /* allocated line */ register char *bp; /* ptr inside line buffer */ - int notfirst = 0; /* set after read something */ register enum state state = WAITING; /* state at start */ int cnt = 0; /* number of DOCSTRs read */ @@ -169,7 +171,7 @@ main () else /* saving and changing state */ { *bp = NUL; - bp = strsav (buf); + bp = xstrdup (buf); if (state == NAME_GET) dp->name = bp; diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 897922a3bf..33dc0a46ab 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c @@ -32,6 +32,7 @@ cool_read (fd, buf, size) } } +int main (argc, argv) int argc; char **argv; @@ -63,7 +64,6 @@ have been corrupted in the files of Emacs, and it will not work.\n", close (fd); #ifdef VMS exit (1); /* On VMS, success is 1. */ -#else - exit (0); #endif + return (0); } diff --git a/lib-src/timer.c b/lib-src/timer.c index 6a3a3fba10..9bd547ce8f 100644 --- a/lib-src/timer.c +++ b/lib-src/timer.c @@ -199,7 +199,6 @@ void getevent () { int i; - int n_events; /* In principle the itimer should be disabled on entry to this function, but it really doesn't make any important difference diff --git a/lib-src/wakeup.c b/lib-src/wakeup.c index c26289c84e..9c8838dbc1 100644 --- a/lib-src/wakeup.c +++ b/lib-src/wakeup.c @@ -18,6 +18,7 @@ struct tm *localtime (); +void main (argc, argv) int argc; char **argv; diff --git a/lib-src/yow.c b/lib-src/yow.c index 0f289a1935..05ec9d4341 100644 --- a/lib-src/yow.c +++ b/lib-src/yow.c @@ -30,6 +30,7 @@ &res;}) #endif +int main (argc, argv) int argc; char *argv[]; @@ -58,7 +59,7 @@ main (argc, argv) setup_yow(fp); yow(fp); fclose(fp); - exit(0); + return 0; } static long len = -1; -- 2.20.1