diff options
| author | Andreas Schwab | 2010-07-06 13:50:35 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2010-07-06 13:50:35 +0200 |
| commit | 1725ae554e4d8cd696c9413b63629bf374c362a3 (patch) | |
| tree | 1df1c2af0546357b9fdaebf2b0720e19f29f4a91 /lib-src | |
| parent | e2ad23ef3f72a4d8169648592740143770c2323e (diff) | |
| download | emacs-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/ChangeLog | 13 | ||||
| -rw-r--r-- | lib-src/movemail.c | 50 |
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 @@ | |||
| 1 | 2010-07-06 Andreas Schwab <schwab@linux-m68k.org> | 1 | 2010-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 | ||
| 5 | 2010-07-04 Dan Nicolaescu <dann@ics.uci.edu> | 18 | 2010-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 | ||
| 143 | char *strerror (int); | 147 | char *strerror (int); |
| 148 | #endif | ||
| 144 | #ifdef HAVE_INDEX | 149 | #ifdef HAVE_INDEX |
| 145 | extern char *index (const char *, int); | 150 | extern char *index (const char *, int); |
| 146 | #endif | 151 | #endif |
| @@ -148,18 +153,18 @@ extern char *index (const char *, int); | |||
| 148 | extern char *rindex (const char *, int); | 153 | extern char *rindex (const char *, int); |
| 149 | #endif | 154 | #endif |
| 150 | 155 | ||
| 151 | void fatal (char *s1, char *s2, char *s3); | 156 | static void fatal (char *s1, char *s2, char *s3); |
| 152 | void error (char *s1, char *s2, char *s3); | 157 | static void error (char *s1, char *s2, char *s3); |
| 153 | void pfatal_with_name (char *name); | 158 | static void pfatal_with_name (char *name); |
| 154 | void pfatal_and_delete (char *name); | 159 | static void pfatal_and_delete (char *name); |
| 155 | char *concat (char *s1, char *s2, char *s3); | 160 | static char *concat (char *s1, char *s2, char *s3); |
| 156 | long *xmalloc (unsigned int size); | 161 | static long *xmalloc (unsigned int size); |
| 157 | #ifdef MAIL_USE_POP | 162 | #ifdef MAIL_USE_POP |
| 158 | int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); | 163 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); |
| 159 | int pop_retr (popserver server, int msgno, FILE *arg); | 164 | static int pop_retr (popserver server, int msgno, FILE *arg); |
| 160 | int mbx_write (char *line, int len, FILE *mbf); | 165 | static int mbx_write (char *line, int len, FILE *mbf); |
| 161 | int mbx_delimit_begin (FILE *mbf); | 166 | static int mbx_delimit_begin (FILE *mbf); |
| 162 | int mbx_delimit_end (FILE *mbf); | 167 | static 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 | ||
| 592 | void | 597 | static void |
| 593 | fatal (char *s1, char *s2, char *s3) | 598 | fatal (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 | ||
| 604 | void | 609 | static void |
| 605 | error (char *s1, char *s2, char *s3) | 610 | error (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 | ||
| 617 | void | 622 | static void |
| 618 | pfatal_with_name (char *name) | 623 | pfatal_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 | ||
| 623 | void | 628 | static void |
| 624 | pfatal_and_delete (char *name) | 629 | pfatal_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 | ||
| 633 | char * | 638 | static char * |
| 634 | concat (char *s1, char *s2, char *s3) | 639 | concat (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 | ||
| 649 | long * | 654 | static long * |
| 650 | xmalloc (unsigned int size) | 655 | xmalloc (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 | ||
| 699 | int | 704 | static int |
| 700 | popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order) | 705 | popmail (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 | ||
| 825 | int | 830 | static int |
| 826 | pop_retr (popserver server, int msgno, FILE *arg) | 831 | pop_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 | ||
| 873 | int | 877 | static int |
| 874 | mbx_write (char *line, int len, FILE *mbf) | 878 | mbx_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 | ||
| 897 | int | 901 | static int |
| 898 | mbx_delimit_begin (FILE *mbf) | 902 | mbx_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 | ||
| 914 | int | 918 | static int |
| 915 | mbx_delimit_end (FILE *mbf) | 919 | mbx_delimit_end (FILE *mbf) |
| 916 | { | 920 | { |
| 917 | if (putc ('\n', mbf) == EOF) | 921 | if (putc ('\n', mbf) == EOF) |