]> Pileus Git - ~andy/fetchmail/blobdiff - unmime.c
Fix typo repsonsible -> responsible.
[~andy/fetchmail] / unmime.c
index 1409bd671e42be728aef8aa74901051d1df9c512..070d7945aee16f0c4cad27e53e3cd66fb6dfb02f 100644 (file)
--- a/unmime.c
+++ b/unmime.c
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include "fetchmail.h"
-#include "i18n.h"
+#include "gettext.h"
 
 static unsigned char unhex(unsigned char c)
 {
@@ -292,7 +292,7 @@ static char *GetBoundary(char *CntType)
   do {
     p2 = strchr(p1, ';'); 
     if (p2)
-      for (p2++; isspace((unsigned char)*p2); p2++);
+      for (p2++; isspace((unsigned char)*p2); p2++) { }
 
     p1 = p2;
   } while ((p1) && (strncasecmp(p1, "boundary", 8) != 0));
@@ -418,7 +418,7 @@ int MimeBodyType(char *hdrs, int WantDecode)
             */
 
            /* Skip the "Content-Type:" part and whitespace after it */
-           for (NxtHdr += 13; ((*NxtHdr == ' ') || (*NxtHdr == '\t')); NxtHdr++);
+           for (NxtHdr += 13; ((*NxtHdr == ' ') || (*NxtHdr == '\t')); NxtHdr++) { }
 
            /* 
             * Get the full value of the Content-Type header;
@@ -459,7 +459,7 @@ int MimeBodyType(char *hdrs, int WantDecode)
 
        /* Check Content-Type to see if this is a multipart message */
        if ( (CntType != NULL) &&
-               ((strncasecmp(CntType, "multipart/mixed", 16) == 0) ||
+               ((strncasecmp(CntType, "multipart/mixed", 15) == 0) ||
                 (strncasecmp(CntType, "message/", 8) == 0)) ) {
 
            char *p1 = GetBoundary(CntType);
@@ -469,7 +469,6 @@ int MimeBodyType(char *hdrs, int WantDecode)
                   the boundary string */
                strcpy(MultipartDelimiter, "--");
                strlcat(MultipartDelimiter, p1, sizeof(MultipartDelimiter));
-               MultipartDelimiter[sizeof(MultipartDelimiter)-1] = '\0';
                BodyType = (MSG_IS_8BIT | MSG_NEEDS_DECODE);
            }
        }
@@ -657,7 +656,7 @@ int outlevel = 0;
 #define BUFSIZE_INCREMENT 4096
 
 #ifdef DEBUG
-#define DBG_FWRITE(B,L,BS,FD) ((void)fwrite((B), (L), (BS), (FD)))
+#define DBG_FWRITE(B,L,BS,FD) do { if (fwrite((B), (L), (BS), (FD))) { } } while(0)
 #else
 #define DBG_FWRITE(B,L,BS,FD)
 #endif
@@ -720,8 +719,11 @@ int main(int argc, char *argv[])
   bodytype = MimeBodyType(buffer, 1);
 
   i = strlen(buffer);
-  fwrite(buffer, i, 1, stdout);
   DBG_FWRITE(buffer, i, 1, fd_conv);
+  if (fwrite(buffer, i, 1, stdout) < 1) {
+      perror("fwrite");
+      goto barf;
+  }
   
   do {
      buf_p = (buffer - 1);
@@ -738,13 +740,17 @@ int main(int argc, char *argv[])
            buf_p = buffer;
            UnMimeBodyline(&buf_p, 0, 0);
         }
-        fwrite(buffer, (buf_p - buffer), 1, stdout);
         DBG_FWRITE(buffer, (buf_p - buffer), 1, fd_conv);
+        if (fwrite(buffer, (buf_p - buffer), 1, stdout) < 1) {
+           perror("fwrite");
+           goto barf;
+       }
      }
   } while (buf_p > buffer);
 
+barf:
   free(buffer);
-  fflush(stdout);
+  if (EOF == fflush(stdout)) perror("fflush");
 
 #ifdef DEBUG
   fclose(fd_orig);
@@ -754,4 +760,3 @@ int main(int argc, char *argv[])
   return 0;
 }
 #endif
-