Index: head/mail/metamail/files/patch-Makefile =================================================================== --- head/mail/metamail/files/patch-Makefile (revision 415138) +++ head/mail/metamail/files/patch-Makefile (revision 415139) @@ -1,100 +1,108 @@ ---- Makefile.orig 1994-01-26 18:32:33.000000000 +0100 -+++ Makefile 2014-06-04 12:42:07.532697759 +0200 -@@ -26,7 +26,7 @@ +--- Makefile.orig 1994-01-26 17:32:33 UTC ++++ Makefile +@@ -26,7 +26,7 @@ MAKE = make CP = cp # How to compile C programs -CC = cc +#CC = cc # You may also want to change the CFLAGS variable, which will be passed on # to all subdirectories. If you do that, the changes will only work right if you -@@ -38,7 +38,7 @@ +@@ -38,7 +38,7 @@ FOOBAR-sun4=-Bstatic STATICFLAG=FOOBAR${HOST_ARCH} -CFLAGS = -g -I. ${$(STATICFLAG)} +CFLAGS += -I. ${$(STATICFLAG)} # The following is better if you want to make sure you run with SYSV defined # CFLAGS = -g -I. ${$(STATICFLAG)} -DSYSV # Also, for SGI Irix, compile in K&R mode -@@ -49,9 +49,9 @@ +@@ -49,9 +49,9 @@ CFLAGS = -g -I. ${$(STATICFLAG)} # LDLIBS variable. # # For Sun and BSD systems, the following should work... -LDLIBS = +# LDLIBS = # On BSD 4.4 systems, you will need the following -# LDLIBS = -lcompat +LDLIBS = -s -lcompat # On SGI machines, we need -lsun for getpw...(), and -lc_s saves some space. # LDLIBS = -lsun -lc_s # ISC SysVr3.2.2 has a shared C library and requires libinet.a to resolve -@@ -72,10 +72,10 @@ +@@ -72,10 +72,10 @@ CONFIGDIR = . # install -s -c $(LOCALBINDIR) $$file # #INSTALL = cp -INSTALL = install -c -s +INSTALL = install -c # Root of installation tree -INSTROOT = /usr/local +INSTROOT = ${PREFIX} # # This is where binaries should be copied LOCALBINDIR = ${INSTROOT}/bin -@@ -96,9 +96,9 @@ +@@ -96,9 +96,9 @@ MAILCAPDIR = ${INSTROOT}/etc # This helps with the "for" constructs below on some platforms: SHELL=/bin/sh -install: basics +install: install-all -basics:: +all basics:: (cd metamail ; $(MAKE) CONFIGDIR=../${CONFIGDIR} CFLAGS="${CFLAGS}" CC="${CC}" LDLIBS="${LDLIBS}") -${RM} bin/metamail (cd bin; ${LN} ../metamail/metamail metamail) -@@ -117,7 +117,7 @@ +@@ -117,38 +117,33 @@ basics:: (cd bin; ${LN} ../richmail/richtext richtext) -${RM} bin/richtoatk (cd bin; ${LN} ../richmail/richtoatk richtoatk) - (cd fonts ; $(MAKE) CONFIGDIR=../${CONFIGDIR} CFLAGS="${CFLAGS}" CC="${CC}" LDLIBS="${LDLIBS}" FONTSUFFIX="${FONTSUFFIX}") -+ (cd fonts ; $(MAKE) PREFIX=${PREFIX} CONFIGDIR=../${CONFIGDIR} CFLAGS="${CFLAGS}" CC="${CC}" LDLIBS="${LDLIBS}" FONTSUFFIX="${FONTSUFFIX}") -${RM} bin/shownonascii - (cd bin; ${LN} ../fonts/shownonascii shownonascii) +- (cd bin; ${LN} ../fonts/shownonascii shownonascii) -${RM} bin/mailto-hebrew -@@ -127,28 +127,27 @@ +- (cd bin; ${LN} ../fonts/mailto-hebrew mailto-hebrew) + + install-all: basics @(cd bin; \ for file in *; \ do \ - target=$(LOCALBINDIR)/$$file; \ + target=$(DESTDIR)$(LOCALBINDIR)/$$file; \ echo "installing binary $$target"; \ ${INSTALL} $$file $$target; \ done) @(cd man; \ for file in *.1; \ do \ - target=$(MAN1DIR)/`basename $$file .1`.$(MAN1EXT); \ + target=$(DESTDIR)$(MAN1DIR)/`basename $$file .1`.$(MAN1EXT); \ echo "installing man page $$target";\ ${CP} $$file $$target; \ done) @(cd man; \ for file in *.4; \ do \ - target=$(MAN4DIR)/`basename $$file .4`.$(MAN4EXT); \ + target=$(DESTDIR)$(MAN4DIR)/`basename $$file .4`.$(MAN4EXT); \ echo "installing man page $$target";\ ${CP} $$file $$target; \ done) - @echo "Renaming old mailcap file to $(MAILCAPDIR)/mailcap.old - -mv $(MAILCAPDIR)/mailcap $(MAILCAPDIR)/mailcap.old @echo "installing file $(MAILCAPDIR)/mailcap" - ${CP} mailcap $(MAILCAPDIR) + ${CP} mailcap $(DESTDIR)$(MAILCAPDIR) -+ (cd fonts ; $(MAKE) PREFIX=${DESTDIR}${PREFIX} CONFIGDIR=../${CONFIGDIR} CFLAGS="${CFLAGS}" CC="${CC}" LDLIBS="${LDLIBS}" FONTSUFFIX="${FONTSUFFIX}" install) uninstall-all: @(cd bin; \ +@@ -179,7 +174,6 @@ clean: + -${RM} -rf *.BAK + (cd metamail ; $(MAKE) clean) + (cd richmail ; $(MAKE) clean) +- (cd fonts ; $(MAKE) FONTSUFFIX="${FONTSUFFIX}" clean) + + cleanbin: + -${RM} bin/metamail Index: head/mail/metamail/files/patch-bin_showaudio =================================================================== --- head/mail/metamail/files/patch-bin_showaudio (revision 415138) +++ head/mail/metamail/files/patch-bin_showaudio (revision 415139) @@ -1,67 +1,67 @@ ---- bin/showaudio.orig Thu Feb 3 00:21:26 1994 -+++ bin/showaudio Mon Dec 18 11:50:24 2006 +--- bin/showaudio.orig 1994-02-02 23:21:26 UTC ++++ bin/showaudio @@ -15,9 +15,35 @@ # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. # - +# Set a sensible value for the temporary directory, if its not +# already set. If TMPDIR is set previously, then we will +# assume it is adequately protected. if (! $?METAMAIL_TMPDIR) then - set METAMAIL_TMPDIR=/tmp + if ($?TMPDIR) then + set METAMAIL_TMPDIR="$TMPDIR" + else + set METAMAIL_TMPDIR=~/metamail_tmp + endif +endif + +# Set a sensible umask value +umask 077 + +# Make sure that the temporary directory is available +if (! -d "$METAMAIL_TMPDIR") then + + if (! -e "$METAMAIL_TMPDIR") then + mkdir "$METAMAIL_TMPDIR" + else + echo "$METAMAIL_TMPDIR exists, but is not a directory" + exit 2 + endif + + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then + echo "Error creating $METAMAIL_TMPDIR" + exit 2 + endif + endif # First, figure out which machine to play it on! -@@ -33,7 +59,7 @@ +@@ -33,7 +59,7 @@ set AUDIOLOGMAIL=andrew@thumper.bellcore set ORG="Bellcore" set STDINPUT=0 if ("$1" == "-p") then - set AUDIOPHONE=$2 + set AUDIOPHONE="$2" shift shift endif -@@ -173,7 +199,7 @@ +@@ -173,7 +199,7 @@ if (-d $AUDIOBINDIR) then set AUDIOPHONE=$< endif if ($thishost == $AUDIOPHONEHOST || $thishost == $AUDIOPHONEHOSTLONG) then - echo Calling Phone number $AUDIOPHONE + echo Calling Phone number "$AUDIOPHONE" echo "You MUST SAY HELLO when you answer the phone, or you will not hear the message." mail -s "showaudio: `whoami` called $AUDIOPHONE" $AUDIOLOGMAIL < /dev/null if ($STDINPUT) then -@@ -206,7 +232,7 @@ +@@ -206,7 +232,7 @@ else echo -n "File name:" set fname=$< endif -cp $1 $fname +cp "$1" $fname if ($status == 0) echo Wrote raw audio file: $fname exit 0 Index: head/mail/metamail/files/patch-bin_showexternal =================================================================== --- head/mail/metamail/files/patch-bin_showexternal (revision 415138) +++ head/mail/metamail/files/patch-bin_showexternal (revision 415139) @@ -1,49 +1,49 @@ ---- bin/showexternal.orig Tue Feb 8 17:39:05 1994 -+++ bin/showexternal Mon Dec 18 11:50:24 2006 +--- bin/showexternal.orig 1994-02-08 16:39:05 UTC ++++ bin/showexternal @@ -15,9 +15,45 @@ # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. # +# Check argument integrity. Don't trust mail headers +switch ("$1$2$3$4$5$6$7") +case "*[\t ]*": + echo "Illegal white space in arguments\!" + echo "Command was:" + echo "'$0' '$1' '$2' '$3' '$4' '$5' '$6' '$7'" + exit 2 +endsw + onintr cleanup +# Set a sensible value for the temporary directory, if its not +# already set. If TMPDIR is set previously, then we will +# assume it is adequately protected. if (! $?METAMAIL_TMPDIR) then - set METAMAIL_TMPDIR=/tmp + if ($?TMPDIR) then + set METAMAIL_TMPDIR="$TMPDIR" + else + set METAMAIL_TMPDIR=~/metamail_tmp + endif +endif + +# Set a sensible umask value +umask 077 + +# Make sure that the temporary directory is available +if (! -d "$METAMAIL_TMPDIR") then + + if (! -e "$METAMAIL_TMPDIR") then + mkdir "$METAMAIL_TMPDIR" + else + echo "$METAMAIL_TMPDIR exists, but is not a directory" + exit 2 + endif + + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then + echo "Error creating $METAMAIL_TMPDIR" + exit 2 + endif + endif if (! $?FTP) then set FTP=ftp Index: head/mail/metamail/files/patch-bin_showpartial =================================================================== --- head/mail/metamail/files/patch-bin_showpartial (revision 415138) +++ head/mail/metamail/files/patch-bin_showpartial (revision 415139) @@ -1,80 +1,80 @@ ---- bin/showpartial.orig Thu Feb 3 00:21:29 1994 -+++ bin/showpartial Mon Dec 18 11:50:24 2006 +--- bin/showpartial.orig 1994-02-02 23:21:29 UTC ++++ bin/showpartial @@ -2,8 +2,44 @@ # (The "-fb" might need to be changed to "-f" on some systems) # +# Check argument integrity. Don't trust mail headers +switch ("$1$2$3$4") +case "*[\t ]*": + echo "Illegal white space in arguments\!" + echo "Command was:" + echo "'$0' '$1' '$2' '$3' '$4'" + exit 2 +endsw + +# Set a sensible value for the temporary directory, if its not +# already set. If TMPDIR is set previously, then we will +# assume it is adequately protected. if (! $?METAMAIL_TMPDIR) then - set METAMAIL_TMPDIR=/tmp + if ($?TMPDIR) then + set METAMAIL_TMPDIR="$TMPDIR" + else + set METAMAIL_TMPDIR=~/metamail_tmp + endif +endif + +# Set a sensible umask value +umask 077 + +# Make sure that the temporary directory is available +if (! -d "$METAMAIL_TMPDIR") then + + if (! -e "$METAMAIL_TMPDIR") then + mkdir "$METAMAIL_TMPDIR" + else + echo "$METAMAIL_TMPDIR exists, but is not a directory" + exit 2 + endif + + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then + echo "Error creating $METAMAIL_TMPDIR" + exit 2 + endif + endif set TREEROOT=${METAMAIL_TMPDIR}/m-prts-`whoami` -@@ -11,14 +47,14 @@ +@@ -11,14 +47,14 @@ if ($#argv < 3 || $#argv > 4) then echo "Usage: showpartial file id partnum totalnum" exit -1 endif -set file=$1 +set file="$1" # This next line is because message-id can contain weird chars -set id=`echo $2 | tr -d \!\$\&\*\(\)\|\'\"\;\/\<\>\\` -@ partnum = $3 -if ($#argv == 3 || $4 == "") then +set id=`echo "$2" | tr -d \!\$\&\*\(\)\|\'\"\;\/\<\>\\` +@ partnum = "$3" +if ($#argv == 3 || "$4" == "") then set totalnum=-1 else - @ totalnum = $4 + @ totalnum = "$4" endif if (! -d $TREEROOT) then -@@ -35,9 +71,9 @@ +@@ -35,9 +71,9 @@ if (! -d ${TREEROOT}/$id) then exit -1 endif endif -cp $file ${TREEROOT}/$id/$partnum +cp "$file" ${TREEROOT}/$id/$partnum if ($status) then - echo cp $file ${TREEROOT}/$id/$partnum failed + echo cp "$file" ${TREEROOT}/$id/$partnum failed exit -1 endif if ($totalnum == -1) then Index: head/mail/metamail/files/patch-bin_showpicture =================================================================== --- head/mail/metamail/files/patch-bin_showpicture (revision 415138) +++ head/mail/metamail/files/patch-bin_showpicture (revision 415139) @@ -1,57 +1,57 @@ ---- bin/showpicture.orig Mon Feb 7 18:59:54 1994 -+++ bin/showpicture Mon Dec 18 11:50:24 2006 +--- bin/showpicture.orig 1994-02-07 17:59:54 UTC ++++ bin/showpicture @@ -15,15 +15,42 @@ # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. # +# Set a sensible value for the temporary directory, if its not +# already set. If TMPDIR is set previously, then we will +# assume it is adequately protected. if (! $?METAMAIL_TMPDIR) then - set METAMAIL_TMPDIR=/tmp + if ($?TMPDIR) then + set METAMAIL_TMPDIR="$TMPDIR" + else + set METAMAIL_TMPDIR=~/metamail_tmp + endif +endif + +# Set a sensible umask value +umask 077 + +# Make sure that the temporary directory is available +if (! -d "$METAMAIL_TMPDIR") then + + if (! -e "$METAMAIL_TMPDIR") then + mkdir "$METAMAIL_TMPDIR" + else + echo "$METAMAIL_TMPDIR exists, but is not a directory" + exit 2 + endif + + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then + echo "Error creating $METAMAIL_TMPDIR" + exit 2 + endif + endif if (! $?X_VIEWER) then -set X_VIEWER="xloadimage -view -quiet -geometry +1+1" + set X_VIEWER="xloadimage -view -quiet -geometry +1+1" # set X_VIEWER="xv -geometry +1+1" endif -if ($1 == "-viewer" && $#argv > 1) then +if ("$1" == "-viewer" && $#argv > 1) then set X_VIEWER = "$2" shift shift -@@ -57,7 +84,7 @@ +@@ -57,7 +84,7 @@ if (! $?DISPLAY) then endif end endif - cp $1 $fname + cp "$1" $fname if ($status == 0) echo Wrote file $fname exit 0 endif Index: head/mail/metamail/files/patch-bin_sun2mime =================================================================== --- head/mail/metamail/files/patch-bin_sun2mime (revision 415138) +++ head/mail/metamail/files/patch-bin_sun2mime (revision 415139) @@ -1,11 +1,11 @@ ---- bin/sun2mime.orig Sat Nov 13 15:54:05 1993 -+++ bin/sun2mime Mon Dec 18 11:50:06 2006 -@@ -11,7 +11,7 @@ +--- bin/sun2mime.orig 1993-11-13 14:54:05 UTC ++++ bin/sun2mime +@@ -11,7 +11,7 @@ if [ x$METAMAIL_TMPDIR = x ]; then fi TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$ -/bin/nawk ' +/usr/bin/awk ' BEGIN { printf("Content-type: multipart/mixed; boundary=--------\n\n") RS=""; FS="\n"; mode="HEADER" } mode == "HEADER" { Index: head/mail/metamail/files/patch-config.h =================================================================== --- head/mail/metamail/files/patch-config.h (revision 415138) +++ head/mail/metamail/files/patch-config.h (revision 415139) @@ -1,23 +1,25 @@ ---- config.h.orig Wed Nov 24 16:36:07 1993 -+++ config.h Mon Dec 18 11:46:21 2006 -@@ -73,7 +73,7 @@ +--- config.h.orig 1993-11-24 15:36:07 UTC ++++ config.h +@@ -73,7 +73,7 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE #ifdef SYSV #define RESET_PROGRAM "tput clear" #else -#ifdef __BSD_4_4__ +#if defined(__BSD_4_4__) || defined(__FreeBSD__) #define RESET_PROGRAM "/usr/bin/reset" #else #define RESET_PROGRAM "/usr/ucb/reset" -@@ -155,7 +155,11 @@ +@@ -155,9 +155,13 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE #ifdef NeXT #define sigtype void #else +#ifdef __FreeBSD__ +#define sigtype void +#else #define sigtype int -+#endif #endif #endif ++#endif + #ifdef MSDOS + #define PATH_SEPARATOR ';' Index: head/mail/metamail/files/patch-fonts_Makefile =================================================================== --- head/mail/metamail/files/patch-fonts_Makefile (revision 415138) +++ head/mail/metamail/files/patch-fonts_Makefile (revision 415139) @@ -1,23 +1,23 @@ ---- fonts/Makefile.orig Mon May 31 22:49:27 1993 -+++ fonts/Makefile Mon Dec 18 11:46:21 2006 -@@ -28,12 +28,18 @@ +--- fonts/Makefile.orig 1993-05-31 20:49:27 UTC ++++ fonts/Makefile +@@ -28,12 +28,18 @@ heb8x13B.${FONTSUFFIX}: heb8x13B.bdf -${DIRBUILDER} shownonascii: Xshownonascii - sed -e s@/u/nsb/lib/fonts@`pwd`@ < Xshownonascii > shownonascii + sed -e s@/u/nsb/lib/fonts@${PREFIX}/lib/metamail/fonts@ < Xshownonascii > shownonascii chmod +x shownonascii mailto-hebrew: Xmailto-hebrew - sed -e s@/u/nsb/lib/fonts@`pwd`@ < Xmailto-hebrew > mailto-hebrew + sed -e s@/u/nsb/lib/fonts@${PREFIX}/lib/metamail/fonts@ < Xmailto-hebrew > mailto-hebrew chmod +x mailto-hebrew -+ + +install: + mkdir -p ${PREFIX}/lib/metamail/fonts + install -c heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} \ + heb8x13B.${FONTSUFFIX} fonts.alias ${PREFIX}/lib/metamail/fonts + mkfontdir ${PREFIX}/lib/metamail/fonts - ++ clean: rm -f heb6x13.${FONTSUFFIX} heb8x13.${FONTSUFFIX} heb8x13B.${FONTSUFFIX} shownonascii mailto-hebrew fonts.dir Index: head/mail/metamail/files/patch-metamail__uue.c =================================================================== --- head/mail/metamail/files/patch-metamail__uue.c (revision 415138) +++ head/mail/metamail/files/patch-metamail__uue.c (revision 415139) @@ -1,33 +1,46 @@ ---- metamail/uue.c.orig 1993-07-29 03:31:02.000000000 +0900 -+++ metamail/uue.c 2012-10-13 08:01:35.000000000 +0900 -@@ -72,26 +72,26 @@ +--- metamail/uue.c.orig 1993-07-28 18:31:02 UTC ++++ metamail/uue.c +@@ -30,7 +30,7 @@ FILE *outfp; + } + + +-getline (buf, size, fp) ++get_line (buf, size, fp) + char *buf; + int size; + FILE *fp; +@@ -70,28 +70,28 @@ int *ctptr; + char buf[63]; + while (1) { - if (getline (buf, sizeof buf, infp) < 0) { +- if (getline (buf, sizeof buf, infp) < 0) { ++ if (get_line (buf, sizeof buf, infp) < 0) { fprintf (stderr, "Premature EOF!\n"); - return; + return(0); } if (strncmp (buf, "begin", 5) == 0) break; else if (buf[0] == '-' && buf[1] == '-') { if (boundaries && PendingBoundary (buf, boundaries, ctptr)) - return; + return(0); } } while (1) { - if (getline (buf, sizeof buf, infp) < 0) { +- if (getline (buf, sizeof buf, infp) < 0) { ++ if (get_line (buf, sizeof buf, infp) < 0) { fprintf (stderr, "Premature EOF!\n"); - return; + return(0); } else if (strncmp (buf, "end", 5) == 0) break; else if (buf[0] == '-' && buf[1] == '-') { if (boundaries && PendingBoundary (buf, boundaries, ctptr)) { fprintf (stderr, "premature end of x-uue body part\n"); - return; + return(0); } else { fprintf (stderr, "ignoring invalid boundary marker\n"); Index: head/mail/metamail/files/patch-metamail_codes.c =================================================================== --- head/mail/metamail/files/patch-metamail_codes.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_codes.c (revision 415139) @@ -1,37 +1,37 @@ ---- metamail/codes.c.orig 1993-09-20 22:13:22.000000000 +0900 -+++ metamail/codes.c 2012-10-13 07:59:21.000000000 +0900 -@@ -13,6 +13,7 @@ +--- metamail/codes.c.orig 1993-09-20 13:13:22 UTC ++++ metamail/codes.c +@@ -13,6 +13,7 @@ OF THIS MATERIAL FOR ANY PURPOSE. IT IS WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. */ #include +#include #include #include -@@ -203,7 +204,7 @@ +@@ -203,7 +204,7 @@ int PortableNewlines; && (Buf[0] == '-') && (Buf[1] == '-') && PendingBoundary(Buf, boundaries, boundaryct)) { - return; + return(0); } fprintf(stderr, "Ignoring unrecognized boundary line: %s\n", Buf); continue; -@@ -221,7 +222,7 @@ +@@ -221,7 +222,7 @@ int PortableNewlines; } while (c4 != EOF && isspace(c4)); if (c2 == EOF || c3 == EOF || c4 == EOF) { fprintf(stderr, "Warning: base64 decoder saw premature EOF!\n"); - return; + return(0); } if (c1 == '=' || c2 == '=') { DataDone=1; -@@ -371,7 +372,7 @@ +@@ -371,7 +372,7 @@ int *boundaryct; && (Buf[0] == '-') && (Buf[1] == '-') && PendingBoundary(Buf, boundaries, boundaryct)) { - return; + return(0); } /* Not a boundary, now we must treat THIS line as q-p, sigh */ if (neednewline) { Index: head/mail/metamail/files/patch-metamail_mailto.c =================================================================== --- head/mail/metamail/files/patch-metamail_mailto.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_mailto.c (revision 415139) @@ -1,154 +1,154 @@ ---- metamail/mailto.c.orig 1994-02-10 05:30:26.000000000 +0900 -+++ metamail/mailto.c 2012-10-13 08:04:36.000000000 +0900 -@@ -37,6 +37,8 @@ +--- metamail/mailto.c.orig 1994-02-09 20:30:26 UTC ++++ metamail/mailto.c +@@ -37,6 +37,8 @@ STILL NEED TO DO/SUPPORT: */ #include +#include +#include #include #include #include -@@ -60,7 +62,6 @@ +@@ -60,7 +62,6 @@ extern char *getenv(); #include #endif -extern char *malloc(), *realloc(), *index(), *getmyname(); struct mailpart *CreateNewPart(); /* The main data structure for the multiple parts of the mail */ -@@ -570,6 +571,7 @@ +@@ -570,6 +571,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); -@@ -1072,7 +1074,7 @@ +@@ -1072,7 +1074,7 @@ struct mailpart *FirstPart; #endif } fprintf(fp, "Message-ID: %s\n", newid()); - if (!FirstPart) return; /* empty body */ + if (!FirstPart) return(0); /* empty body */ if (FirstPart->next) { char boundary[120]; #ifdef AMIGA -@@ -1130,6 +1132,7 @@ +@@ -1130,6 +1132,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 +1143,7 @@ +@@ -1140,6 +1143,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); -@@ -1346,7 +1350,7 @@ +@@ -1346,7 +1350,7 @@ int EightBitMode, RightToLeftMode; } part->isrich = 1; PartEndsWithNewline=1; - return; + return(0); } InNewLineSequence = 0; if (RightToLeftMode) { -@@ -1745,6 +1749,7 @@ +@@ -1745,6 +1749,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) { -@@ -1752,8 +1757,9 @@ +@@ -1752,8 +1757,9 @@ CreateNewPart() { 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+strlen(CTLineBuf) -1; + sdum = *CTLineBuf ? CTLineBuf+strlen(CTLineBuf) -1 : CTLineBuf; while (sdum >= CTLineBuf && isspace((unsigned char) *sdum)) { *sdum = '\0'; --sdum; -@@ -1791,7 +1797,10 @@ +@@ -1791,7 +1797,10 @@ 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); + *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); -@@ -1809,7 +1818,7 @@ +@@ -1809,7 +1818,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; -@@ -2109,7 +2118,7 @@ +@@ -2109,7 +2118,7 @@ int UseVisual; fpout = fopen(FirstPart->filename, "a"); free(CmdBuf); free(CmdBuf2); - return; + return(0); } lastmp = mp = FirstPart; while (mp) { -@@ -2137,6 +2146,7 @@ +@@ -2137,6 +2146,7 @@ int UseVisual; 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; -@@ -2221,7 +2231,7 @@ +@@ -2221,7 +2231,7 @@ int IsAndrew; int LineAlloced = 0, LineCount = 0; fp = fopen(fname, "r"); - if (!fp) return; + if (!fp) return(0); do { LineBuf=NextAliasLine(LineBuf, &LineAlloced, &LineCount, fp, IsAndrew); if (LineCount == 0) continue; -@@ -2310,7 +2320,7 @@ +@@ -2310,7 +2320,7 @@ char *aliasline; if (s != s2) printf("mailto: ignoring bad alias line in init file: %s\n", aliasline); free(s); free(tmpalias); - return; + return(0); } *s2++ = '\0'; tmpalias->shortname = s; -@@ -2364,7 +2374,7 @@ +@@ -2364,7 +2374,7 @@ char *hdr; { char *firstnonascii, *firstascii; - if (!s) return; + if (!s) return(0); firstnonascii=firstbad(s); if (firstnonascii) { if (!strcmp(CharacterSet, "us-ascii")) { -@@ -2454,7 +2464,7 @@ +@@ -2454,7 +2464,7 @@ char *hdr; /* if (!lc2strcmp(name, tmpalias->shortname)) { */ *end = savechar; EmitAddresses(fp, tmpalias->longname, hdr); - return; + return(0); } } *end = savechar; Index: head/mail/metamail/files/patch-metamail_metamail.c =================================================================== --- head/mail/metamail/files/patch-metamail_metamail.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_metamail.c (revision 415139) @@ -1,218 +1,218 @@ ---- metamail/metamail.c.orig 1994-02-17 10:57:19.000000000 +0900 -+++ metamail/metamail.c 2012-10-16 01:27:14.000000000 +0900 -@@ -20,6 +20,8 @@ +--- metamail/metamail.c.orig 1994-02-17 01:57:19 UTC ++++ metamail/metamail.c +@@ -20,6 +20,8 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE ******************************************************* */ #include +#include +#include #include #include #include -@@ -46,8 +48,8 @@ +@@ -46,8 +48,8 @@ extern char *mktemp(char *); #include #ifndef AMIGA -#ifdef SYSV -#include +#if 1 +#include #include #else /* SYSV */ #include -@@ -83,7 +85,7 @@ +@@ -83,7 +85,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,6 +102,7 @@ +@@ -100,6 +102,7 @@ extern char **environ, *gets(); #define CMDSIZE 1200 /* Maximum size of command to execute */ #define LINE_BUF_SIZE 2000 +#if 0 #ifndef MICROSOFT extern char *malloc(); extern char *realloc(); -@@ -107,10 +110,12 @@ +@@ -107,10 +110,12 @@ extern char *realloc(); extern char *getenv(); extern char *index(); extern char *rindex(); +extern FILE *popen(); +#endif + char fileToDelete[MAX_FILE_NAME_SIZE]; char *FindParam(); -extern FILE *popen(); static char *nomem = "Out of memory!"; static char *mmversion = MM_VERSTRING; static char *NoAskDefault = "text,text/plain,text/richtext"; -@@ -540,6 +545,7 @@ +@@ -540,6 +545,7 @@ int nestingdepth; 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,8 +560,10 @@ +@@ -554,8 +560,10 @@ int nestingdepth; 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); - Fname[strlen(Fname) - 1] = '\0'; /* bogus newline */ + 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,10 +587,12 @@ +@@ -579,10 +587,12 @@ int nestingdepth; int overwriteans = -1; do { printf("File %s exists. Do you want to overwrite it (y/n) ?\n", Fname); - s = gets(AnsBuf); + *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,9 +1212,9 @@ +@@ -1202,9 +1212,9 @@ char *SquirrelFile; fprintf(outfp, "Content-type: %s", ContentType); for (j=0; jFrom ", 6)) { for (numkeys = 0; KeyHeadList[numkeys]; ++numkeys) { if (!strcmp(KeyHeadList[numkeys], "*") || !lc2strncmp(">from", KeyHeadList[numkeys], 5)) { if (!KeyKeep) phead(hdr); - return; + return(0); } } if (KeyKeep) phead(hdr); -@@ -2022,7 +2033,8 @@ +@@ -2022,7 +2033,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 +2044,7 @@ +@@ -2032,7 +2044,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); -@@ -2375,8 +2387,8 @@ +@@ -2375,8 +2387,8 @@ char *Prefix; int HasSavedTtyState=0; #if !defined(AMIGA) && !defined(MSDOS) -#ifdef SYSV -static struct termio MyTtyStateIn, MyTtyStateOut; +#if 1 +static struct termios MyTtyStateIn, MyTtyStateOut; #else static struct sgttyb MyTtyStateIn, MyTtyStateOut; #endif -@@ -2385,9 +2397,9 @@ +@@ -2385,9 +2397,9 @@ static struct sgttyb MyTtyStateIn, MyTty SaveTtyState() { /* Bogus -- would like a good portable way to reset the terminal state here */ #if !defined(AMIGA) && !defined(MSDOS) -#ifdef SYSV - ioctl(fileno(stdin), TCGETA, &MyTtyStateIn); - ioctl(fileno(stdout), TCGETA, &MyTtyStateOut); +#if 1 + tcgetattr(fileno(stdin), &MyTtyStateIn); + tcgetattr(fileno(stdout), &MyTtyStateOut); #else gtty(fileno(stdin), &MyTtyStateIn); gtty(fileno(stdout), &MyTtyStateOut); -@@ -2398,10 +2410,10 @@ +@@ -2398,10 +2410,10 @@ SaveTtyState() { RestoreTtyState() { #if !defined(AMIGA) && !defined(MSDOS) -#ifdef SYSV +#if 1 if (HasSavedTtyState) { - ioctl(fileno(stdout), TCSETA, &MyTtyStateOut); - ioctl(fileno(stdin), TCSETA, &MyTtyStateIn); + tcsetattr(fileno(stdout), TCSANOW, &MyTtyStateOut); + tcsetattr(fileno(stdin), TCSANOW, &MyTtyStateIn); } #else if (HasSavedTtyState) { -@@ -2660,7 +2672,7 @@ +@@ -2660,7 +2672,7 @@ PauseForUser() { char Buf[100]; #endif - if (DefinitelyNotTty || MustNotBeTty) return; + if (DefinitelyNotTty || MustNotBeTty) return(0); #if defined(MSDOS) || defined(AMIGA) printf("Press RETURN to go on\n"); gets(Buf); -@@ -2681,15 +2693,15 @@ +@@ -2681,15 +2693,15 @@ PauseForUser() { StartRawStdin() { #if !defined(AMIGA) && !defined(MSDOS) -#ifdef SYSV - struct termio orterm, fterm; - ioctl(0, TCGETA, &orterm); /* get current (i.e. cooked) termio */ +#if 1 + struct termios orterm, fterm; + tcgetattr(0, &orterm); fterm = orterm; /* get termio to modify */ fterm.c_lflag &= ~ICANON; /* clear ICANON giving raw mode */ fterm.c_cc[VMIN] = 1; /* set MIN char count to 1 */ fterm.c_cc[VTIME] = 0; /* set NO time limit */ - return ioctl(0, TCSETAW, &fterm); /* modify termio for raw mode */ + return tcsetattr(0, TCSANOW, &fterm); /* modify termio for raw mode */ #else struct sgttyb ts; gtty(fileno(stdin), &ts); Index: head/mail/metamail/files/patch-metamail_mmencode.c =================================================================== --- head/mail/metamail/files/patch-metamail_mmencode.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_mmencode.c (revision 415139) @@ -1,10 +1,10 @@ ---- metamail/mmencode.c.orig Wed Jan 26 19:47:37 1994 -+++ metamail/mmencode.c Mon Dec 18 11:46:22 2006 -@@ -13,6 +13,7 @@ +--- metamail/mmencode.c.orig 1994-01-26 18:47:37 UTC ++++ metamail/mmencode.c +@@ -13,6 +13,7 @@ OF THIS MATERIAL FOR ANY PURPOSE. IT IS WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. */ #include +#include #include #ifdef MSDOS #include Index: head/mail/metamail/files/patch-metamail_putenv.c =================================================================== --- head/mail/metamail/files/patch-metamail_putenv.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_putenv.c (revision 415139) @@ -1,23 +1,23 @@ ---- metamail/putenv.c.orig Tue Oct 12 17:17:43 1993 -+++ metamail/putenv.c Sat Jul 14 17:35:44 2007 -@@ -17,6 +17,8 @@ +--- metamail/putenv.c.orig 1993-10-12 16:17:43 UTC ++++ metamail/putenv.c +@@ -17,6 +17,8 @@ not, write to the Free Software Foundati Cambridge, MA 02139, USA. */ #include +#include +#include #include #include #ifdef STDC_HEADERS -@@ -48,7 +50,11 @@ +@@ -48,7 +50,11 @@ extern char **environ; /* Put STRING, which is of the form "NAME=VALUE", in the environment. */ int putenv (string) +#if defined __FreeBSD__ && __FreeBSD__ <= 6 const char *string; +#else + char *string; +#endif { char *name_end = index (string, '='); register size_t size; Index: head/mail/metamail/files/patch-metamail_shared.c =================================================================== --- head/mail/metamail/files/patch-metamail_shared.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_shared.c (revision 415139) @@ -1,17 +1,17 @@ ---- metamail/shared.c.orig Sun May 16 20:19:32 1993 -+++ metamail/shared.c Mon Dec 18 11:46:22 2006 +--- metamail/shared.c.orig 1993-05-16 18:19:32 UTC ++++ metamail/shared.c @@ -1,4 +1,6 @@ #include +#include +#include #include #include #ifdef SYSV @@ -6,7 +8,6 @@ #include #endif -extern char *malloc(); char **Exceptions; int *NeedsPortableNewlines; int ExceptionsAlloced = 0, ExceptionsUsed = 0; Index: head/mail/metamail/files/patch-metamail_splitmail.c =================================================================== --- head/mail/metamail/files/patch-metamail_splitmail.c (revision 415138) +++ head/mail/metamail/files/patch-metamail_splitmail.c (revision 415139) @@ -1,62 +1,62 @@ ---- metamail/splitmail.c.orig Mon Jan 31 23:23:14 1994 -+++ metamail/splitmail.c Mon Dec 18 11:46:22 2006 -@@ -21,6 +21,8 @@ +--- metamail/splitmail.c.orig 1994-01-31 22:23:14 UTC ++++ metamail/splitmail.c +@@ -21,6 +21,8 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE ******************************************************* */ #include +#include +#include #include #include #include -@@ -28,7 +30,7 @@ +@@ -28,7 +30,7 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE #include #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */ -extern char *malloc(), *index(), *getmyname(); +extern char *getmyname(); #ifdef AMIGA #define Prototype extern -@@ -41,8 +43,8 @@ +@@ -41,8 +43,8 @@ extern char *malloc(), *index(), *getmyn #define VERBOSEDELIVERYCMD VerboseDeliveryCmd #else extern char *getenv(); -#define NORMALDELIVERYCMD "/usr/lib/sendmail -t -oi" -#define VERBOSEDELIVERYCMD "/usr/lib/sendmail -t -v -oi" +#define NORMALDELIVERYCMD "/usr/sbin/sendmail -t -oi" +#define VERBOSEDELIVERYCMD "/usr/sbin/sendmail -t -v -oi" #endif usageexit() { -@@ -194,7 +196,7 @@ +@@ -194,7 +196,7 @@ char **argv; s = endofheader(from); /* would be index(from, '\n'), but need to check for continuation lines */ *s = '\0'; - if (ShareThisHeader(from, SubjectBuf, &OrigID)) { + if (ShareThisHeader(from, SubjectBuf, sizeof(SubjectBuf), &OrigID)) { strcat(SharedHeaders, from); strcat(SharedHeaders, "\n"); } -@@ -339,9 +341,10 @@ +@@ -339,9 +341,10 @@ static char *SharedHeads[] = { NULL }; -ShareThisHeader(s, SubjectBuf, OrigID) +ShareThisHeader(s, SubjectBuf, size, OrigID) char *s; char *SubjectBuf; +size_t size; char **OrigID; { int i; -@@ -361,7 +364,8 @@ +@@ -361,7 +364,8 @@ char **OrigID; } if (!ULstrcmp(s, "subject")) { *colon = ':'; - strcpy(SubjectBuf, ++colon); + strncpy(SubjectBuf, ++colon, size); + SubjectBuf[size - 1] = '\0'; return(0); } if (!ULstrcmp(s, "content-type")) { Index: head/mail/metamail/files/patch-richmail__iso2022.c =================================================================== --- head/mail/metamail/files/patch-richmail__iso2022.c (revision 415138) +++ head/mail/metamail/files/patch-richmail__iso2022.c (revision 415139) @@ -1,11 +1,11 @@ ---- richmail/iso2022.c.orig 1992-12-23 02:50:21.000000000 +0900 -+++ richmail/iso2022.c 2012-10-13 08:09:11.000000000 +0900 -@@ -84,7 +84,7 @@ +--- richmail/iso2022.c.orig 1992-12-22 17:50:21 UTC ++++ richmail/iso2022.c +@@ -84,7 +84,7 @@ char *name; OutCharSet = OUT_ASCII; OutAsciiMode = RICH_ENC_US_ASCII; if (!name) - return; + return(0); if (!strncmp (name,"iso-2022-jp",11)) richtextencoding (RICH_ENC_JP_ASCII); else if (!strncmp (name,"iso-2022-kr",11)) { Index: head/mail/metamail/files/patch-richmail_richlex.c =================================================================== --- head/mail/metamail/files/patch-richmail_richlex.c (revision 415138) +++ head/mail/metamail/files/patch-richmail_richlex.c (revision 415139) @@ -1,10 +1,10 @@ ---- richmail/richlex.c.orig Thu Feb 3 03:29:37 1994 -+++ richmail/richlex.c Mon Dec 18 11:46:22 2006 +--- richmail/richlex.c.orig 1994-02-03 02:29:37 UTC ++++ richmail/richlex.c @@ -42,6 +42,7 @@ -------------------------------------------------------------------------*/ #include +#include #include #include "richlex.h" #include "richset.h" Index: head/mail/metamail/files/patch-richmail_richset.c =================================================================== --- head/mail/metamail/files/patch-richmail_richset.c (revision 415138) +++ head/mail/metamail/files/patch-richmail_richset.c (revision 415139) @@ -1,10 +1,10 @@ ---- richmail/richset.c.orig Wed Oct 21 19:04:19 1992 -+++ richmail/richset.c Mon Dec 18 11:46:22 2006 +--- richmail/richset.c.orig 1992-10-21 18:04:19 UTC ++++ richmail/richset.c @@ -34,6 +34,7 @@ -------------------------------------------------------------------------*/ #include +#include #include "richlex.h" #include "richset.h" Index: head/mail/metamail/files/patch-richmail_richtext.c =================================================================== --- head/mail/metamail/files/patch-richmail_richtext.c (revision 415138) +++ head/mail/metamail/files/patch-richmail_richtext.c (revision 415139) @@ -1,63 +1,63 @@ ---- richmail/richtext.c.orig 1994-02-10 01:31:18.000000000 +0900 -+++ richmail/richtext.c 2012-10-13 08:07:01.000000000 +0900 -@@ -14,6 +14,8 @@ +--- richmail/richtext.c.orig 1994-02-09 16:31:18 UTC ++++ richmail/richtext.c +@@ -14,6 +14,8 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE */ #include +#include +#include #include #include #include "richlex.h" -@@ -155,6 +157,16 @@ +@@ -155,6 +157,16 @@ static nomemabort() { exit(-1); #endif } +static lc2strcmp(s1, s2) +char *s1, *s2; +{ + if (!s1 || !s2) return (-1); + while (*s1 && *s2) { + if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1); + ++s1; ++s2; + } + return((*s1 == *s2) ? 0 : -1); +} #ifndef RICHTEXT_LIBRARY -@@ -910,7 +922,7 @@ +@@ -910,7 +922,7 @@ struct charsetmember *s; FILE *fp; { int inmargin=1; - if (!s) return; + if (!s) return(0); while (s -> ch) { if (inmargin && (s -> ch) == ' ') { controloutput(MoveRight, 1); -@@ -932,7 +944,7 @@ +@@ -932,7 +944,7 @@ char *standoutbuf, *standendbuf, *StartU *BoldOn, *BoldOff; { if (OverStrike) - return; + return(0); /* We always turn back on the appropriate terminal modes, because on some terminals one thing turns off all of them */ -@@ -989,16 +1001,6 @@ +@@ -989,16 +1001,6 @@ FILE *fp; while(*s) (*RichtextPutc)((int)(*s++),fp); } -static lc2strcmp(s1, s2) -char *s1, *s2; -{ - if (!s1 || !s2) return (-1); - while (*s1 && *s2) { - if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1); - ++s1; ++s2; - } - return((*s1 == *s2) ? 0 : -1); -} static lc2strncmp(s1, s2, len) char *s1, *s2;