/[pkg-mixmaster]/trunk/Mix/Src/mail.c
ViewVC logotype

Diff of /trunk/Mix/Src/mail.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 228 by weaselp, Sun Sep 8 21:59:43 2002 UTC revision 262 by rabbi, Wed Sep 18 23:26:17 2002 UTC
# Line 6  Line 6 
6     details.     details.
7    
8     Socket-based mail transport services     Socket-based mail transport services
9     $Id: mail.c,v 1.12 2002/09/08 21:59:43 weaselp Exp $ */     $Id: mail.c,v 1.13 2002/09/18 23:26:16 rabbi Exp $ */
10    
11    
12  #include "mix3.h"  #include "mix3.h"
# Line 21  Line 21 
21  #include <netinet/in.h>  #include <netinet/in.h>
22  #include <arpa/inet.h>  #include <arpa/inet.h>
23  #include <netdb.h>  #include <netdb.h>
24  #endif  #endif /* defined(UNIX) && defined(USE_SOCK) */
25    
26  #include <fcntl.h>  #include <fcntl.h>
27  #include <time.h>  #include <time.h>
28  #include <sys/stat.h>  #include <sys/stat.h>
# Line 141  int sendmail(BUFFER *message, char *from Line 142  int sendmail(BUFFER *message, char *from
142          break;          break;
143      }      }
144      f = fopen(path, "w");      f = fopen(path, "w");
145  #else /* SHORTNAMES */  #else /* end of SHORTNAMES */
146      static unsigned long namecounter = 0;      static unsigned long namecounter = 0;
147      struct stat statbuf;      struct stat statbuf;
148      int count;      int count;
# Line 169  int sendmail(BUFFER *message, char *from Line 170  int sendmail(BUFFER *message, char *from
170          break; /* Too many retries - give up */          break; /* Too many retries - give up */
171  #ifdef WIN32  #ifdef WIN32
172        Sleep(2000); /* sleep and retry */        Sleep(2000); /* sleep and retry */
173  #else  #else /* end of WIN32 */
174        sleep(2); /* sleep and retry */        sleep(2); /* sleep and retry */
175  #endif  #endif /* else not WIN32 */
176      }      }
177  #endif /* SHORTNAMES */  #endif /* else not SHORTNAMES */
178      if (f != NULL) {      if (f != NULL) {
179        err = buf_write(head, f);        err = buf_write(head, f);
180        err = buf_write(message, f);        err = buf_write(message, f);
# Line 218  void sock_exit(void) Line 219  void sock_exit(void)
219  {  {
220    WSACleanup();    WSACleanup();
221  }  }
222  #endif  #endif /* WIN32 */
223    
224  SOCKET opensocket(char *hostname, int port)  SOCKET opensocket(char *hostname, int port)
225  {  {
# Line 248  int closesocket(SOCKET s) Line 249  int closesocket(SOCKET s)
249  {  {
250    return (close(s));    return (close(s));
251  }  }
252  #endif  #endif /* ifndef WIN32 */
253    
254  int sock_getline(SOCKET s, BUFFER *line)  int sock_getline(SOCKET s, BUFFER *line)
255  {  {
# Line 281  int sock_cat(SOCKET s, BUFFER *b) Line 282  int sock_cat(SOCKET s, BUFFER *b)
282    } while (p < b->length);    } while (p < b->length);
283    return (0);    return (0);
284  }  }
285  #else  #else /* end of USE_SOCK */
286  SOCKET opensocket(char *hostname, int port)  SOCKET opensocket(char *hostname, int port)
287  {  {
288    return (INVALID_SOCKET);    return (INVALID_SOCKET);
# Line 301  int sock_cat(SOCKET s, BUFFER *b) Line 302  int sock_cat(SOCKET s, BUFFER *b)
302  {  {
303    return (-1);    return (-1);
304  }  }
305  #endif  #endif /* else not USE_SOCK */
306    
307  /* send messages by SMTP ************************************************/  /* send messages by SMTP ************************************************/
308    
# Line 362  SOCKET smtp_open(void) Line 363  SOCKET smtp_open(void)
363      }      }
364      buf_free(line);      buf_free(line);
365    }    }
366  #endif  #endif /* USE_SOCK */
367    return (s);    return (s);
368  }  }
369    
# Line 382  int smtp_close(SOCKET s) Line 383  int smtp_close(SOCKET s)
383      errlog(WARNING, "SMTP quit failed: %b\n", line);      errlog(WARNING, "SMTP quit failed: %b\n", line);
384    closesocket(s);    closesocket(s);
385    buf_free(line);    buf_free(line);
386  #endif  #endif /* USE_SOCK */
387    return (ret);    return (ret);
388  }  }
389    
# Line 484  end: Line 485  end:
485    buf_free(field);    buf_free(field);
486    buf_free(content);    buf_free(content);
487    buf_free(rcpt);    buf_free(rcpt);
488  #endif  #endif /* USE_SOCK */
489    return (ret);    return (ret);
490  }  }
491    
# Line 757  void pop3get(void) Line 758  void pop3get(void)
758    buf_free(line);    buf_free(line);
759    buf_free(msg);    buf_free(msg);
760  }  }
761  #endif  #endif /* USE_SOCK */

Legend:
Removed from v.228  
changed lines
  Added in v.262

  ViewVC Help
Powered by ViewVC 1.1.5