summaryrefslogtreecommitdiff
path: root/mail/metamail/patches/patch-ai
blob: eedfe1407f656491bb8289708a1e74f227459f04 (plain)
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
$NetBSD: patch-ai,v 1.2 2012/10/26 20:27:15 joerg Exp $

--- metamail/metamail.c.orig	1994-02-17 01:57:19.000000000 +0000
+++ metamail/metamail.c
@@ -83,7 +83,7 @@ extern char *MkRmScript();
 #define MAX_FILE_NAME_SIZE 256
 #define WRITE_BINARY	"w"
 #else /* AMIGA */
-extern char **environ, *gets();
+extern char **environ;
 #define CATCOMMAND  "cat"
 #define CATTEMPLATE "cat %s"
 #define METAMAIL    "metamail"
@@ -100,15 +100,14 @@ extern char **environ, *gets();
 #define CMDSIZE 1200 /* Maximum size of command to execute */
 
 #define LINE_BUF_SIZE       2000
-#ifndef MICROSOFT
-extern char *malloc();
-extern char *realloc();
-#endif
-extern char *getenv();
-extern char *index();
-extern char *rindex();
+#include <string.h>
+#include <stdlib.h>
+
 char fileToDelete[MAX_FILE_NAME_SIZE];
 
+void PauseForUser(void);
+void maybephead(char *);
+
 char *FindParam();
 extern FILE *popen();
 static char *nomem = "Out of memory!";
@@ -579,7 +578,7 @@ int nestingdepth;
                                 int overwriteans = -1;
                                 do {
                                     printf("File %s exists.  Do you want to overwrite it (y/n) ?\n", Fname);
-                                    s = gets(AnsBuf);
+				    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
                                     if (!s) {
                                         overwriteans = 0;
                                     } else {
@@ -1202,9 +1201,9 @@ char *SquirrelFile;
     fprintf(outfp, "Content-type: %s", ContentType);
     for (j=0; j<CParamsUsed; ++j) {
         fprintf(outfp, " ; ");
-        fprintf(outfp, CParams[j]);
+        fprintf(outfp, "%s", CParams[j]);
         fprintf(outfp, " = ");
-        fprintf(outfp, CParamValues[j]);
+        fprintf(outfp, "%s", CParamValues[j]);
     }
     fprintf(outfp, "\n\n"); 
     TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType);
@@ -1823,7 +1822,7 @@ char *ctype, *progname, *label;
         } 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);
+	s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
         if (!s) return(0); /* EOF */
 	while (s && *s && isspace((unsigned char) *s)) ++s;
 	if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
@@ -1900,7 +1899,7 @@ char *hdr;
 }
 
 /* check the header given to see if it matches any in the KeyHeadList */
-maybephead(hdr)
+void maybephead(hdr)
 char *hdr;
 {
     char *s;
@@ -2022,7 +2021,8 @@ int ShowLeadingWhitespace;
     if (lc2strcmp(charset, PrevCharset)) {
         char *s2, *charsetinuse;
 
-        strcpy(PrevCharset, charset);
+        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,7 +2032,7 @@ int ShowLeadingWhitespace;
         }
     }
     if (ecode == ENCODING_NONE) {
-        printf(txt+1);
+        printf("%s", txt+1);
     } else {
         /* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
         MkTmpFileName(TmpFile);
@@ -2655,12 +2655,12 @@ char *s2;
 #endif
 }
 
-PauseForUser() {
+void PauseForUser() {
 #if defined(MSDOS) || defined(AMIGA)
     char Buf[100];
 #endif
 
-    if (DefinitelyNotTty || MustNotBeTty) return;	
+    if (DefinitelyNotTty || MustNotBeTty) return;
 #if defined(MSDOS) || defined(AMIGA)
     printf("Press RETURN to go on\n");
     gets(Buf);