| 1 | #!/bin/sh |
| 2 | # $Id: mkindex 52596 2019-11-01 18:11:31Z karl $ |
| 3 | # Public domain. Originally written by Thomas Esser around 2001.. |
| 4 | |
| 5 | test -f /bin/sh5 && test -z "$RUNNING_SH5" \ |
| 6 | && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \ |
| 7 | && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; } |
| 8 | unset RUNNING_SH5 |
| 9 | |
| 10 | test -f /bin/bsh && test -z "$RUNNING_BSH" \ |
| 11 | && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \ |
| 12 | && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } |
| 13 | unset RUNNING_BSH |
| 14 | |
| 15 | progname=`basename $0` |
| 16 | case $# in |
| 17 | 0) |
| 18 | echo "Usage: `basename $0` file[.idx|.glo] ..." 1>&2 |
| 19 | exit 1 |
| 20 | ;; |
| 21 | esac |
| 22 | |
| 23 | gind=gind.ist |
| 24 | gglo=gglo.ist |
| 25 | |
| 26 | # remember starting directory |
| 27 | dir=`pwd` |
| 28 | |
| 29 | # loop over all files |
| 30 | for i |
| 31 | do |
| 32 | destdir=`echo "$i" | sed 's/^[^\/]*$/./; s/\/[^\/]*$//'` |
| 33 | test -d "$destdir" || continue |
| 34 | cd "$destdir" || exit 1 |
| 35 | FILENAME=`basename "$i" .idx` |
| 36 | test -f "$FILENAME".idx \ |
| 37 | && makeindex -s "$gind" "$FILENAME" |
| 38 | test -f "$FILENAME".glo \ |
| 39 | && makeindex -s "$gglo" -o "$FILENAME".gls "$FILENAME".glo |
| 40 | cd "$dir" || exit 1 |
| 41 | done |