head	1.1;
access;
symbols
	rel-7-10-4:1.1
	STABLE:1.1.0.2
	rel-7-10-2:1.1
	rel-7-10-0:1.1;
locks; strict;
comment	@# @;


1.1
date	2007.03.02.21.49.29;	author brlcad;	state Exp;
branches;
next	;


desc
@@


1.1
log
@upgrade tcl/tk from 8.4.6 to 8.5a5; also move to a recursive configure, using AC_CONFIG_SUBDIRS to call upon tcl, tk, and enigma's configure scripts as needed instead of redoing their build systems for our purpose.  this has a rather drastic impact on the way the libraries are linked together, including the need to compile tcl/tk static so as to avoid libtool portability issues as well as letting us take advantage of their build system for reduced maintenance and easing future upgrades.  undoubtedly more build issues to be worked out with other platforms given the extent of this change.  this does move us one step closer towards correctly linking against system tcl/tk installations too.
@
text
@#!/bin/sh

ZIP=:
while true; do
    case $1 in
        -s | --symlinks  )      S="-s ";;
        -z | --compress  )    ZIP=$2;  shift ;;
	-e | --extension )      Z=$2;  shift ;;
	-s | --suffix    ) SUFFIX=$2;  shift ;;
	*)  break ;;
    esac
    shift
done
if test "$#" != 2; then
    echo "Usage: installManPages <options> file dir"
    exit 1
fi

MANPAGE=$1
DIR=$2
test -z "$S" && S="$DIR/"

# A sed script to parse the alternative names out of a man page.
#
# Backslashes are trippled in the sed script, because it is in
# backticks which doesn't pass backslashes literally.
#
NAMES=`sed -n '
#                               Look for a line, that starts with .SH NAME
#                               optionally allow NAME to be surrounded
#                               by quotes.
    /^\.SH NAME/{
#                               Read next line
	n
#                               Remove all commas ...
	s/,//g
#                               ... and backslash-escaped spaces.
	s/\\\ //g
#                               Delete from \- to the end of line
	s/ \\\-.*//
#                               print the result and exit
	p;q
    }' $MANPAGE`

case $MANPAGE in
    *.1) SECTION=1 ;;
    *.3) SECTION=3 ;;
    *.n) SECTION=n ;;
esac

SRCDIR=`dirname $MANPAGE`

FIRST=""
for f in $NAMES; do
    f=$f.$SECTION$SUFFIX
    if test -z "$FIRST" ; then
	FIRST=$f
	rm -f $DIR/$FIRST $DIR/$FIRST.*
	sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
	    $MANPAGE > $DIR/$FIRST
	chmod 444 $DIR/$FIRST
	$ZIP $DIR/$FIRST
    else
	rm -f $DIR/$f $DIR/$f.*
	ln $S$FIRST$Z $DIR/$f$Z
    fi
done
@
