762b9f7f3f
XXX: this package should be terminated with prejudice
178 lines
5.5 KiB
Text
178 lines
5.5 KiB
Text
$NetBSD: patch-af,v 1.5 2012/12/30 05:38:55 dholland Exp $
|
|
|
|
- use required standard headers
|
|
- don't provide own declarations of standard functions
|
|
- declare own functions
|
|
- use C89
|
|
- don't use gets()
|
|
- ...? (XXX)
|
|
|
|
--- metamail/mailto.c.orig 1994-02-09 20:30:26.000000000 +0000
|
|
+++ metamail/mailto.c
|
|
@@ -36,7 +36,9 @@ STILL NEED TO DO/SUPPORT:
|
|
-- Replace EditString with something that does the right thing in-line.
|
|
*/
|
|
|
|
+#include <stdlib.h>
|
|
#include <stdio.h>
|
|
+#include <string.h>
|
|
#include <ctype.h>
|
|
#include <config.h>
|
|
#include <pwd.h>
|
|
@@ -50,8 +52,6 @@ STILL NEED TO DO/SUPPORT:
|
|
#include <getfiles.h>
|
|
#include <time.h>
|
|
#include <lib_protos.h>
|
|
-#else
|
|
-extern char *getenv();
|
|
#endif
|
|
|
|
#ifdef SYSV
|
|
@@ -60,9 +60,16 @@ extern char *getenv();
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
-extern char *malloc(), *realloc(), *index(), *getmyname();
|
|
struct mailpart *CreateNewPart();
|
|
|
|
+void DeAlias(char *name, FILE *fp, char *hdr);
|
|
+void HeaderFputs(char *s, FILE *fp, char *hdr);
|
|
+void HandleAliasCommand(char *aliasline);
|
|
+void ProcessOneMailRC(char *fname, int IsAndrew);
|
|
+void EditCurrentMessage(int UseVisual);
|
|
+void FputsQuotingLT(char *s, FILE *fp, struct mailpart *part, int EightBitMode, int RightToLeftMode);
|
|
+void WriteOutMessage(FILE *fp, char *ToList, char *Subject, char *CCList, struct mailpart *FirstPart);
|
|
+
|
|
/* The main data structure for the multiple parts of the mail */
|
|
|
|
struct mailpart {
|
|
@@ -570,6 +577,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);
|
|
@@ -1042,10 +1050,7 @@ char *newid() {
|
|
return(idbuf);
|
|
}
|
|
|
|
-WriteOutMessage(fp, ToList, Subject, CCList, FirstPart)
|
|
-FILE *fp;
|
|
-char *ToList, *Subject, *CCList;
|
|
-struct mailpart *FirstPart;
|
|
+void WriteOutMessage(FILE *fp, char *ToList, char *Subject, char *CCList, struct mailpart *FirstPart)
|
|
{
|
|
FILE *fpin;
|
|
static int ctr = 0;
|
|
@@ -1130,6 +1135,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 +1146,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);
|
|
@@ -1328,11 +1335,7 @@ struct mailpart *part;
|
|
}
|
|
}
|
|
|
|
-FputsQuotingLT(s, fp, part, EightBitMode, RightToLeftMode)
|
|
-char *s;
|
|
-FILE *fp;
|
|
-struct mailpart *part;
|
|
-int EightBitMode, RightToLeftMode;
|
|
+void FputsQuotingLT(char *s, FILE *fp, struct mailpart *part, int EightBitMode, int RightToLeftMode)
|
|
{
|
|
static int InNewLineSequence=1;
|
|
int c=0;
|
|
@@ -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;
|
|
@@ -2073,8 +2077,7 @@ char *ctype, *pat;
|
|
return(0);
|
|
}
|
|
|
|
-EditCurrentMessage(UseVisual)
|
|
-int UseVisual;
|
|
+void EditCurrentMessage(int UseVisual)
|
|
{
|
|
char *editor = NULL;
|
|
char *CmdBuf, *CmdBuf2, LineBuf[100];
|
|
@@ -2212,9 +2215,7 @@ int IsAndrew;
|
|
}
|
|
}
|
|
|
|
-ProcessOneMailRC(fname, IsAndrew)
|
|
-char *fname;
|
|
-int IsAndrew;
|
|
+void ProcessOneMailRC(char *fname, int IsAndrew)
|
|
{
|
|
FILE *fp;
|
|
char *LineBuf = NULL, *sdum;
|
|
@@ -2290,8 +2291,7 @@ struct alias {
|
|
struct alias *next;
|
|
} *FirstAlias = NULL;
|
|
|
|
-HandleAliasCommand(aliasline)
|
|
-char *aliasline;
|
|
+void HandleAliasCommand(char *aliasline)
|
|
{
|
|
struct alias *tmpalias;
|
|
char *s, *s2;
|
|
@@ -2357,10 +2357,7 @@ char *s;
|
|
return(NULL);
|
|
}
|
|
|
|
-HeaderFputs(s, fp, hdr)
|
|
-char *s;
|
|
-FILE *fp;
|
|
-char *hdr;
|
|
+void HeaderFputs(char *s, FILE *fp, char *hdr)
|
|
{
|
|
char *firstnonascii, *firstascii;
|
|
|
|
@@ -2436,10 +2433,7 @@ char *hdr;
|
|
}
|
|
}
|
|
|
|
-DeAlias(name, fp, hdr)
|
|
-char *name;
|
|
-FILE *fp;
|
|
-char *hdr;
|
|
+void DeAlias(char *name, FILE *fp, char *hdr)
|
|
{
|
|
struct alias *tmpalias;
|
|
char *end, savechar;
|