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 |
|
25 PATH=/bin:/usr/bin:/usr/local/bin:$PATH |
|
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 |
|
47 # BUGADDR="bug-octave@che.utexas.edu" |
|
48 BUGADDR="jwe@che.utexas.edu" |
|
49 |
|
50 SUBJECT="[50 character or so descriptive subject here (for reference)]" |
|
51 if test $# -gt 0 |
|
52 then |
|
53 case "$1" in |
|
54 -s) |
|
55 shift; |
|
56 if test $# -gt 0 |
|
57 then |
|
58 SUBJECT="$1" |
|
59 else |
|
60 echo "usage: octave-bug [-s subject]" |
|
61 exit 1 |
|
62 fi |
|
63 ;; |
|
64 *) |
|
65 echo "usage: octave-bug [-s subject]" |
|
66 exit 1 |
|
67 ;; |
|
68 esac |
|
69 fi |
|
70 |
|
71 cat > $TEMP << EOF |
|
72 To: $BUGADDR |
|
73 Subject: $SUBJECT |
|
74 |
|
75 Configuration (please do not edit this section): |
|
76 ----------------------------------------------- |
|
77 |
|
78 Bug report for Octave $VERSION configured for $MACHINE |
|
79 |
|
80 uname output: $UN |
|
81 Fortran compiler: $F77 |
|
82 FFLAGS: $FFLAGS |
|
83 C compiler: $CC |
|
84 CFLAGS: $CFLAGS |
|
85 C++ compiler: $CXX |
|
86 CXXFLAGS: $CXXFLAGS |
|
87 DEFS: |
|
88 |
|
89 EOF |
|
90 |
|
91 if $HAVE_FMT |
|
92 then |
|
93 echo $DEFS | fmt | sed 's/^/ /' >> $TEMP |
|
94 else |
|
95 echo $DEFS >> $TEMP |
|
96 fi |
|
97 |
|
98 cat >> $TEMP << EOF |
|
99 |
|
100 Description: |
|
101 ----------- |
|
102 |
|
103 * Please replace this item with a detailed description of the |
|
104 problem. Suggestions or general comments are also welcome. |
|
105 |
|
106 Repeat-By: |
|
107 --------- |
|
108 |
|
109 * Please replace this item with a description of the sequence of |
|
110 events that causes the problem to occur. |
|
111 |
|
112 Fix: |
|
113 --- |
|
114 |
|
115 * If possible, replace this item with a description of how to |
|
116 fix the problem (if you don't have a fix for the problem, don't |
|
117 include this section, but please do submit your report anyway). |
|
118 |
|
119 EOF |
|
120 |
|
121 chmod u+w $TEMP |
|
122 cp $TEMP $TEMP.x |
|
123 |
|
124 status=0 |
|
125 |
|
126 if $EDITOR $TEMP |
|
127 then |
|
128 if cmp -s $TEMP $TEMP.x |
|
129 then |
|
130 echo "file not changed -- no bug report submitted" |
|
131 status=1 |
|
132 else |
|
133 rmail $BUGADDR < $TEMP || cat $TEMP >> $HOME/dead.octave-bug |
|
134 fi |
|
135 else |
|
136 echo "problems with edit -- no bug report submitted" |
|
137 status=1 |
|
138 fi |
|
139 |
|
140 exit $status |