From: Andreas Schwab Date: Tue, 6 Jul 2010 11:50:35 +0000 (+0200) Subject: Clean up movemail source X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~51^2~81^2~21 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1725ae554e4d8cd696c9413b63629bf374c362a3;p=emacs.git Clean up movemail source * movemail.c: Add MAIL_USE_POP around prototypes. Include if HAVE_STRING_H. (strerror): Only declare if !HAVE_STRERROR. (fatal): Make static. (error): Likewise. (pfatal_with_name): Likewise. (pfatal_and_delete). Likewise. (concat): Likewise. (xmalloc): Likewise. (popmail): Likewise. (pop_retr): Likewise. (mbx_write): Likewise. (mbx_delimit_begin): Likewise. (mbx_delimit_end): Likewise. --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index fcdc00993ef..f79fc20f108 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,6 +1,19 @@ 2010-07-06 Andreas Schwab * movemail.c: Add MAIL_USE_POP around prototypes. + Include if HAVE_STRING_H. + (strerror): Only declare if !HAVE_STRERROR. + (fatal): Make static. + (error): Likewise. + (pfatal_with_name): Likewise. + (pfatal_and_delete). Likewise. + (concat): Likewise. + (xmalloc): Likewise. + (popmail): Likewise. + (pop_retr): Likewise. + (mbx_write): Likewise. + (mbx_delimit_begin): Likewise. + (mbx_delimit_end): Likewise. 2010-07-04 Dan Nicolaescu diff --git a/lib-src/movemail.c b/lib-src/movemail.c index ad9f7c76ea0..dfa4a92d057 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -69,6 +69,9 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_STRING_H +#include +#endif #include "syswait.h" #ifdef MAIL_USE_POP #include "pop.h" @@ -140,7 +143,9 @@ static char *mail_spool_name (); #endif #endif +#ifndef HAVE_STRERROR char *strerror (int); +#endif #ifdef HAVE_INDEX extern char *index (const char *, int); #endif @@ -148,18 +153,18 @@ extern char *index (const char *, int); extern char *rindex (const char *, int); #endif -void fatal (char *s1, char *s2, char *s3); -void error (char *s1, char *s2, char *s3); -void pfatal_with_name (char *name); -void pfatal_and_delete (char *name); -char *concat (char *s1, char *s2, char *s3); -long *xmalloc (unsigned int size); +static void fatal (char *s1, char *s2, char *s3); +static void error (char *s1, char *s2, char *s3); +static void pfatal_with_name (char *name); +static void pfatal_and_delete (char *name); +static char *concat (char *s1, char *s2, char *s3); +static long *xmalloc (unsigned int size); #ifdef MAIL_USE_POP -int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); -int pop_retr (popserver server, int msgno, FILE *arg); -int mbx_write (char *line, int len, FILE *mbf); -int mbx_delimit_begin (FILE *mbf); -int mbx_delimit_end (FILE *mbf); +static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); +static int pop_retr (popserver server, int msgno, FILE *arg); +static int mbx_write (char *line, int len, FILE *mbf); +static int mbx_delimit_begin (FILE *mbf); +static int mbx_delimit_end (FILE *mbf); #endif /* Nonzero means this is name of a lock file to delete on fatal error. */ @@ -589,7 +594,7 @@ mail_spool_name (inname) /* Print error message and exit. */ -void +static void fatal (char *s1, char *s2, char *s3) { if (delete_lockname) @@ -601,7 +606,7 @@ fatal (char *s1, char *s2, char *s3) /* Print error message. `s1' is printf control string, `s2' and `s3' are args for it or null. */ -void +static void error (char *s1, char *s2, char *s3) { fprintf (stderr, "movemail: "); @@ -614,13 +619,13 @@ error (char *s1, char *s2, char *s3) fprintf (stderr, "\n"); } -void +static void pfatal_with_name (char *name) { fatal ("%s for %s", strerror (errno), name); } -void +static void pfatal_and_delete (char *name) { char *s = strerror (errno); @@ -630,7 +635,7 @@ pfatal_and_delete (char *name) /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ -char * +static char * concat (char *s1, char *s2, char *s3) { int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); @@ -646,7 +651,7 @@ concat (char *s1, char *s2, char *s3) /* Like malloc but get fatal error if memory is exhausted. */ -long * +static long * xmalloc (unsigned int size) { long *result = (long *) malloc (size); @@ -696,7 +701,7 @@ char Errmsg[200]; /* POP errors, at least, can exceed * Return a value suitable for passing to `exit'. */ -int +static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order) { int nmsgs, nbytes; @@ -822,10 +827,9 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse return EXIT_SUCCESS; } -int +static int pop_retr (popserver server, int msgno, FILE *arg) { - extern char *strerror (int); char *line; int ret; @@ -870,7 +874,7 @@ pop_retr (popserver server, int msgno, FILE *arg) && (a[3] == 'm') \ && (a[4] == ' ')) -int +static int mbx_write (char *line, int len, FILE *mbf) { #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES @@ -894,7 +898,7 @@ mbx_write (char *line, int len, FILE *mbf) return (OK); } -int +static int mbx_delimit_begin (FILE *mbf) { time_t now; @@ -911,7 +915,7 @@ mbx_delimit_begin (FILE *mbf) return (OK); } -int +static int mbx_delimit_end (FILE *mbf) { if (putc ('\n', mbf) == EOF)