summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorVolker Stolz <vs@FreeBSD.org>2005-03-10 13:53:57 +0000
committerVolker Stolz <vs@FreeBSD.org>2005-03-10 13:53:57 +0000
commit1502660c61079b6108f7457467f22e69cbe731e3 (patch)
tree03ed676c3ea293ca672b31c407fbb31195a9e652 /mail
parent- Update to 2.3-20050308 (diff)
Correctly handle difference between gets() and fgets(): The latter retains
the trailing newline. PR: ports/78662 Submitted by: Mats Peterson
Notes
Notes: svn path=/head/; revision=130799
Diffstat (limited to 'mail')
-rw-r--r--mail/metamail/Makefile2
-rw-r--r--mail/metamail/files/patch-af109
2 files changed, 93 insertions, 18 deletions
diff --git a/mail/metamail/Makefile b/mail/metamail/Makefile
index 573027e9a342..d44aeb5a50b8 100644
--- a/mail/metamail/Makefile
+++ b/mail/metamail/Makefile
@@ -7,7 +7,7 @@
PORTNAME= metamail
PORTVERSION= 2.7
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= mail
MASTER_SITES= http://ftp.funet.fi/pub/unix/mail/metamail/
DISTNAME= mm${PORTVERSION}
diff --git a/mail/metamail/files/patch-af b/mail/metamail/files/patch-af
index 3a67175fd480..730c76348e9f 100644
--- a/mail/metamail/files/patch-af
+++ b/mail/metamail/files/patch-af
@@ -1,5 +1,5 @@
-*** mailto.c.orig Wed Feb 9 23:30:26 1994
---- metamail/mailto.c Mon Nov 20 01:21:37 1995
+*** 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 ----
@@ -41,6 +41,26 @@
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);
@@ -49,11 +69,14 @@
if (index(LineBuf, '/')) {
char lc[100], *s, AnsBuf[100];
strcpy(lc, LineBuf);
---- 1795,1801 ----
+--- 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);
-! fgets(LineBuf, sizeof(LineBuf), stdin);
+! *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);
@@ -66,16 +89,26 @@
while (s && *s && isspace((unsigned char) *s)) ++s;
if (s && (*s == 'y' || *s == 'Y')) break;
continue;
---- 1813,1819 ----
+--- 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);
+! s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
while (s && *s && isspace((unsigned char) *s)) ++s;
if (s && (*s == 'y' || *s == 'Y')) break;
continue;
-*** metamail/metamail.c.orig Wed Feb 16 19:57:19 1994
---- metamail/metamail.c Wed Feb 18 15:39:09 2004
+***************
+*** 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
@@ -94,7 +127,38 @@
#define CATTEMPLATE "cat %s"
#define METAMAIL "metamail"
***************
-*** 579,585 ****
+*** 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);
@@ -102,14 +166,22 @@
if (!s) {
overwriteans = 0;
} else {
---- 579,585 ----
+ 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);
-! s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+! *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);
@@ -121,7 +193,7 @@
}
fprintf(outfp, "\n\n");
TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
---- 1202,1210 ----
+--- 1207,1215 ----
fprintf(outfp, "Content-type: %s", ContentType);
for (j=0; j<CParamsUsed; ++j) {
fprintf(outfp, " ; ");
@@ -132,7 +204,7 @@
fprintf(outfp, "\n\n");
TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
***************
-*** 1823,1829 ****
+*** 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));
}
@@ -140,14 +212,17 @@
if (!s) return(0); /* EOF */
while (s && *s && isspace((unsigned char) *s)) ++s;
if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
---- 1823,1829 ----
+ 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);
+! 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)) {
@@ -157,7 +232,7 @@
for (s2=PrevCharset; *s2; ++s2) {
if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2);
}
---- 2022,2029 ----
+--- 2028,2035 ----
if (lc2strcmp(charset, PrevCharset)) {
char *s2, *charsetinuse;
@@ -175,7 +250,7 @@
} else {
/* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
MkTmpFileName(TmpFile);
---- 2033,2039 ----
+--- 2039,2045 ----
}
}
if (ecode == ENCODING_NONE) {