797
|
1 #! /bin/sh - |
|
2 # |
|
3 # octave-bug - create a bug report and mail it to the bug-octave |
|
4 # mailing list. |
|
5 # |
|
6 # Patterned after the bashbug script from bash 1.14. |
|
7 # |
|
8 # John W. Eaton |
|
9 # jwe@che.utexas.edu |
|
10 # Department of Chemical Engineering |
|
11 # The University of Texas at Austin |
|
12 |
|
13 # Configuration: these variables are filled in at configuration time. |
|
14 |
|
15 VERSION="%VERSION%" |
|
16 MACHINE="%TARGET_HOST_TYPE%" |
|
17 F77="%F77%" |
|
18 FFLAGS="%FFLAGS%" |
|
19 CC="%CC%" |
|
20 CFLAGS="%CFLAGS%" |
|
21 CXX="%CXX%" |
|
22 CXXFLAGS="%CXXFLAGS%" |
|
23 DEFS="%DEFS%" |
|
24 |
846
|
25 PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:$PATH |
797
|
26 export PATH |
|
27 |
|
28 TEMP=/tmp/octave-bug.$$ |
|
29 |
|
30 : ${EDITOR=emacs} |
|
31 |
|
32 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15 |
|
33 trap 'rm -f $TEMP $TEMP.x' 0 |
|
34 |
|
35 UN= |
|
36 if (uname) > /dev/null 2>&1 |
|
37 then |
|
38 UN=`uname -a` |
|
39 fi |
|
40 |
|
41 HAVE_FMT=false |
|
42 if (fmt < /dev/null) > /dev/null 2>&1 |
|
43 then |
|
44 HAVE_FMT=true |
|
45 fi |
|
46 |
801
|
47 ss_p=`echo $VERSION | grep "^ss-"` |
|
48 if test -n "$ss_p" |
|
49 then |
|
50 BUGADDR="octave-maintainers@che.utexas.edu" |
|
51 else |
|
52 BUGADDR="bug-octave@che.utexas.edu" |
|
53 fi |
797
|
54 |
|
55 SUBJECT="[50 character or so descriptive subject here (for reference)]" |
|
56 if test $# -gt 0 |
|
57 then |
|
58 case "$1" in |
|
59 -s) |
801
|
60 shift |
797
|
61 if test $# -gt 0 |
|
62 then |
|
63 SUBJECT="$1" |
801
|
64 shift |
797
|
65 else |
|
66 echo "usage: octave-bug [-s subject]" |
|
67 exit 1 |
|
68 fi |
|
69 ;; |
|
70 esac |
|
71 fi |
|
72 |
|
73 cat > $TEMP << EOF |
|
74 To: $BUGADDR |
|
75 Subject: $SUBJECT |
|
76 |
|
77 Bug report for Octave $VERSION configured for $MACHINE |
|
78 |
|
79 Description: |
|
80 ----------- |
|
81 |
|
82 * Please replace this item with a detailed description of the |
|
83 problem. Suggestions or general comments are also welcome. |
|
84 |
|
85 Repeat-By: |
|
86 --------- |
|
87 |
|
88 * Please replace this item with a description of the sequence of |
|
89 events that causes the problem to occur. |
|
90 |
|
91 Fix: |
|
92 --- |
|
93 |
|
94 * If possible, replace this item with a description of how to |
|
95 fix the problem (if you don't have a fix for the problem, don't |
|
96 include this section, but please do submit your report anyway). |
|
97 |
801
|
98 |
|
99 |
|
100 Configuration (please do not edit this section): |
|
101 ----------------------------------------------- |
|
102 |
|
103 uname output: $UN |
|
104 Fortran compiler: $F77 |
|
105 FFLAGS: $FFLAGS |
|
106 C compiler: $CC |
|
107 CFLAGS: $CFLAGS |
|
108 C++ compiler: $CXX |
|
109 CXXFLAGS: $CXXFLAGS |
|
110 DEFS: |
|
111 |
797
|
112 EOF |
|
113 |
801
|
114 if $HAVE_FMT |
|
115 then |
|
116 echo $DEFS | fmt | sed 's/^/ /' >> $TEMP |
|
117 else |
|
118 echo $DEFS >> $TEMP |
|
119 fi |
|
120 |
|
121 if test $# -gt 0 |
|
122 then |
|
123 if test -f "$1" |
|
124 then |
|
125 cat >> $TEMP << EOF |
|
126 |
|
127 User-preferences (please do not edit this section): |
|
128 -------------------------------------------------- |
|
129 |
|
130 EOF |
|
131 cat $1 >> $TEMP |
|
132 fi |
|
133 fi |
|
134 |
797
|
135 chmod u+w $TEMP |
|
136 cp $TEMP $TEMP.x |
|
137 |
|
138 status=0 |
|
139 |
|
140 if $EDITOR $TEMP |
|
141 then |
|
142 if cmp -s $TEMP $TEMP.x |
|
143 then |
|
144 echo "file not changed -- no bug report submitted" |
|
145 status=1 |
|
146 else |
846
|
147 rmail $BUGADDR < $TEMP > /dev/null 2>&1 || \ |
|
148 mailx -s $SUBJECT $BUGADDR < $TEMP /dev/null 2>&1 || \ |
|
149 Mail -s $SUBJECT $BUGADDR < $TEMP /dev/null 2>&1 || \ |
|
150 /usr/ucb/mail -s $SUBJECT $BUGADDR < $TEMP /dev/null 2>&1 || \ |
|
151 /bin/mail -s $SUBJECT $BUGADDR < $TEMP /dev/null 2>&1 || \ |
|
152 ( echo "unable to send mail -- saving message in \$HOME/dead.octave-bug"; \ |
|
153 cat $TEMP >> $HOME/dead.octave-bug ) |
797
|
154 fi |
|
155 else |
|
156 echo "problems with edit -- no bug report submitted" |
|
157 status=1 |
|
158 fi |
|
159 |
|
160 exit $status |