gccbug.in revision 132718
1149487Stjr#!/bin/sh 260786Sps# Submit a problem report to a GNATS site. 3170259Sdelphij# Copyright (C) 1993, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 460786Sps# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a 560786Sps# version written by Heinz G. Seidl (hgs@cygnus.com). 660786Sps# 760786Sps# This file is part of GNU GNATS. 860786Sps# 960786Sps# GNU GNATS is free software; you can redistribute it and/or modify 1060786Sps# it under the terms of the GNU General Public License as published by 1160786Sps# the Free Software Foundation; either version 2, or (at your option) 1260786Sps# any later version. 1360786Sps# 1460786Sps# GNU GNATS is distributed in the hope that it will be useful, 1560786Sps# but WITHOUT ANY WARRANTY; without even the implied warranty of 1660786Sps# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1760786Sps# GNU General Public License for more details. 1860786Sps# 1960786Sps# You should have received a copy of the GNU General Public License 20161478Sdelphij# along with GNU GNATS; see the file COPYING. If not, write to 2160786Sps# the Free Software Foundation, 59 Temple Place - Suite 330, 22161478Sdelphij# Boston, MA 02111-1307, USA. 2389019Sps 2489019Sps# The version of this send-pr. 2560786SpsVERSION=3.113 26161478Sdelphij 2760786Sps# The submitter-id for your site. 2889019SpsSUBMITTER=net 2989019Sps 3089019Sps# The default mail address for PR submissions. 3160786SpsGNATS_ADDR=gcc-gnats@gcc.gnu.org 3260786Sps 3360786Sps# The default release for this host. 3460786SpsDEFAULT_RELEASE="@gcc_version_full@" 3560786Sps 36128345Stjr# The default organization. 3760786SpsDEFAULT_ORGANIZATION= 3863128Sps 39161478Sdelphij# What mailer to use. This must come after the config file, since it is 4060786Sps# host-dependent. 4160786Sps# Copied from cvsbug 4260786Spsif [ -f /usr/sbin/sendmail ]; then 43161478Sdelphij MAIL_AGENT="/usr/sbin/sendmail -oi -t" 4460786Spselse 45161478Sdelphij MAIL_AGENT="/usr/lib/sendmail -oi -t" 46161478Sdelphijfi 4760786SpsMAILER=`echo $MAIL_AGENT | sed -e 's, .*,,'` 4860786Spsif [ ! -f "$MAILER" ] ; then 49161478Sdelphij echo "$COMMAND: Cannot file mail program \"$MAILER\"." 5060786Sps echo "$COMMAND: Please fix the MAIL_AGENT entry in the $COMMAND file." 5160786Sps exit 1 5260786Spsfi 5360786Sps 5460786Sps 5563128Sps# How to read the passwd database. 5660786SpsPASSWD="cat /etc/passwd" 5760786Sps 5860786SpsECHON=bsd 5960786Sps 6060786Spsif [ $ECHON = bsd ] ; then 6160786Sps ECHON1="echo -n" 6260786Sps ECHON2= 63170259Sdelphijelif [ $ECHON = sysv ] ; then 6463128Sps ECHON1=echo 6563128Sps ECHON2='\c' 6660786Spselse 67161478Sdelphij ECHON1=echo 68161478Sdelphij ECHON2= 69161478Sdelphijfi 70161478Sdelphij 71161478Sdelphij# 7260786Sps 7360786Spsif [ -z "$TMPDIR" ]; then 7460786Sps TMPDIR=/tmp 7560786Spselse 7660786Sps if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then 7760786Sps TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`" 7860786Sps fi 7960786Spsfi 8060786Sps 81161478Sdelphijif [ @have_mktemp_command@ = yes ]; then 82161478Sdelphij TEMP0=`mktemp $TMPDIR/poXXXXXX` || exit 1 83161478Sdelphij TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1 84161478Sdelphij BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1 85161478Sdelphij REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1 8689019Sps REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF" 8789019Spselse 8889019Sps TEMPD=$TMPDIR/pd$$ 8960786Sps TEMP0=$TEMPD/po$$ 9060786Sps TEMP=$TEMPD/p$$ 9160786Sps BAD=$TEMPD/pbad$$ 9289019Sps REF=$TEMPD/pf$$ 9389019Sps mkdir $TEMPD || exit 1 94161478Sdelphij REMOVE_TEMP="rm -rf $TEMPD" 9589019Spsfi 9689019Sps 97161478Sdelphij# find a user name 98161478Sdelphijif [ "$LOGNAME" = "" ]; then 99161478Sdelphij if [ "$USER" != "" ]; then 100161478Sdelphij LOGNAME="$USER" 101161478Sdelphij else 102161478Sdelphij LOGNAME="UNKNOWN" 103161478Sdelphij fi 104161478Sdelphijfi 10589019Sps 10689019SpsFROM="$LOGNAME" 107161478SdelphijREPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}" 10889019Sps 10989019Sps# Find out the name of the originator of this PR. 11089019Spsif [ -n "$NAME" ]; then 11189019Sps ORIGINATOR="$NAME" 11289019Spselif [ -f $HOME/.fullname ]; then 11389019Sps ORIGINATOR="`sed -e '1q' $HOME/.fullname`" 11489019Spselse 11589019Sps # Must use temp file due to incompatibilities in quoting behavior 116161478Sdelphij # and to protect shell metacharacters in the expansion of $LOGNAME 117161478Sdelphij $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP0 118161478Sdelphij ORIGINATOR="`cat $TEMP0`" 119161478Sdelphij rm -f $TEMP0 120161478Sdelphijfi 121161478Sdelphij 122161478Sdelphijif [ -n "$ORGANIZATION" ]; then 123161478Sdelphij if [ -f "$ORGANIZATION" ]; then 124161478Sdelphij ORGANIZATION="`cat $ORGANIZATION`" 125161478Sdelphij fi 126161478Sdelphijelse 127161478Sdelphij if [ -n "$DEFAULT_ORGANIZATION" ]; then 12889019Sps ORGANIZATION="$DEFAULT_ORGANIZATION" 12989019Sps elif [ -f $HOME/.organization ]; then 130128345Stjr ORGANIZATION="`cat $HOME/.organization`" 131128345Stjr fi 132161478Sdelphijfi 13389019Sps 13489019Sps# If they don't have a preferred editor set, then use 13589019Spsif [ -z "$VISUAL" ]; then 13689019Sps if [ -z "$EDITOR" ]; then 13789019Sps EDIT=vi 13889019Sps else 13989019Sps EDIT="$EDITOR" 140161478Sdelphij fi 141161478Sdelphijelse 142161478Sdelphij EDIT="$VISUAL" 143161478Sdelphijfi 144161478Sdelphij 145161478Sdelphij# Find out some information. 146161478SdelphijSYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \ 147161478Sdelphij ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""` 148161478SdelphijARCH=`[ -f /bin/arch ] && /bin/arch` 149161478SdelphijMACHINE=`[ -f /bin/machine ] && /bin/machine` 15060786Sps 15160786SpsCOMMAND=`echo $0 | sed -e 's,.*/,,'` 15260786SpsUSAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity] 15360786Sps [-c address] [--request-id] [--version]" 15460786SpsREMOVE= 15560786SpsBATCH= 15660786SpsCC= 157161478SdelphijSEVERITY_C= 15860786Sps 159161478Sdelphijwhile [ $# -gt 0 ]; do 160161478Sdelphij case "$1" in 16160786Sps -r) ;; # Ignore for backward compat. 16260786Sps -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi 16363128Sps shift ; GNATS_ADDR="$1" 164128345Stjr EXPLICIT_GNATS_ADDR=true 165128345Stjr ;; 16689019Sps -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi 167161478Sdelphij shift ; IN_FILE="$1" 16889019Sps if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then 16960786Sps echo "$COMMAND: cannot read $IN_FILE" 17060786Sps $REMOVE_TEMP 17160786Sps exit 1 17260786Sps fi 17360786Sps ;; 17460786Sps -b | --batch) BATCH=true ;; 17560786Sps -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi 17660786Sps shift ; CC="$1" 17760786Sps ;; 178128345Stjr -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi 17960786Sps shift ; SEVERITY_C="$1" 18060786Sps ;; 18163128Sps -p | -P | --print) PRINT=true ;; 18263128Sps -L | --list) FORMAT=norm ;; 18363128Sps -l | -CL | --lisp) FORMAT=lisp ;; 18463128Sps --request-id) REQUEST_ID=true ;; 18563128Sps -h | --help) echo "$USAGE"; $REMOVE_TEMP; exit 0 ;; 18663128Sps -V | --version) cat <<EOF 18763128Spsgccbug (GCC) $DEFAULT_RELEASE 18863128SpsCopyright (C) 2002 Free Software Foundation, Inc. 18963128SpsThis is free software; see the source for copying conditions. There is NO 19063128Spswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 191128345Stjr 19263128SpsEOF 19363128Sps $REMOVE_TEMP; exit 0 ;; 19460786Sps -*) echo "$USAGE" ; $REMOVE_TEMP; exit 1 ;; 19563128Sps *) echo "$USAGE" ; $REMOVE_TEMP; exit 1 19660786Sps esac 19763128Sps shift 19863128Spsdone 19963128Sps 20063128Sps# spam does not need to be listed here 20163128SpsCATEGORIES="ada bootstrap c++ c debug driver fortran inline-asm java libf2c libgcj libobjc libstdc++ middle-end objc other pch preprocessor rtl-optimization target tree-optimization web" 202161478Sdelphij 20363128Spscase "$FORMAT" in 204161478Sdelphij lisp) echo "$CATEGORIES" | \ 20563128Sps awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}' 20663128Sps $REMOVE_TEMP 20763128Sps exit 0 20860786Sps ;; 20963128Sps norm) l=`echo "$CATEGORIES" | \ 21063128Sps awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } } 21160786Sps END {print max + 1;}'` 21263128Sps c=`expr 70 / $l` 21363128Sps if [ $c -eq 0 ]; then c=1; fi 214128345Stjr echo "$CATEGORIES" | \ 215128345Stjr awk 'BEGIN {print "Known categories:"; i = 0 } 216128345Stjr { printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } } 217128345Stjr END { print ""; }' 218128345Stjr $REMOVE_TEMP 219128345Stjr exit 0 220128345Stjr ;; 221128345Stjresac 222128345Stjr 223128345StjrORIGINATOR_C='<name of the PR author (one line)>' 224128345StjrORGANIZATION_C='<organization of PR author (multiple lines)>' 225128345StjrSYNOPSIS_C='<synopsis of the problem (one line)>' 226128345Stjrif [ -z "$SEVERITY_C" ]; then 227128345Stjr SEVERITY_C='<[ non-critical | serious | critical ] (one line)>' 22863128Spsfi 229128345StjrPRIORITY_C='<[ low | medium ] (one line)>' 23060786SpsCATEGORY_C='<choose from the top of this file (one line)>' 23163128SpsRELEASE_C='<release number or tag (one line)>' 23260786SpsENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>' 23363128SpsDESCRIPTION_C='<precise description of the problem (multiple lines)>' 23460786SpsHOW_TO_REPEAT_C='<When reporting a compiler error, preprocessor output must be included>' 23560786SpsFIX_C='<how to correct or work around the problem, if known (multiple lines)>' 23660786Sps 23760786Sps# Catch some signals. ($xs kludge needed by Sun /bin/sh) 23863128Spsxs=0 23960786Spstrap '$REMOVE_TEMP; exit $xs' 0 24060786Spstrap 'echo "$COMMAND: Aborting ..."; $REMOVE_TEMP; xs=1; exit' 1 3 13 15 24160786Sps 242161478Sdelphij# If they told us to use a specific file, then do so. 243161478Sdelphijif [ -n "$IN_FILE" ]; then 24460786Sps if [ "$IN_FILE" = "-" ]; then 245161478Sdelphij # The PR is coming from the standard input. 246161478Sdelphij if [ -n "$EXPLICIT_GNATS_ADDR" ]; then 247161478Sdelphij sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP 248161478Sdelphij else 249161478Sdelphij cat > $TEMP 250161478Sdelphij fi 251161478Sdelphij else 252161478Sdelphij # Use the file they named. 253161478Sdelphij if [ -n "$EXPLICIT_GNATS_ADDR" ]; then 25489019Sps sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP 255161478Sdelphij else 256161478Sdelphij cat $IN_FILE > $TEMP 257161478Sdelphij fi 25889019Sps fi 259161478Sdelphijelse 260161478Sdelphij 261161478Sdelphij if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then 262161478Sdelphij # If their PR_FORM points to a bogus entry, then bail. 263161478Sdelphij if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then 264161478Sdelphij echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM" 26589019Sps sleep 1 266161478Sdelphij PRINT_INTERN=bad_prform 267161478Sdelphij fi 26889019Sps fi 269161478Sdelphij 27089019Sps if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then 271161478Sdelphij cp $PR_FORM $TEMP || 272172471Sdelphij ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit ) 27389019Sps else 274161478Sdelphij for file in $TEMP $REF ; do 275161478Sdelphij cat > $file << '__EOF__' 276161478SdelphijSEND-PR: -*- send-pr -*- 277161478SdelphijSEND-PR: Lines starting with `SEND-PR' will be removed automatically, as 278161478SdelphijSEND-PR: will all comments (text enclosed in `<' and `>'). 279161478SdelphijSEND-PR: 280161478SdelphijSEND-PR: Please consult the GCC manual if you are not sure how to 281161478SdelphijSEND-PR: fill out a problem report. 282161478SdelphijSEND-PR: Note that the Synopsis field is mandatory. The Subject (for 283161478SdelphijSEND-PR: the mail) will be made the same as Synopsis unless explicitly 284161478SdelphijSEND-PR: changed. 285161478SdelphijSEND-PR: 286161478SdelphijSEND-PR: Choose from the following categories: 287161478SdelphijSEND-PR: 288161478Sdelphij__EOF__ 289161478Sdelphij 290161478Sdelphij # Format the categories so they fit onto lines. 291161478Sdelphij l=`echo "$CATEGORIES" | \ 292161478Sdelphij awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } } 293161478Sdelphij END {print max + 1;}'` 294161478Sdelphij c=`expr 61 / $l` 295161478Sdelphij if [ $c -eq 0 ]; then c=1; fi 296161478Sdelphij echo "$CATEGORIES" | \ 297161478Sdelphij awk 'BEGIN {printf "SEND-PR: "; i = 0 } 298161478Sdelphij { printf ("%-'$l'.'$l's", $0); 299161478Sdelphij if ((++i % '$c') == 0) { printf "\nSEND-PR: " } } 300161478Sdelphij END { printf "\nSEND-PR:\n"; }' >> $file 30189019Sps 30289019Sps cat >> $file << __EOF__ 303161478SdelphijTo: $GNATS_ADDR 304161478SdelphijSubject: 305161478SdelphijFrom: $FROM 306161478SdelphijReply-To: $REPLYTO 307161478SdelphijCc: $CC 308161478SdelphijX-send-pr-version: $VERSION 309161478SdelphijX-GNATS-Notify: 310161478Sdelphij 311161478Sdelphij 312161478Sdelphij>Submitter-Id: $SUBMITTER 313161478Sdelphij>Originator: $ORIGINATOR 314161478Sdelphij>Organization: ${ORGANIZATION-$ORGANIZATION_C} 315161478Sdelphij>Confidential: no 316161478SdelphijSEND-PR: Leave "Confidential" as "no"; all GCC PRs are public. 317161478Sdelphij>Synopsis: $SYNOPSIS_C 318161478Sdelphij>Severity: $SEVERITY_C 319161478SdelphijSEND-PR: critical GCC is completely not operational; no work-around known. 320161478SdelphijSEND-PR: serious GCC is not working properly; a work-around is possible. 321161478SdelphijSEND-PR: non-critical Report indicates minor problem. 322161478Sdelphij>Priority: $PRIORITY_C 323161478SdelphijSEND-PR: medium The problem should be solved in the next release. 324161478SdelphijSEND-PR: low The problem should be solve in a future release. 325161478Sdelphij>Category: $CATEGORY_C 326161478Sdelphij>Class: <[ doc-bug | accepts-illegal | rejects-legal | wrong-code | ice-on-legal-code| ice-on-illegal-code | pessimizes-code | sw-bug | change-request | support ] (one line)> 327161478SdelphijSEND-PR: doc-bug The documentation is incorrect. 328161478SdelphijSEND-PR: accepts-illegal GCC fails to reject erroneous code. 329161478SdelphijSEND-PR: rejects-legal GCC gives an error message for correct code. 330161478SdelphijSEND-PR: wrong-code The machine code generated by gcc is incorrect. 331161478SdelphijSEND-PR: ice-on-legal-code GCC gives an Internal Compiler Error (ICE) 332161478SdelphijSEND-PR: for correct code 333161478SdelphijSEND-PR: ice-on-illegal-code GCC gives an ICE instead of reporting an error 334161478SdelphijSEND-PR: pessimizes-code GCC misses an important optimization opportunity 335161478SdelphijSEND-PR: sw-bug Software bug of some other class than above 33689019SpsSEND-PR: change-request A feature in GCC is missing. 337161478SdelphijSEND-PR: support I need help with gcc. 338161478Sdelphij>Release: ${DEFAULT_RELEASE-$RELEASE_C} 339161478Sdelphij>Environment: 34089019Sps`[ -n "$SYSTEM" ] && echo System: $SYSTEM` 34189019Sps`[ -n "$ARCH" ] && echo Architecture: $ARCH` 34289019Sps`[ -n "$MACHINE" ] && echo Machine: $MACHINE` 343161478Sdelphij $ENVIRONMENT_C 344161478Sdelphijhost: @host@ 345161478Sdelphijbuild: @build@ 346161478Sdelphijtarget: @target@ 347161478Sdelphij__EOF__ 348161478Sdelphij cat >> $file << \__EOF__ 34960786Spsconfigured with: @gcc_config_arguments@ 350161478Sdelphij__EOF__ 35160786Sps cat >> $file << __EOF__ 352161478Sdelphij>Description: 353161478Sdelphij $DESCRIPTION_C 35460786Sps>How-To-Repeat: 355161478Sdelphij $HOW_TO_REPEAT_C 356161478Sdelphij>Fix: 357161478Sdelphij $FIX_C 35860786Sps__EOF__ 35960786Sps done 36060786Sps fi 361161478Sdelphij 36260786Sps if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then 363161478Sdelphij cat $TEMP 364161478Sdelphij xs=0; exit 36560786Sps fi 366161478Sdelphij 36760786Sps chmod u+w $TEMP 36860786Sps if [ -z "$REQUEST_ID" ]; then 36960786Sps eval $EDIT $TEMP 37060786Sps else 37160786Sps ed -s $TEMP << '__EOF__' 37260786Sps/^Subject/s/^Subject:.*/Subject: request for a customer id/ 37360786Sps/^>Category/s/^>Category:.*/>Category: send-pr/ 37460786Spsw 37560786Spsq 37660786Sps__EOF__ 377161478Sdelphij fi 378161478Sdelphij 379161478Sdelphij if cmp -s $REF $TEMP ; then 380161478Sdelphij echo "$COMMAND: problem report not filled out, therefore not sent" 381161478Sdelphij xs=1; exit 382161478Sdelphij fi 383161478Sdelphijfi 384161478Sdelphij 385161478Sdelphij# 386161478Sdelphij# Check the enumeration fields 387161478Sdelphij 388161478Sdelphij# This is a "sed-subroutine" with one keyword parameter 389161478Sdelphij# (with workaround for Sun sed bug) 390161478Sdelphij# 39160786SpsSED_CMD=' 39260786Sps/$PATTERN/{ 39360786Spss||| 39460786Spss|<.*>|| 39560786Spss|^[ ]*|| 39660786Spss|[ ]*$|| 39760786Spsp 39860786Spsq 39960786Sps}' 40060786Sps 401161478Sdelphij 402161478Sdelphijwhile [ -z "$REQUEST_ID" ]; do 403161478Sdelphij CNT=0 404161478Sdelphij 405161478Sdelphij # 1) Confidential 406161478Sdelphij # 407161478Sdelphij PATTERN=">Confidential:" 408161478Sdelphij CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP` 409161478Sdelphij case "$CONFIDENTIAL" in 410161478Sdelphij no) CNT=`expr $CNT + 1` ;; 411161478Sdelphij *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;; 412161478Sdelphij esac 413161478Sdelphij # 414161478Sdelphij # 2) Severity 41560786Sps # 41660786Sps PATTERN=">Severity:" 41760786Sps SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` 41860786Sps case "$SEVERITY" in 41960786Sps ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;; 42060786Sps *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'." 42160786Sps esac 42260786Sps # 42360786Sps # 3) Priority 424161478Sdelphij # 425161478Sdelphij PATTERN=">Priority:" 42660786Sps PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` 427161478Sdelphij case "$PRIORITY" in 42860786Sps ""|low|medium) CNT=`expr $CNT + 1` ;; 429161478Sdelphij high) echo "$COMMAND: \`Priority: high' is reserved for GCC maintainers." ;; 43060786Sps *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'." 431161478Sdelphij esac 43260786Sps # 433161478Sdelphij # 4) Category 434161478Sdelphij # 43560786Sps PATTERN=">Category:" 436161478Sdelphij CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` 43760786Sps FOUND= 438161478Sdelphij for C in $CATEGORIES 439161478Sdelphij do 440161478Sdelphij if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi 441161478Sdelphij done 442161478Sdelphij if [ -n "$FOUND" ]; then 443161478Sdelphij CNT=`expr $CNT + 1` 444161478Sdelphij else 445161478Sdelphij if [ -z "$CATEGORY" ]; then 446161478Sdelphij echo "$COMMAND: you must include a Category: field in your report." 447161478Sdelphij else 448161478Sdelphij echo "$COMMAND: \`$CATEGORY' is not a known category." 449161478Sdelphij fi 450161478Sdelphij fi 451161478Sdelphij # 452161478Sdelphij # 5) Class 453161478Sdelphij # 454161478Sdelphij PATTERN=">Class:" 455161478Sdelphij CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP` 456161478Sdelphij case "$CLASS" in 457161478Sdelphij ""|doc-bug|accepts-illegal|rejects-legal|wrong-code|ice-on-legal-code|ice-on-illegal-code|pessimizes-code|sw-bug|change-request|support) CNT=`expr $CNT + 1` ;; 458161478Sdelphij *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'." 459161478Sdelphij esac 460161478Sdelphij # 461161478Sdelphij # 6) Check that synopsis is not empty 462161478Sdelphij # 463161478Sdelphij if grep "^>Synopsis:[ ]*${SYNOPSIS_C}\$" $TEMP > /dev/null 464161478Sdelphij then 465161478Sdelphij echo "$COMMAND: Synopsis must not be empty." 466161478Sdelphij else 46760786Sps CNT=`expr $CNT + 1` 46860786Sps fi 469161478Sdelphij 47060786Sps [ $CNT -lt 6 -a -z "$BATCH" ] && 47160786Sps echo "Errors were found with the problem report." 47260786Sps 473161478Sdelphij while true; do 474161478Sdelphij if [ -z "$BATCH" ]; then 475161478Sdelphij $ECHON1 "a)bort, e)dit or s)end? $ECHON2" 47660786Sps read input 477161478Sdelphij else 478161478Sdelphij if [ $CNT -eq 6 ]; then 47960786Sps input=s 48060786Sps else 48160786Sps input=a 48260786Sps fi 48360786Sps fi 484161478Sdelphij case "$input" in 485161478Sdelphij a*) 48660786Sps if [ -z "$BATCH" ]; then 487161478Sdelphij echo "$COMMAND: the problem report remains in $BAD and is not sent." 48860786Sps REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF" 48960786Sps mv $TEMP $BAD 490161478Sdelphij else 491161478Sdelphij echo "$COMMAND: the problem report is not sent." 492161478Sdelphij fi 493161478Sdelphij xs=1; exit 494161478Sdelphij ;; 495161478Sdelphij e*) 496161478Sdelphij eval $EDIT $TEMP 497161478Sdelphij continue 2 498161478Sdelphij ;; 499161478Sdelphij s*) 500161478Sdelphij break 2 501161478Sdelphij ;; 502161478Sdelphij esac 503161478Sdelphij done 504161478Sdelphijdone 505161478Sdelphij 506161478Sdelphij# 507161478Sdelphij# Make sure the mail has got a Subject. If not, use the same as 508161478Sdelphij# in Synopsis. 509161478Sdelphij# 51060786Sps 51160786Spsif grep '^Subject:[ ]*$' $TEMP > /dev/null 51260786Spsthen 51360786Sps SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ ]*//'` 51460786Sps ed -s $TEMP << __EOF__ 51560786Sps/^Subject:/s/:.*\$/: $SYNOPSIS/ 51660786Spsw 51760786Spsq 518161478Sdelphij__EOF__ 51960786Spsfi 52060786Sps 52160786Sps# 52260786Sps# Remove comments and send the problem report 52360786Sps# (we have to use patterns, where the comment contains regex chars) 524161478Sdelphij# 52560786Sps# /^>Originator:/s;$ORIGINATOR;; 526161478Sdelphijsed -e " 527172471Sdelphij/^SEND-PR:/d 52860786Sps/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;; 529161478Sdelphij/^>Confidential:/s;<.*>;; 53060786Sps/^>Synopsis:/s;$SYNOPSIS_C;; 53160786Sps/^>Severity:/s;<.*>;; 53260786Sps/^>Priority:/s;<.*>;; 53360786Sps/^>Category:/s;$CATEGORY_C;; 53460786Sps/^>Class:/s;<.*>;; 53560786Sps/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;; 53689019Sps/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;; 53789019Sps/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;; 53889019Sps/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;; 539161478Sdelphij/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;; 540161478Sdelphij" $TEMP > $REF 54189019Sps 542161478Sdelphijif $MAIL_AGENT < $REF; then 543161478Sdelphij echo "$COMMAND: problem report sent" 544161478Sdelphij xs=0; exit 54589019Spselse 54689019Sps echo "$COMMAND: mysterious mail failure." 54789019Sps if [ -z "$BATCH" ]; then 548161478Sdelphij echo "$COMMAND: the problem report remains in $BAD and is not sent." 549161478Sdelphij REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF" 550161478Sdelphij mv $REF $BAD 551161478Sdelphij else 552161478Sdelphij echo "$COMMAND: the problem report is not sent." 553161478Sdelphij fi 554161478Sdelphij xs=1; exit 555161478Sdelphijfi 556161478Sdelphij