1 --- gawk-3.1.0/doc/gawk.texi.orig Tue Jun 26 00:01:14 2001
2 +++ gawk-3.1.0/doc/gawk.texi Tue Jun 26 00:13:40 2001
3 @@ -20336,8 +20336,7 @@
4 arranges to clean up any temporary files on program exit or upon an
7 -@c 2e: For the temp file handling, go with Darrel's ig=${TMP:-/tmp}/igs.$$
8 -@c 2e: or something as similar as possible.
9 +@c 2e: For the temporary file handling, use mktemp with $@{TMPDIR:-/tmp@}.
11 The next part loops through all the command-line arguments.
12 There are several cases of interest:
13 @@ -20358,13 +20357,13 @@
14 These are saved and passed on to @command{gawk}.
16 @item -f@r{,} --file@r{,} --file=@r{,} -Wfile=
17 -The @value{FN} is saved to the temporary file @file{/tmp/ig.s.$$} with an
18 +The @value{FN} is saved to the temporary file with an
19 @samp{@@include} statement.
20 The @command{sed} utility is used to remove the leading option part of the
21 argument (e.g., @samp{--file=}).
23 @item --source@r{,} --source=@r{,} -Wsource=
24 -The source text is echoed into @file{/tmp/ig.s.$$}.
25 +The source text is echoed into a temporary file.
27 @item --version@r{,} -Wversion
28 @command{igawk} prints its version number, runs @samp{gawk --version}
29 @@ -20375,10 +20374,7 @@
30 or @option{-Wsource} arguments are supplied, then the first non-option argument
31 should be the @command{awk} program. If there are no command-line
32 arguments left, @command{igawk} prints an error message and exits.
33 -Otherwise, the first argument is echoed into @file{/tmp/ig.s.$$}.
34 -In any case, after the arguments have been processed,
35 -@file{/tmp/ig.s.$$} contains the complete text of the original @command{awk}
37 +Otherwise, the first argument is echoed into a temporary file.
39 @cindex @command{sed} utility
41 @@ -20403,13 +20399,25 @@
44 @c file eg/prog/igawk.sh
45 +# Temporary file handling modifications for Owl by
46 +# Jarno Huuskonen and Solar Designer, still Public Domain
49 +if [ ! -x /bin/mktemp ]; then
50 + echo "$0 needs mktemp to create temporary files."
54 +STEMPFILE=`/bin/mktemp $@{TMPDIR:-/tmp@}/igawk.s.XXXXXX` || exit 1
55 +ETEMPFILE=`/bin/mktemp $@{TMPDIR:-/tmp@}/igawk.e.XXXXXX` || exit 1
62 # cleanup on exit, hangup, interrupt, quit, termination
63 - trap 'rm -f /tmp/ig.[se].$$' 0 1 2 3 15
64 + trap 'rm -f $STEMPFILE $ETEMPFILE' EXIT HUP INT QUIT TERM
67 while [ $# -ne 0 ] # loop over arguments
68 @@ -20426,26 +20434,26 @@
70 -[vF]*) opts="$opts '$1'" ;;
72 - -f) echo @@include "$2" >> /tmp/ig.s.$$
73 + -f) echo @@include "$2" >> $STEMPFILE
76 -f*) f=`echo "$1" | sed 's/-f//'`
77 - echo @@include "$f" >> /tmp/ig.s.$$ ;;
78 + echo @@include "$f" >> $STEMPFILE ;;
80 -?file=*) # -Wfile or --file
81 f=`echo "$1" | sed 's/-.file=//'`
82 - echo @@include "$f" >> /tmp/ig.s.$$ ;;
83 + echo @@include "$f" >> $STEMPFILE ;;
86 - echo @@include "$2" >> /tmp/ig.s.$$
87 + echo @@include "$2" >> $STEMPFILE
90 -?source=*) # -Wsource or --source
91 t=`echo "$1" | sed 's/-.source=//'`
92 - echo "$t" >> /tmp/ig.s.$$ ;;
93 + echo "$t" >> $STEMPFILE ;;
95 -?source) # get arg, $2
96 - echo "$2" >> /tmp/ig.s.$$
97 + echo "$2" >> $STEMPFILE
101 @@ -20460,7 +20468,7 @@
105 -if [ ! -s /tmp/ig.s.$$ ]
106 +if [ ! -s $STEMPFILE ]
110 @@ -20469,12 +20477,12 @@
114 - echo "$1" > /tmp/ig.s.$$
115 + echo "$1" > $STEMPFILE
120 -# at this point, /tmp/ig.s.$$ has the program
121 +# at this point, $STEMPFILE has the program
125 @@ -20553,7 +20561,7 @@
129 -The stack is initialized with @code{ARGV[1]}, which will be @file{/tmp/ig.s.$$}.
130 +The stack is initialized with @code{ARGV[1]}, which will be @file{$STEMPFILE}.
131 The main loop comes next. Input lines are read in succession. Lines that
132 do not start with @samp{@@include} are printed verbatim.
133 If the line does start with @samp{@@include}, the @value{FN} is in @code{$2}.
134 @@ -20599,7 +20607,7 @@
136 close(input[stackptr])
138 -@}' /tmp/ig.s.$$ > /tmp/ig.e.$$
139 +@}' $STEMPFILE > $ETEMPFILE
143 @@ -20625,7 +20633,7 @@
146 @c file eg/prog/igawk.sh
147 -eval gawk -f /tmp/ig.e.$$ $opts -- "$@@"
148 +eval gawk -f $ETEMPFILE $opts -- "$@@"