#! /bin/sh -e

# DP: add gccbug(1) manpage

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

2003-03-11  Matthias Klose  <doko@debian.org> 

	* Makefile.in (generated-manpages): Add $(docdir)/gccbug.1.
	($(docdir)/gccbug.1): Build from doc/bugreport.texi,
	(maintainer-clean): Remove gccbug.1,
	(install-man): Install gccbug.1.
	* doc/bugreport.texi: Add manpage sections for gccbug(1).
	(contributed by Omni Flux <josh at nebonet dot com>).
	Do not document options possibly unsupported by a future BTS.
	* doc/.cvsignore: Add gccbug.1.


--- gcc/Makefile.in~	2003-03-02 13:49:32.000000000 +0100
+++ gcc/Makefile.in	2003-03-03 23:13:21.000000000 +0100
@@ -2541,6 +2541,7 @@
 	$(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/cppinternals.texi
 
 generated-manpages: $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1 \
+	 $(docdir)/gccbug.1 \
 	 $(docdir)/gfdl.7 $(docdir)/gpl.7 $(docdir)/fsf-funding.7 \
 	 lang.generated-manpages
 
@@ -2570,6 +2571,14 @@
 		(rm -f $(docdir)/gcc.1.T$$$$ && exit 1)
 	-rm -f gcc.pod
 
+$(docdir)/gccbug.1: $(docdir)/bugreport.texi
+	$(STAMP) $(docdir)/gccbug.1
+	-$(TEXI2POD) $(docdir)/bugreport.texi > gccbug.pod
+	-($(POD2MAN) --section=1 gccbug.pod > $(docdir)/gccbug.1.T$$$$ && \
+		mv -f $(docdir)/gccbug.1.T$$$$ $(docdir)/gccbug.1) || \
+		(rm -f $(docdir)/gccbug.1.T$$$$ && exit 1)
+	-rm -f gccbug.pod
+
 $(docdir)/gfdl.7: $(docdir)/include/fdl.texi
 	$(STAMP) $(docdir)/gfdl.7
 	-$(TEXI2POD) $(docdir)/include/fdl.texi > gfdl.pod
@@ -2736,6 +2745,7 @@
 	-rm -f $(docdir)/cpp.info* $(docdir)/gcc.info* $(docdir)/gccint.info*
 	-rm -f $(docdir)/cppinternals.info*
 	-rm -f $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1
+	-rm -f $(docdir)/gccbug.1
 	-rm -f $(docdir)/fsf-funding.7 $(docdir)/gfdl.7 $(docdir)/gpl.7
 #
 # Entry points `install' and `uninstall'.
@@ -2893,6 +2903,9 @@
 	  $(INSTALL_DATA) $(docdir)/gcc.1 $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
 	  chmod a-x $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
 	fi
+	-rm -f $(DESTDIR)$(man1dir)/gccbug$(man1ext)
+	-$(INSTALL_DATA) $(docdir)/gccbug.1 $(DESTDIR)$(man1dir)/gccbug$(man1ext)
+	-chmod a-x $(DESTDIR)$(man1dir)/gccbug$(man1ext)
 	-rm -f $(DESTDIR)$(man1dir)/cpp$(man1ext)
 	-$(INSTALL_DATA) $(docdir)/cpp.1 $(DESTDIR)$(man1dir)/cpp$(man1ext)
 	-chmod a-x $(DESTDIR)$(man1dir)/cpp$(man1ext)
@@ -3069,6 +3082,7 @@
 	-rm -rf $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext)
 	-rm -rf $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext)
 	-rm -rf $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(man1ext)
+	-rm -rf $(DESTDIR)$(man1dir)/gccbug$(man1ext)
 	-rm -rf $(DESTDIR)$(man1dir)/cpp$(man1ext)
 	-rm -rf $(DESTDIR)$(man1dir)/protoize$(man1ext)
 	-rm -rf $(DESTDIR)$(man1dir)/unprotoize$(man1ext)

--- gcc/doc/bugreport.texi.old	2003-03-13 20:56:48.000000000 +0100
+++ gcc/doc/bugreport.texi	2003-03-13 20:59:11.000000000 +0100
@@ -374,6 +374,44 @@
 @section The gccbug script
 @cindex gccbug script
 
+@ignore
+@c man begin SYNOPSIS
+gccbug
+       [ @option{--cc} @var{mail-address} ]
+       [ @option{--version} ] | [ @option{--help} ]
+@c man end
+@c Set file name and title for the man page.
+@setfilename gccbug
+@settitle Reporting GCC Bugs
+@c man begin SEEALSO
+gcc(1), send-pr(1), send-pr(8), the info entries for @file{gcc} (node Bugs),
+and the online pages at @uref{http://gcc.gnu.org/bugs.html}.
+@c man end
+@c man begin DESCRIPTION
+@command{gccbug} is a version of GNU GNATS send-pr configured for GCC bug
+reporting.
+
+Invoking @command{gccbug} calls the editor named in your environment
+variable @env{VISUAL} or @env{EDITOR} on a problem report template.
+
+Your bug reports play an essential role in making GCC reliable. However
+since the maintainers are very overloaded, please first make sure that:
+@itemize @bullet
+@item
+The problem is not already known.  See
+@uref{http://gcc.gnu.org/bugs.html#known} for a list of known bugs.
+If it isn't known, then you should report the problem.
+
+You can browse the bug database for bugs reported at
+@uref{http://gcc.gnu.org/cgi-bin/gnatsweb.pl}.
+
+@item
+You include the information that makes for fixing the bug. See
+@uref{http://gcc.gnu.org/bugs.html#report} for bug reporting instructions.
+@end itemize
+@c man end
+@end ignore
+
 To simplify creation of bug reports, and to allow better tracking of
 reports, we use the GNATS bug tracking system.  Part of that system is
 the @command{gccbug} script.  This is a Unix shell script, so you need a
@@ -382,9 +420,31 @@
 
 The gccbug script is derived from send-pr, @pxref{using
 send-pr,,Creating new Problem Reports,send-pr,Reporting Problems}.  When
-invoked, it starts a text editor so you can fill out the various fields
-of the report.  When the you quit the editor, the report is automatically
+invoked, it starts a text editor named in your environment variable
+@env{VISUAL} or @env{EDITOR} so you can fill out the various fields of
+the report.  When the you quit the editor, the report is automatically
 send to the bug reporting address.
 
 A number of fields in this bug report form are specific to GCC, and are
 explained at @uref{http://gcc.gnu.org/gnats.html}.
+
+The @command{gccbug} script accepts the following options:
+
+@c man begin OPTIONS
+@table @gcctabopt
+
+@item --cc @var{mail-address}
+Specifies the mail-address to which the PR should be carbon-copied.
+
+@item --version
+Displays the @command{gccbug} version number and a usage summary.  No mail
+is sent.
+
+@item --help
+Displays a usage summary for @command{gccbug}.  No mail is sent.
+@end table
+
+@command{gccbug} has more (undocumented) options, which may be
+unsupported by a future GCC bug tracking system.
+
+@c man end

#--- gcc/doc/.cvsignore~ 2002-06-26 20:27:50.000000000 +0200
#+++ gcc/doc/.cvsignore  2003-03-13 21:07:13.000000000 +0100
#@@ -4,6 +4,7 @@
# cpp.info*
# cppinternals.info*
# gcc.1
#+gccbug.1
# cpp.1
# gcov.1
# gfdl.7

