ttce2xdr: use autoconf substitutions

This commit is contained in:
Chase
2025-12-19 22:31:54 -05:00
committed by Jon Trulson
parent 7ab683d29a
commit 36b6f82ee8
3 changed files with 59 additions and 70 deletions

View File

@@ -617,6 +617,7 @@ lib/tt/bin/Makefile
lib/tt/bin/shell/Makefile lib/tt/bin/shell/Makefile
lib/tt/bin/ttauth/Makefile lib/tt/bin/ttauth/Makefile
lib/tt/bin/scripts/Makefile lib/tt/bin/scripts/Makefile
lib/tt/bin/scripts/ttce2xdr
lib/tt/bin/tttar/Makefile lib/tt/bin/tttar/Makefile
lib/tt/bin/tt_type_comp/Makefile lib/tt/bin/tt_type_comp/Makefile
lib/tt/bin/tttrace/Makefile lib/tt/bin/tttrace/Makefile

View File

@@ -1,16 +1,4 @@
MAINTAINERCLEANFILES = Makefile.in MAINTAINERCLEANFILES = Makefile.in
TT_VERSION = "CDE Version @CDE_VERSION_MAJOR@.@CDE_VERSION_MINOR@.@CDE_VERSION_MICRO@@CDE_VERSION_DEV@"
TT_VERSION_DEFINE = -DTT_VERSION_STRING=\"$(TT_VERSION)\"
noinst_SCRIPTS = ttce2xdr noinst_SCRIPTS = ttce2xdr
BUILT_SOURCES = ttce2xdr
CLEANFILES = ttce2xdr CLEANFILES = ttce2xdr
AM_CPPFLAGS = $(TT_VERSION_DEFINE)
ttce2xdr: ttce2xdr.cpp
$(RM) $@
$(GENCPP) -P -DXCOMM=# $(AM_CPPFLAGS) $< > $@

View File

