1 | #!/bin/sh |
---|
2 | # $Id: sendbug.sh,v 1.3 1989-12-04 15:22:54 raeburn Exp $ |
---|
3 | # make sure stuff this script needs is up front |
---|
4 | eval `/etc/athena/sh_commands_path` |
---|
5 | PATH=$PATH:/bin/athena |
---|
6 | bugs_address=bugs@Athena.MIT.EDU |
---|
7 | sendmail="/usr/lib/sendmail -t -oi" |
---|
8 | report_file=/tmp/bug$$.text |
---|
9 | version_file=/etc/version |
---|
10 | if [ ! -r $version_file ]; then |
---|
11 | version="unknown version (no $version_file found)" |
---|
12 | else |
---|
13 | awk_cmd='\ |
---|
14 | {if ($5 == "Update") update++; \ |
---|
15 | else if ($5 == version) { same++; update=0; } \ |
---|
16 | else { version=$5; update=0; same=0; } } \ |
---|
17 | END { printf "%s", version; \ |
---|
18 | close=0; \ |
---|
19 | if (update) { printf " (plus partial update"; close=1; }\ |
---|
20 | else if (same) { \ |
---|
21 | if (close) printf "; "; \ |
---|
22 | else printf " ("; \ |
---|
23 | printf "%d update(s) to same version", same; \ |
---|
24 | close=1; } \ |
---|
25 | if (close) printf ")"; \ |
---|
26 | }' |
---|
27 | version=`awk "$awk_cmd" < $version_file` |
---|
28 | fi |
---|
29 | short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'` |
---|
30 | machtype=`machtype` |
---|
31 | cpu=`machtype -c` |
---|
32 | hostname=`hostname` |
---|
33 | dpy=`machtype -d` |
---|
34 | /usr/ucb/fmt << EOF |
---|
35 | Please enter the subject for this bug report. (Generally, this means the |
---|
36 | name of the program or locker with which you are having problems.) |
---|
37 | EOF |
---|
38 | echo -n ' --> ' |
---|
39 | read subject |
---|
40 | cat > $report_file << EOF |
---|
41 | To: $bugs_address |
---|
42 | Subject: $machtype $short_version: $subject |
---|
43 | ------- |
---|
44 | System name: $hostname |
---|
45 | Type and version: $cpu $version |
---|
46 | Display type: $dpy |
---|
47 | What were you trying to do? |
---|
48 | [Please fill this in.] |
---|
49 | |
---|
50 | What's wrong: |
---|
51 | [Please fill this in.] |
---|
52 | |
---|
53 | What should have happened: |
---|
54 | [Please fill this in.] |
---|
55 | |
---|
56 | Please describe any relevant documentation references: |
---|
57 | [Please fill this in.] |
---|
58 | EOF |
---|
59 | |
---|
60 | fmt << EOF |
---|
61 | |
---|
62 | Please fill in the specified fields of the bug report form, which will |
---|
63 | be displayed momentarily. |
---|
64 | Remember to save the file before exiting the editor. |
---|
65 | EOF |
---|
66 | |
---|
67 | if [ -r $HOME/.mh_profile ]; then |
---|
68 | comp -form $report_file |
---|
69 | rm $report_file |
---|
70 | exit 0 |
---|
71 | fi |
---|
72 | # not using MH; run the editor, and send, ourselves. |
---|
73 | if [ "x$EDITOR" = "x" ]; then |
---|
74 | EDITOR=/usr/athena/emacs ; export EDITOR |
---|
75 | fi |
---|
76 | |
---|
77 | $EDITOR $report_file |
---|
78 | exec whatnow $report_file |
---|