aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorAndreas Schwab2010-07-06 13:50:35 +0200
committerAndreas Schwab2010-07-06 13:50:35 +0200
commit1725ae554e4d8cd696c9413b63629bf374c362a3 (patch)
tree1df1c2af0546357b9fdaebf2b0720e19f29f4a91 /lib-src
parente2ad23ef3f72a4d8169648592740143770c2323e (diff)
downloademacs-1725ae554e4d8cd696c9413b63629bf374c362a3.tar.gz
emacs-1725ae554e4d8cd696c9413b63629bf374c362a3.zip
Clean up movemail source
* movemail.c: Add MAIL_USE_POP around prototypes. Include <string.h> 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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog13
-rw-r--r--lib-src/movemail.c50
2 files changed, 40 insertions, 23 deletions
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 @@
12010-07-06 Andreas Schwab <schwab@linux-m68k.org> 12010-07-06 Andreas Schwab <schwab@linux-m68k.org>
2 2
3 * movemail.c: Add MAIL_USE_POP around prototypes. 3 * movemail.c: Add MAIL_USE_POP around prototypes.
4 Include <string.h> if HAVE_STRING_H.
5 (strerror): Only declare if !HAVE_STRERROR.
6 (fatal): Make static.
7 (error): Likewise.
8 (pfatal_with_name): Likewise.
9 (pfatal_and_delete). Likewise.
10 (concat): Likewise.
11 (xmalloc): Likewise.
12 (popmail): Likewise.
13 (pop_retr): Likewise.
14 (mbx_write): Likewise.
15 (mbx_delimit_begin): Likewise.
16 (mbx_delimit_end): Likewise.
4 17
52010-07-04 Dan Nicolaescu <dann@ics.uci.edu> 182010-07-04 Dan Nicolaescu <dann@ics.uci.edu>
6 19
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 <http://www.gnu.org/licenses/>. */
69#ifdef HAVE_FCNTL_H 69#ifdef HAVE_FCNTL_H
70#include <fcntl.h> 70#include <fcntl.h>
71#endif 71#endif
72#ifdef HAVE_STRING_H
73#include <string.h>
74#endif
72#include "syswait.h" 75#include "syswait.h"
73#ifdef MAIL_USE_POP 76#ifdef MAIL_USE_POP
74#include "pop.h" 77#include "pop.h"
@@ -140,7 +143,9 @@ static char *mail_spool_name ();
140#endif 143#endif
141#endif 144#endif
142 145
146#ifndef HAVE_STRERROR
143char *strerror (int); 147char *strerror (int);
148#endif
144#ifdef HAVE_INDEX 149#ifdef HAVE_INDEX
145extern char *index (const char *, int); 150extern char *index (const char *, int);
146#endif 151#endif
@@ -148,18 +153,18 @@ extern char *index (const char *, int);
148extern char *rindex (const char *, int); 153extern char *rindex (const char *, int);
149#endif 154#endif
150 155
151void fatal (char *s1, char *s2, char *s3); 156static void fatal (char *s1, char *s2, char *s3);
152void error (char *s1, char *s2, char *s3); 157static void error (char *s1, char *s2, char *s3);
153void pfatal_with_name (char *name); 158static void pfatal_with_name (char *name);
154void pfatal_and_delete (char *name); 159static void pfatal_and_delete (char *name);
155char *concat (char *s1, char *s2, char *s3); 160static char *concat (char *s1, char *s2, char *s3);
156long *xmalloc (unsigned int size); 161static long *xmalloc (unsigned int size);
157#ifdef MAIL_USE_POP 162#ifdef MAIL_USE_POP
158int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); 163static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
159int pop_retr (popserver server, int msgno, FILE *arg); 164static int pop_retr (popserver server, int msgno, FILE *arg);
160int mbx_write (char *line, int len, FILE *mbf); 165static int mbx_write (char *line, int len, FILE *mbf);
161int mbx_delimit_begin (FILE *mbf); 166static int mbx_delimit_begin (FILE *mbf);
162int mbx_delimit_end (FILE *mbf); 167static int mbx_delimit_end (FILE *mbf);
163#endif 168#endif
164 169
165/* Nonzero means this is name of a lock file to delete on fatal error. */ 170/* Nonzero means this is name of a lock file to delete on fatal error. */
@@ -589,7 +594,7 @@ mail_spool_name (inname)
589 594
590/* Print error message and exit. */ 595/* Print error message and exit. */
591 596
592void 597static void
593fatal (char *s1, char *s2, char *s3) 598fatal (char *s1, char *s2, char *s3)
594{ 599{
595 if (delete_lockname) 600 if (delete_lockname)
@@ -601,7 +606,7 @@ fatal (char *s1, char *s2, char *s3)
601/* Print error message. `s1' is printf control string, `s2' and `s3' 606/* Print error message. `s1' is printf control string, `s2' and `s3'
602 are args for it or null. */ 607 are args for it or null. */
603 608
604void 609static void
605error (char *s1, char *s2, char *s3) 610error (char *s1, char *s2, char *s3)
606{ 611{
607 fprintf (stderr, "movemail: "); 612 fprintf (stderr, "movemail: ");
@@ -614,13 +619,13 @@ error (char *s1, char *s2, char *s3)
614 fprintf (stderr, "\n"); 619 fprintf (stderr, "\n");
615} 620}
616 621
617void 622static void
618pfatal_with_name (char *name) 623pfatal_with_name (char *name)
619{ 624{
620 fatal ("%s for %s", strerror (errno), name); 625 fatal ("%s for %s", strerror (errno), name);
621} 626}
622 627
623void 628static void
624pfatal_and_delete (char *name) 629pfatal_and_delete (char *name)
625{ 630{
626 char *s = strerror (errno); 631 char *s = strerror (errno);
@@ -630,7 +635,7 @@ pfatal_and_delete (char *name)
630 635
631/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ 636/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
632 637
633char * 638static char *
634concat (char *s1, char *s2, char *s3) 639concat (char *s1, char *s2, char *s3)
635{ 640{
636 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); 641 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
@@ -646,7 +651,7 @@ concat (char *s1, char *s2, char *s3)
646 651
647/* Like malloc but get fatal error if memory is exhausted. */ 652/* Like malloc but get fatal error if memory is exhausted. */
648 653
649long * 654static long *
650xmalloc (unsigned int size) 655xmalloc (unsigned int size)
651{ 656{
652 long *result = (long *) malloc (size); 657 long *result = (long *) malloc (size);
@@ -696,7 +701,7 @@ char Errmsg[200]; /* POP errors, at least, can exceed
696 * Return a value suitable for passing to `exit'. 701 * Return a value suitable for passing to `exit'.
697 */ 702 */
698 703
699int 704static int
700popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order) 705popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order)
701{ 706{
702 int nmsgs, nbytes; 707 int nmsgs, nbytes;
@@ -822,10 +827,9 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
822 return EXIT_SUCCESS; 827 return EXIT_SUCCESS;
823} 828}
824 829
825int 830static int
826pop_retr (popserver server, int msgno, FILE *arg) 831pop_retr (popserver server, int msgno, FILE *arg)
827{ 832{
828 extern char *strerror (int);
829 char *line; 833 char *line;
830 int ret; 834 int ret;
831 835
@@ -870,7 +874,7 @@ pop_retr (popserver server, int msgno, FILE *arg)
870 && (a[3] == 'm') \ 874 && (a[3] == 'm') \
871 && (a[4] == ' ')) 875 && (a[4] == ' '))
872 876
873int 877static int
874mbx_write (char *line, int len, FILE *mbf) 878mbx_write (char *line, int len, FILE *mbf)
875{ 879{
876#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES 880#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
@@ -894,7 +898,7 @@ mbx_write (char *line, int len, FILE *mbf)
894 return (OK); 898 return (OK);
895} 899}
896 900
897int 901static int
898mbx_delimit_begin (FILE *mbf) 902mbx_delimit_begin (FILE *mbf)
899{ 903{
900 time_t now; 904 time_t now;
@@ -911,7 +915,7 @@ mbx_delimit_begin (FILE *mbf)
911 return (OK); 915 return (OK);
912} 916}
913 917
914int 918static int
915mbx_delimit_end (FILE *mbf) 919mbx_delimit_end (FILE *mbf)
916{ 920{
917 if (putc ('\n', mbf) == EOF) 921 if (putc ('\n', mbf) == EOF)