@@ -1,18 +1,18 @@
XCOMM! /bin/sh #!/bin/sh
XCOMM $XConsortium: ttce2xdr.cpp /main/4 1996/04/21 19:11:34 drk $ # $XConsortium: ttce2xdr.cpp /main/4 1996/04/21 19:11:34 drk $
XCOMM (c) Copyright 1996 Digital Equipment Corporation. # (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company. # (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp. # (c) Copyright 1993,1994,1996 International Business Machines Corp.
XCOMM (c) Copyright 1992-1994,1996 Sun Microsystems, Inc. # (c) Copyright 1992-1994,1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993,1994,1996 Novell, Inc. # (c) Copyright 1993,1994,1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED. # (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi. # (c) Copyright 1996 Hitachi.
XCOMM #
XCOMM ttce2xdr - Convert ToolTalk Classing Engine tables to XDR types database # ttce2xdr - Convert ToolTalk Classing Engine tables to XDR types database
XCOMM #
XCOMM usage # usage
XCOMM #
usage() { usage() {
echo "$1: convert ToolTalk CE tables to XDR types database" echo "$1: convert ToolTalk CE tables to XDR types database"
echo "Usage: $1 [-xn][-d user|system]" echo "Usage: $1 [-xn][-d user|system]"
@@ -29,32 +29,32 @@ usage() {
echo " <OPENWINHOME2> OWv3 installation to write to" echo " <OPENWINHOME2> OWv3 installation to write to"
} }
XCOMM #
XCOMM version # version
XCOMM #
version() { version() {
echo TT_VERSION_STRING echo "CDE Version @CDE_VERSION_MAJOR@.@CDE_VERSION_MINOR@.@CDE_VERSION_MICRO@@CDE_VERSION_DEV@"
} }
XCOMM #
XCOMM cleanup - Call me before exiting # cleanup - Call me before exiting
XCOMM #
cleanup() { cleanup() {
rm -f /tmp/ttce2xdr.types.$$ /tmp/ttce2xdr.types.$$.deps /tmp/ttce2xdr.ceascii.$$ rm -f /tmp/ttce2xdr.types.$$ /tmp/ttce2xdr.types.$$.deps /tmp/ttce2xdr.ceascii.$$
} }
XCOMM #
XCOMM nullit - create null ~/.tt/xdr.types so auto convert won't be run # nullit - create null ~/.tt/xdr.types so auto convert won't be run
XCOMM next time # next time
XCOMM #
nullit() { nullit() {
test -d $HOME/.tt || mkdir $HOME/.tt test -d $HOME/.tt || mkdir $HOME/.tt
touch $HOME/.tt/types.xdr touch $HOME/.tt/types.xdr
} }
XCOMM #
XCOMM Main # Main
XCOMM #
trap cleanup 0 1 2 3 15 trap cleanup 0 1 2 3 15
cmd=`basename $0` cmd=`basename $0`
@@ -64,9 +64,9 @@ database=
ow1= ow1=
ow2= ow2=
XCOMM #
XCOMM Parse command line # Parse command line
XCOMM #
args=$* args=$*
while getopts hxnvrfd: option while getopts hxnvrfd: option
do do
@@ -79,14 +79,14 @@ do
esac esac
done done
XCOMM #
XCOMM Discard args processed by getopts # Discard args processed by getopts
XCOMM #
shift `expr $OPTIND - 1` shift `expr $OPTIND - 1`
XCOMM #
XCOMM Process mandatory args # Process mandatory args
XCOMM #
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
ow1=$1 ow1=$1
shift shift
@@ -96,9 +96,9 @@ if [ $# -gt 0 ]; then
fi fi
fi fi
XCOMM #
XCOMM Check for extraneous args # Check for extraneous args
XCOMM #
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
usage $cmd usage $cmd
exit 1 exit 1
@@ -122,13 +122,13 @@ else
database="user" database="user"
fi fi
XCOMM if we are doing user (perhaps automatic) conversion. make # if we are doing user (perhaps automatic) conversion. make
XCOMM sure there is some conversion to do, otherwise we can bail out # sure there is some conversion to do, otherwise we can bail out
XCOMM early. # early.
if [ "$database" = "user" ]; then if [ "$database" = "user" ]; then
if [ ! -f $HOME/.cetables/cetables ]; then if [ ! -f $HOME/.cetables/cetables ]; then
XCOMM user doesn't even have a cetables, nothing to do # user doesn't even have a cetables, nothing to do
nullit nullit
exit 0 exit 0
fi fi
@@ -138,22 +138,22 @@ XCOMM user doesn't even have a cetables, nothing to do
if egrep -s "NS_NAME=SUN_TOOLTALK_TYPES" /tmp/ttce2xdr.ceascii.$$ ; then if egrep -s "NS_NAME=SUN_TOOLTALK_TYPES" /tmp/ttce2xdr.ceascii.$$ ; then
: :
else else
XCOMM user has cetables, but no ToolTalk types # user has cetables, but no ToolTalk types
nullit nullit
exit 0 exit 0
fi fi
XCOMM Now, we know the user has a cetables with ToolTalk types. Now # Now, we know the user has a cetables with ToolTalk types. Now
XCOMM check for a possible malformed cetables with no ToolTalk name # check for a possible malformed cetables with no ToolTalk name
XCOMM space definition. # space definition.
if egrep -s '^NS_ATTR=$' /tmp/ttce2xdr.ceascii.$$ ; then if egrep -s '^NS_ATTR=$' /tmp/ttce2xdr.ceascii.$$ ; then
XCOMM The cetables exists, and has ToolTalk types, but # The cetables exists, and has ToolTalk types, but
XCOMM since the basic definitions in the network CE database # since the basic definitions in the network CE database
XCOMM may be gone, we need to add them back in. Eventually # may be gone, we need to add them back in. Eventually
XCOMM in a future release we should remove all ToolTalk info # in a future release we should remove all ToolTalk info
XCOMM from user's cetables. # from user's cetables.
ed /tmp/ttce2xdr.ceascii.$$ >/dev/null <<- 'EOF' ed /tmp/ttce2xdr.ceascii.$$ >/dev/null <<- 'EOF'
/^NS_ATTR=$/d /^NS_ATTR=$/d
@@ -222,11 +222,11 @@ else
fi fi
rm -f /tmp/ttce2xdr.types.$$ rm -f /tmp/ttce2xdr.types.$$
if tt_type_comp -Eps $dbopt > /tmp/ttce2xdr.types.$$; then :; else if tt_type_comp -Eps $dbopt > /tmp/ttce2xdr.types.$$; then :; else
XCOMM Conversion failed for some reason. If we're working on a # Conversion failed for some reason. If we're working on a
XCOMM user database, we're probably doing an automatic conversion. # user database, we're probably doing an automatic conversion.
XCOMM and there's no point in continuing to retry this every time. # and there's no point in continuing to retry this every time.
XCOMM Just touch the .tt/types.xdr file so auto conversion won't # Just touch the .tt/types.xdr file so auto conversion won't
XCOMM keep getting run. # keep getting run.
case $database in case $database in
user) user)