Fix blkarg.c test to fail even on alpha.
[official-gcc.git] / texinfo / gen-info-dir
blobede0daa7e7b9e4a19df55b47062fc4f319e31f4f
1 #!/bin/sh
3 # generate an Info directory, given a directory of Info files and a
4 # list of entries. The output will be suitable for a dir.info file,
5 # in the order given in the skeleton file
7 INFODIR=$1
8 if [ $# = 2 ] ; then
9 SKELETON=$2
10 else
11 SKELETON=/dev/null
14 skip=
16 if [ $# -gt 2 ] ; then
17 echo usage: $0 info-directory [ skeleton-file ] 1>&2
18 exit 1
19 else
20 true
23 if [ ! -d ${INFODIR} ] ; then
24 echo "$0: first argument must specify a directory"
25 exit 1
28 infofiles=`(cd ${INFODIR}; ls *.info | sort | sed "s/dir\.info//")`
29 template=`cat ${SKELETON}`
31 ### output the dir.info header
32 echo "-*- Text -*-"
33 echo "This file was generated automatically by the gen-info-dir script."
34 echo "This version was generated on `date`"
35 echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
37 cat << moobler
39 This is the file .../info/dir, which contains the topmost node of the
40 Info hierarchy. The first time you invoke Info you start off
41 looking at that node, which is (dir)Top.
42 \x1f
43 File: dir Node: Top This is the top of the INFO tree
44 This (the Directory node) gives a menu of major topics.
45 Typing "d" returns here, "q" exits, "?" lists all INFO commands, "h"
46 gives a primer for first-timers, "mTexinfo<Return>" visits Texinfo topic,
47 etc.
48 --- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) ---
50 * Menu: The list of major topics begins on the next line.
52 moobler
55 ### go through the list of files in the template. If an info file
56 ### exists, grab the ENTRY information from it. If there is no entry
57 ### info, then create a minimal dir entry, otherwise use the given info.
58 ###
59 ### Then remove that file from the list of existing files. If any
60 ### additional files remain (ones that don't have a template entry),
61 ### then generate entries for those in the same way, putting the info for
62 ### those at the very end....
64 for file in ${template} ; do
65 if [ "${file}" = "--" ] ; then
66 skip=1
67 else
68 if [ -f ${INFODIR}/${file}.info ] ; then
69 entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}.info`
70 if [ ! -z "${skip}" ] ; then
71 echo
72 skip=
75 if [ ! -z "${entry}" ] ; then
76 echo "${entry}"
77 else
78 echo "* ${file}: (${file})."
81 infofiles=`echo ${infofiles} | sed -e "s/${file}\.info//"`
83 fi
84 done
86 if [ -z "${infofiles}" ] ; then
87 exit 0
88 else
89 echo
92 for file in ${infofiles}; do
93 entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}`
95 if [ ! -z "${entry}" ] ; then
96 echo "${entry}"
97 else
98 echo "* ${file}: (${file})."
100 done