annotate lib-src/send-pr @ 129:e292c9648bb9 xemacs-20-1p3

Import from CVS: tag xemacs-20-1p3
author cvs
date Mon, 13 Aug 2007 09:28:38 +0200
parents 7d55a9ba150c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
1 #!/bin/sh
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
2 # Submit a problem report to a GNATS site.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
3 # Copyright (C) 1993 Free Software Foundation, Inc.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
4 # Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
5 # version written by Heinz G. Seidl (hgs@cygnus.com).
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
6 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
7 # This file is part of GNU GNATS.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
8 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
9 # GNU GNATS is free software; you can redistribute it and/or modify
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
10 # it under the terms of the GNU General Public License as published by
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
11 # the Free Software Foundation; either version 2, or (at your option)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
12 # any later version.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
13 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
14 # GNU GNATS is distributed in the hope that it will be useful,
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
17 # GNU General Public License for more details.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
18 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
20 # along with GNU GNATS; see the file COPYING. If not, write to
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
21 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
22
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
23 # The version of this send-pr.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
24 VERSION=3.101
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
25
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
26 # The submitter-id for your site.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 112
diff changeset
27 SUBMITTER=net
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
28
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
29 # Where the GNATS directory lives, if at all.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
30 [ -z "$GNATS_ROOT" ] &&
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
31 GNATS_ROOT=/usr/lib/gnats/gnats-db
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
32
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
33 # The default mail address for PR submissions.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 112
diff changeset
34 GNATS_ADDR=bugs@xemacs.org
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
35
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
36 # Where the gnats category tree lives.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 112
diff changeset
37 [ -z "$DATADIR" ] &&
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
38 DATADIR=/usr/share
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
39
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
40 # If we've been moved around, try using GCC_EXEC_PREFIX.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
41 [ ! -d $DATADIR/gnats -a -d "$GCC_EXEC_PREFIX" ] &&
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
42 DATADIR=${GCC_EXEC_PREFIX}../../../lib
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
43
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
44
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
45 # The default release for this host.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
46 DEFAULT_RELEASE="gnats-3.101"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
47
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
48 # The default organization.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
49 DEFAULT_ORGANIZATION="XEmacs Users"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
50
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
51 # The default site to look for.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 112
diff changeset
52 GNATS_SITE=xemacs.org
112
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
53
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
54 # Newer config information?
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
55 [ -f ${GNATS_ROOT}/gnats-adm/config ] && . ${GNATS_ROOT}/gnats-adm/config
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
56
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
57 # What mailer to use. This must come after the config file, since it is
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
58 # host-dependent.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
59 MAIL_AGENT="/usr/lib/sendmail -oi -t"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
60
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
61 # How to read the passwd database.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
62 PASSWD="cat /etc/passwd"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
63
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
64 ECHON=bsd
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
65
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
66 if [ $ECHON = bsd ] ; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
67 ECHON1="echo -n"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
68 ECHON2=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
69 elif [ $ECHON = sysv ] ; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
70 ECHON1=echo
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
71 ECHON2='\c'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
72 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
73 ECHON1=echo
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
74 ECHON2=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
75 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
76
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
77 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
78
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
79 if [ -z "$TMPDIR" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
80 TMPDIR=/tmp
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
81 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
82 if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
83 TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
84 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
85 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
86
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
87 TEMP=$TMPDIR/p$$
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
88 BAD=$TMPDIR/pbad$$
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
89 REF=$TMPDIR/pf$$
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
90
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
91 # find a user name
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
92 if [ "$LOGNAME" = "" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
93 if [ "$USER" != "" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
94 LOGNAME="$USER"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
95 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
96 LOGNAME="UNKNOWN"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
97 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
98 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
99
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
100 FROM="$LOGNAME"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
101 if [ -z "$REPLYTO" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
102 REPLYTO="$LOGNAME"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
103 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
104
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
105 # Find out the name of the originator of this PR.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
106 if [ -n "$NAME" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
107 ORIGINATOR="$NAME"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
108 elif [ -f $HOME/.fullname ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
109 ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
110 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
111 # Must use temp file due to incompatibilities in quoting behavior
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
112 # and to protect shell metacharacters in the expansion of $LOGNAME
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
113 $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
114 ORIGINATOR="`cat $TEMP`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
115 rm -f $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
116 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
117
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
118 if [ -n "$ORGANIZATION" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
119 if [ -f "$ORGANIZATION" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
120 ORGANIZATION="`cat $ORGANIZATION`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
121 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
122 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
123 if [ -n "$DEFAULT_ORGANIZATION" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
124 ORGANIZATION="$DEFAULT_ORGANIZATION"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
125 elif [ -f $HOME/.organization ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
126 ORGANIZATION="`cat $HOME/.organization`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
127 elif [ -f $HOME/.signature ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
128 ORGANIZATION="`cat $HOME/.signature`"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
129 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
130 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
131
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
132 # If they don't have a preferred editor set, then use
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
133 if [ -z "$VISUAL" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
134 if [ -z "$EDITOR" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
135 EDIT=vi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
136 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
137 EDIT="$EDITOR"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
138 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
139 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
140 EDIT="$VISUAL"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
141 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
142
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
143 # Find out some information.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
144 SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
145 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
146 ARCH=`[ -f /bin/arch ] && /bin/arch`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
147 MACHINE=`[ -f /bin/machine ] && /bin/machine`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
148
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
149 COMMAND=`echo $0 | sed -e 's,.*/,,'`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
150 USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity]
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
151 [-c address] [--request-id] [--version]"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
152 REMOVE=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
153 BATCH=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
154 CC=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
155 SEVERITY_C=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
156
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
157 while [ $# -gt 0 ]; do
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
158 case "$1" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
159 -r) ;; # Ignore for backward compat.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
160 -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
161 shift ; GNATS_ADDR="$1"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
162 EXPLICIT_GNATS_ADDR=true
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
163 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
164 -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
165 shift ; IN_FILE="$1"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
166 if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
167 echo "$COMMAND: cannot read $IN_FILE"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
168 exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
169 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
170 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
171 -b | --batch) BATCH=true ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
172 -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
173 shift ; CC="$1"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
174 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
175 -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
176 shift ; SEVERITY_C="$1"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
177 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
178 -p | -P | --print) PRINT=true ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
179 -L | --list) FORMAT=norm ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
180 -l | -CL | --lisp) FORMAT=lisp ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
181 --request-id) REQUEST_ID=true ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
182 -h | --help) echo "$USAGE"; exit 0 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
183 -V | --version) echo "$VERSION"; exit 0 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
184 -*) echo "$USAGE" ; exit 1 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
185 *) if [ -z "$USER_GNATS_SITE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
186 if [ ! -r "$DATADIR/gnats/$1" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
187 echo "$COMMAND: the GNATS site $1 does not have a categories list."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
188 exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
189 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
190 # The site name is the alias they'll have to have created.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
191 USER_GNATS_SITE=$1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
192 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
193 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
194 echo "$USAGE" ; exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
195 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
196 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
197 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
198 shift
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
199 done
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
200
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
201 if [ -n "$USER_GNATS_SITE" ] && [ "$USER_GNATS_SITE" != "$GNATS_SITE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
202 GNATS_SITE=$USER_GNATS_SITE
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
203 GNATS_ADDR=$USER_GNATS_SITE-gnats
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
204 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
205
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
206 if [ "$SUBMITTER" = "unknown" -a -z "$REQUEST_ID" -a -z "$IN_FILE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
207 cat << '__EOF__'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
208 It seems that send-pr is not installed with your unique submitter-id.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
209 You need to run
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
210
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
211 install-sid YOUR-SID
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
212
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
213 where YOUR-SID is the identification code you received with `send-pr'.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
214 `send-pr' will automatically insert this value into the template field
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
215 `>Submitter-Id'. If you've downloaded `send-pr' from the Net, use `net'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
216 for this value. If you do not know your id, run `send-pr --request-id' to
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
217 get one from your support site.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
218 __EOF__
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
219 exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
220 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
221
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
222 if [ -r "$DATADIR/gnats/$GNATS_SITE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
223 CATEGORIES=`grep -v '^#' $DATADIR/gnats/$GNATS_SITE | sort`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
224 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
225 echo "$COMMAND: could not read $DATADIR/gnats/$GNATS_SITE for categories list."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
226 exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
227 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
228
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
229 if [ -z "$CATEGORIES" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
230 echo "$COMMAND: the categories list for $GNATS_SITE was empty!"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
231 exit 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
232 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
233
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
234 case "$FORMAT" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
235 lisp) echo "$CATEGORIES" | \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
236 awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
237 exit 0
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
238 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
239 norm) l=`echo "$CATEGORIES" | \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
240 awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
241 END {print max + 1;}'`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
242 c=`expr 70 / $l`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
243 if [ $c -eq 0 ]; then c=1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
244 echo "$CATEGORIES" | \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
245 awk 'BEGIN {print "Known categories:"; i = 0 }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
246 { printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
247 END { print ""; }'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
248 exit 0
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
249 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
250 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
251
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
252 ORIGINATOR_C='<name of the PR author (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
253 ORGANIZATION_C='<organization of PR author (multiple lines)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
254 CONFIDENTIAL_C='<[ yes | no ] (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
255 SYNOPSIS_C='<synopsis of the problem (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
256 if [ -z "$SEVERITY_C" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
257 SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
258 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
259 PRIORITY_C='<[ low | medium | high ] (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
260 CATEGORY_C='<name of the product (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
261 CLASS_C='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
262 RELEASE_C='<release number or tag (one line)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
263 ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
264 DESCRIPTION_C='<precise description of the problem (multiple lines)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
265 HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
266 FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
267
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
268 # Catch some signals. ($xs kludge needed by Sun /bin/sh)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
269 xs=0
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
270 trap 'rm -f $REF $TEMP; exit $xs' 0
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
271 trap 'echo "$COMMAND: Aborting ..."; rm -f $REF $TEMP; xs=1; exit' 1 2 3 13 15
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
272
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
273 # If they told us to use a specific file, then do so.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
274 if [ -n "$IN_FILE" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
275 if [ "$IN_FILE" = "-" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
276 # The PR is coming from the standard input.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
277 if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
278 sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
279 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
280 cat > $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
281 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
282 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
283 # Use the file they named.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
284 if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
285 sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
286 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
287 cat $IN_FILE > $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
288 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
289 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
290 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
291
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
292 if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
293 # If their PR_FORM points to a bogus entry, then bail.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
294 if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
295 echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
296 sleep 1
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
297 PRINT_INTERN=bad_prform
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
298 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
299 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
300
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
301 if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
302 cp $PR_FORM $TEMP ||
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
303 ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit )
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
304 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
305 for file in $TEMP $REF ; do
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
306 cat > $file << '__EOF__'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
307 SEND-PR: -*- send-pr -*-
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
308 SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
309 SEND-PR: will all comments (text enclosed in `<' and `>').
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
310 SEND-PR:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
311 SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
312 SEND-PR: manual if you are not sure how to fill out a problem report.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
313 SEND-PR:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
314 SEND-PR: Choose from the following categories:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
315 SEND-PR:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
316 __EOF__
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
317
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
318 # Format the categories so they fit onto lines.
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
319 l=`echo "$CATEGORIES" | \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
320 awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
321 END {print max + 1;}'`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
322 c=`expr 61 / $l`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
323 if [ $c -eq 0 ]; then c=1; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
324 echo "$CATEGORIES" | \
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
325 awk 'BEGIN {printf "SEND-PR: "; i = 0 }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
326 { printf ("%-'$l'.'$l's", $0);
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
327 if ((++i % '$c') == 0) { printf "\nSEND-PR: " } }
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
328 END { printf "\nSEND-PR:\n"; }' >> $file
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
329
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
330 cat >> $file << __EOF__
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
331 To: $GNATS_ADDR
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
332 Subject:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
333 From: $FROM
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
334 Reply-To: $REPLYTO
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
335 Cc: $CC
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
336 X-send-pr-version: $VERSION
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
337
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
338
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
339 >Submitter-Id: $SUBMITTER
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
340 >Originator: $ORIGINATOR
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
341 >Organization:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
342 ${ORGANIZATION- $ORGANIZATION_C}
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
343 >Confidential: $CONFIDENTIAL_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
344 >Synopsis: $SYNOPSIS_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
345 >Severity: $SEVERITY_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
346 >Priority: $PRIORITY_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
347 >Category: $CATEGORY_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
348 >Class: $CLASS_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
349 >Release: ${DEFAULT_RELEASE-$RELEASE_C}
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
350 >Environment:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
351 $ENVIRONMENT_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
352 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
353 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
354 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
355 >Description:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
356 $DESCRIPTION_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
357 >How-To-Repeat:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
358 $HOW_TO_REPEAT_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
359 >Fix:
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
360 $FIX_C
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
361 __EOF__
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
362 done
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
363 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
364
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
365 if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
366 cat $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
367 xs=0; exit
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
368 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
369
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
370 chmod u+w $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
371 if [ -z "$REQUEST_ID" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
372 eval $EDIT $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
373 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
374 ed -s $TEMP << '__EOF__'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
375 /^Subject/s/^Subject:.*/Subject: request for a customer id/
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
376 /^>Category/s/^>Category:.*/>Category: send-pr/
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
377 w
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
378 q
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
379 __EOF__
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
380 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
381
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
382 if cmp -s $REF $TEMP ; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
383 echo "$COMMAND: problem report not filled out, therefore not sent"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
384 xs=1; exit
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
385 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
386 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
387
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
388 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
389 # Check the enumeration fields
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
390
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
391 # This is a "sed-subroutine" with one keyword parameter
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
392 # (with workaround for Sun sed bug)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
393 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
394 SED_CMD='
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
395 /$PATTERN/{
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
396 s|||
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
397 s|<.*>||
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
398 s|^[ ]*||
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
399 s|[ ]*$||
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
400 p
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
401 q
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
402 }'
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
403
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
404
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
405 while [ -z "$REQUEST_ID" ]; do
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
406 CNT=0
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
407
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
408 # 1) Confidential
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
409 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
410 PATTERN=">Confidential:"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
411 CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
412 case "$CONFIDENTIAL" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
413 ""|yes|no) CNT=`expr $CNT + 1` ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
414 *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
415 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
416 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
417 # 2) Severity
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
418 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
419 PATTERN=">Severity:"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
420 SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
421 case "$SEVERITY" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
422 ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
423 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
424 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
425 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
426 # 3) Priority
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
427 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
428 PATTERN=">Priority:"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
429 PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
430 case "$PRIORITY" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
431 ""|low|medium|high) CNT=`expr $CNT + 1` ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
432 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
433 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
434 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
435 # 4) Category
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
436 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
437 PATTERN=">Category:"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
438 CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
439 FOUND=
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
440 for C in $CATEGORIES
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
441 do
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
442 if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
443 done
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
444 if [ -n "$FOUND" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
445 CNT=`expr $CNT + 1`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
446 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
447 if [ -z "$CATEGORY" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
448 echo "$COMMAND: you must include a Category: field in your report."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
449 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
450 echo "$COMMAND: \`$CATEGORY' is not a known category."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
451 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
452 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
453 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
454 # 5) Class
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
455 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
456 PATTERN=">Class:"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
457 CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
458 case "$CLASS" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
459 ""|sw-bug|doc-bug|change-request|support) CNT=`expr $CNT + 1` ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
460 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
461 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
462
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
463 [ $CNT -lt 5 -a -z "$BATCH" ] &&
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
464 echo "Errors were found with the problem report."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
465
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
466 while true; do
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
467 if [ -z "$BATCH" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
468 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
469 read input
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
470 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
471 if [ $CNT -eq 5 ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
472 input=s
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
473 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
474 input=a
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
475 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
476 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
477 case "$input" in
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
478 a*)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
479 if [ -z "$BATCH" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
480 echo "$COMMAND: the problem report remains in $BAD and is not sent."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
481 mv $TEMP $BAD
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
482 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
483 echo "$COMMAND: the problem report is not sent."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
484 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
485 xs=1; exit
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
486 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
487 e*)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
488 eval $EDIT $TEMP
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
489 continue 2
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
490 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
491 s*)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
492 break 2
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
493 ;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
494 esac
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
495 done
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
496 done
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
497 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
498 # Remove comments and send the problem report
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
499 # (we have to use patterns, where the comment contains regex chars)
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
500 #
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
501 # /^>Originator:/s;$ORIGINATOR;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
502 sed -e "
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
503 /^SEND-PR:/d
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
504 /^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
505 /^>Confidential:/s;<.*>;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
506 /^>Synopsis:/s;$SYNOPSIS_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
507 /^>Severity:/s;<.*>;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
508 /^>Priority:/s;<.*>;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
509 /^>Category:/s;$CATEGORY_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
510 /^>Class:/s;<.*>;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
511 /^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
512 /^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
513 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
514 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
515 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
516 " $TEMP > $REF
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
517
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
518 if $MAIL_AGENT < $REF; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
519 echo "$COMMAND: problem report sent"
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
520 xs=0; exit
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
521 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
522 echo "$COMMAND: mysterious mail failure."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
523 if [ -z "$BATCH" ]; then
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
524 echo "$COMMAND: the problem report remains in $BAD and is not sent."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
525 mv $REF $BAD
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
526 else
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
527 echo "$COMMAND: the problem report is not sent."
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
528 fi
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
529 xs=1; exit
48d667d6f17f Import from CVS: tag r20-1b8
cvs
parents:
diff changeset
530 fi