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