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