aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorDave Love2000-08-28 18:56:15 +0000
committerDave Love2000-08-28 18:56:15 +0000
commitcc3b64e8ff91e2464146282aa0513f0b55e42c61 (patch)
tree8b88703c2897f7ed3430581c1d4406efb34a3b10 /lib-src
parent2d9296941c5ce9a78ac5deda4f30cd42353ce5c8 (diff)
downloademacs-cc3b64e8ff91e2464146282aa0513f0b55e42c61.tar.gz
emacs-cc3b64e8ff91e2464146282aa0513f0b55e42c61.zip
(toplevel) [HAVE_STRING_H]: Include string.h.
(toplevel) [HAVE_STRINGS_H]: Include strings.h.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/movemail.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 3aee681b48b..e28a8f44613 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -61,8 +61,18 @@ Boston, MA 02111-1307, USA. */
61#include <sys/file.h> 61#include <sys/file.h>
62#include <stdio.h> 62#include <stdio.h>
63#include <errno.h> 63#include <errno.h>
64#include <../src/syswait.h> 64#ifdef HAVE_STRING_H
65#include <string.h>
66#endif
67
68#ifdef HAVE_STRINGS_H
69#include <strings.h>
70#endif
71#include "syswait.h"
65#include <getopt.h> 72#include <getopt.h>
73#ifdef HAVE_FCNTL_H
74#include <fcntl.h>
75#endif
66#ifdef MAIL_USE_POP 76#ifdef MAIL_USE_POP
67#include "pop.h" 77#include "pop.h"
68#endif 78#endif
@@ -98,16 +108,15 @@ Boston, MA 02111-1307, USA. */
98#include <fcntl.h> 108#include <fcntl.h>
99#endif /* WINDOWSNT */ 109#endif /* WINDOWSNT */
100 110
101#ifdef USG 111#ifdef HAVE_FCNTL_H
102#include <fcntl.h> 112#include <fcntl.h>
103#include <unistd.h> 113#endif
104#ifndef F_OK 114#ifndef F_OK
105#define F_OK 0 115#define F_OK 0
106#define X_OK 1 116#define X_OK 1
107#define W_OK 2 117#define W_OK 2
108#define R_OK 4 118#define R_OK 4
109#endif 119#endif
110#endif /* USG */
111 120
112#ifdef HAVE_UNISTD_H 121#ifdef HAVE_UNISTD_H
113#include <unistd.h> 122#include <unistd.h>
@@ -602,18 +611,24 @@ fatal (s1, s2)
602{ 611{
603 if (delete_lockname) 612 if (delete_lockname)
604 unlink (delete_lockname); 613 unlink (delete_lockname);
605 error (s1, s2); 614 error (s1, s2, 0);
606 exit (1); 615 exit (1);
607} 616}
608 617
609/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 618/* Print error message. `s1' is printf control string, `s2' and `s3'
619 are args for it or null. */
610 620
611void 621void
612error (s1, s2, s3) 622error (s1, s2, s3)
613 char *s1, *s2, *s3; 623 char *s1, *s2, *s3;
614{ 624{
615 fprintf (stderr, "movemail: "); 625 fprintf (stderr, "movemail: ");
616 fprintf (stderr, s1, s2, s3); 626 if (s3)
627 fprintf (stderr, s1, s2, s3);
628 else if (s2)
629 fprintf (stderr, s1, s2);
630 else
631 fprintf (stderr, s1);
617 fprintf (stderr, "\n"); 632 fprintf (stderr, "\n");
618} 633}
619 634
@@ -701,6 +716,7 @@ char Errmsg[200]; /* POP errors, at least, can exceed
701 * null. 716 * null.
702 */ 717 */
703 718
719int
704popmail (mailbox, outfile, preserve, password, reverse_order) 720popmail (mailbox, outfile, preserve, password, reverse_order)
705 char *mailbox; 721 char *mailbox;
706 char *outfile; 722 char *outfile;
@@ -724,13 +740,13 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
724 server = pop_open (hostname, user, password, POP_NO_GETPASS); 740 server = pop_open (hostname, user, password, POP_NO_GETPASS);
725 if (! server) 741 if (! server)
726 { 742 {
727 error ("Error connecting to POP server: %s", pop_error); 743 error ("Error connecting to POP server: %s", pop_error, 0);
728 return (1); 744 return (1);
729 } 745 }
730 746
731 if (pop_stat (server, &nmsgs, &nbytes)) 747 if (pop_stat (server, &nmsgs, &nbytes))
732 { 748 {
733 error ("Error getting message count from POP server: %s", pop_error); 749 error ("Error getting message count from POP server: %s", pop_error, 0);
734 return (1); 750 return (1);
735 } 751 }
736 752
@@ -752,7 +768,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
752 if ((mbf = fdopen (mbfi, "wb")) == NULL) 768 if ((mbf = fdopen (mbfi, "wb")) == NULL)
753 { 769 {
754 pop_close (server); 770 pop_close (server);
755 error ("Error in fdopen: %s", strerror (errno)); 771 error ("Error in fdopen: %s", strerror (errno), 0);
756 close (mbfi); 772 close (mbfi);
757 unlink (outfile); 773 unlink (outfile);
758 return (1); 774 return (1);
@@ -776,7 +792,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
776 mbx_delimit_begin (mbf); 792 mbx_delimit_begin (mbf);
777 if (pop_retr (server, i, mbf) != OK) 793 if (pop_retr (server, i, mbf) != OK)
778 { 794 {
779 error (Errmsg); 795 error (Errmsg, 0, 0);
780 close (mbfi); 796 close (mbfi);
781 return (1); 797 return (1);
782 } 798 }
@@ -784,7 +800,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
784 fflush (mbf); 800 fflush (mbf);
785 if (ferror (mbf)) 801 if (ferror (mbf))
786 { 802 {
787 error ("Error in fflush: %s", strerror (errno)); 803 error ("Error in fflush: %s", strerror (errno), 0);
788 pop_close (server); 804 pop_close (server);
789 close (mbfi); 805 close (mbfi);
790 return (1); 806 return (1);
@@ -807,7 +823,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
807 823
808 if (close (mbfi) == -1) 824 if (close (mbfi) == -1)
809 { 825 {
810 error ("Error in close: %s", strerror (errno)); 826 error ("Error in close: %s", strerror (errno), 0);
811 return (1); 827 return (1);
812 } 828 }
813 829
@@ -816,7 +832,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
816 { 832 {
817 if (pop_delete (server, i)) 833 if (pop_delete (server, i))
818 { 834 {
819 error ("Error from POP server: %s", pop_error); 835 error ("Error from POP server: %s", pop_error, 0);
820 pop_close (server); 836 pop_close (server);
821 return (1); 837 return (1);
822 } 838 }
@@ -824,7 +840,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
824 840
825 if (pop_quit (server)) 841 if (pop_quit (server))
826 { 842 {
827 error ("Error from POP server: %s", pop_error); 843 error ("Error from POP server: %s", pop_error, 0);
828 return (1); 844 return (1);
829 } 845 }
830 846
@@ -917,6 +933,7 @@ mbx_delimit_begin (mbf)
917 return (OK); 933 return (OK);
918} 934}
919 935
936int
920mbx_delimit_end (mbf) 937mbx_delimit_end (mbf)
921 FILE *mbf; 938 FILE *mbf;
922{ 939{