--- a2ps-4.13/contrib/card.m4 +++ a2ps-4.13/contrib/card.m4 Thu Mar 18 14:27:29 2004 @@ -27,7 +27,6 @@ print_form_feeds=: RM="/bin/rm -rf" tmp_dir=${TMPDIR-/tmp}/$program.$$ -tmp_file=$tmp_dir/card success=false verbose=: version_short="card $card_version (@GNU_PACKAGE@ @VERSION@)" @@ -111,8 +110,14 @@ fi # Create a tmp dir and be ready to clean up -trap "$RM $tmp_dir" 0 1 2 15 -(umask 077 && mkdir $tmp_dir) || exit 1 +if type -p mktemp > /dev/null 2>&1 ; then + tmp_dir="`mktemp -d ${tmp_dir}.XXXXXX`" || exit 1 + trap "$RM $tmp_dir" 0 1 2 3 13 15 +else + trap "$RM $tmp_dir" 0 1 2 3 13 15 + (umask 077 && mkdir $tmp_dir) || exit 1 +fi +tmp_file=$tmp_dir/card case $LC_ALL in fr) footer="Engendré par $version_short" ;; --- a2ps-4.13/contrib/fixnt.l +++ a2ps-4.13/contrib/fixnt.l Thu Mar 18 14:20:59 2004 @@ -90,6 +90,7 @@ int ifcorel = 0; int ifendsetup = 0; int pid; +int fd; char fontfname[255]; char adobefname[255]; char bodyfname[255]; @@ -131,7 +132,9 @@ %%Page:.*\n { /* read up to first page and just output everyting */ sprintf(bodyfname, "%s/fixnt_Body_%d", tmpdir, pid); - body = fopen(bodyfname,"w+"); + fd = mkstemp(bodyfname); + if (fd == -1) abort(); + body = fdopen(fd,"w+"); fprintf(body,"%s",yytext); BEGIN BODY; } @@ -143,7 +146,9 @@ [/]Adobe_WinNT_Driver_Gfx[ ]175[ ]dict[ ]dup[ ]begin.*\n { /* Adobe Stuff */ sprintf(adobefname, "%s/fixnt_Adobe_%d", tmpdir, pid); - adobe = fopen(adobefname,"w+"); + fd = mkstemp(adobefname); + if (fd == -1) abort(); + adobe = fdopen(fd,"w+"); fprintf(adobe,"%s",yytext); BEGIN ADOBE; } @@ -170,7 +175,9 @@ (NTPSOct95[ ]){0,1}[/]FontSV[ ]save[ ](put|def).*\n { /* font definitions from here on */ sprintf(fontfname, "%s/fixnt_Font_%d", tmpdir, pid); - font = fopen(fontfname,"w+"); + fd = mkstemp(fontfname); + if (fd == -1) abort(); + font = fdopen(fd,"w+"); fprintf(font,"%s",yytext); BEGIN FONT; } --- a2ps-4.13/contrib/fixps.m4 +++ a2ps-4.13/contrib/fixps.m4 Thu Mar 18 14:30:48 2004 @@ -101,15 +101,24 @@ exit 1;; esac -if test -n "$debug"; then - # Set -x now if debugging - set -x +if type -p mktemp > /dev/null 2>&1 ; then + tmpdir="`mktemp -d ${tmpdir}.XXXXXX`" || exit 1 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi else - # Temp dir. Get ready not to leave junk (if not debugging) - trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + # Temp dir. Get ready not to leave junk (if not debugging) + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi + (umask 077 && mkdir $tmpdir) || exit 1 fi - -mkdir $tmpdir fixps_sed=$tmpdir/fixps.sed # If printing from stdin, save into a tmp file --- a2ps-4.13/contrib/pdiff.m4 +++ a2ps-4.13/contrib/pdiff.m4 Thu Mar 18 14:20:59 2004 @@ -20,7 +20,6 @@ diff_options='-u' file= output= -tmpdir=/tmp/$program.$$ verbose=echo wdiff_prog=${WDIFF:-wdiff} wdiff_options='-w[wd- -x-wd] -y{wd+ -z+wd}' --- a2ps-4.13/contrib/psmandup.m4 +++ a2ps-4.13/contrib/psmandup.m4 Thu Mar 18 14:32:22 2004 @@ -22,7 +22,7 @@ message= psselect=${PSSELECT:-psselect} psset=${PSSET:-psset} -tmpdir=/tmp/$program.$$ +tmpdir=${TMPDIR-/tmp}/$program.$$ # These two must be kept in synch. They are opposed. verbose=echo @@ -95,15 +95,25 @@ exit 1;; esac -if test -n "$debug"; then - # Set -x now if debugging - set -x +if type -p mktemp > /dev/null 2>&1 ; then + tmpdir="`mktemp -d ${tmpdir}.XXXXXX`" || exit 1 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + # Temp dir. Get ready not to leave junk (if not debugging) + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi else - # Temp dir. Get ready not to leave junk (if not debugging) - trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + # Temp dir. Get ready not to leave junk (if not debugging) + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi + (umask 077 && mkdir $tmpdir) || exit 1 fi - -mkdir $tmpdir # If printing from stdin, save into a tmp file if test $file = '-'; then --- a2ps-4.13/contrib/psset.m4 +++ a2ps-4.13/contrib/psset.m4 Thu Mar 18 14:33:31 2004 @@ -20,7 +20,6 @@ pagedevices= # `;' separated list of `key:value' quiet=: # i.e., verbose tmpdir=${TMPDIR:-/tmp}/$program.$$ -sedscript=$tmpdir/psset.sed # The version/usage strings version="$program 1.3 (@GNU_PACKAGE@ @VERSION@) @@ -106,15 +105,26 @@ exit 1;; esac -mkdir $tmpdir - -if test -n "$debug"; then - # Set -x now if debugging - set -x +if type -p mktemp > /dev/null 2>&1 ; then + tmpdir="`mktemp -d ${tmpdir}.XXXXXX`" || exit 1 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + # Temp dir. Get ready not to leave junk (if not debugging) + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi else - # Temp dir. Get ready not to leave junk (if not debugging) - trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + if test -n "$debug"; then + # Set -x now if debugging + set -x + else + # Temp dir. Get ready not to leave junk (if not debugging) + trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15 + fi + (umask 077 && mkdir $tmpdir) || exit 1 fi +sedscript=$tmpdir/psset.sed # Well, if there is nothing to do, just do nothing. if test -z "$pagedevices"; then --- a2ps-4.13/contrib/texi2dvi4a2ps +++ a2ps-4.13/contrib/texi2dvi4a2ps Thu Mar 18 14:34:56 2004 @@ -198,13 +198,21 @@ ;; esac -# Prepare the temporary directory. Remove it at exit, unless debugging. -if test -z "$debug"; then - trap "cd / && rm -rf $tmpdir" 0 1 2 15 +if type -p mktemp > /dev/null 2>&1 ; then + # Create the temporary directory with strict rights + tmpdir="`mktemp -d ${tmpdir}.XXXXXX`" || exit 1 + # Prepare the temporary directory. Remove it at exit, unless debugging. + if test -z "$debug"; then + trap "cd / && rm -rf $tmpdir" 0 1 2 3 13 15 + fi +else + # Prepare the temporary directory. Remove it at exit, unless debugging. + if test -z "$debug"; then + trap "cd / && rm -rf $tmpdir" 0 1 2 3 13 15 + fi + # Create the temporary directory with strict rights + (umask 077 && mkdir $tmpdir) || exit 1 fi - -# Create the temporary directory with strict rights -(umask 077 && mkdir $tmpdir) || exit 1 # Prepare the tools we might need. This may be extra work in some # cases, but improves the readibility of the script. --- a2ps-4.13/contrib/emacs/elisp-comp +++ a2ps-4.13/contrib/emacs/elisp-comp Thu Mar 18 14:36:40 2004 @@ -35,8 +35,12 @@ EMACS=emacs fi - tempdir=elc.$$ - mkdir $tempdir + if type -p mktemp > /dev/null 2>&1 ; then + tempdir="`mktemp -d elc.XXXXXX`" || exit 1 + else + tempdir=elc.$$ + mkdir $tempdir || exit 1 + fi cp $* $tempdir cd $tempdir