*BSD News Article 24834


Return to BSD News archive

Xref: sserve comp.os.386bsd.development:1566 comp.os.386bsd.bugs:1900 comp.os.386bsd.misc:1708
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!news.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!news.clark.edu!spool.mu.edu!olivea!decwrl!apple!kaleida.com!conklin
From: conklin@kaleida.com (J.T. Conklin)
Newsgroups: comp.os.386bsd.development,comp.os.386bsd.bugs,comp.os.386bsd.misc
Subject: NetBSD switching to the GNATS bug tracking system
Date: 08 Dec 1993 23:52:40 GMT
Organization: Winning Strategies, Inc.
Lines: 2128
Message-ID: <CONKLIN.93Dec8155242@ngai.kaleida.com>
Reply-To: conklin@kaleida.com
NNTP-Posting-Host: ngai.kaleida.com

NetBSD has switched from the BSD bugfiler to GNU GNATS to maintain our
bug database.  This change will allow NetBSD developers to track bugs
throughout their life cycle ("open", "analyzed", ... "closed"), assign
them to the appropriate people to fix, and provide an reliable archive
of bugs and their fixes.

It is hoped that a better bug tracking system will allow the "core"
developers to make NetBSD even better than it is today.


What does the switch mean to users?

* Bug reports should now submitted with the "send-pr" program.

  Although we appreciate bug reports sent posted in the news or 
  sent to netbsd-bugs@sun-lamp.cs.berkeley.edu, sometimes they
  are accidentally overlooked.  By using send-pr, you can be
  sure that the bug reports will be availible to the developers.

  Send-pr is distributed in NetBSD-current.  For those of you
  running NetBSD 0.8 or 0.9, a 'shar'ed copy is enclosed at the
  end of this posting.  Please unpack it and install it on your
  system.

* Bug reports will be automatically filed into the appropriate database
  category, and the appropriate people working on that area will be notified
  about the new bug.

* Access to the bug database is a lot easier than with the bugfiler.
  Hopefully, convienent access will encourage NetBSD developers to
  keep up to date with the current bug list.  If this occurs, the 
  bugs you submit may be fixed faster.

At the present time, there are only a few categories of bugs: "lib",
for library bugs; "bin", for userlevel bugs; and "kern", for kernel
bugs.  More categories will be added as needed.


How can I see if my bug has been fixed?

* There is a email interface to our database.  To query the database
  send mail to "query-pr@sun-lamp.cs.berkeley.edu".  The mail server
  will send a bug database listing back to the user.

* There are several flags that are useful to send to the mail server.
  The flags are entered in the "Subject" line:
  --summary	Display an one-line entry for each bug
  --full 	Display the full entry for each bug	
  --help	Display a help string containing the rest of the flags.
  PR		The Problem Report number of a particular bug

For example, to send a query about all the bugs:
  $ Mail -s "--summary" sun-lamp.cs.berkeley.edu < /dev/null

If you want to know more about a particular bug, let's say bug 40:
  $ Mail -s "--full 40" sun-lamp.cs.berkeley.edu < /dev/null

