1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
*** metamail.old/mailto.c Wed Feb 9 21:30:26 1994
--- metamail/mailto.c Thu Jul 29 14:32:28 2004
***************
*** 570,575 ****
--- 570,576 ----
if (isupper(*sdum)) *sdum = tolower(*sdum);
}
if (strcmp(CharacterSet, "us-ascii")
+ && strcmp(CharacterSet, "koi8-r")
&& strncmp(CharacterSet, "iso-8859-", 9)) {
fprintf(stderr, "mailto: Unsupported character set: %s\n", CharacterSet);
exit(-1);
***************
*** 1130,1135 ****
--- 1131,1137 ----
if (part->isrich) {
if (strcmp(CharacterSet, "us-ascii")
&& (strncmp(CharacterSet, "iso-8859-", 9)
+ && strcmp(CharacterSet, "koi8-r")
|| part->encoding_type_needed != ENC_NONE)) {
fprintf(fp, "Content-type: text/richtext; charset=\"%s\"\n", CharacterSet);
} else {
***************
*** 1140,1145 ****
--- 1142,1148 ----
WriteCtypeNicely(fp, part->content_type);
if (strcmp(CharacterSet, "us-ascii")
&& (strncmp(CharacterSet, "iso-8859-", 9)
+ && strcmp(CharacterSet, "koi8-r")
|| part->encoding_type_needed != ENC_NONE)) {
fprintf(fp, "; charset=\"%s\"\n", CharacterSet);
} else fputs("\n", fp);
***************
*** 1745,1750 ****
--- 1748,1754 ----
}
printf("\n\nEnter your choice as a number from 0 to %d: ", i);
fflush(stdout);
+ *LineBuf = '\0';
fgets(LineBuf, sizeof(LineBuf), stdin);
ans = atoi(LineBuf);
if (ans == 0 || ans == 1) {
***************
*** 1752,1759 ****
FILE *fpi, *fpo;
printf("\nIf you want to include non-textual data from a file, enter the file name.\nTo include the output of a command, enter \"|\" followed by the command.\nIf you do not want to include anything, just press ENTER (RETURN).\n> ");
fflush(stdout);
fgets(CTLineBuf, sizeof(CTLineBuf), stdin);
! sdum = CTLineBuf+strlen(CTLineBuf) -1;
while (sdum >= CTLineBuf && isspace((unsigned char) *sdum)) {
*sdum = '\0';
--sdum;
--- 1756,1764 ----
FILE *fpi, *fpo;
printf("\nIf you want to include non-textual data from a file, enter the file name.\nTo include the output of a command, enter \"|\" followed by the command.\nIf you do not want to include anything, just press ENTER (RETURN).\n> ");
fflush(stdout);
+ *CTLineBuf = '\0';
fgets(CTLineBuf, sizeof(CTLineBuf), stdin);
! sdum = *CTLineBuf ? CTLineBuf+strlen(CTLineBuf) -1 : CTLineBuf;
while (sdum >= CTLineBuf && isspace((unsigned char) *sdum)) {
*sdum = '\0';
--sdum;
***************
*** 1791,1797 ****
int ct;
printf("\nEnter the MIME Content-type value for the data from file %s\n (type '?' for a list of locally-valid content-types): ", sdum);
fflush(stdout);
! gets(LineBuf);
if (index(LineBuf, '/')) {
char lc[100], *s, AnsBuf[100];
strcpy(lc, LineBuf);
--- 1796,1805 ----
int ct;
printf("\nEnter the MIME Content-type value for the data from file %s\n (type '?' for a list of locally-valid content-types): ", sdum);
fflush(stdout);
! *LineBuf = '\0';
! fgets(LineBuf, sizeof(LineBuf), stdin);
! if (*LineBuf)
! LineBuf[strlen(LineBuf) - 1] = '\0';
if (index(LineBuf, '/')) {
char lc[100], *s, AnsBuf[100];
strcpy(lc, LineBuf);
***************
*** 1809,1815 ****
}
if (mc) break;
printf("The MIME content-type '%s' is not listed in your local mailcap files,\nand may not be a valid MIME type. Do you want to use it anyway [no] ? ", LineBuf);
! s = gets(AnsBuf);
while (s && *s && isspace((unsigned char) *s)) ++s;
if (s && (*s == 'y' || *s == 'Y')) break;
continue;
--- 1817,1823 ----
}
if (mc) break;
printf("The MIME content-type '%s' is not listed in your local mailcap files,\nand may not be a valid MIME type. Do you want to use it anyway [no] ? ", LineBuf);
! s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
while (s && *s && isspace((unsigned char) *s)) ++s;
if (s && (*s == 'y' || *s == 'Y')) break;
continue;
***************
*** 2137,2142 ****
--- 2145,2151 ----
printf("2: %s\n", CmdBuf);
printf("\n\nEnter 1 or 2, or 0 to not edit it: ");
fflush(stdout);
+ *LineBuf = '\0';
fgets(LineBuf, sizeof(LineBuf), stdin);
ans = atoi(LineBuf);
} else ans = 2;
*** metamail.old/metamail.c Thu Feb 17 02:57:19 1994
--- metamail/metamail.c Wed Mar 9 21:30:22 2005
***************
*** 83,89 ****
#define MAX_FILE_NAME_SIZE 256
#define WRITE_BINARY "w"
#else /* AMIGA */
! extern char **environ, *gets();
#define CATCOMMAND "cat"
#define CATTEMPLATE "cat %s"
#define METAMAIL "metamail"
--- 83,89 ----
#define MAX_FILE_NAME_SIZE 256
#define WRITE_BINARY "w"
#else /* AMIGA */
! extern char **environ;
#define CATCOMMAND "cat"
#define CATTEMPLATE "cat %s"
#define METAMAIL "metamail"
***************
*** 540,545 ****
--- 540,546 ----
ans = 2;
} else {
printf("\nWhat do you want to do with the %s data?\n1 -- See it as text\n2 -- Write it to a file\n3 -- Just skip it\n\n", octetstream ? "raw" : ContentType);
+ *Fname = '\0';
fgets(Fname, sizeof(Fname), stdin);
ans = atoi(Fname);
}
***************
*** 554,561 ****
needname = 0;
printf("Please enter the name of a file to which the data should be written\n(Default: %s) > ", suggestedname);
fflush(stdout);
fgets(Fname, sizeof(Fname), stdin);
! Fname[strlen(Fname) - 1] = '\0'; /* bogus newline */
#if !defined(AMIGA) && !defined(MSDOS)
if (!Fname[0]) strcpy(Fname, suggestedname);
if (Fname[0] == '~' && Fname[1] == '/') {
--- 555,564 ----
needname = 0;
printf("Please enter the name of a file to which the data should be written\n(Default: %s) > ", suggestedname);
fflush(stdout);
+ *Fname = '\0';
fgets(Fname, sizeof(Fname), stdin);
! if (*Fname)
! Fname[strlen(Fname) - 1] = '\0'; /* bogus newline */
#if !defined(AMIGA) && !defined(MSDOS)
if (!Fname[0]) strcpy(Fname, suggestedname);
if (Fname[0] == '~' && Fname[1] == '/') {
***************
*** 579,588 ****
int overwriteans = -1;
do {
printf("File %s exists. Do you want to overwrite it (y/n) ?\n", Fname);
! s = gets(AnsBuf);
if (!s) {
overwriteans = 0;
} else {
while (s && *s && isspace((unsigned char) *s)) ++s;
if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') {
overwriteans = 1;
--- 582,593 ----
int overwriteans = -1;
do {
printf("File %s exists. Do you want to overwrite it (y/n) ?\n", Fname);
! *AnsBuf = '\0';
! s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
if (!s) {
overwriteans = 0;
} else {
+ s[strlen(s) - 1] = '\0';
while (s && *s && isspace((unsigned char) *s)) ++s;
if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') {
overwriteans = 1;
***************
*** 1202,1210 ****
fprintf(outfp, "Content-type: %s", ContentType);
for (j=0; j<CParamsUsed; ++j) {
fprintf(outfp, " ; ");
! fprintf(outfp, CParams[j]);
fprintf(outfp, " = ");
! fprintf(outfp, CParamValues[j]);
}
fprintf(outfp, "\n\n");
TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
--- 1207,1215 ----
fprintf(outfp, "Content-type: %s", ContentType);
for (j=0; j<CParamsUsed; ++j) {
fprintf(outfp, " ; ");
! fprintf(outfp, "%s", CParams[j]);
fprintf(outfp, " = ");
! fprintf(outfp, "%s", CParamValues[j]);
}
fprintf(outfp, "\n\n");
TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
***************
*** 1823,1830 ****
} else {
printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname));
}
! s = gets(AnsBuf);
if (!s) return(0); /* EOF */
while (s && *s && isspace((unsigned char) *s)) ++s;
if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
--- 1828,1836 ----
} else {
printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname));
}
! s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
if (!s) return(0); /* EOF */
+ s[strlen(s) - 1] = '\0';
while (s && *s && isspace((unsigned char) *s)) ++s;
if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
if (*s == 'n' || *s == 'N' || *s == 'q' || *s == 'Q') {
***************
*** 2022,2028 ****
if (lc2strcmp(charset, PrevCharset)) {
char *s2, *charsetinuse;
! strcpy(PrevCharset, charset);
for (s2=PrevCharset; *s2; ++s2) {
if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2);
}
--- 2028,2035 ----
if (lc2strcmp(charset, PrevCharset)) {
char *s2, *charsetinuse;
! strncpy(PrevCharset, charset, sizeof(PrevCharset));
! PrevCharset[sizeof(PrevCharset) - 1] = '\0';
for (s2=PrevCharset; *s2; ++s2) {
if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2);
}
***************
*** 2032,2038 ****
}
}
if (ecode == ENCODING_NONE) {
! printf(txt+1);
} else {
/* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
MkTmpFileName(TmpFile);
--- 2039,2045 ----
}
}
if (ecode == ENCODING_NONE) {
! printf("%s", txt+1);
} else {
/* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
MkTmpFileName(TmpFile);
|