comparison lib-src/movemail.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents a86b2b5e0111
children 697ef44129c6
comparison
equal deleted inserted replaced
409:301b9ebbdf3b 410:de805c49cfc1
67 #include <sys/stat.h> 67 #include <sys/stat.h>
68 #include <stdio.h> 68 #include <stdio.h>
69 #include <errno.h> 69 #include <errno.h>
70 #include "../src/sysfile.h" 70 #include "../src/sysfile.h"
71 #include "../src/syswait.h" 71 #include "../src/syswait.h"
72 #ifndef WINDOWSNT 72 #ifndef WIN32_NATIVE
73 #include "../src/systime.h" 73 #include "../src/systime.h"
74 #endif 74 #endif
75 #include <stdlib.h> 75 #include <stdlib.h>
76 #include <string.h> 76 #include <string.h>
77 #include "getopt.h" 77 #include "getopt.h"
85 85
86 #ifndef HAVE_STRERROR 86 #ifndef HAVE_STRERROR
87 char * strerror (int errnum); 87 char * strerror (int errnum);
88 #endif /* HAVE_STRERROR */ 88 #endif /* HAVE_STRERROR */
89 89
90 #ifdef MSDOS
91 #undef access
92 #endif /* MSDOS */
93
94 #ifndef DIRECTORY_SEP 90 #ifndef DIRECTORY_SEP
95 #define DIRECTORY_SEP '/' 91 #define DIRECTORY_SEP '/'
96 #endif 92 #endif
97 #ifndef IS_DIRECTORY_SEP 93 #ifndef IS_DIRECTORY_SEP
98 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) 94 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
99 #endif 95 #endif
100 96
101 #ifdef WINDOWSNT 97 #ifdef WIN32_NATIVE
102 #undef access 98 #undef access
103 #undef unlink 99 #undef unlink
104 #define fork() 0 100 #define fork() 0
105 #define sys_wait(var) (*(var) = 0) 101 #define sys_wait(var) (*(var) = 0)
106 /* Unfortunately, Samba doesn't seem to properly lock Unix files even 102 /* Unfortunately, Samba doesn't seem to properly lock Unix files even
108 other NT programs). If you have direct file access using an NFS 104 other NT programs). If you have direct file access using an NFS
109 client or something other than Samba, the locking call might work 105 client or something other than Samba, the locking call might work
110 properly - make sure it does before you enable this! */ 106 properly - make sure it does before you enable this! */
111 #define DISABLE_DIRECT_ACCESS 107 #define DISABLE_DIRECT_ACCESS
112 #include <io.h> 108 #include <io.h>
113 #endif /* WINDOWSNT */ 109 #endif /* WIN32_NATIVE */
114 110
115 #if defined (HAVE_UNISTD_H) 111 #if defined (HAVE_UNISTD_H)
116 #include <unistd.h> 112 #include <unistd.h>
117 #endif /* unistd.h */ 113 #endif /* unistd.h */
118 #ifndef F_OK 114 #ifndef F_OK
341 { 337 {
342 int retcode = popmail (inname + 3, outname, poppass); 338 int retcode = popmail (inname + 3, outname, poppass);
343 exit (retcode); 339 exit (retcode);
344 } 340 }
345 341
346 #ifndef WINDOWSNT 342 #ifndef WIN32_NATIVE
347 setuid (getuid ()); 343 setuid (getuid ());
348 #endif 344 #endif
349 #endif /* MAIL_USE_POP */ 345 #endif /* MAIL_USE_POP */
350 346
351 #ifndef DISABLE_DIRECT_ACCESS 347 #ifndef DISABLE_DIRECT_ACCESS
707 703
708 /* This is the guts of the interface to the Post Office Protocol. */ 704 /* This is the guts of the interface to the Post Office Protocol. */
709 705
710 #ifdef MAIL_USE_POP 706 #ifdef MAIL_USE_POP
711 707
712 #ifndef WINDOWSNT 708 #ifndef WIN32_NATIVE
713 #include <sys/socket.h> 709 #include <sys/socket.h>
714 #include <netinet/in.h> 710 #include <netinet/in.h>
715 #include <netdb.h> 711 #include <netdb.h>
716 #else 712 #else
717 #undef _WINSOCKAPI_ 713 #undef _WINSOCKAPI_
718 #include <winsock.h> 714 #include <winsock.h>
719 #endif 715 #endif
720 #include <stdio.h> 716 #include <stdio.h>
721 #include <pwd.h> 717 #include "../src/syspwd.h"
722 718
723 #define POP_ERROR (-1) 719 #define POP_ERROR (-1)
724 #define POP_RETRIEVED (0) 720 #define POP_RETRIEVED (0)
725 #define POP_DONE (1) 721 #define POP_DONE (1)
726 722
772 { 768 {
773 pop_close (server); 769 pop_close (server);
774 error ("Error in open: %s, %s", strerror (errno), outfile); 770 error ("Error in open: %s, %s", strerror (errno), outfile);
775 return (1); 771 return (1);
776 } 772 }
777 #if !defined(__CYGWIN32__) && !defined(WINDOWSNT) 773 #if !defined(CYGWIN) && !defined(WIN32_NATIVE)
778 fchown (mbfi, getuid (), (gid_t) -1); 774 fchown (mbfi, getuid (), (gid_t) -1);
779 #endif 775 #endif
780 776
781 if ((mbf = fdopen (mbfi, "wb")) == NULL) 777 if ((mbf = fdopen (mbfi, "wb")) == NULL)
782 { 778 {