--
J.T. Conklin
NetBSD Bug Database Administrator


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	COPYING
#	Makefile
#	categories
#	install-sid.sh
#	send-pr-el.in
#	send-pr.man
#	send-pr.sh
#
echo x - COPYING
sed 's/^X//' >COPYING << 'END-of-COPYING'
X		    GNU GENERAL PUBLIC LICENSE
X		       Version 2, June 1991
X
X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
X                          675 Mass Ave, Cambridge, MA 02139, USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X			    Preamble
X
X  The licenses for most software are designed to take away your
Xfreedom to share and change it.  By contrast, the GNU General Public
XLicense is intended to guarantee your freedom to share and change free
Xsoftware--to make sure the software is free for all its users.  This
XGeneral Public License applies to most of the Free Software
XFoundation's software and to any other program whose authors commit to
Xusing it.  (Some other Free Software Foundation software is covered by
Xhe GNU Library General Public License instead.)  You can apply it to
Xyour programs, too.
X
X  When we speak of free software, we are referring to freedom, not
Xprice.  Our General Public Licenses are designed to make sure that you
Xhave the freedom to distribute copies of free software (and charge for
Xthis service if you wish), that you receive source code or can get it
Xif you want it, that you can change the software or use pieces of it
Xin new free programs; and that you know you can do these things.
X
X  To protect your rights, we need to make restrictions that forbid
Xanyone to deny you these rights or to ask you to surrender the rights.
XThese restrictions translate to certain responsibilities for you if you
Xdistribute copies of the software, or if you modify it.
X
X  For example, if you distribute copies of such a program, whether
Xgratis or for a fee, you must give the recipients all the rights that
Xyou have.  You must make sure that they, too, receive or can get the
Xsource code.  And you must show them these terms so they know their
Xrights.
X
X  We protect your rights with two steps: (1) copyright the software, and
X(2) offer you this license which gives you legal permission to copy,
Xdistribute and/or modify the software.
X
X  Also, for each author's protection and ours, we want to make certain
Xthat everyone understands that there is no warranty for this free
Xsoftware.  If the software is modified by someone else and passed on, we
Xwant its recipients to know that what they have is not the original, so
Xthat any problems introduced by others will not reflect on the original
Xauthors' reputations.
X
X  Finally, any free program is threatened constantly by software
Xpatents.  We wish to avoid the danger that redistributors of a free
Xprogram will individually obtain patent licenses, in effect making the
Xprogram proprietary.  To prevent this, we have made it clear that any
Xpatent must be licensed for everyone's free use or not licensed at all.
X
X  The precise terms and conditions for copying, distribution and
Xmodification follow.
X
X		    GNU GENERAL PUBLIC LICENSE
X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X  0. This License applies to any program or other work which contains
Xa notice placed by the copyright holder saying it may be distributed
Xunder the terms of this General Public License.  The "Program", below,
Xrefers to any such program or work, and a "work based on the Program"
Xmeans either the Program or any derivative work under copyright law:
Xthat is to say, a work containing the Program or a portion of it,
Xeither verbatim or with modifications and/or translated into another
Xlanguage.  (Hereinafter, translation is included without limitation in
Xthe term "modification".)  Each licensee is addressed as "you".
X
XActivities other than copying, distribution and modification are not
Xcovered by this License; they are outside its scope.  The act of
Xrunning the Program is not restricted, and the output from the Program
Xis covered only if its contents constitute a work based on the
XProgram (independent of having been made by running the Program).
XWhether that is true depends on what the Program does.
X
X  1. You may copy and distribute verbatim copies of the Program's
Xsource code as you receive it, in any medium, provided that you
Xconspicuously and appropriately publish on each copy an appropriate
Xcopyright notice and disclaimer of warranty; keep intact all the
Xnotices that refer to this License and to the absence of any warranty;
Xand give any other recipients of the Program a copy of this License
Xalong with the Program.
X
XYou may charge a fee for the physical act of transferring a copy, and
Xyou may at your option offer warranty protection in exchange for a fee.
X
X  2. You may modify your copy or copies of the Program or any portion
Xof it, thus forming a work based on the Program, and copy and
Xdistribute such modifications or work under the terms of Section 1
Xabove, provided that you also meet all of these conditions:
X
X    a) You must cause the modified files to carry prominent notices
X    stating that you changed the files and the date of any change.
X
X    b) You must cause any work that you distribute or publish, that in
X    whole or in part contains or is derived from the Program or any
X    part thereof, to be licensed as a whole at no charge to all third
X    parties under the terms of this License.
X
X    c) If the modified program normally reads commands interactively
X    when run, you must cause it, when started running for such
X    interactive use in the most ordinary way, to print or display an
X    announcement including an appropriate copyright notice and a
X    notice that there is no warranty (or else, saying that you provide
X    a warranty) and that users may redistribute the program under
X    these conditions, and telling the user how to view a copy of this
X    License.  (Exception: if the Program itself is interactive but
X    does not normally print such an announcement, your work based on
X    the Program is not required to print an announcement.)
X
XThese requirements apply to the modified work as a whole.  If
Xidentifiable sections of that work are not derived from the Program,
Xand can be reasonably considered independent and separate works in
Xthemselves, then this License, and its terms, do not apply to those
Xsections when you distribute them as separate works.  But when you
Xdistribute the same sections as part of a whole which is a work based
Xon the Program, the distribution of the whole must be on the terms of
Xthis License, whose permissions for other licensees extend to the
Xentire whole, and thus to each and every part regardless of who wrote it.
X
XThus, it is not the intent of this section to claim rights or contest
Xyour rights to work written entirely by you; rather, the intent is to
Xexercise the right to control the distribution of derivative or
Xcollective works based on the Program.
X
XIn addition, mere aggregation of another work not based on the Program
Xwith the Program (or with a work based on the Program) on a volume of
Xa storage or distribution medium does not bring the other work under
Xthe scope of this License.
X
X  3. You may copy and distribute the Program (or a work based on it,
Xunder Section 2) in object code or executable form under the terms of
XSections 1 and 2 above provided that you also do one of the following:
X
X    a) Accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of Sections
X    1 and 2 above on a medium customarily used for software interchange; or,
X
X    b) Accompany it with a written offer, valid for at least three
X    years, to give any third party, for a charge no more than your
X    cost of physically performing source distribution, a complete
X    machine-readable copy of the corresponding source code, to be
X    distributed under the terms of Sections 1 and 2 above on a medium
X    customarily used for software interchange; or,
X
X    c) Accompany it with the information you received as to the offer
X    to distribute corresponding source code.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form with such
X    an offer, in accord with Subsection b above.)
X
XThe source code for a work means the preferred form of the work for
Xmaking modifications to it.  For an executable work, complete source
Xcode means all the source code for all modules it contains, plus any
Xassociated interface definition files, plus the scripts used to
Xcontrol compilation and installation of the executable.  However, as a
Xspecial exception, the source code distributed need not include
Xanything that is normally distributed (in either source or binary
Xform) with the major components (compiler, kernel, and so on) of the
Xoperating system on which the executable runs, unless that component
Xitself accompanies the executable.
X
XIf distribution of executable or object code is made by offering
Xaccess to copy from a designated place, then offering equivalent
Xaccess to copy the source code from the same place counts as
Xdistribution of the source code, even though third parties are not
Xcompelled to copy the source along with the object code.
X
X  4. You may not copy, modify, sublicense, or distribute the Program
Xexcept as expressly provided under this License.  Any attempt
Xotherwise to copy, modify, sublicense or distribute the Program is
Xvoid, and will automatically terminate your rights under this License.
XHowever, parties who have received copies, or rights, from you under
Xthis License will not have their licenses terminated so long as such
Xparties remain in full compliance.
X
X  5. You are not required to accept this License, since you have not
Xsigned it.  However, nothing else grants you permission to modify or
Xdistribute the Program or its derivative works.  These actions are
Xprohibited by law if you do not accept this License.  Therefore, by
Xmodifying or distributing the Program (or any work based on the
XProgram), you indicate your acceptance of this License to do so, and
Xall its terms and conditions for copying, distributing or modifying
Xthe Program or works based on it.
X
X  6. Each time you redistribute the Program (or any work based on the
XProgram), the recipient automatically receives a license from the
Xoriginal licensor to copy, distribute or modify the Program subject to
Xthese terms and conditions.  You may not impose any further
Xrestrictions on the recipients' exercise of the rights granted herein.
XYou are not responsible for enforcing compliance by third parties to
Xthis License.
X
X  7. If, as a consequence of a court judgment or allegation of patent
Xinfringement or for any other reason (not limited to patent issues),
Xconditions are imposed on you (whether by court order, agreement or
Xotherwise) that contradict the conditions of this License, they do not
Xexcuse you from the conditions of this License.  If you cannot
Xdistribute so as to satisfy simultaneously your obligations under this
XLicense and any other pertinent obligations, then as a consequence you
Xmay not distribute the Program at all.  For example, if a patent
Xlicense would not permit royalty-free redistribution of the Program by
Xall those who receive copies directly or indirectly through you, then
Xthe only way you could satisfy both it and this License would be to
Xrefrain entirely from distribution of the Program.
X
XIf any portion of this section is held invalid or unenforceable under
Xany particular circumstance, the balance of the section is intended to
Xapply and the section as a whole is intended to apply in other
Xcircumstances.
X
XIt is not the purpose of this section to induce you to infringe any
Xpatents or other property right claims or to contest validity of any
Xsuch claims; this section has the sole purpose of protecting the
Xintegrity of the free software distribution system, which is
Ximplemented by public license practices.  Many people have made
Xgenerous contributions to the wide range of software distributed
Xthrough that system in reliance on consistent application of that
Xsystem; it is up to the author/donor to decide if he or she is willing
Xto distribute software through any other system and a licensee cannot
Ximpose that choice.
X
XThis section is intended to make thoroughly clear what is believed to
Xbe a consequence of the rest of this License.
X
X  8. If the distribution and/or use of the Program is restricted in
Xcertain countries either by patents or by copyrighted interfaces, the
Xoriginal copyright holder who places the Program under this License
Xmay add an explicit geographical distribution limitation excluding
Xthose countries, so that distribution is permitted only in or among
Xcountries not thus excluded.  In such case, this License incorporates
Xthe limitation as if written in the body of this License.
X
X  9. The Free Software Foundation may publish revised and/or new versions
Xof the General Public License from time to time.  Such new versions will
Xbe similar in spirit to the present version, but may differ in detail to
Xaddress new problems or concerns.
X
XEach version is given a distinguishing version number.  If the Program
Xspecifies a version number of this License which applies to it and "any
Xlater version", you have the option of following the terms and conditions
Xeither of that version or of any later version published by the Free
XSoftware Foundation.  If the Program does not specify a version number of
Xthis License, you may choose any version ever published by the Free Software
XFoundation.
X
X  10. If you wish to incorporate parts of the Program into other free
Xprograms whose distribution conditions are different, write to the author
Xto ask for permission.  For software which is copyrighted by the Free
XSoftware Foundation, write to the Free Software Foundation; we sometimes
Xmake exceptions for this.  Our decision will be guided by the two goals
Xof preserving the free status of all derivatives of our free software and
Xof promoting the sharing and reuse of software generally.
X
X			    NO WARRANTY
X
X  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
XREPAIR OR CORRECTION.
X
X  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
XPOSSIBILITY OF SUCH DAMAGES.
X
X		     END OF TERMS AND CONDITIONS
X
X	Appendix: How to Apply These Terms to Your New Programs
X
X  If you develop a new program, and you want it to be of the greatest
Xpossible use to the public, the best way to achieve this is to make it
Xfree software which everyone can redistribute and change under these terms.
X
X  To do so, attach the following notices to the program.  It is safest
Xto attach them to the start of each source file to most effectively
Xconvey the exclusion of warranty; and each file should have at least
Xthe "copyright" line and a pointer to where the full notice is found.
X
X    <one line to give the program's name and a brief idea of what it does.>
X    Copyright (C) 19yy  <name of author>
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 2 of the License, or
X    (at your option) any later version.
X
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X
XAlso add information on how to contact you by electronic and paper mail.
X
XIf the program is interactive, make it output a short notice like this
Xwhen it starts in an interactive mode:
X
X    Gnomovision version 69, Copyright (C) 19yy name of author
X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X    This is free software, and you are welcome to redistribute it
X    under certain conditions; type `show c' for details.
X
XThe hypothetical commands `show w' and `show c' should show the appropriate
Xparts of the General Public License.  Of course, the commands you use may
Xbe called something other than `show w' and `show c'; they could even be
Xmouse-clicks or menu items--whatever suits your program.
X
XYou should also get your employer (if you work as a programmer) or your
Xschool, if any, to sign a "copyright disclaimer" for the program, if
Xnecessary.  Here is a sample; alter the names:
X
X  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
X  `Gnomovision' (which makes passes at compilers) written by James Hacker.
X
X  <signature of Ty Coon>, 1 April 1989
X  Ty Coon, President of Vice
X
XThis General Public License does not permit incorporating your program into
Xproprietary programs.  If your program is a subroutine library, you may
Xconsider it more useful to permit linking proprietary applications with the
Xlibrary.  If this is what you want to do, use the GNU Library General
XPublic License instead of this License.
END-of-COPYING
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X#
X# Makefile for building a standalone send-pr.
X#
X
XVERSION=3.01.6
XRELEASE=NetBSD-current
XGNATS_HOST=sun-lamp
X
XBINDIR=		/usr/bin
XLIBDIR=		/usr/share
X
XNOPROG=	
XMAN1=		send-pr.0
X
XCLEANFILES=	send-pr install-sid send-pr.1
X
Xall:		send-pr install-sid send-pr.1
X
Xsend-pr:	send-pr.sh
X	sed -e 's/@VERSION@/$(VERSION)/g' \
X	    -e 's/@DEFAULT_RELEASE@/$(RELEASE)/g' \
X		${.CURDIR}/send-pr.sh > send-pr
X
Xsend-pr.1:	send-pr.man
X	sed -e 's/@VERSION@/$((VERSION)/g' \
X		${.CURDIR}/send-pr.man > send-pr.1
X
Xinstall-sid:	install-sid.sh
X	sed -e 's/@VERSION@/$(VERSION)/g' \
X		${.CURDIR}/install-sid.sh > install-sid
X
Xbeforeinstall:
X	install ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} send-pr \
X		${DESTDIR}${BINDIR}
X	install ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} install-sid \
X		${DESTDIR}${BINDIR}
X	install -d -o root -g wheel -m 755 ${DESTDIR}${LIBDIR}/gnats
X	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/categories \
X		${DESTDIR}${LIBDIR}/gnats/${GNATS_HOST}
X
X.include <bsd.prog.mk>
END-of-Makefile
echo x - categories
sed 's/^X//' >categories << 'END-of-categories'
Xkern
Xlib
Xbin
Xmisc
END-of-categories
echo x - install-sid.sh
sed 's/^X//' >install-sid.sh << 'END-of-install-sid.sh'
X#!/bin/sh
X# Drop in the SUBMITTER id into a site's installed send-pr script.
X# Copyright (C) 1993 Free Software Foundation, Inc.
X# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
X# version written by Heinz G. Seidl (hgs@ide.com).
X#
X# This file is part of GNU GNATS.
X#
X# GNU GNATS is free software; you can redistribute it and/or modify
X# it under the terms of the GNU General Public License as published by
X# the Free Software Foundation; either version 2, or (at your option)
X# any later version.
X#
X# GNU GNATS is distributed in the hope that it will be useful,
X# but WITHOUT ANY WARRANTY; without even the implied warranty of
X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X# GNU General Public License for more details.
X#
X# You should have received a copy of the GNU General Public License
X# along with GNU GNATS; see the file COPYING.  If not, write to
X# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X
XCOMMAND=`echo $0 | sed -e 's,.*/,,g'`
XUSAGE="Usage: $COMMAND [--install-dir=prefix] [--help] [--version] submitter-id"
X
XVERSION=3.01.6
X
XBINDIR=/usr/bin
X
XSUBMITTER=
XTEMP=/tmp/sp$$
X
Xif [ $# -eq 0 ]; then
X  echo "$USAGE"
X  exit 1
Xfi
X
Xwhile [ $# -gt 0 ]; do
X  case "$1" in
X    -install-dir=*|--install-dir=*|--install-di=*|--install-d=*|--install-=*|--install=*|--instal=*|--insta=*|--inst=*|--ins=*|--in=*|--i=*)
X    I=`echo "$1" | sed 's/-*i[a-z\-]*=//'`
X    BINDIR=$I/bin ;;
X    --version) echo $COMMAND version $VERSION ; exit 1 ;;
X    -*) echo "$USAGE" ; exit 1 ;;
X    *) SUBMITTER=$1 ;;
X  esac
X  shift
Xdone
X
Xpath=`echo $0 | sed -e "s;${COMMAND};;"`
X
X[ -z "$path" ] && path=.
X
Xif [ -f $BINDIR/send-pr ]; then
X  SPPATH=$BINDIR/send-pr
Xelif [ -f $path/send-pr ]; then
X  SPPATH=$path/send-pr
Xelse
X  echo "$COMMAND: cannot find \`$BINDIR/send-pr' or \`$path/send-pr'" >&2
X  exit 1
Xfi
X
Xtrap 'rm -f $TEMP ; exit 0' 0
Xtrap 'echo "$COM: Aborting ..."; rm -f $TEMP ; exit 1' 1 2 3 13 15
X
Xsed -e "s/^SUBMITTER=.*/SUBMITTER=${SUBMITTER}/" $SPPATH > $TEMP
X
Xif grep $SUBMITTER $TEMP > /dev/null; then
X  cp $SPPATH $SPPATH.orig &&
X  rm -f $SPPATH &&
X  cp $TEMP $SPPATH &&
X  chmod a+rx $SPPATH &&
X  rm -f $TEMP $SPPATH.orig ||
X  { echo "$COMMAND: unable to replace send-pr" >&2 ; exit 1; }  
Xelse
X  echo "$COMMAND: something went wrong when sed-ing the submitter into send-pr" >&2
X  exit 1
Xfi
X
Xecho "$COMMAND: \`$SUBMITTER' is now the default submitter ID for send-pr"
X
Xexit 0
END-of-install-sid.sh
echo x - send-pr-el.in
sed 's/^X//' >send-pr-el.in << 'END-of-send-pr-el.in'
X;;;; -*-emacs-lisp-*-
X;;;;---------------------------------------------------------------------------
X;;;;    EMACS interface for send-pr (by Heinz G. Seidl, hgs@cygnus.com)
X;;;;    Slightly hacked by Brendan Kehoe (brendan@cygnus.com).
X;;;;
X;;;;    This file is part of the Problem Report Management System (GNATS)
X;;;;    Copyright 1992, 1993 Cygnus Support
X;;;;
X;;;;    This program is free software; you can redistribute it and/or
X;;;;    modify it under the terms of the GNU General Public
X;;;;    License as published by the Free Software Foundation; either
X;;;;    version 2 of the License, or (at your option) any later version.
X;;;;
X;;;;    This program is distributed in the hope that it will be useful,
X;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
X;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X;;;;    General Public License for more details.
X;;;;
X;;;;    You should have received a copy of the GNU Library General Public
X;;;;    License along with this program; if not, write to the Free
X;;;;    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X;;;;
X;;;;---------------------------------------------------------------------------
X;;;;
X;;;;    This file contains the EMACS interface to the Problem Report Management
X;;;;	System (GNATS):
X;;;;
X;;;;		- The `send-pr' command and the `send-pr-mode' for sending 
X;;;;              Problem Reports (PRs).
X;;;;
X;;;;    For more information about how to send a PR see send-pr(1).
X;;;;
X;;;;---------------------------------------------------------------------------
X;;;;
X;;;;	Configuration: the symbol `DEFAULT-RELEASE' can be replaced by
X;;;;	site/release specific strings during the configuration/installation
X;;;;	process.
X;;;;
X;;;;    Install this file in your EMACS library directory.
X;;;;
X;;;;---------------------------------------------------------------------------
X
X(provide 'send-pr)
X
X;;;;---------------------------------------------------------------------------
X;;;; Customization: put the following forms into your default.el file
X;;;; (or into your .emacs)
X;;;;---------------------------------------------------------------------------
X
X;(autoload 'send-pr-mode "send-pr"
X;	  "Major mode for sending problem reports." t)
X
X;(autoload 'send-pr "send-pr"
X;	  	  "Command to create and send a problem report." t)
X
X;;;;---------------------------------------------------------------------------
X;;;; End of Customization Section
X;;;;---------------------------------------------------------------------------
X
X(autoload 'server-buffer-done "server")
X(defvar server-buffer-clients nil)
X(defvar mail-self-blind nil)
X(defvar mail-default-reply-to nil)
X
X(defconst send-pr::version "3.01.6")
X
X(defvar gnats:root "/b/gnats"
X  "*The top of the tree containing the GNATS database.")
X
X;;;;---------------------------------------------------------------------------
X;;;; hooks
X;;;;---------------------------------------------------------------------------
X
X(defvar text-mode-hook nil)   ; we define it here in case it's not defined
X(defvar send-pr-mode-hook text-mode-hook "Called when send-pr is invoked.")
X
X;;;;---------------------------------------------------------------------------
X;;;; Domains and default values for (some of) the Problem Report fields;
X;;;; constants and definitions.
X;;;;---------------------------------------------------------------------------
X
X(defconst gnats::emacs-19p (not (string-lessp emacs-version "19"))
X  "Is this emacs v19?")
X
X;;; These may be changed during configuration/installation or by the individual
X;;; user in his/her .emacs file.
X;;;
X(defun gnats::get-config (var)
X  (let ((shell-file-name "/bin/sh")
X	(buf (generate-new-buffer " *GNATS config*"))
X	ret)
X    (save-excursion
X      (set-buffer buf)
X      (shell-command (concat ". " gnats:root "/gnats-adm/config; echo $" var )
X		     t)
X      (if (looking-at "/bin/sh:\\|\n")
X	  (setq ret nil)
X	(setq ret (buffer-substring (point-min) (- (point-max) 1)))))
X    (kill-buffer buf)
X    ret))
X
X;; const because it must match the script's value
X(defconst send-pr:datadir (or (gnats::get-config "DATADIR") "/usr/local/lib")
X  "*Where the `gnats' subdirectory containing category lists lives.")
X
X(defvar send-pr::sites nil
X  "List of GNATS support sites; computed at runtime.")
X(defvar send-pr:default-site
X  (or (gnats::get-config "GNATS_SITE") "sun-lamp")
X  "Default site to send bugs to.")
X(defvar send-pr:::site send-pr:default-site
X  "The site to which a problem report is currently being submitted, or NIL
Xif using the default site (buffer local).")
X
X(defvar send-pr:::categories nil
X  "Buffer local list of available categories, derived at runtime from
Xsend-pr:::site and send-pr::category-alist.")
X(defvar send-pr::category-alist nil
X  "Alist of GNATS support sites and the categories supported at each; computed
Xat runtime.")
X
X;;; Ideally we would get all the following values from a central database
X;;; during runtime instead of having them here in the code.
X;;;
X(defconst send-pr::fields
X  (` (("Category" send-pr::set-categories
X       (, (or (gnats::get-config "DEFAULT_CATEGORY") nil)) enum)
X      ("Class" (("sw-bug") ("doc-bug") ("change-request") ("support"))
X       (, (or (gnats::get-config "DEFAULT_CONFIDENTIAL") 0)) enum)
X      ("Confidential" (("yes") ("no"))
X       (, (or (gnats::get-config "DEFAULT_CONFIDENTIAL") 1)) enum)
X      ("Severity" (("non-critical") ("serious") ("critical"))
X       (, (or (gnats::get-config "DEFAULT_SEVERITY") 1)) enum)
X      ("Priority" (("low") ("medium") ("high"))
X       (, (or (gnats::get-config "DEFAULT_PRIORITY") 1)) enum)
X      ("Release" nil
X       (, (or (gnats::get-config "DEFAULT_RELEASE") "@DEFAULT_RELEASE@"))
X       text)
X      ("Submitter-Id" nil
X       (, (or (gnats::get-config "DEFAULT_SUBMITTER") "@DEFAULT_SUBMITTER@"))
X       text)
X      ("Synopsis" nil nil text
X       (lambda (a b c) (gnats::set-mail-field "Subject" c)))))
X  "AList, keyed on the name of the field, of:
X1) The field name.
X2) The list of completions.  This can be a list, a function to call, or nil.
X3) The default value.
X4) The type of the field.
X5) A sub-function to call when changed.")
X
X(defvar gnats::fields nil)
X
X(defmacro gnats::push (i l)
X  (` (setq (, l) (cons (,@ (list i l))))))
X
X(defun send-pr::set-categories (&optional arg)
X  "Get the list of categories for the current site out of
Xsend-pr::category-alist if there or from send-pr if not.  With arg, force
Xupdate."
X  ;;
X  (let ((entry (assoc send-pr:::site send-pr::category-alist)))
X    (or (and entry (null arg))
X	(let ((oldpr (getenv "GNATS_ROOT")) cats)
X	  (send-pr::set-sites arg)
X	  (setenv "GNATS_ROOT" gnats:root)
X	  (setq cats (gnats::get-value-from-shell
X		      "send-pr" "-CL" send-pr:::site))
X	  (setenv "GNATS_ROOT" oldpr)
X	  (if entry (setcdr entry cats)
X	    (setq entry (cons send-pr:::site cats))
X	    (gnats::push entry send-pr::category-alist))))
X    (setq send-pr:::categories (cdr entry))))
X
X(defun send-pr::set-sites (&optional arg)
X  "Get the list of sites (by listing the contents of DATADIR/gnats) and assign
Xit to send-pr::sites.  With arg, force update."
X  (or (and (null arg) send-pr::sites)
X      (progn
X	(setq send-pr::sites nil)
X	(mapcar
X	 (function
X	  (lambda (file)
X	    (or (memq t (mapcar (function (lambda (x) (string= x file)))
X				'("." ".." "pr-edit" "pr-addr")))
X		(not (file-readable-p file))
X		(gnats::push (list (file-name-nondirectory file))
X			    send-pr::sites))))
X	 (directory-files (format "%s/gnats" send-pr:datadir) t))
X	(setq send-pr::sites (reverse send-pr::sites)))))
X
X(defconst send-pr::pr-buffer-name "*send-pr*"
X  "Name of the temporary buffer, where the problem report gets composed.")
X
X(defconst send-pr::err-buffer-name "*send-pr-error*"
X  "Name of the temporary buffer, where send-pr error messages appear.")
X
X(defvar send-pr:::err-buffer nil
X  "The error buffer used by the current PR buffer.")
X
X(defconst gnats::indent 17 "Indent for formatting the value.")
X
X;;;;---------------------------------------------------------------------------
X;;;; `send-pr' - command for creating and sending of problem reports
X;;;;---------------------------------------------------------------------------
X
X(fset 'send-pr 'send-pr:send-pr)
X(defun send-pr:send-pr (&optional site)
X  "Create a buffer and read in the result of `send-pr -P'.
XWhen finished with editing the problem report use \\[send-pr:submit-pr]
Xto send the PR with `send-pr -b -f -'."
X  ;;
X  (interactive
X   (if current-prefix-arg
X       (list (completing-read "Site: " (send-pr::set-sites 'recheck) nil t
X			      send-pr:default-site))))
X  (or site (setq site send-pr:default-site))
X  (let ((buf (get-buffer send-pr::pr-buffer-name)))
X    (if (or (not buf)
X	    (and (switch-to-buffer buf)
X		 (or (not (buffer-modified-p buf))
X		     (y-or-n-p "Erase previous problem report? "))
X		 (or (erase-buffer) t)))
X	(send-pr::start-up site))))
X
X(defun send-pr::start-up (site)
X  (switch-to-buffer (get-buffer-create send-pr::pr-buffer-name))
X  (setq default-directory (expand-file-name "~/"))
X  (auto-save-mode auto-save-default)
X  (let ((oldpr (getenv "GNATS_ROOT"))
X	(case-fold-search nil))
X    (setenv "GNATS_ROOT" gnats:root)
X    (shell-command (concat "send-pr -P " site) t)
X    (setenv "GNATS_ROOT" oldpr)
X    (if (looking-at "send-pr:")
X	(cond ((looking-at "send-pr: .* does not have a categories list")
X	       (setq send-pr::sites nil)
X	       (error "send-pr: the GNATS site %s does not have a categories list" site))
X	      (t (error (buffer-substring (point-min) (point-max)))))
X      (save-excursion
X	;; Clear cruft inserted by bdamaged .cshrcs
X	(re-search-forward "^SEND-PR:")
X	(delete-region 1 (match-beginning 0)))))
X  (set-buffer-modified-p nil)
X  (send-pr:send-pr-mode)
X  (setq send-pr:::site site)
X  (send-pr::set-categories)
X  (if (null send-pr:::categories)
X      (progn
X	(and send-pr:::err-buffer (kill-buffer send-pr:::err-buffer))
X	(kill-buffer nil)
X	(message "send-pr: no categories found"))
X    (and mail-default-reply-to
X	 (gnats::set-mail-field "Reply-To" mail-default-reply-to))
X    (and mail-self-blind
X	 (gnats::set-mail-field "BCC" (user-login-name)))
X    (mapcar 'send-pr::maybe-change-field send-pr::fields)
X    (gnats::position-on-field "Description")
X    (message (substitute-command-keys
X	      "To send the problem report use: \\[send-pr:submit-pr]"))))
X
X(fset 'do-send-pr 'send-pr:submit-pr)	;backward compat
X(defun send-pr:submit-pr ()
X  "Pipe the contents of the buffer *send-pr* to `send-pr -f -.' unless this
Xbuffer was loaded with emacsclient, in which case save the buffer and exit."
X  ;;
X  (interactive)
X  (cond
X   ((and (boundp 'server-buffer-clients)
X	 server-buffer-clients)
X    (let ((buffer (current-buffer))
X	  (version-control nil) (buffer-backed-up nil))
X      (save-buffer buffer)
X      (kill-buffer buffer)
X      (server-buffer-done buffer)))
X   (t
X    (or (and send-pr:::err-buffer
X	     (buffer-name send-pr:::err-buffer))
X	(setq send-pr:::err-buffer
X	      (get-buffer-create send-pr::err-buffer-name)))
X    (let ((err-buffer send-pr:::err-buffer) mesg ok)
X      (save-excursion (set-buffer err-buffer) (erase-buffer))
X      (message "running send-pr...")
X      (let ((oldpr (getenv "GNATS_ROOT")))
X	(setenv "GNATS_ROOT" gnats:root)
X	;; FIXME -r flag is obsolete; remove for 3.3 release
X	(call-process-region (point-min) (point-max) "send-pr"
X			     nil err-buffer nil "-b" "-r" "-f" "-")
X	(setenv "GNATS_ROOT" oldpr))
X      (message "running send-pr...done")
X      ;; stupidly we cannot check the return value in EMACS 18.57, thus we need
X      ;; this kluge to find out whether send-pr succeeded.
X      (if (save-excursion
X	    (set-buffer err-buffer)
X	    (goto-char (point-min))
X	    (setq mesg (buffer-substring (point-min) (- (point-max) 1)))
X	    (search-forward "problem report sent" nil t))
X	  (progn (message mesg)
X		 (kill-buffer err-buffer)
X		 (delete-auto-save-file-if-necessary)
X		 (set-buffer-modified-p nil)
X		 (bury-buffer))
X	(pop-to-buffer err-buffer))
X    ))))
X   
X;;;;---------------------------------------------------------------------------
X;;;; send-pr:send-pr-mode mode
X;;;;---------------------------------------------------------------------------
X
X(defvar send-pr-mode-map
X  (let ((map (make-sparse-keymap)))
X    (define-key map "\C-c\C-c" 'send-pr:submit-pr)
X    (define-key map "\C-c\C-f" 'gnats:change-field)
X    (define-key map "\M-n" 'gnats:next-field)
X    (define-key map "\M-p" 'gnats:previous-field)
X    (define-key map "\C-\M-f" 'gnats:forward-field)
X    (define-key map "\C-\M-b" 'gnats:backward-field)
X    map)
X  "Keymap for send-pr mode.")
X
X(defconst gnats::keyword "^>\\([-a-zA-Z]+\\):")
X(defconst gnats::before-keyword "[ \t\n\f]*[\n\f]+>\\([-a-zA-Z]+\\):")
X(defconst gnats::after-keyword "^>\\([-a-zA-Z]+\\):[ \t\n\f]+")
X
X(fset 'send-pr-mode 'send-pr:send-pr-mode)
X(defun send-pr:send-pr-mode ()
X  "Major mode for submitting problem reports.
XFor information about the form see gnats(1) and send-pr(1).
XSpecial commands: \\{send-pr-mode-map}
XTurning on send-pr-mode calls the value of the variable send-pr-mode-hook,
Xif it is not nil."
X  (interactive)
X  (gnats::patch-exec-path)
X  (put 'send-pr:send-pr-mode 'mode-class 'special)
X  (kill-all-local-variables)
X  (setq major-mode 'send-pr:send-pr-mode)
X  (setq mode-name "send-pr")
X  (use-local-map send-pr-mode-map)
X  (set-syntax-table text-mode-syntax-table)
X  (setq local-abbrev-table text-mode-abbrev-table)
X  (setq buffer-offer-save t)
X  (make-local-variable 'send-pr:::site)
X  (make-local-variable 'send-pr:::categories)
X  (make-local-variable 'send-pr:::err-buffer)
X  (make-local-variable 'paragraph-separate)
X  (setq paragraph-separate (concat (default-value 'paragraph-separate)
X				   "\\|" gnats::keyword "[ \t\n\f]*$"))
X  (make-local-variable 'paragraph-start)
X  (setq paragraph-start (concat (default-value 'paragraph-start)
X				"\\|" gnats::keyword))
X  (run-hooks 'send-pr-mode-hook)
X  t)
X
X;;;;---------------------------------------------------------------------------
X;;;; Functions to read and replace field values.
X;;;;---------------------------------------------------------------------------
X
X(defun gnats::position-on-field (field)
X  (goto-char (point-min))
X  (if (not (re-search-forward (concat "^>" field ":") nil t))
X      (error "Field `>%s:' not found." field)
X    (re-search-forward "[ \t\n\f]*")
X    (if (looking-at gnats::keyword)
X	(backward-char 1))
X    t))
X
X(defun gnats::mail-position-on-field (field)
X  (let (end
X	(case-fold-search t))
X    (goto-char (point-min))
X    (re-search-forward "^$")
X    (setq end (match-beginning 0))
X    (goto-char (point-min))
X    (if (not (re-search-forward (concat "^" field ":") end 'go-to-end))
X	(insert field ": \n")
X      (re-search-forward "[ \t\n\f]*"))
X    (skip-chars-backward "\n")
X    t))
X
X(defun gnats::field-contents (field &optional elem move)
X  (let (pos)
X    (unwind-protect
X	(save-excursion
X	  (if (not (gnats::position-on-field field))
X	      nil
X	    (setq pos (point-marker))
X	    (if (or (looking-at "<.*>$") (eolp))
X		t
X	      (looking-at ".*$")	; to set match-{beginning,end}
X	      (gnats::nth-word 
X	       (buffer-substring (match-beginning 0) (match-end 0))
X	       elem))))
X      (and move pos (goto-char pos)))))
X
X(defun gnats::functionp (thing)
X  (or (and (symbolp thing) (fboundp thing))
X      (and (listp thing) (eq (car thing) 'lambda))))
X
X(defun gnats::field-values (field)
X  "Return the possible (known) values for field FIELD."
X  (let* ((fields (if (eq major-mode 'gnats:gnats-mode) gnats::fields
X		   send-pr::fields))
X	 (thing (elt (assoc field fields) 1)))
X    (cond ((gnats::functionp thing) (funcall thing))
X	  ((listp thing) thing)
X	  (t (error "ACK")))))
X
X(defun gnats::field-default (field)
X  "Return the default value for field FIELD."
X  (let* ((fields (if (eq major-mode 'gnats:gnats-mode) gnats::fields
X		   send-pr::fields))
X	 (thing (elt (assoc field fields) 2)))
X    (cond ((stringp thing) thing)
X	  ((null thing) "")
X	  ((numberp thing) (car (elt (gnats::field-values field) thing)))
X	  ((gnats::functionp thing)
X	   (funcall thing (gnats::field-contents field)))
X	  ((eq thing t) (gnats::field-contents field))
X	  (t (error "ACK")))))
X
X(defun gnats::field-type (field)
X  "Return the type of field FIELD."
X  (let* ((fields (if (eq major-mode 'gnats:gnats-mode) gnats::fields
X		   send-pr::fields))
X	 (thing (elt (assoc field fields) 3)))
X    thing))
X
X(defun gnats::field-action (field)
X  "Return the extra handling function for field FIELD."
X  (let* ((fields (if (eq major-mode 'gnats:gnats-mode) gnats::fields
X		   send-pr::fields))
X	 (thing (elt (assoc field fields) 4)))
X    (cond ((null thing) 'ignore)
X	  ((gnats::functionp thing) thing)
X	  (t (error "ACK")))))
X
X;;;;---------------------------------------------------------------------------
X;;;; Point movement functions
X;;;;---------------------------------------------------------------------------
X
X(or (fboundp 'defsubst) (fset 'defsubst 'defun))
X
X(defun send-pr::maybe-change-field (field)
X  (setq field (car field))
X  (let ((thing (gnats::field-contents field)))
X    (and thing (eq t thing)
X	 (not (eq 'multi-text (gnats::field-type field)))
X	 (gnats:change-field field))))
X    
X(defun gnats:change-field (&optional field default)
X  "Change the value of the field containing the cursor.  With arg, ask the
Xuser for the field to change.  From a program, the function takes optional
Xarguments of the field to change and the default value to use."
X  (interactive
X   (if current-prefix-arg
X       (list (completing-read
X	      "Field: " (if (eq major-mode 'gnats:gnats-mode) gnats::fields
X			 send-pr::fields)
X	      nil t))))
X  (or field
X      (setq field (gnats::current-field)))
X  (gnats::position-on-field field)
X  (sit-for 0)
X  (let* ((old (gnats::field-contents field))
X	 new)
X    (if (null old)
X	(error "ACK")
X      (let ((prompt (concat ">" field ": "))
X	    (domain (gnats::field-values field))
X	    (type (gnats::field-type field))
X	    (action (gnats::field-action field)))
X	(or default (setq default (gnats::field-default field)))
X	(setq new (if (eq type 'enum)
X		      (completing-read prompt domain nil t 
X				       (if gnats::emacs-19p (cons default 0)
X					 default))
X		    (read-string prompt (if gnats::emacs-19p (cons default 1)
X					  default))))
X	(gnats::set-field field new)
X	(funcall action field old new)
X	new))))
X
X(defun gnats::set-field (field value)
X  (gnats::position-on-field field)
X  (delete-horizontal-space)
X  (looking-at ".*$")
X  (replace-match
X   (concat (make-string (- gnats::indent (length field) 2) ?\40 ) value) t))
X
X(defun gnats::set-mail-field (field value)
X  (gnats::mail-position-on-field field)
X  (delete-horizontal-space)
X  (looking-at ".*$")
X  (replace-match (concat " " value) t))
X  
X(defun gnats::before-keyword (&optional where)
X  "Returns t if point is in some white space before a keyword.
XIf where is nil, then point is not changed; if where is t then point is moved
Xto the beginning of the keyword, otherwise it is moved to the beginning
Xof the white space it was in."
X  ;;
X  (if (looking-at gnats::before-keyword)
X      (prog1 t
X	(cond  ((eq where t)
X		(re-search-forward "^>") (backward-char))
X	       ((not (eq where nil))
X		(re-search-backward "[^ \t\n\f]") (forward-char))))
X       nil))
X
X(defun gnats::after-keyword (&optional where)
X  "Returns t if point is in some white space after a keyword.
XIf where is nil, then point is not changed; if where is t then point is moved
Xto the beginning of the keyword, otherwise it is moved to the end of the white
Xspace it was in."
X  ;;
X  (if (gnats::looking-after gnats::after-keyword)
X      (prog1 t
X	(cond  ((eq where t)
X		(re-search-backward "^>"))
X	       ((not (eq where nil))
X		(re-search-forward "[^ \t\n\f]") (backward-char))))
X       nil))
X
X(defun gnats::in-keyword (&optional where)
X  "Returns t if point is within a keyword.
XIf where is nil, then point is not changed; if where is t then point is moved
Xto the beginning of the keyword."
X  ;;
X  (let ((old-point (point-marker)))
X    (beginning-of-line)
X    (cond ((and (looking-at gnats::keyword)
X	       (< old-point (match-end 0)))
X	   (prog1 t
X	     (if (eq where t) 
X		 t
X	       (goto-char old-point))))
X	  (t (goto-char old-point)
X	     nil))))
X
X(defun gnats::forward-bofield ()
X  "Moves point to the beginning of a field. Assumes that point is in the
Xkeyword." 
X  ;;
X  (if (re-search-forward "[ \t\n\f]+[^ \t\n\f]" (point-max) '-)
X      (backward-char)
X    t))
X
X(defun gnats::backward-eofield ()
X  "Moves point to the end of a field. Assumes point is in the keyword."
X  ;;
X  (if (re-search-backward "[^ \t\n\f][ \t\n\f]+" (point-min) '-)
X      (forward-char)
X    t))
X
X(defun gnats::forward-eofield ()
X  "Moves point to the end of a field. Assumes that point is in the field." 
X  ;;
X  ;; look for the next field
X  (if (re-search-forward gnats::keyword (point-max) '-) 
X      (progn (beginning-of-line) (gnats::backward-eofield))
X  (re-search-backward "[^ \t\n\f][ \t\n\f]*" (point-min) '-)
X  (forward-char)))
X
X(defun gnats::backward-bofield ()
X  "Moves point to the beginning of a field. Assumes that point is in the
Xfield." 
X  ;;
X  ;;look for previous field
X  (if (re-search-backward gnats::keyword (point-min) '-)
X      (gnats::forward-bofield)
X    t))
X
X
X(defun gnats:forward-field ()
X  "Move point forward to the end of the field or to the beginning of the next
Xfield."
X  ;;
X  (interactive)
X  (if (or (gnats::before-keyword t) (gnats::in-keyword t)
X	  (gnats::after-keyword t))
X	(gnats::forward-bofield)
X    (gnats::forward-eofield)))
X
X(defun gnats:backward-field ()
X  "Move point backward to the beginning/end of a field."
X  ;;
X  (interactive)
X  (backward-char)
X  (if (or (gnats::before-keyword t) (gnats::in-keyword t)
X	  (gnats::after-keyword t))
X      (gnats::backward-eofield)
X    (gnats::backward-bofield)))
X
X(defun gnats:next-field ()
X  "Move point to the beginning of the next field."
X  ;;
X  (interactive)
X  (if (or (gnats::before-keyword t) (gnats::in-keyword t)
X	  (gnats::after-keyword t))
X      (gnats::forward-bofield)
X    (if (re-search-forward gnats::keyword (point-max) '-)
X	(gnats::forward-bofield)
X      t)))
X
X(defun gnats:previous-field ()
X  "Move point to the beginning of the previous field."
X  ;;
X  (interactive)
X  (backward-char)
X  (if (or (gnats::after-keyword t) (gnats::in-keyword t)
X	  (gnats::before-keyword t))
X      (progn (re-search-backward gnats::keyword (point-min) '-)
X	     (gnats::forward-bofield))
X    (gnats::backward-bofield)))
X
X(defun gnats:beginning-of-field ()
X  "Move point to the beginning of the current field."
X  (interactive)
X  (cond ((gnats::in-keyword t)
X	 (gnats::forward-bofield))
X	((gnats::after-keyword 0))
X	(t
X	 (gnats::backward-bofield))))
X
X(defun gnats::current-field ()
X  (save-excursion
X    (cond ((or (gnats::in-keyword t) (gnats::after-keyword t))
X	   (looking-at gnats::keyword))
X	  ((re-search-backward gnats::keyword nil t))
X	  (t
X	   nil))
X    (buffer-substring (match-beginning 1) (match-end 1))))
X
X;;;;---------------------------------------------------------------------------
X;;;; Support functions
X;;;;---------------------------------------------------------------------------
X
X(defun gnats::looking-after (regex)
X  "Returns t if point is after regex."
X  ;;
X  (let* ((old-point (point))
X	 (start (if (eobp)
X		   old-point
X		 (forward-char) (point))))
X    (cond ((re-search-backward regex (point-min) t)
X	   (goto-char old-point)
X	   (cond ((eq (match-end 0) start)
X		  t))))))
X
X(defun gnats::nth-word (string &optional elem)
X  "Returns the elem-th word of the string.
XIf elem is nil, then the first wort is returned, if elem is 0 then
Xthe whole string is returned."
X   ;;
X  (if (integerp elem)
X      (cond ((eq elem 0) string)
X	    ((eq elem 1) (gnats::first-word string))
X	    ((equal string "") "")
X	    ((>= elem 2) 
X	     (let ((i 0) (value ""))
X	       (setq string		; strip leading blanks
X		     (substring string (or (string-match "[^ \t]" string) 0)))
X	       (while (< i elem)
X		 (setq value 
X		       (substring string 0 
X				  (string-match "[ \t]*$\\|[ \t]+" string)))
X		 (setq string 
X		       (substring string (match-end 0)))
X		 (setq i (+ i 1)))
X	       value)))
X    (gnats::first-word string)))
X
X(defun gnats::first-word (string)
X  (setq string 
X	(substring string (or (string-match "[^ \t]" string) 0)))
X  (substring string 0 (string-match "[ \t]*$\\|[ \t]+" string)))
X
X;;;;---------------------------------------------------------------------------
X
X(defun gnats::patch-exec-path ()
X  ;;
X  "Replaces `//' by `/' in `exec-path'."
X  ;;
X  ;(make-local-variable 'exec-path)
X  (let ((err-buffer (get-buffer-create " *gnats::patch-exec-path*"))
X	(ret))
X    (setq exec-path (save-excursion (set-buffer err-buffer)
X				    (prin1 exec-path err-buffer)
X				    (goto-char (point-min))
X				    (replace-string "//" "/")
X				    (goto-char (point-min))
X				    (setq ret (read err-buffer))
X				    (kill-buffer err-buffer)
X				    ret
X				    ))))
X
X(defun gnats::get-value-from-shell (&rest command)
X  "Execute shell command to get a list of valid values for `variable'."
X  ;;
X  (let ((err-buffer (get-buffer-create " *gnats::get-value-from-shell*")))
X    (save-excursion
X      (set-buffer err-buffer)
X      (unwind-protect
X	  (condition-case var
X	      (progn
X		(apply 'call-process
X		       (car command) nil err-buffer nil (cdr command))
X		(goto-char (point-min))
X		(if (looking-at "[-a-z]+: ")
X		    (error (buffer-substring (point-min) (point-max))))
X		(read err-buffer))
X	    (error nil))
X	(kill-buffer err-buffer)))))
X
X(or (fboundp 'setenv)
X    (defun setenv (variable &optional value)
X      "Set the value of the environment variable named VARIABLE to VALUE.
XVARIABLE should be a string.  VALUE is optional; if not provided or is
X`nil', the environment variable VARIABLE will be removed.  
XThis function works by modifying `process-environment'."
X      (interactive "sSet environment variable: \nsSet %s to value: ")
X      (if (string-match "=" variable)
X	  (error "Environment variable name `%s' contains `='" variable)
X	(let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
X	      (case-fold-search nil)
X	      (scan process-environment))
X	  (while scan
X	    (cond
X	     ((string-match pattern (car scan))
X	      (if (eq nil value)
X		  (setq process-environment (delq (car scan)
X						  process-environment))
X		(setcar scan (concat variable "=" value)))
X	      (setq scan nil))
X	     ((null (setq scan (cdr scan)))
X	      (setq process-environment
X		    (cons (concat variable "=" value)
X			  process-environment)))))))))
X
X;;;; end of send-pr.el
END-of-send-pr-el.in
echo x - send-pr.man
sed 's/^X//' >send-pr.man << 'END-of-send-pr.man'
X.\" -*- nroff -*-
X.\" ---------------------------------------------------------------------------
X.\"    man page for send-pr (by Heinz G. Seidl, hgs@cygnus.com)
X.\"    updated Feb 1993 for GNATS 3.00 by Jeffrey Osier, jeffrey@cygnus.com
X.\"
X.\"    This file is part of the Problem Report Management System (GNATS)
X.\"    Copyright 1992 Cygnus Support
X.\"
X.\"    This program is free software; you can redistribute it and/or
X.\"    modify it under the terms of the GNU General Public
X.\"    License as published by the Free Software Foundation; either
X.\"    version 2 of the License, or (at your option) any later version.
X.\"
X.\"    This program is distributed in the hope that it will be useful,
X.\"    but WITHOUT ANY WARRANTY; without even the implied warranty of
X.\"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
X.\"    General Public License for more details.
X.\"
X.\"    You should have received a copy of the GNU Library General Public
X.\"    License along with this program; if not, write to the Free
X.\"    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
X.\"
X.\" ---------------------------------------------------------------------------
X.nh
X.TH SEND-PR 1 @VERSION@ "February 1993"
X.SH NAME
Xsend-pr \- send problem report (PR) to a central support site
X.SH SYNOPSIS
X.B send-pr
X[
X.I site
X]
X[
X.B \-f
X.I problem-report
X]
X[
X.B \-t
X.I mail-address
X]
X.br
X.in +0.8i
X[
X.B \-p
X]
X[
X.B \-P
X]
X[
X.B \-L
X]
X[
X.B \-\-request-id
X]
X[
X.B \-v
X]
X.SH DESCRIPTION
X.B send-pr
Xis a tool used to submit 
X.I problem reports 
X.\" SITE ADMINISTRATORS - change this if you use a local default
X(PRs) to a central support site.  In most cases the correct 
X.I site
Xwill be the default.  This argument indicates the support site which
Xis responsible for the category of problem involved.  Some sites may
Xuse a local address as a default.  
X.I site
Xvalues are defined by using the 
X.BR aliases (5).
X.LP
X.B send-pr
Xinvokes an editor on a problem report template (after trying to fill
Xin some fields with reasonable default values).  When you exit the
Xeditor,
X.B send-pr 
Xsends the completed form to the
X.I Problem Report Management System
X(\fBGNATS\fR) at a central support site.  At the support site, the PR
Xis assigned a unique number and is stored in the \fBGNATS\fR database
Xaccording to its category and submitter-id.  \fBGNATS\fR automatically
Xreplies with an acknowledgement, citing the category and the PR
Xnumber.
X.LP
XTo ensure that a PR is handled promptly, it should contain your (unique)
X\fIsubmitter-id\fR and one of the available \fIcategories\fR to identify the
Xproblem area.  (Use
X.B `send-pr -L'
Xto see a list of categories.)
X.LP
XThe
X.B send-pr
Xtemplate at your site should already be customized with your
Xsubmitter-id (running `\|\fBinstall-sid\fP \fIsubmitter-id\fP\|' to
Xaccomplish this is part of the installation procedures for
X.BR send-pr ).
XIf this hasn't been done, see your system administrator for your
Xsubmitter-id, or request one from your support site by invoking
X.B `send-pr \-\-request\-id'.
XIf your site does not distinguish between different user sites, or if
Xyou are not affiliated with the support site, use
X.B `net'
Xfor this field.
X.LP
XThe more precise your problem description and the more complete your
Xinformation, the faster your support team can solve your problems.
X.SH OPTIONS
X.TP
X.BI \-f " problem-report"
Xspecify a file (\fIproblem-report\fR) which already contains a
Xcomplete problem report.
X.B send-pr
Xsends the contents of the file without invoking the editor.  If 
Xthe value for 
X.I problem-report
Xis
X.BR `\|\-\|' ,
Xthen
X.B send-pr
Xreads from standard input.
X.TP
X.BI \-t " mail-address"
XChange mail address at the support site for problem reports.  The
Xdefault 
X.I mail-address
Xis the address used for the default 
X.IR site .  
XUse the
X.I site
Xargument rather than this option in nearly all cases.
X.TP
X.B \-p 
XPrint the standard blank template on standard output.  No mail is sent.
X.TP
X.B \-P
Xprint the form specified by the environment variable 
X.B PR_FORM 
Xon standard output.  No mail is sent.
X.TP
X.BI \-s " mail-agent"
XUse 
X.I mail-agent
Xinstead of the default mailer,
X.BR sendmail (8).
X.TP
X.B -L
Xprint the list of available categories.  No mail is sent.
X.TP
X.B \-\-request\-id
Xsends mail to the default support site, or
X.I site
Xif specified, with a request for your 
X.IR submitter-id . 
XIf you are
Xnot affiliated with 
X.IR site ,
Xuse a
X.I submitter-id
Xof
X.BR net \|'.
X.TP
X.B \-v
XDisplay the 
X.B send-pr
Xversion number.
X.LP
XNote: use
X.B send-pr
Xto submit problem reports rather than mailing them directly.  Using
Xboth the template and
X.B send-pr
Xitself will help ensure all necessary information will reach the
Xsupport site.
X.SH ENVIRONMENT
XThe environment variable 
X.B EDITOR
Xspecifies the editor to invoke on the template.
X.br
Xdefault:
X.B vi
X.sp
XIf the environment variable 
X.B PR_FORM
Xis set, then its value is used as the file name of the template for
Xyour problem-report editing session.  You can use this to start with a
Xpartially completed form (for example, a form with the identification
Xfields already completed).
X.SH "HOW TO FILL OUT A PROBLEM REPORT"
XProblem reports have to be in a particular form so that a program can
Xeasily manage them.  Please remember the following guidelines:
X.IP \(bu 3m 
Xdescribe only 
X.B one problem
Xwith each problem report.
X.IP \(bu 3m
XFor follow-up mail, use the same subject line as the one in the automatic
Xacknowledgent. It consists of category, PR number and the original synopsis
Xline.  This allows the support site to relate several mail messages to a
Xparticular PR and to record them automatically.
X.IP \(bu 3m 
XPlease try to be as accurate as possible in the subject and/or synopsis line.
X.IP \(bu 3m 
XThe subject and the synopsis line are not confidential.  This is
Xbecause open-bugs lists are compiled from them.  Avoid confidential
Xinformation there.
X.LP
XSee the GNU 
X.B Info 
Xfile
X.B send-pr.info
Xor the document \fIReporting Problems With send-pr\fR\ for detailed
Xinformation on reporting problems
X.SH "HOW TO SUBMIT TEST CASES, CODE, ETC."
XSubmit small code samples with the PR.  Contact the support site for
Xinstructions on submitting larger test cases and problematic source
Xcode.
X.SH FILES
X.ta \w'/tmp/pbad$$  'u
X/tmp/p$$	copy of PR used in editing session
X.br
X/tmp/pf$$	copy of empty PR form, for testing purposes
X.br
X/tmp/pbad$$	file for rejected PRs
X.if !\n(PR==1 \{.
X.SH SEE ALSO
X.BR gnats.texi
Xand
X.BR send-pr.texi,
Xwhich are also installed as GNU
X.B Info
Xfiles
X.BR gnats.info
Xand 
X.BR send-pr.info;
X.LP
X.BR gnats (l),
X.BR query-pr (1),
X.BR edit-pr (1),
X.BR gnats (8),
X.BR queue-pr (8),
X.BR at-pr (8),
X.BR mkcat (8),
X.BR mkdist (8).
X.SH EMACS USER INTERFACE
XAn Emacs user interface for 
X.B send-pr
Xwith completion of field values is part of the 
X.B send-pr
Xdistribution (invoked with
X.BR "M-x send-pr" ).
XSee the file
X.B send-pr.info
Xor the ASCII file
X.B INSTALL
Xin the top level directory of the distribution for configuration and
Xinstallation information.  The Emacs LISP template file is 
X.B send-pr-el.in
Xand is installed as
X.BR send-pr.el .
X
X.SH INSTALLATION AND CONFIGURATION
XSee 
X.B send-pr.info
Xor
X.B INSTALL
Xfor installation instructions.
X.LP
XThere are many ways in which 
X.B send-pr 
Xcan be customized to meet specific needs. As mentioned above, at
Xleast the
X.I submitter-id
Xshould be set before using
X.BR send-pr .
XYou can change the 
X.I submitter-id 
Xused by an already installed 
X.B send-pr
Xscript, by running an auxiliary script: `\|\c
X.B install_sid
X.IR submitter-id \|'.
X.LP
XThe file
X.B send-pr.el
Xis automatically installed when the distribution is built.  It is not,
Xhowever, automatically loaded every time Emacs starts up.  See
X.B send-pr.info
Xor 
X.B INSTALL
Xfor instructions on how to load 
X.B send-pr
Xautomatically into Emacs.
X.SH AUTHORS
XJeffrey Osier, Brendan Kehoe, Heinz G. Seidl (Cygnus Support)
X.SH COPYING
XCopyright (c) 1992, 1993 Free Software Foundation, Inc.
X.PP
XPermission is granted to make and distribute verbatim copies of
Xthis manual provided the copyright notice and this permission notice
Xare preserved on all copies.
X.PP
XPermission is granted to copy and distribute modified versions of this
Xmanual under the conditions for verbatim copying, provided that the
Xentire resulting derived work is distributed under the terms of a
Xpermission notice identical to this one.
X.PP
XPermission is granted to copy and distribute translations of this
Xmanual into another language, under the above conditions for modified
Xversions, except that this permission notice may be included in
Xtranslations approved by the Free Software Foundation instead of in
Xthe original English.
X
END-of-send-pr.man
echo x - send-pr.sh
sed 's/^X//' >send-pr.sh << 'END-of-send-pr.sh'
X#!/bin/sh
X# Submit a problem report to a GNATS site.
X# Copyright (C) 1993 Free Software Foundation, Inc.
X# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
X# version written by Heinz G. Seidl (hgs@ide.com).
X#
X# This file is part of GNU GNATS.
X#
X# GNU GNATS is free software; you can redistribute it and/or modify
X# it under the terms of the GNU General Public License as published by
X# the Free Software Foundation; either version 2, or (at your option)
X# any later version.
X#
X# GNU GNATS is distributed in the hope that it will be useful,
X# but WITHOUT ANY WARRANTY; without even the implied warranty of
X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X# GNU General Public License for more details.
X#
X# You should have received a copy of the GNU General Public License
X# along with GNU GNATS; see the file COPYING.  If not, write to
X# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X
X# The version of this send-pr.
XVERSION=3.01.6
X
X# The submitter-id for your site.
XSUBMITTER=net
X
X# Where the GNATS directory lives, if at all.
X[ -z "$GNATS_ROOT" ] && 
XGNATS_ROOT=/b/gnats
X
X# The default mail address for PR submissions. 
XGNATS_ADDR=gnats-bugs@sun-lamp.cs.berkeley.edu
X
X# Where the gnats category tree lives.
XDATADIR=/usr/share
X
X# If we've been moved around, try using GCC_EXEC_PREFIX.
X[ ! -d $DATADIR/gnats -a -d "$GCC_EXEC_PREFIX" ] && DATADIR=${GCC_EXEC_PREFIX}..
X
X# The default release for this host.
XDEFAULT_RELEASE=""
X
X# The default organization.
XDEFAULT_ORGANIZATION=""
X
X# The default site to look for.
XGNATS_SITE=sun-lamp
X
X# Newer config information?
X[ -f ${GNATS_ROOT}/gnats-adm/config ] && . ${GNATS_ROOT}/gnats-adm/config
X
X# What mailer to use.  This must come after the config file, since it is
X# host-dependent.
XMAIL_AGENT="/usr/sbin/sendmail -oi -t"
X
X#
X
X[ -z "$TMPDIR" ] && TMPDIR=/tmp
X
XTEMP=$TMPDIR/p$$
XBAD=$TMPDIR/pbad$$
XREF=$TMPDIR/pf$$
X
Xif [ -z "$HOSTNAME" ]; then
X  if [ -f /bin/hostname ] ; then HOSTNAME=`/bin/hostname` 
X  elif [ -f /usr/bin/hostname ] ; then HOSTNAME=`/usr/bin/hostname` 
X  # Solaris et al.
X  elif [ -f /usr/ucb/hostname ] ; then HOSTNAME=`/usr/ucb/hostname`
X  # Irix
X  elif [ -f /usr/bsd/hostname ] ; then HOSTNAME=`/usr/bsd/hostname`
X  else echo "$COMMAND: HOSTNAME not set and hostname not found"; exit 1
X  fi
Xfi
X
Xif [ -z "$LOGNAME" -a -n "$USER" ]; then
X  LOGNAME=$USER
Xfi
Xif [ -z "$LOGNAME" ]; then
X  FROM=
X  REPLY_TO=
Xelse
X  FROM="$LOGNAME@$HOSTNAME"
X  REPLY_TO="$LOGNAME@$HOSTNAME"
Xfi
X
X# Find out the name of the originator of this PR.
Xif [ -n "$NAME" ]; then
X  ORIGINATOR="$NAME"
Xelif [ -f $HOME/.fullname ]; then
X  ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
Xelif [ -f /bin/domainname ]; then
X  if [ "`/bin/domainname`" != "" -a -f /usr/bin/ypcat ]; then
X    # Must use temp file due to incompatibilities in quoting behavior
X    # and to protect shell metacharacters in the expansion of $LOGNAME
X    /usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" |
X      cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
X    ORIGINATOR="`cat $TEMP`"
X    rm -f $TEMP
X  fi
Xfi
X
Xif [ "$ORIGINATOR" = "" ]; then
X  grep "^$LOGNAME:" /etc/passwd | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
X  ORIGINATOR="`cat $TEMP`"
X  rm -f $TEMP
Xfi
X
Xif [ -n "$ORGANIZATION" ]; then
X  if [ -f "$ORGANIZATION" ]; then
X    ORGANIZATION="`cat $ORGANIZATION`"
X  fi
Xelse
X  if [ -n "$DEFAULT_ORGANIZATION" ]; then
X    ORGANIZATION="$DEFAULT_ORGANIZATION"
X  elif [ -f $HOME/.organization ]; then
X    ORGANIZATION="`cat $HOME/.organization`"
X  elif [ -f $HOME/.signature ]; then
X    ORGANIZATION="`cat $HOME/.signature`"
X  fi
Xfi
X
X# If they don't have a preferred editor set, then use
Xif [ -z "$VISUAL" ]; then
X  if [ -z "$EDITOR" ]; then
X    EDIT=vi
X  else
X    EDIT="$EDITOR"
X  fi
Xelse
X  EDIT="$VISUAL"
Xfi
X
X# Find out some information.
XSYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
X        ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
XARCH=`[ -f /bin/arch ] && /bin/arch`
XMACHINE=`[ -f /bin/machine ] && /bin/machine`
X
XCOMMAND=`echo $0 | sed -e 's,.*/,,'`
XUSAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [--request-id] 
X[--version]"
XREMOVE=
XBATCH=
X
Xwhile [ $# -gt 0 ]; do
X  case "$1" in
X    -r | -p) ;; 		# Ignore for backward compat.
X    -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
X	shift ; GNATS_ADDR="$1"
X	EXPLICIT_GNATS_ADDR=true
X        ;;
X    -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
X	shift ; IN_FILE="$1"
X	if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
X	  echo "$COMMAND: cannot read $IN_FILE"
X	  exit 1
X	fi
X	;;
X    -b | --batch) BATCH=true ;;
X    -P | --print) PRINT=true ;;
X    -L | --list) FORMAT=norm ;;
X    -l | -CL | --lisp) FORMAT=lisp ;;
X    --request-id) REQUEST_ID=true ;;
X    -h | --help) echo "$USAGE"; exit 0 ;;
X    -V | --version) echo "$VERSION"; exit 0 ;;
X    -*) echo "$USAGE" ; exit 1 ;;
X    *) if [ -z "$USER_GNATS_SITE" ]; then
X	 if [ ! -r "$DATADIR/gnats/$1" ]; then
X	   echo "$COMMAND: the GNATS site $1 does not have a categories list."
X	   exit 1
X	 else
X	   # The site name is the alias they'll have to have created.
X	   USER_GNATS_SITE=$1
X	 fi
X       else
X	 echo "$USAGE" ; exit 1
X       fi
X       ;;
X esac
X shift
Xdone
X
Xif [ -n "$USER_GNATS_SITE" ]; then
X  GNATS_SITE=$USER_GNATS_SITE
X  GNATS_ADDR=$USER_GNATS_SITE-gnats
Xfi
X
Xif [ "$SUBMITTER" = "unknown" -a -z "$REQUEST_ID" -a -z "$IN_FILE" ]; then
X  cat << '__EOF__'
XIt seems that send-pr is not installed with your unique submitter-id.
XYou need to run
X
X          install-sid YOUR-SID
X
Xwhere YOUR-SID is the identification code you received with `send-pr'.
X`send-pr' will automatically insert this value into the template field
X`>Submitter-Id'.  If you've downloaded `send-pr' from the Net, use `net'
Xfor this value.  If you do not know your id, run `send-pr --request-id' to 
Xget one from your support site.
X__EOF__
X  exit 1
Xfi
X
Xif [ -r "$DATADIR/gnats/$GNATS_SITE" ]; then
X  CATEGORIES=`grep -v '^#' $DATADIR/gnats/$GNATS_SITE | sort`
Xelse
X  echo "$COMMAND: could not read $DATADIR/gnats/$GNATS_SITE for categories list."
X  exit 1
Xfi
X
Xif [ -z "$CATEGORIES" ]; then
X  echo "$COMMAND: the categories list for $GNATS_SITE was empty!"
X  exit 1
Xfi
X
Xcase "$FORMAT" in
X  lisp) echo "$CATEGORIES" | \
X        awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}'
X        exit 0
X        ;;
X  norm) echo "$CATEGORIES" | \
X        awk 'BEGIN {print "Known categories:"; i = 1 }
X          { printf ("%-12.12s", $0); if ((++i % 5) == 0) { print "" } }
X            END { print ""; }'
X        exit 0
X        ;;
Xesac
X
XORIGINATOR_C='<name of the PR author (one line)>'
XORGANIZATION_C='<organization of PR author (multiple lines)>'
XCONFIDENTIAL_C='<[ yes | no ] (one line)>'
XSYNOPSIS_C='<synopsis of the problem (one line)>'
XSEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
XPRIORITY_C='<[ low | medium | high ] (one line)>'
XCATEGORY_C='<name of the product (one line)>'
XCLASS_C='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
XRELEASE_C='<release number or tag (one line)>'
XENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
XDESCRIPTION_C='<precise description of the problem (multiple lines)>'
XHOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>'
XFIX_C='<how to correct or work around the problem, if known (multiple lines)>'
X
X# Catch some signals. ($xs kludge needed by Sun /bin/sh)
Xxs=0
Xtrap 'rm -f $REF $TEMP; exit $xs' 0
Xtrap 'echo "$COMMAND: Aborting ..."; rm -f $REF $TEMP; xs=1; exit' 1 2 3 13 15
X
X# If they told us to use a specific file, then do so.
Xif [ -n "$IN_FILE" ]; then
X  if [ "$IN_FILE" = "-" ]; then
X    # The PR is coming from the standard input.
X    if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
X      sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP
X    else
X      cat > $TEMP
X    fi
X  else
X    # Use the file they named.
X    if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
X      sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP
X    else
X      cat $IN_FILE > $TEMP
X    fi
X  fi
Xelse
X
X  if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
X    # If their PR_FORM points to a bogus entry, then bail.
X    if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then
X      echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM"
X      sleep 1
X      PRINT_INTERN=bad_prform
X    fi
X  fi
X
X  if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
X    cp $PR_FORM $TEMP || 
X      ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit )
X  else
X    for file in $TEMP $REF ; do
X      cat  > $file << '__EOF__'
XSEND-PR: -*- send-pr -*-
XSEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
XSEND-PR: will all comments (text enclosed in `<' and `>').
XSEND-PR: 
XSEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
XSEND-PR: manual if you are not sure how to fill out a problem report.
XSEND-PR:
XSEND-PR: Choose from the following categories:
XSEND-PR:
X__EOF__
X
X      # Format the categories so they fit onto lines.
X      echo "$CATEGORIES" | awk '
X      BEGIN { printf "SEND-PR: "; i = 1 }
X           { printf ("%-12.12s", $0) ;
X	     if ((++i % 5) == 0) { printf "\nSEND-PR: "}}
X      END   { printf "\nSEND-PR:\n" }' >> $file
X
X      cat >> $file << __EOF__
XTo: $GNATS_ADDR
XSubject: 
XFrom: $FROM
XReply-To: $REPLY_TO
XX-send-pr-version: $VERSION
X
X>Submitter-Id:   $SUBMITTER
X>Originator: 	 $ORIGINATOR
X>Organization:
X`
X  if [ -n "$ORGANIZATION" ]; then
X    echo "$ORGANIZATION"
X  else
X    echo "	$ORGANIZATION_C" ;
X  fi ;
X`
X>Confidential:  $CONFIDENTIAL_C
X>Synopsis:	$SYNOPSIS_C
X>Severity:	$SEVERITY_C
X>Priority:	$PRIORITY_C
X>Category: 	$CATEGORY_C
X>Class:		$CLASS_C
X>Release:	 `if [ -n "$DEFAULT_RELEASE" ]; then
X		   echo "$DEFAULT_RELEASE"
X		  else
X		   echo "	$RELEASE_C"
X		  fi; `
X>Environment:
X    	$ENVIRONMENT_C
X`[ -n "$SYSTEM" ] && echo System: $SYSTEM`
X`[ -n "$ARCH" ] && echo Architecture: $ARCH`
X`[ -n "$MACHINE" ] && echo Machine: $MACHINE`
X>Description:
X	$DESCRIPTION_C
X>How-To-Repeat:
X	$HOW_TO_REPEAT_C
X>Fix:
X	$FIX_C
X__EOF__
X    done
X  fi
X
X  if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
X    cat $TEMP
X    xs=0; exit
X  fi
X
X  chmod u+w $TEMP
X  if [ -z "$REQUEST_ID" ]; then
X    eval $EDIT $TEMP
X  else
X    ed -s $TEMP << '__EOF__'
X/^Subject/s/^Subject:.*/Subject: request for a customer id/
X/^>Category/s/^>Category:.*/>Category: send-pr/
Xw
Xq
X__EOF__
X  fi
X
X  if cmp -s $REF $TEMP ; then
X    echo "$COMMAND: problem report not filled out, therefore not sent"
X    xs=1; exit
X  fi
Xfi
X
X#
X#	Check the enumeration fields
X
X# This is a "sed-subroutine" with one keyword parameter 
X# (with workaround for Sun sed bug)
X#
XSED_CMD='
X/$PATTERN/{
Xs|||
Xs|<.*>||
Xs|^[ 	]*||
Xs|[ 	]*$||
Xp
Xq
X}'
X
X
Xwhile [ -z "$REQUEST_ID" ]; do
X  CNT=0
X
X  # 1) Confidential
X  #
X  PATTERN=">Confidential:"
X  CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
X  case "$CONFIDENTIAL" in
X    ""|yes|no) CNT=`expr $CNT + 1` ;;
X    *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
X  esac
X  #
X  # 2) Severity
X  #
X  PATTERN=">Severity:"
X  SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
X  case "$SEVERITY" in
X    ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
X    *)  echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
X  esac
X  #
X  # 3) Priority
X  #
X  PATTERN=">Priority:"
X  PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
X  case "$PRIORITY" in
X    ""|low|medium|high) CNT=`expr $CNT + 1` ;;
X    *)  echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
X  esac
X  #
X  # 4) Category
X  #
X  PATTERN=">Category:"
X  CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
X  FOUND=
X  for C in $CATEGORIES
X  do
X    if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi
X  done
X  if [ -n "$FOUND" ]; then
X    CNT=`expr $CNT + 1`	
X  else
X    if [ -z "$CATEGORY" ]; then
X      echo "$COMMAND: you must include a Category: field in your report."
X    else
X      echo "$COMMAND: \`$CATEGORY' is not a known category."
X    fi
X  fi
X  #
X  # 5) Class
X  #
X  PATTERN=">Class:"
X  CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
X  case "$CLASS" in
X    ""|sw-bug|doc-bug|change-request|support) CNT=`expr $CNT + 1` ;;
X    *)  echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
X  esac
X
X  [ $CNT -lt 5 -a -z "$BATCH" ] && 
X    echo "Errors were found with the problem report."
X
X  while true; do
X    if [ -z "$BATCH" ]; then
X      echo -n "a)bort, e)dit or s)end? "
X      read input
X    else
X      if [ $CNT -eq 5 ]; then
X        input=s
X      else
X        input=a
X      fi
X    fi
X    case "$input" in
X      a*)
X	if [ -z "$BATCH" ]; then
X	  echo "$COMMAND: the problem report remains in $BAD and is not sent."
X	  mv $TEMP $BAD
X        else
X	  echo "$COMMAND: the problem report is not sent."
X	fi
X	xs=1; exit
X	;;
X      e*)
X        eval $EDIT $TEMP
X	continue 2
X	;;
X      s*)
X	break 2
X	;;
X    esac
X  done
Xdone
X#
X#	Remove comments and send the problem report
X#	(we have to use patterns, where the comment contains regex chars)
X#
X# /^>Originator:/s;$ORIGINATOR;;
Xsed  -e "
X/^SEND-PR:/d
X/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
X/^>Confidential:/s;<.*>;;
X/^>Synopsis:/s;$SYNOPSIS_C;;
X/^>Severity:/s;<.*>;;
X/^>Priority:/s;<.*>;;
X/^>Category:/s;$CATEGORY_C;;
X/^>Class:/s;<.*>;;
X/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
X/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
X/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
X/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
X/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
X" $TEMP > $REF
X
Xif $MAIL_AGENT < $REF; then
X  echo "$COMMAND: problem report sent"
X  xs=0; exit
Xelse
X  echo "$COMMAND: mysterious mail failure."
X  if [ -z "$BATCH" ]; then
X    echo "$COMMAND: the problem report remains in $BAD and is not sent."
X    mv $REF $BAD
X  else
X    echo "$COMMAND: the problem report is not sent."
X  fi
X  xs=1; exit
Xfi
END-of-send-pr.sh
exit