$NetBSD: patch-af,v 1.3 2004/02/25 03:58:43 snj Exp $ --- metamail/mailto.c.orig 1994-02-09 12:30:26.000000000 -0800 +++ metamail/mailto.c 2004-02-24 10:13:44.000000000 -0800 @@ -570,6 +570,7 @@ char **argv; 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,6 +1131,7 @@ struct mailpart *part; 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,6 +1142,7 @@ struct mailpart *part; 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,6 +1748,7 @@ CreateNewPart() { } 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) { @@ -1791,7 +1795,7 @@ CreateNewPart() { 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); + fgets(LineBuf, sizeof(LineBuf), stdin); if (index(LineBuf, '/')) { char lc[100], *s, AnsBuf[100]; strcpy(lc, LineBuf); @@ -1809,7 +1813,7 @@ CreateNewPart() { } 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); + s = fgets(AnsBuf, sizeof(AnsBuf), stdin); while (s && *s && isspace((unsigned char) *s)) ++s; if (s && (*s == 'y' || *s == 'Y')) break; continue;