| [2] | 1 | #!/usr/bin/perl
|
|---|
| 2 | # -*- perl -*-
|
|---|
| 3 |
|
|---|
| 4 | # Copyright (C) 2001
|
|---|
| 5 | # Free Software Foundation
|
|---|
| 6 | #
|
|---|
| 7 | # This file is part of the libiberty library.
|
|---|
| 8 | # Libiberty is free software; you can redistribute it and/or
|
|---|
| 9 | # modify it under the terms of the GNU Library General Public
|
|---|
| 10 | # License as published by the Free Software Foundation; either
|
|---|
| 11 | # version 2 of the License, or (at your option) any later version.
|
|---|
| 12 | #
|
|---|
| 13 | # Libiberty is distributed in the hope that it will be useful,
|
|---|
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 16 | # Library General Public License for more details.
|
|---|
| 17 | #
|
|---|
| 18 | # You should have received a copy of the GNU Library General Public
|
|---|
| 19 | # License along with libiberty; see the file COPYING.LIB. If not,
|
|---|
| 20 | # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|---|
| 21 | # Boston, MA 02111-1307, USA.
|
|---|
| 22 | #
|
|---|
| 23 | # Originally written by DJ Delorie <[email protected]>
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | # This program looks for texinfo snippets in source files and other
|
|---|
| 28 | # files, and builds per-category files with entries sorted in
|
|---|
| 29 | # alphabetical order.
|
|---|
| 30 |
|
|---|
| 31 | # The syntax it looks for is lines starting with '@def' in *.c and
|
|---|
| 32 | # other files (see TEXIFILES in Makefile.in). Entries are terminated
|
|---|
| 33 | # at the next @def* (which begins a new entry) or, for C files, a line
|
|---|
| 34 | # that begins with '*/' without leading spaces (this assumes that the
|
|---|
| 35 | # texinfo snippet is within a C-style /* */ comment).
|
|---|
| 36 |
|
|---|
| 37 | #
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | if ($ARGV[0] eq "-v") {
|
|---|
| 42 | $verbose = 1;
|
|---|
| 43 | shift;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | $srcdir = shift;
|
|---|
| 47 | $outfile = shift;
|
|---|
| 48 |
|
|---|
| 49 | if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) {
|
|---|
| 50 | print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n";
|
|---|
| 51 | exit 1;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | $errors = 0;
|
|---|
| 55 |
|
|---|
| 56 | for $in (@ARGV) {
|
|---|
| 57 |
|
|---|
| 58 | if (!open(IN, "$srcdir/$in")) {
|
|---|
| 59 | print STDERR "Cannot open $srcdir/$in for reading: $!\n";
|
|---|
| 60 | $errors ++;
|
|---|
| 61 |
|
|---|
| 62 | } else {
|
|---|
| 63 | $first = 1;
|
|---|
| |
|---|