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));
* be really careful if you change this.
*/
- static char *DecodedTypes[] = {
+ static const char *DecodedTypes[] = {
"text/", /* Will match ALL content-type's starting with 'text/' */
"message/rfc822",
NULL
*/
/* 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;
#include <stdio.h>
#include <unistd.h>
-char *program_name = "unmime";
+const char *program_name = "unmime";
int outlevel = 0;
#define BUFSIZE_INCREMENT 4096
#ifdef DEBUG
-#define DBG_FWRITE(B,L,BS,FD) 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
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);
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);
return 0;
}
#endif
-