summaryrefslogtreecommitdiff
blob: 951af7968ae7f22533b5e761c3d105c9bc368d65 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
diff -urN noweb-2.9.orig/src/awk/totex.nw noweb-2.9/src/awk/totex.nw
--- noweb-2.9.orig/src/awk/totex.nw	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/awk/totex.nw	2006-02-17 12:47:05.000000000 +0100
@@ -24,7 +24,7 @@
 @
 On an ugly system, we have to put it in a file.
 <<invoke awk program using file>>=
-awkfile=/tmp/totex$$.awk
+awkfile=$(tempfile -p totex)
 trap 'rm -f $awkfile; exit 1' 0 1 2 15	# clean up files
 cat > $awkfile << 'EOF'
 <<awk program for conversion to {\TeX}>>
diff -urN noweb-2.9.orig/src/awkname noweb-2.9/src/awkname
--- noweb-2.9.orig/src/awkname	2000-06-23 12:56:00.000000000 +0200
+++ noweb-2.9/src/awkname	2006-02-17 12:47:05.000000000 +0100
@@ -5,7 +5,7 @@
 esac
 
 rc=0
-new=/tmp/$$.new; old=/tmp/$$.old
+new=$(tempfile -p new); old=$(tempfile -p old)
 
 for file in lib/emptydefn lib/unmarkup lib/toascii lib/btdefn \
                         awk/noidx awk/totex awk/tohtml awk/noindex \
diff -urN noweb-2.9.orig/src/lib/toascii noweb-2.9/src/lib/toascii
--- noweb-2.9.orig/src/lib/toascii	2001-03-28 15:49:00.000000000 +0200
+++ noweb-2.9/src/lib/toascii	2006-02-17 12:47:05.000000000 +0100
@@ -7,9 +7,9 @@
                 *)      echo "This can't happen -- $i passed to toascii" 1>&2 ; exit 1 ;;
         esac
 done
-awkfile="tmp/awk$$.tmp"
-textfile="/tmp/text$$.tmp"
-tagsfile="/tmp/tags$$.tmp"
+awkfile=$(tempfile -p awk -s .tmp)
+textfile=$(tempfile -p text -s .tmp)
+tagsfile=$(tempfile -p tags -s .tmp)
 export awkfile textfile tagsfile
 trap 'rm -f $awkfile $textfile $tagsfile' 0 1 2 10 14 15
 nawk 'BEGIN { textfile=ENVIRON["textfile"]
diff -urN noweb-2.9.orig/src/lib/toascii.nw noweb-2.9/src/lib/toascii.nw
--- noweb-2.9.orig/src/lib/toascii.nw	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/lib/toascii.nw	2006-02-17 12:48:20.000000000 +0100
@@ -28,9 +28,9 @@
 Also arranged here is a temporary file for storage of the awk program on an
 ugly system, as discussed below.
 <<arrange temporary files>>=
