Path: blob/main/korean/hcode/files/patch-mail.c
16461 views
--- mail.c.orig 1998-03-11 10:02:22 UTC1+++ mail.c2@@ -1,5 +1,9 @@3+#include <ctype.h>4#include <stdio.h>5+#include <string.h>67+static int ks2iso(unsigned char *, FILE *);8+9/* ------------------------------------------------------10Search for Starting Mark and print out (ENGLISH) prologue11mark : Starting Code12@@ -66,9 +70,8 @@ FILE *fpin, *fpout;13#define SI '\017'14#define SO '\016'1516-int ks2iso(ibuf,fpout)17-unsigned char *ibuf;18-FILE *fpout;19+static int20+ks2iso(unsigned char *ibuf, FILE *fpout)21{22int mode=ASCII;23int i=0;24@@ -172,8 +175,8 @@ void (*prwc)();25if (fgets((char *) ibuf,HDR_BUF_LEN,fpin) == NULL) /* no message body */26return(1); /* header only (6/8/96) */2728- if ( ! strncasecmp("Content-Type:",iptr,13) ||29- !strncasecmp("Content-Transfer-Encoding:",iptr,26) ) {30+ if ( ! strncasecmp("Content-Type:", (char *)iptr, 13) ||31+ !strncasecmp("Content-Transfer-Encoding:", (char *)iptr, 26) ) {32header_switch(iptr,fpout);33continue;34}35@@ -186,7 +189,7 @@ void (*prwc)();36while ( charset[++i] != NULL ) {3738sprintf(encode_prefix,"=?%s?B?",charset[i]);39- if ( ! strncasecmp(encode_prefix,iptr,40+ if ( ! strncasecmp(encode_prefix, (char *)iptr,41strlen(encode_prefix)) ) {42isbqheader=43bqheader_decode(&iptr,encode_prefix,Bencode,44@@ -195,7 +198,7 @@ void (*prwc)();45}4647sprintf(encode_prefix,"=?%s?Q?",charset[i]);48- if ( ! strncasecmp(encode_prefix,iptr,49+ if ( ! strncasecmp(encode_prefix, (char *)iptr,50strlen(encode_prefix)) ) {51isbqheader=52bqheader_decode(&iptr,encode_prefix,Qencode,53@@ -238,7 +241,7 @@ int outCode;54unsigned char ibuf[HDR_BUF_LEN],obuf[HDR_BUF_LEN],tbuf[HDR_BUF_LEN];55unsigned char *iptr, *tptr;5657- if ( cp >= HDR_BUF_LEN ) {58+ if ( cp >= (HDR_BUF_LEN-8) ) {59pr2m(Printwc,fpout,outCode);60return;61}62@@ -250,15 +253,15 @@ int outCode;63return;64}65ibuf[cp++] = '\n';66- ibuf[cp] = NULL;67+ ibuf[cp] = '\0';68cp = 0;69iptr = ibuf;70while (*iptr) {71tptr = tbuf;72while (*iptr && *iptr<0x80) fputc(*iptr++,fpout);73while (*iptr && (*iptr>0x80 || *iptr ==' ')) *tptr++ = *iptr++;74- *tptr = NULL;75- if (tbuf[0]!=NULL) {76+ *tptr = '\0';77+ if (tbuf[0]!='\0') {78string_to_base64(obuf, tbuf);79fprintf(fpout,"=?EUC-KR?B?%s?=",obuf);80}81@@ -342,12 +345,12 @@ void (*prwc)();82only checks if there's any whitespace or '?'.83*/8485- while ( *iptr && strncmp("?=",iptr,2) && tptr-tbuf < BQ_BUF_SIZE - 2 ) {86+ while ( *iptr && strncmp("?=", (char *)iptr, 2) && tptr-tbuf < BQ_BUF_SIZE - 2 ) {87if ( isspace(*iptr) || *iptr == '?' ) break;88*tptr++ = *iptr++;89}90- *tptr = NULL;91- if ( ! strncmp("?=",iptr,2) ) {92+ *tptr = '\0';93+ if ( ! strncmp("?=", (char *)iptr, 2) ) {94iptr+=2;95if ( encoding == Bencode)96base64_to_string(obuf, tbuf);97@@ -495,7 +498,7 @@ void header_switch(iptr,fpout)98/* void header_switch(iptr0,fpout,name_len) */99void header_switch(iptr,fpout)100/* unsigned char **iptr0; */101-unsigned char *iptr;102+char *iptr;103FILE *fpout;104/* int name_len; */105{106107108