]> Pileus Git - ~andy/fetchmail/commitdiff
Eliminate SockWrite and SockPrintf.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 17 Dec 1996 20:36:26 +0000 (20:36 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 17 Dec 1996 20:36:26 +0000 (20:36 -0000)
svn path=/trunk/; revision=649

driver.c
smtp.c
socket.h

index eebffe1b4d6dfc8d5b2950cda4acd9956461edc2..5d8abfb7e981e19f31d39b1bda9460c79e2b5409 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -622,10 +622,9 @@ struct query *ctl; /* query control record */
            }
 
            /* write all the headers */
-           if (ctl->mda[0])
+           n = 0;
+           if (sinkfp)
                n = fwrite(headers, 1, oldlen, sinkfp);
-           else if (sinkfp)
-               n = SockWrite(headers, oldlen, sinkfp);
 
            if (n < 0)
            {
@@ -686,10 +685,8 @@ struct query *ctl; /* query control record */
 
                strcat(errmsg, "\n");
 
-               if (ctl->mda[0])
+               if (sinkfp)
                    fputs(errmsg, sinkfp);
-               else if (sinkfp)
-                   SockWrite(errmsg, strlen(errmsg), sinkfp);
            }
 
            free_str_list(&xmit_names);
@@ -698,7 +695,7 @@ struct query *ctl;  /* query control record */
        /* SMTP byte-stuffing */
        if (*bufp == '.' && ctl->mda[0] == 0)
            if (sinkfp)
-               SockWrite(".", 1, sinkfp);
+               fputs(".", sinkfp);
 
        /* replace all LFs with CR-LF  in the line */
        if (!ctl->mda[0])
@@ -710,10 +707,9 @@ struct query *ctl; /* query control record */
        }
 
        /* ship out the text line */
-       if (ctl->mda[0])
+       n = 0;
+       if (sinkfp)
            n = fwrite(bufp, 1, strlen(bufp), sinkfp);
-       else if (sinkfp)
-           n = SockWrite(bufp, strlen(bufp), sinkfp);
 
        if (!ctl->mda[0])
            free(bufp);
@@ -1151,7 +1147,7 @@ va_dcl {
     va_end(ap);
 
     strcat(buf, "\r\n");
-    SockWrite(buf, strlen(buf), sockfp);
+    fputs(buf, sockfp);
 
     if (outlevel == O_VERBOSE)
     {
@@ -1194,7 +1190,7 @@ va_dcl {
   va_end(ap);
 
   strcat(buf, "\r\n");
-  SockWrite(buf, strlen(buf), sockfp);
+  fputs(buf, sockfp);
   if (outlevel == O_VERBOSE)
   {
       char *cp;
diff --git a/smtp.c b/smtp.c
index 515366b583eb90998a7ff1ab9802199b35efb873..0133e5a9d0b8c99e33c02d7ae9b3cfc1298fa806 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -25,7 +25,7 @@ int SMTP_helo(FILE *sockfp,char *host)
 {
   int ok;
 
-  SockPrintf(sockfp,"HELO %s\r\n", host);
+  fprintf(sockfp,"HELO %s\r\n", host);
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP> HELO %s", host);
   ok = SMTP_ok(sockfp);
@@ -37,7 +37,7 @@ int SMTP_from(FILE *sockfp, char *from)
 {
   int ok;
 
-  SockPrintf(sockfp,"MAIL FROM:<%s>\r\n", from);
+  fprintf(sockfp,"MAIL FROM:<%s>\r\n", from);
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP> MAIL FROM:<%s>", from);
   ok = SMTP_ok(sockfp);
@@ -49,7 +49,7 @@ int SMTP_rcpt(FILE *sockfp, char *to)
 {
   int ok;
 
-  SockPrintf(sockfp,"RCPT TO:<%s>\r\n", to);
+  fprintf(sockfp,"RCPT TO:<%s>\r\n", to);
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP> RCPT TO:<%s>", to);
   ok = SMTP_ok(sockfp);
@@ -61,7 +61,7 @@ int SMTP_data(FILE *sockfp)
 {
   int ok;
 
-  SockPrintf(sockfp,"DATA\r\n");
+  fprintf(sockfp,"DATA\r\n");
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP> DATA");
   ok = SMTP_ok(sockfp);
@@ -73,7 +73,7 @@ int SMTP_quit(FILE *sockfp)
 {
   int ok;
 
-  SockPrintf(sockfp,"QUIT\r\n");
+  fprintf(sockfp,"QUIT\r\n");
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP> QUIT");
   ok = SMTP_ok(sockfp);
@@ -85,7 +85,7 @@ int SMTP_eom(FILE *sockfp)
 {
   int ok;
 
-  SockPrintf(sockfp,".\r\n");
+  fprintf(sockfp,".\r\n");
   if (outlevel == O_VERBOSE)
       error(0, 0, "SMTP>. (EOM)");
   ok = SMTP_ok(sockfp);
index bdc58ca0e9a980de745769b41e6c8fa8dadfa671..a69f36bc57b2c54c7c4b9b7ba5db83750c010204 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -21,13 +21,4 @@ returns 0 for success.
 */
 int SockGets(char *buf, int len, FILE *sockfp);
 
-/* Ship a character array to the socket */
-#define SockWrite(buf, len, sockfp)    fwrite(buf, 1, len, sockfp)
-
-/* 
-Send formatted output to the socket, followed
-by a CR-LF.  Returns 0 for success.
-*/
-#define SockPrintf     fprintf
-
 #endif /* SOCKET__ */