-awkfile="tmp/awk$$.tmp"
-textfile="/tmp/text$$.tmp"
-tagsfile="/tmp/tags$$.tmp"
+awkfile=$(tempfile -p awk -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+textfile=$(tempfile -p text -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+tagsfile=$(tempfile -p tags -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
 export awkfile textfile tagsfile
 trap 'rm -f $awkfile $textfile $tagsfile' 0 1 2 10 14 15
 @ %def textfile tagsfile awkfile
diff -urN noweb-2.9.orig/src/shell/cpif noweb-2.9/src/shell/cpif
--- noweb-2.9.orig/src/shell/cpif	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/shell/cpif	2006-02-17 12:47:05.000000000 +0100
@@ -17,7 +17,7 @@
 0)		echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2
 esac
 
-new=/tmp/$$
+new=$(tempfile)
 trap 'rm -f $new; exit 1' 1 2 15	# clean up files
 
 cat >$new
diff -urN noweb-2.9.orig/src/shell/nonu noweb-2.9/src/shell/nonu
--- noweb-2.9.orig/src/shell/nonu	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/shell/nonu	2006-02-17 12:47:05.000000000 +0100
@@ -2,7 +2,7 @@
 LIB=/usr/public/pkg/noweb/lib
 # attempt to convert nuweb to noweb using sam
 
-tmp=/tmp/nonu$$
+tmp=$(tempfile -p nonu)
 trap '/bin/rm -f $tmp; exit 1' 1 2 15	# clean up files
 cp $1 $tmp || exit 1
 
diff -urN noweb-2.9.orig/src/shell/noroff noweb-2.9/src/shell/noroff
--- noweb-2.9.orig/src/shell/noroff	2001-03-28 15:49:00.000000000 +0200
+++ noweb-2.9/src/shell/noroff	2006-02-17 12:47:05.000000000 +0100
@@ -35,9 +35,10 @@
 
 base="`basename $1 | sed '/\./s/\.[^.]*$//'`"
 tagsfile="$base.nwt"
+tmpfile=$(tempfile -p tags)
 (echo ".so $macrodir/tmac.w"
 if [ -r "$tagsfile" ]; then 
-   cp $tagsfile /tmp/tags.$$
+   cp $tagsfile $tmpfile
    $AWK '{
 	     if      (sub(/^###TAG### /       , "")) tags[$1] = $2
 	     else if (sub(/^###BEGINCHUNKS###/, "")) printf ".de CLIST\n.CLISTBEGIN\n"
@@ -88,8 +89,8 @@
 	 #	print str3
 	 #	print convquote(str3)
 	 # }
-	 function tag(s) { if (s in tags) return tags[s]; else return "???" }' /tmp/tags.$$
-   rm -f /tmp/tags.$$
+	 function tag(s) { if (s in tags) return tags[s]; else return "???" }' $tmpfile
+   rm -f $tmpfile
  fi
  cat "$@") |
 ($ROFF $opts 2>$tagsfile)
diff -urN noweb-2.9.orig/src/shell/roff.mm noweb-2.9/src/shell/roff.mm
--- noweb-2.9.orig/src/shell/roff.mm	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/shell/roff.mm	2006-02-17 12:48:20.000000000 +0100
@@ -214,7 +214,7 @@
 .ADDLIST 1a
 .PRINTLIST
 
-awkfile="/tmp/noweb$$.awk"
+awkfile=$(tempfile -p noweb -s .awk) || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
 trap 'rm -f $awkfile' 0 1 2 10 14 15
 cat > $awkfile \&<< 'EOF'
 \c
@@ -1628,14 +1628,15 @@
 tagsfile="$base.nwt"
 (echo ".so $macrodir/tmac.w"
 if [ -r "$tagsfile" ]; then 
-   cp $tagsfile /tmp/tags.$$
+   tagstemp=$(tempfile -p tags) || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+   cp $tagsfile $tagstemp
    $AWK '\c
 .USE "action for \*[BEGINCONVQUOTE]tags\*[ENDCONVQUOTE] line" 11c
 \&
          \c
 .USE "functions" 8a
-\&' /tmp/tags.$$
-   rm -f /tmp/tags.$$
+\&' $tagstemp
+   rm -f $tagstemp
  fi
  cat "$@") |
 ($ROFF $opts 2>$tagsfile)
diff -urN noweb-2.9.orig/src/shell/roff.nw noweb-2.9/src/shell/roff.nw
--- noweb-2.9.orig/src/shell/roff.nw	2000-03-27 02:00:00.000000000 +0200
+++ noweb-2.9/src/shell/roff.nw	2006-02-17 12:47:05.000000000 +0100
@@ -80,7 +80,7 @@
 other, and quoting each quote is ugly.  The pragmatic solution is to
 copy the awk program into a temporary file, using a shell here-document.
 <<invoke awk program>>=
-awkfile="/tmp/noweb$$.awk"
+awkfile=$(tempfile -p noweb -s .awk)
 trap 'rm -f $awkfile' 0 1 2 10 14 15
 cat > $awkfile << 'EOF'
 <<awk program>>
@@ -662,12 +662,13 @@
 
 base="`basename $1 | sed '/\./s/\.[^.]*$//'`"
 tagsfile="$base.nwt"
+tmpfile=$(tempfile -p tags)
 (echo ".so $macrodir/tmac.w"
 if [ -r "$tagsfile" ]; then 
-   cp $tagsfile /tmp/tags.$$
+   cp $tagsfile $tmpfile
    $AWK '<<action for [[tags]] line>>
-         <<functions>>' /tmp/tags.$$
-   rm -f /tmp/tags.$$
+         <<functions>>' $tmpfile
+   rm -f $tmpfile
  fi
  cat "$@") |
 ($ROFF $opts 2>$tagsfile)
diff -urN noweb-2.9.orig/src/shell/toroff noweb-2.9/src/shell/toroff
--- noweb-2.9.orig/src/shell/toroff	2001-03-28 15:49:00.000000000 +0200
+++ noweb-2.9/src/shell/toroff	2006-02-17 12:47:05.000000000 +0100
@@ -9,7 +9,7 @@
            exit 1;;
     esac
 done
-awkfile="/tmp/noweb$$.awk"
+awkfile=$(tempfile -p noweb -s .awk)
 trap 'rm -f $awkfile' 0 1 2 10 14 15
 cat > $awkfile << 'EOF'
 /^@begin docs 0$/ { if (delay) next }