Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#!/bin/sh
## ChangeCaseTitle $SrcLibDir $BookCaseName $BookCaseTitle
if [ $# -lt 3 ]; then
echo "(ERROR) Usage : ChangCaseTitle SrcLibDir BookCaseName BookCaseTitle"
exit 1
fi
SrcLibDir=$1
BookCaseName=$2
BookCaseTitle=$3
MMDBMAP=bookcase.map
## first grab the entry out from the $MMDBMAP ##
awk ' BEGIN { FS="\t" }
{ if ( $1 == BookCaseName && NR > 1 )
printf("%s\t%s\t%s\t%s\t%d\t%d\n", $1, BookCaseTitle, $3, $4, $5, $6);
else { print $0 }
}' BookCaseName=$BookCaseName BookCaseTitle="$BookCaseTitle" < $SrcLibDir/$MMDBMAP > $SrcLibDir/$MMDBMAP.$$
mv $SrcLibDir/$MMDBMAP.$$ $SrcLibDir/$MMDBMAP
exit $?

View File

@@ -0,0 +1,80 @@
#!/bin/sh
##############################################################
# DeInstallBase #
# #
# Performs de-installation for the bookcase from an info #
# library. #
# #
##############################################################
#### Parse the argument ####
if [ $# -lt 2 ]; then
echo "Usage : $0 [ bookcase ] [ info-library ] " >&2
exit 1
fi
BookCase=$1
InfoLib=$2
NAMES_MMDB=$InfoLib/bookcase.map
### Validate if both bookcase and info-library is valid ###
if [ ! -f $NAMES_MMDB ]; then
echo "(ERROR) $InfoLib is not a valid info-library" >&2
exit 1
fi
if [ ! -w $NAMES_MMDB ]; then
echo "(ERROR) No write permission to de-install $BookCase "
exit 1
fi
##### Check to see if bookcase is already existing in the infolibrary
TSTSTRING=
TSTSTRING=`awk '{
if ( NR > 1 && $1 == bookcasename ) { print bookcasename }
}' bookcasename=$BookCase $NAMES_MMDB`
if [ -z "$TSTSTRING" ]; then
echo "(ERROR) $BookCase does not already exist in $InfoLib" >&2
exit 2
fi
### remove the entry in the names.mmdb file ###
TMP_NAMES_MMDB=$NAMES_MMDB.tmp
awk '{
if ( NR == 1 || $1 != bookcasename ) { print $0 }
}' bookcasename=$BookCase $NAMES_MMDB > $TMP_NAMES_MMDB
mv $TMP_NAMES_MMDB $NAMES_MMDB
### remove the physical storage of bookcase from info-lib ###
if [ ! -d $InfoLib/$BookCase ]; then
echo "(ERROR) $BookCase is not found under $InfoLib"
exit 1
fi
rm -fr $InfoLib/$BookCase
if [ $? -ne 0 ]; then
echo "(ERROR) Failed to remove $InfoLib/$BookCase" >&2
exit 1
fi
exit 0

View File

@@ -0,0 +1,222 @@
XCOMM $XConsortium: Imakefile /main/13 1996/10/09 14:13:10 drk $
XCOMM
XCOMM
XCOMM Copyright (c) 1993 HAL Computer Systems International, Ltd.
XCOMM All rights reserved. Unpublished -- rights reserved under
XCOMM the Copyright Laws of the United States. USE OF A COPYRIGHT
XCOMM NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
XCOMM OR DISCLOSURE.
XCOMM
XCOMM THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
XCOMM SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
XCOMM DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
XCOMM PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
XCOMM INTERNATIONAL, LTD.
XCOMM
XCOMM RESTRICTED RIGHTS LEGEND
XCOMM Use, duplication, or disclosure by the Government is subject
XCOMM to the restrictions as set forth in subparagraph (c)(l)(ii)
XCOMM of the Rights in Technical Data and Computer Software clause
XCOMM at DFARS 252.227-7013.
XCOMM
XCOMM HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
XCOMM 1315 Dell Avenue
XCOMM Campbell, CA 95008
XCOMM
XCOMM
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
INCLUDES=$(GLOBAL_INCLUDES) $(MMDB_INCLUDES) $(EXCEPTIONS_INCLUDES)
MMDB_DIR=../../mmdb
#ifdef AIXArchitecture
API_OBJS = \
$(MMDB_DIR)/api/base.o $(MMDB_DIR)/api/info_base.o \
$(MMDB_DIR)/api/info_lib.o $(MMDB_DIR)/api/smart_ptr.o \
$(MMDB_DIR)/api/transaction.o $(MMDB_DIR)/api/utility.o
BTREE_OBJS = \
$(MMDB_DIR)/btree/mmdb_btree.o
#if !defined(AIXArchitecture)
EXTRA_BTREE_BERKELEY_OBJS = $(MMDB_DIR)/btree_berkeley/memmove.o
#endif
BTREE_BERKELEY_OBJS = \
$(MMDB_DIR)/btree_berkeley/bt_close.o $(MMDB_DIR)/btree_berkeley/bt_conv.o \
$(MMDB_DIR)/btree_berkeley/bt_debug.o $(MMDB_DIR)/btree_berkeley/bt_delete.o \
$(MMDB_DIR)/btree_berkeley/bt_get.o $(MMDB_DIR)/btree_berkeley/bt_open.o \
$(MMDB_DIR)/btree_berkeley/bt_overflow.o $(MMDB_DIR)/btree_berkeley/bt_page.o \
$(MMDB_DIR)/btree_berkeley/bt_put.o $(MMDB_DIR)/btree_berkeley/bt_search.o \
$(MMDB_DIR)/btree_berkeley/bt_seq.o $(MMDB_DIR)/btree_berkeley/bt_split.o \
$(MMDB_DIR)/btree_berkeley/bt_stack.o $(MMDB_DIR)/btree_berkeley/bt_utils.o \
$(MMDB_DIR)/btree_berkeley/mktemp.o $(MMDB_DIR)/btree_berkeley/realloc.o \
$(MMDB_DIR)/btree_berkeley/snprintf.o $(EXTRA_BTREE_BERKELEY_OBJS) \
$(MMDB_DIR)/btree_berkeley/mpool.o $(MMDB_DIR)/btree_berkeley/db.o
COMPRESSION_OBJS = \
$(MMDB_DIR)/compression/abs_agent.o $(MMDB_DIR)/compression/zip.o \
$(MMDB_DIR)/compression/huffman.o $(MMDB_DIR)/compression/trie.o \
$(MMDB_DIR)/compression/code.o $(MMDB_DIR)/compression/lzss.o \
$(MMDB_DIR)/compression/sgml.o $(MMDB_DIR)/compression/ps.o
DISKHASH_OBJS = \
$(MMDB_DIR)/diskhash/disk_bucket.o $(MMDB_DIR)/diskhash/bucket_array.o \
$(MMDB_DIR)/diskhash/disk_hash.o
DSTR_OBJS = \
$(MMDB_DIR)/dstr/set.o $(MMDB_DIR)/dstr/bset.o \
$(MMDB_DIR)/dstr/slist.o $(MMDB_DIR)/dstr/dlist_cell.o \
$(MMDB_DIR)/dstr/dlist.o $(MMDB_DIR)/dstr/heap.o \
$(MMDB_DIR)/dstr/void_ptr_array.o $(MMDB_DIR)/dstr/void_ptr_stack.o \
$(MMDB_DIR)/dstr/memory_pool.o $(MMDB_DIR)/dstr/dstr_test.o \
$(MMDB_DIR)/dstr/index_agent.o $(MMDB_DIR)/dstr/token_stack.o \
$(MMDB_DIR)/dstr/slist_char_ptr_cell.o
DTI_EXCS_OBJS = \
$(MMDB_DIR)/dti_excs/Jump_Environment.o $(MMDB_DIR)/dti_excs/Exceptions.o \
$(MMDB_DIR)/dti_excs/Exception.o $(MMDB_DIR)/dti_excs/Destructable.o \
$(MMDB_DIR)/dti_excs/terminate.o
DYNHASH_OBJS = \
$(MMDB_DIR)/dynhash/data_t.o $(MMDB_DIR)/dynhash/imp_bucket.o \
$(MMDB_DIR)/dynhash/imp_die.o
HMPHF_OBJS = \
$(MMDB_DIR)/hmphf/buckets.o $(MMDB_DIR)/hmphf/mphf_funcs.o \
$(MMDB_DIR)/hmphf/mphf_hash_table.o $(MMDB_DIR)/hmphf/params.o \
$(MMDB_DIR)/hmphf/pattern.o $(MMDB_DIR)/hmphf/sorter.o
INDEX_OBJS = \
$(MMDB_DIR)/index/btree_index.o $(MMDB_DIR)/index/dyn_disk_index.o \
$(MMDB_DIR)/index/dyn_index.o $(MMDB_DIR)/index/dyn_memory_index.o \
$(MMDB_DIR)/index/fast_mphf.o $(MMDB_DIR)/index/hash.o \
$(MMDB_DIR)/index/index.o $(MMDB_DIR)/index/inv_lists.o \
$(MMDB_DIR)/index/mphf_index.o
MGRS_OBJS = \
$(MMDB_DIR)/mgrs/managers.o $(MMDB_DIR)/mgrs/misc.o \
$(MMDB_DIR)/mgrs/query_mgr.o $(MMDB_DIR)/mgrs/template_mgr.o
MISC_OBJS = \
$(MMDB_DIR)/misc/unique_id.o
OBJECT_OBJS = \
$(MMDB_DIR)/object/composite.o $(MMDB_DIR)/object/compressed_pstring.o \
$(MMDB_DIR)/object/cset.o $(MMDB_DIR)/object/dl_list.o \
$(MMDB_DIR)/object/dl_list_cell.o $(MMDB_DIR)/object/handler.o \
$(MMDB_DIR)/object/integer.o $(MMDB_DIR)/object/long_pstring.o \
$(MMDB_DIR)/object/oid.o $(MMDB_DIR)/object/oid_list.o \
$(MMDB_DIR)/object/oid_t.o $(MMDB_DIR)/object/primitive.o \
$(MMDB_DIR)/object/pstring.o $(MMDB_DIR)/object/random_gen.o \
$(MMDB_DIR)/object/root.o $(MMDB_DIR)/object/short_list.o \
$(MMDB_DIR)/object/tuple.o
OLIASDB_OBJS = \
$(MMDB_DIR)/oliasdb/asciiIn_filters.o $(MMDB_DIR)/oliasdb/collectionIterator.o \
$(MMDB_DIR)/oliasdb/dlp_hd.o $(MMDB_DIR)/oliasdb/dlp_test.o \
$(MMDB_DIR)/oliasdb/doc_hd.o $(MMDB_DIR)/oliasdb/doc_test.o \
$(MMDB_DIR)/oliasdb/graphic_hd.o $(MMDB_DIR)/oliasdb/graphic_test.o \
$(MMDB_DIR)/oliasdb/loc_test.o $(MMDB_DIR)/oliasdb/locator_hd.o \
$(MMDB_DIR)/oliasdb/mark.o $(MMDB_DIR)/oliasdb/mark_base.o \
$(MMDB_DIR)/oliasdb/mark_test.o $(MMDB_DIR)/oliasdb/mmdb.o \
$(MMDB_DIR)/oliasdb/node_hd.o $(MMDB_DIR)/oliasdb/node_test.o \
$(MMDB_DIR)/oliasdb/olias_funcs.o $(MMDB_DIR)/oliasdb/olias_test.o \
$(MMDB_DIR)/oliasdb/stylesheet_hd.o $(MMDB_DIR)/oliasdb/stylesheet_test.o \
$(MMDB_DIR)/oliasdb/toc_hd.o $(MMDB_DIR)/oliasdb/toc_test.o \
$(MMDB_DIR)/oliasdb/user_base.o
SCHEMA_OBJS = \
$(MMDB_DIR)/schema/desc.o $(MMDB_DIR)/schema/store_desc.o \
$(MMDB_DIR)/schema/object_dict.o $(MMDB_DIR)/schema/stored_object_desc.o \
$(MMDB_DIR)/schema/index_desc.o $(MMDB_DIR)/schema/inv_desc.o \
$(MMDB_DIR)/schema/agent_desc.o $(MMDB_DIR)/schema/container_desc.o \
$(MMDB_DIR)/schema/sheet.o $(MMDB_DIR)/schema/token.o
STORAGE_OBJS = \
$(MMDB_DIR)/storage/abs_storage.o $(MMDB_DIR)/storage/chunks_index.o \
$(MMDB_DIR)/storage/heap_comp_funcs.o $(MMDB_DIR)/storage/lru.o \
$(MMDB_DIR)/storage/page.o $(MMDB_DIR)/storage/page_cache.o \
$(MMDB_DIR)/storage/page_rep.o $(MMDB_DIR)/storage/page_storage.o \
$(MMDB_DIR)/storage/rep_cell.o $(MMDB_DIR)/storage/rep_policy.o \
$(MMDB_DIR)/storage/store_test.o $(MMDB_DIR)/storage/unixf_storage.o \
$(MMDB_DIR)/storage/version.o $(MMDB_DIR)/storage/vm_storage.o
UTILITY_OBJS = \
$(MMDB_DIR)/utility/funcs.o $(MMDB_DIR)/utility/ostring.o \
$(MMDB_DIR)/utility/pm_random.o $(MMDB_DIR)/utility/atoi_pearson.o \
$(MMDB_DIR)/utility/xtime.o $(MMDB_DIR)/utility/buffer.o \
$(MMDB_DIR)/utility/atoi_larson.o $(MMDB_DIR)/utility/atomic_lock.o \
$(MMDB_DIR)/utility/rw_lock.o $(MMDB_DIR)/utility/atoi_fast.o \
$(MMDB_DIR)/utility/filter.o $(MMDB_DIR)/utility/mmdb_exception.o \
$(MMDB_DIR)/utility/randomize.o
DTI_CC_OBJS = \
$(MMDB_DIR)/dti_cc/CC_Listbase.o $(MMDB_DIR)/dti_cc/cc_exceptions.o \
$(MMDB_DIR)/dti_cc/CC_String.o $(MMDB_DIR)/dti_cc/CC_Tokenizer.o \
$(MMDB_DIR)/dti_cc/CC_Stack.o $(MMDB_DIR)/dti_cc/CC_Slist.o
#if defined(HPArchitecture) || !defined(CplusplusCompilerMajorVersion) || (CplusplusCompilerMajorVersion != 4)
EXTRA_HARDCOPY_OBJS = $(MMDB_DIR)/HardCopy/TemplatesAutoNumber.o
#endif
HARDCOPY_OBJS = \
$(MMDB_DIR)/HardCopy/FPset.o $(MMDB_DIR)/HardCopy/HardCopyFP.o \
$(MMDB_DIR)/HardCopy/autoNumber.o $(MMDB_DIR)/HardCopy/autoNumberFP.o \
$(EXTRA_HARDCOPY_OBJS)
#if defined(HPArchitecture) || !defined(CplusplusCompilerMajorVersion) || (CplusplusCompilerMajorVersion != 4)
EXTRA_STYLESHEET_OBJS = $(MMDB_DIR)/StyleSheet/SSTemplates.o
#endif
STYLESHEET_OBJS = \
$(MMDB_DIR)/StyleSheet/Attribute.o $(MMDB_DIR)/StyleSheet/AttributeList.o \
$(MMDB_DIR)/StyleSheet/BitVector.o $(MMDB_DIR)/StyleSheet/DocParser.o \
$(MMDB_DIR)/StyleSheet/Element.o $(MMDB_DIR)/StyleSheet/Expression.o \
$(MMDB_DIR)/StyleSheet/Feature.o $(MMDB_DIR)/StyleSheet/FeatureDefDictionary.o \
$(MMDB_DIR)/StyleSheet/FeatureSet.o $(MMDB_DIR)/StyleSheet/FeatureValue.o \
$(MMDB_DIR)/StyleSheet/PathQualifier.o $(MMDB_DIR)/StyleSheet/PathTable.o \
$(MMDB_DIR)/StyleSheet/Resolver.o $(MMDB_DIR)/StyleSheet/ResolverStack.o \
$(MMDB_DIR)/StyleSheet/SSPath.o $(MMDB_DIR)/StyleSheet/StyleSheet.o \
$(MMDB_DIR)/StyleSheet/StyleSheetExceptions.o \
$(MMDB_DIR)/StyleSheet/SymTab.o $(MMDB_DIR)/StyleSheet/VariableTable.o \
$(MMDB_DIR)/StyleSheet/defParser.o $(MMDB_DIR)/StyleSheet/defToken.o \
$(MMDB_DIR)/StyleSheet/style.o $(MMDB_DIR)/StyleSheet/tokenStyle.o \
$(MMDB_DIR)/StyleSheet/RendererHCV.o $(EXTRA_STYLESHEET_OBJS)
MMDB_OBJS = $(HARDCOPY_OBJS) $(STYLESHEET_OBJS) $(DTI_CC_OBJS)
ALL_MMDB_OBJS = $(API_OBJS) $(BTREE_OBJS) \
$(BTREE_BERKELEY_OBJS) $(COMPRESSION_OBJS) \
$(DISKHASH_OBJS) $(DSTR_OBJS) \
$(DTI_EXCS_OBJS) $(DYNHASH_OBJS) \
$(HMPHF_OBJS) $(INDEX_OBJS) \
$(MGRS_OBJS) $(MISC_OBJS) \
$(OBJECT_OBJS) $(OLIASDB_OBJS) \
$(SCHEMA_OBJS) $(STORAGE_OBJS) \
$(UTILITY_OBJS) $(MMDB_OBJS)
#endif
#ifdef AIXArchitecture
Libs=$(ALL_MMDB_OBJS) $(DTSVCLIB) $(TTLIB) $(MATH_LIB)
#else
Libs=$(MMDB_LIBS) $(DTSVCLIB) $(TTLIB) $(MATH_LIB)
#endif
SimpleCPlusPlusProgram(valBase,valBase.o,$(Libs))
InstallBuildToolsBinary(valBase)
InstallPlatformBuildToolsScript(DeInstallBase)
InstallPlatformBuildToolsScript(ChangeCaseTitle)
InstallPlatformBuildToolsScript(Librarian)
SRCS = valBase.C
DependTarget()

View File

@@ -0,0 +1,159 @@
#!/bin/sh
##############################################################
# InstallBase #
# #
# Performs installation for bookcase #
# #
##############################################################
#### Parse the argument ####
INSTALL_BOOKCASE=
while getopts p:b:i OPTS
do
case $OPTS in
p) # position to install the bookcase
Position=$OPTARG
;;
b) # grap the bookcase
BookCase=$OPTARG
## Make sure it doesn't have any trailing / ###
BookCase=`echo $BookCase | sed "s/\(.*\)\/$/\1/g"`
;;
i) # Install the bookcase even if it already exists in the InfoLib
INSTALL_BOOKCASE="YES"
;;
\?) # Unrecognized option - exit with 1
usage_f
exit 1
;;
esac
done
if [ "$OPTIND" -gt "$#" -o -z "$BookCase" ]; then
echo "Usage : $0 [ -i ] [ -p position ] -b bookcase info-lib " >&2
exit 1
fi
shift `expr $OPTIND - 1`
if [ $? -ne 0 ]; then
echo "(ERROR) shift failed" >&2
exit 1
fi
InfoLib=$1
BookCaseName=`basename $BookCase`
NAMES_MMDB=$InfoLib/names.mmdb
NAMES_MMDB_TMP=$InfoLib/names.mmdb.$$
if [ -z "$Position" ]; then
Position="END"
fi
### first check if bookcase exists ###
if [ ! -f $NAMES_MMDB ]; then
echo "(ERROR) $InfoLib is not a valid info-library" >&2
exit 1
fi
TSTSTRING=
TSTSTRING=`awk '{
if ( $1 == bookcasename ) { print bookcasename }
}' bookcasename=$BookCaseName $NAMES_MMDB`
if [ -n "$TSTSTRING" ]; then
if [ -z "$INSTALL_BOOKCASE" ]; then
echo "$BookCaseName already exists in $InfoLib, no installation takes place" >&2
exit 2
fi
### Prepare names.mmdb file for update
awk '{
if ( $1 != bookcasename ) { print $0 }
}' bookcasename=$BookCaseName $NAMES_MMDB > $NAMES_MMDB_TMP
### Clean up everything there before proceeding ###
( cd $InfoLib/$BookCaseName ; rm -r ./* )
else
cp $NAMES_MMDB $NAMES_MMDB_TMP
fi
### perform validation for the bookcase against the infolibrary ###
# InfoValidate $BookCase $InfoLib
if [ $? -ne 0 ]; then
exit 1
fi
### Grap the entry line for the bookcase
BaseDir=`dirname $BookCase`
if [ -z "$BaseDir" ]; then
echo "(ERROR) Info-library for $BookCase is not found" >&2
exit 1
fi
if [ ! -f $BaseDir/names.mmdb ]; then
echo "(ERROR) BaseDir/names.mmdb does not exist in $InfoLib" >&2
exit 1
fi
BookEntryLine=`awk '{
if ( $1 == bookcasename ) { print $0 }
}' bookcasename=$BookCaseName $BaseDir/names.mmdb`
if [ -z "$BookEntryLine" ]; then
echo "(ERROR) $BookCase does not exist in $InfoLib" >&2
exit 1
fi
### Update the names.mmdb file with the new entry ###
if [ "$Position" != "END" ]; then
awk '{
if ( NR != position ) { print $0 }
if ( NR == position ) { print bookcaseEntry; print $0 }
}' position=$Position bookcaseEntry="$BookEntryLine" $NAMES_MMDB_TMP > \
$NAMES_MMDB
else
echo "$BookEntryLine" >> $NAMES_MMDB_TMP
mv $NAMES_MMDB_TMP $NAMES_MMDB
fi
rm -f $NAMES_MMDB_TMP
### Copy the physical data to the infolib
( cd $BaseDir ; tar cf - $BookCaseName ) | ( cd $InfoLib; tar xof - )
if [ $? -ne 0 ]; then
echo "(ERROR) Unable to install $BookCase to $InfoLib" >&2
exit 1
fi
exit 0

View File

@@ -0,0 +1,770 @@
#!/bin/sh
set -h
###############################################################################
#
# Set up shell traps
#
###############################################################################
USERPATH=$PATH
PATH=/bin:/usr/bin:/usr/sbin
RETCODE=0
trap '\
RETCODE=${RETCODE:-$?} ;\
/bin/rm -rf $BogusInfoLibDir ;\
/bin/rm -f $SRCLIBPATH/$MMDBMAP.1.$$ ;\
/bin/rm -f $SRCLIBPATH/$MMDBMAP.2.$$ ;\
exit $RETCODE \
' 0 1 2 3 4 5 6 7 8 10 12 15
###############################################################################
ECHOCMD="echo"
ECHOSUF='\\c'
if [ -n "`eval $ECHOCMD $ECHOSUF`" ]; then
ECHOCMD="echo -n"
ECHOSUF=""
fi
echo_f() {
eval $ECHOCMD "$1$ECHOSUF"
}
###############################################################################
confirm_f() {
YorN=
echo ""
echo_f "\ \ \ \ Is \[$1] correct? \[ynq\]\ "
read YorN
if [ "$YorN" = "q" -o "$YorN" = "Q" ] ; then
exit 0
fi
if [ -z "$YorN" -o "$YorN" = "y" -o "$YorN" = "Y" ] ; then
return 1
else
return 0
fi
}
###############################################################################
read_f() {
ANSWER=
read ANSWER
if [ "$ANSWER" = "q" -o "$ANSWER" = "Q" ] ; then
exit 0
fi
}
###############################################################################
DisplayMenu() {
clear
echo "
1) List bookcases in a library
2) Copy a bookcase from another library
3) Rename a bookcase
4) Rearrange bookcases in a library
5) Remove a bookcase
6) Exit
"
echo_f "Please enter your choice \[1-6\]\ "
}
###############################################################################
### Listing of all bookcases available in $1
ListCatalog () {
# list all the bookcases available in the infolib parameter
echo "
The bookcases available in [$1] are:
"
awk 'BEGIN { FS="\t" }
{ if (NR > 1) printf (" %d) %s\t[%s]\n", NR-1, $1, $2 ) }' \
< $1/$MMDBMAP
}
###############################################################################
MoveCatalog () {
# list all the bookcases available in the infolib parameter
echo "
The order of the bookcase(s) without [$BOOKCASENAME1] is:
"
awk 'BEGIN { FS="\t" }
{ if (NR > 1) printf (" %d) %s\t[%s]\n", NR-1, $1, $2 ) }' \
< $1
}
###############################################################################
ValidateInfolibPath () {
INFOLIB=$1
if [ -z "$INFOLIB" -o ! -d $INFOLIB ] ; then
echo "(ERROR) $INFOLIB is not a valid information library" >&2
INFOLIB=""
return
fi
cd $INFOLIB
INFOLIB=`pwd`
cd $CURDIR
}
###############################################################################
ListLibrary() {
SRCLIBPATH=
while [ -z "$SRCLIBPATH" ] ; do
echo "
Enter the path for the library to view.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
ValidateInfolibPath $ANSWER
SRCLIBPATH=$INFOLIB
done
### prompt for name of bookcase that is going to be installed ###
LIBDESC=`awk 'BEGIN { FS="\t" }
{ if (NR == 1) print ($1) }' \
< $SRCLIBPATH/$MMDBMAP`
echo ""
echo " Description: [$LIBDESC]"
ListCatalog $SRCLIBPATH
if [ $? -ne 0 ] ; then
exit 1
fi
echo ""
echo_f "\ \ \ \ Hit any key to continue or type 'q' to quit\ "
read_f
}
###############################################################################
CopyBookcase() {
### prompt for infolib and bookcase ###
SRCLIBPATH=
while [ -z "$SRCLIBPATH" ] ; do
echo "
Enter the path for the library from which you want to copy a bookcase.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
SRCLIBPATH=$ANSWER
ValidateInfolibPath $SRCLIBPATH
SRCLIBPATH=$INFOLIB
done
BOOKCASENAME=
while [ -z "$BOOKCASENAME" ] ; do
### prompt for name of bookcase that is going to be installed ###
ListCatalog $SRCLIBPATH
if [ $? -ne 0 ] ; then
exit 1
fi
SRCBOOKCASELIST=`awk '{ if (NR > 1) print $1 }' < $SRCLIBPATH/$MMDBMAP `
NUMPOS=`awk 'END { print NR-1 }' < $SRCLIBPATH/$MMDBMAP `
if [ $? -ne 0 ] ; then
echo "(ERROR) Cannot display bookcase #" >&2
exit 1
fi
echo ""
echo_f "\ \ \ \ Enter the number of the bookcase to copy \[1-$NUMPOS\]\ "
read_f
POSITION=$ANSWER
if [ -z "$POSITION" ] ; then
continue
fi
if [ "$POSITION" -lt 1 -o "$POSITION" -gt "$NUMPOS" ]; then
echo "(ERROR) Invalid choice [$POSITION], please try again"
sleep 2
continue
fi
### Confirm the selection with the user
BOOKCASENAME=`awk '{
if ( NR == position+1 ) { print $1 }
}' position=$POSITION < $SRCLIBPATH/$MMDBMAP`
confirm_f "$BOOKCASENAME"
if [ $? -eq 0 ] ; then
BOOKCASENAME=""
fi
done
DESTLIBPATH=
while [ -z "$DESTLIBPATH" ] ; do
echo "
Enter the path for the destination library.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
DESTLIBPATH=$ANSWER
ValidateInfolibPath $DESTLIBPATH
DESTLIBPATH=$INFOLIB
### Check if BookCaseName already exists ###
TSTSTRING=
TSTSTRING=`awk '{
if ( $1 == bcname ) { print $1 }
}' bcname=$BOOKCASENAME < $DESTLIBPATH/$MMDBMAP`
if [ -n "$TSTSTRING" ] ; then
echo "\ \ \ \ $BOOKCASENAME already exists in $DESTLIBPATH"
echo_f "\ \ \ \ Do you want to override it? \[ynq\]\ "
read_f
RESPONSE=$ANSWER
OVERRIDE=
if [ "$RESPONSE" = "y" ] ; then
OVERRIDE=-i
DeInstallBase $BOOKCASENAME $DESTLIBPATH
if [ $? -ne 0 ] ; then
echo "(ERROR) Unable to remove $BOOKCASENAME from $DESTLIBPATH"
exit 1
fi
elif [ "$RESPONSE" = "n" ]; then
break
fi
fi
done
### Prompt for parameter verification ###
echo "
You specified this information.
Copy [$BOOKCASENAME] from: $SRCLIBPATH
to : $DESTLIBPATH
"
echo_f "\ \ \ \ Is this correct? [ynq]\ "
read_f
echo ""
RESPONSE=$ANSWER
if [ "$RESPONSE" = "n" ]; then
return
fi
### Grab the bookcase entry line
BCENTRY=`awk '{
if ( NR > 1 && $1 == bookcasename ) { print $0 }
}' bookcasename=$BOOKCASENAME $SRCLIBPATH/$MMDBMAP`
if [ -z "$BCENTRY" ]; then
echo "(ERROR) $BOOKCASENAME does not exist in $SRCLIBPATH"
exit 1
fi
if [ ! -d $BogusInfoLibDir ]; then
mkdir -p $BogusInfoLibDir
else
echo "(ERROR) $BogusInfoLibDir already exists, cannot proceed" >&2
exit 1
fi
cd $BogusInfoLibDir
MMDB_PATH=$BogusInfoLibDir
### set up the bogus link to fool MMDB into believing that
### it is an info-lib
DESTBCLIST=`awk '{ if (NR > 1) print $1 }' < $DESTLIBPATH/$MMDBMAP `
for CurBookCase in $DESTBCLIST; do
ln -s $DESTLIBPATH/$CurBookCase $CurBookCase
done
if [ $? -ne 0 ]; then
echo "(ERROR) Failed to link bookcases from $DESTLIBPATH" >&2
exit 1
fi
### Link the new bookcase to be installed ###
ln -s $SRCLIBPATH/$BOOKCASENAME $BOOKCASENAME
cp $DESTLIBPATH/$MMDBMAP $MMDBMAP
### Update the new $MMDBMAP file with the new entry
echo "$BCENTRY" >> $MMDBMAP
### actually perform the validation ###
echo " Validating bookcases...please wait"
### Generate the BookCaseList ###
BookCaseList=`awk '{if (NR > 1) print $1 }' < $MMDBMAP`
for CurBookCase in $BookCaseList; do
if [ "$BOOKCASENAME" != "$CurBookCase" ]; then
echo " ...Validating $BOOKCASENAME against $CurBookCase"
valBase $BOOKCASENAME $CurBookCase
fi
if [ $? -ne 0 ]; then
echo "(ERROR) No copying is performed because of errors found in validation" >&2
rm -rf $BogusInfoLibDir
sleep 2
return
fi
done
echo " Validation complete."
### clean up the bogus infolib directory ###
cd $CURDIR
rm -r $BogusInfoLibDir
echo "
Copying bookcase... please wait
"
cd $DESTLIBPATH
(cd $SRCLIBPATH ; tar cf - $BOOKCASENAME) | tar xpf -
if [ $? -ne 0 ]; then
echo "(ERROR) Copying failed" >&2
exit 1
fi
echo "$BCENTRY" >> $MMDBMAP
echo " Bookcase copied."
echo ""
echo_f "\ \ \ \ Hit any key to continue or type 'q' to quit\ "
read_f
}
###############################################################################
RenameBookcase() {
### prompt for bookcase to be renamed ###
SRCLIBPATH=
while [ -z "$SRCLIBPATH" ] ; do
echo "
Enter the path for the library to modify.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
ValidateInfolibPath $ANSWER
SRCLIBPATH=$INFOLIB
done
BOOKCASENAME=
while [ -z "$BOOKCASENAME" ] ; do
### prompt for name of bookcase that is going to be installed ###
ListCatalog $SRCLIBPATH
if [ $? -ne 0 ] ; then
exit 1
fi
SRCBOOKCASELIST=`awk '{ if (NR > 1) print $1 }' < $SRCLIBPATH/$MMDBMAP `
NUMPOS=`awk 'END { print NR-1 }' < $SRCLIBPATH/$MMDBMAP `
if [ $? -ne 0 ] ; then
echo "(ERROR) Cannot display bookcase #" >&2
exit 1
fi
echo ""
echo_f "\ \ \ \ Enter the number of the bookcase to rename \[1-$NUMPOS\]\ "
read_f
POSITION=$ANSWER
if [ -z "$POSITION" ] ; then
continue
fi
if [ "$POSITION" -lt 1 -o "$POSITION" -gt "$NUMPOS" ]; then
echo "(ERROR) Invalid choice [$POSITION], please try again"
sleep 2
continue
fi
### Confirm the selection with the user
BOOKCASENAME=`awk '{
if ( NR == position+1 ) { print $1 }
}' position=$POSITION < $SRCLIBPATH/$MMDBMAP`
confirm_f "$BOOKCASENAME"
if [ $? -eq 0 ] ; then
BOOKCASENAME=""
fi
done
BookCaseTitle=""
while [ -z "$BookCaseTitle" ] ; do
echo "
Enter the new description for $BOOKCASENAME, or type 'q' to quit."
echo_f "\ \ \ \ --\>\ "
read_f
BookCaseTitle=$ANSWER
### Confirm the title with the user ###
confirm_f "$BookCaseTitle"
if [ $? -eq 0 ] ; then
BOOKCASENAME=""
continue
fi
ChangeCaseTitle $SRCLIBPATH $BOOKCASENAME "$BookCaseTitle"
if [ $? -ne 0 ]; then
exit 1
fi
done
echo " Bookcase renamed."
echo ""
echo_f "\ \ \ \ Hit any key to continue or type 'q' to quit\ "
read_f
}
###############################################################################
RearrangeBookcase() {
### prompt for source information library ###
SRCLIBPATH=
while [ -z "$SRCLIBPATH" ] ; do
echo "
Enter the path for the library to modify.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
ValidateInfolibPath $ANSWER
SRCLIBPATH=$INFOLIB
done
BOOKCASENAME1=
while [ -z "$BOOKCASENAME1" ] ; do
SRCBOOKCASELIST=`awk '{ if (NR > 1) print $1 }' < $SRCLIBPATH/$MMDBMAP `
NUMPOS=`awk 'END { print NR-1 }' < $SRCLIBPATH/$MMDBMAP `
if [ $NUMPOS -lt 2 ] ; then
echo " No bookcases to rearrange only $NUMPOS available."
sleep 2
return
fi
### prompt for name of bookcase that is going to be moved ###
ListCatalog $SRCLIBPATH
if [ $? -ne 0 ] ; then
exit 1
fi
echo ""
echo_f "\ \ \ \ Enter the number of the bookcase to move \[1-$NUMPOS\]\ "
read_f
POSITION=$ANSWER
if [ -z "$POSITION" ] ; then
continue
fi
if [ "$POSITION" -lt 1 -o "$POSITION" -gt "$NUMPOS" ]; then
echo "(ERROR) Invalid choice [$POSITION], please try again"
sleep 2
continue
fi
### Confirm the selection with the user
BOOKCASENAME1=`awk '{
if ( NR == position+1 ) { print $1 }
}' position=$POSITION < $SRCLIBPATH/$MMDBMAP`
confirm_f "$BOOKCASENAME1"
if [ $? -eq 0 ] ; then
BOOKCASENAME1=""
fi
done
### Grab the entry line for the bookcase
BCENTRY=`awk '{
if ( NR > 1 && $1 == bookcasename ) { print $0 }
}' bookcasename=$BOOKCASENAME1 $SRCLIBPATH/$MMDBMAP`
if [ -z "$BCENTRY" ]; then
echo "(ERROR) $BOOKCASENAME1 does not exist in $SRCLIBPATH"
exit 1
fi
### Prepare $MMDBMAP for rearrangement ###
awk '{
if ( NR == 1 || $1 != BookCaseName ) { print $0 }
}' BookCaseName=$BOOKCASENAME1 \
< $SRCLIBPATH/$MMDBMAP > $SRCLIBPATH/$MMDBMAP.1.$$
POSITION=
while [ -z "$POSITION" ] ; do
MoveCatalog $SRCLIBPATH/$MMDBMAP.1.$$
echo "
Enter the number corresponding to the position you want [$BOOKCASENAME1]
to occupy. If another bookcase already occupies the position you
choose, the bookcase you are moving takes its place, and the original
bookcase moves one place down in the list."
echo_f "\ \ \ \ Default is $NUMPOS, or type 'q' to quit. \[1-$NUMPOS\]\ "
read_f
POSITION=$ANSWER
if [ -z "$POSITION" ] ; then
POSITION=$NUMPOS
fi
if [ $POSITION -lt 1 -o $POSITION -gt $NUMPOS ]; then
echo "(ERROR) Invalid choice [$POSITION], try again"
continue
fi
### Prompt for parameter verification ###
echo "
You specified this order for the bookcases :
"
if [ "$POSITION" != "$NUMPOS" ]; then
awk ' {
if ( NR != POSITION+1 ) { print $0 }
if ( NR == POSITION+1 ) { print BookCaseEntry; print $0 }
}' POSITION="$POSITION" BookCaseEntry="$BCENTRY" < \
$SRCLIBPATH/$MMDBMAP.1.$$ > $SRCLIBPATH/$MMDBMAP.2.$$
else
cp $SRCLIBPATH/$MMDBMAP.1.$$ $SRCLIBPATH/$MMDBMAP.2.$$
echo "$BCENTRY" >> $SRCLIBPATH/$MMDBMAP.2.$$
fi
awk 'BEGIN { FS="\t" }
{ if (NR > 1) {printf(" %d) %s\t[%s]\n", NR-1, $1, $2); }}
' < $SRCLIBPATH/$MMDBMAP.2.$$
echo ""
echo_f "\ \ \ \ Is this correct? \[ynq\]\ "
read_f
Response=$ANSWER
if [ "$Response" = "n" ]; then
POSITION=
continue
fi
## move the file with new order to $MMDBMAP ###
mv $SRCLIBPATH/$MMDBMAP.2.$$ $SRCLIBPATH/$MMDBMAP
rm -f $SRCLIBPATH/$MMDBMAP.1.$$
done
echo " Bookcase rearranged."
echo ""
echo_f "\ \ \ \ Hit any key to continue or type 'q' to quit\ "
read_f
}
###############################################################################
RemoveBookcase() {
### prompt for bookcase to be removed ###
SRCLIBPATH=
while [ -z "$SRCLIBPATH" ] ; do
echo "
Enter the path for the library to modify.
This can be a relative or absolute path, or to exit, type 'q'."
echo_f "\ \ \ \ --\>\ "
read_f
ValidateInfolibPath $ANSWER
SRCLIBPATH=$INFOLIB
done
BOOKCASENAME=
while [ -z "$BOOKCASENAME" ] ; do
### prompt for name of bookcase that is going to be installed ###
ListCatalog $SRCLIBPATH
if [ $? -ne 0 ] ; then
exit 1
fi
SRCBOOKCASELIST=`awk '{ if (NR > 1) print $1 }' < $SRCLIBPATH/$MMDBMAP `
NUMPOS=`awk 'END { print NR-1 }' < $SRCLIBPATH/$MMDBMAP `
if [ $? -ne 0 ] ; then
echo "(ERROR) Cannot display bookcase #" >&2
exit 1
fi
echo ""
echo_f "\ \ \ \ Enter the number of the bookcase to remove \[1-$NUMPOS\]\ "
read_f
POSITION=$ANSWER
if [ -z "$POSITION" ] ; then
continue
fi
if [ "$POSITION" -lt 1 -o "$POSITION" -gt "$NUMPOS" ]; then
echo "(ERROR) Invalid choice [$POSITION], please try again"
sleep 2
continue
fi
### Confirm the selection with the user
BOOKCASENAME=`awk '{
if ( NR == position+1 ) { print $1 }
}' position=$POSITION < $SRCLIBPATH/$MMDBMAP`
confirm_f "$BOOKCASENAME"
if [ $? -eq 0 ] ; then
BOOKCASENAME=""
fi
done
### Actually perform the de-installation ###
echo " Removing $BOOKCASENAME...please wait"
DeInstallBase $BOOKCASENAME $SRCLIBPATH
if [ $? -ne 0 ]; then
echo "(ERROR) Bookcase is not removed because of errors found in De-Installation utility" >&2
exit 1
fi
echo " Bookcase removed."
echo ""
echo_f "\ \ \ \ Hit any key to continue or type 'q' to quit\ "
read_f
}
###############################################################################
CURDIR=`pwd`
if [ -z "$OLIASDDKBIN" ]; then
NewDir=`dirname $0`
cd $NewDir
OLIASDDKBIN=`pwd`
cd $CURDIR
fi
export MMDB_PATH PATH TMPDIR
TMPDIR=${TMPDIR:-/usr/tmp}
PATH=/bin:/usr/bin:/usr/sbin:${OLIASDDKBIN}
MMDBMAP=bookcase.map
### set up bogus info-lib directory for validation
BogusInfoLibDir=$TMPDIR/infolib$$
###############################################################################
## Get the task option ###
CHOICE=
while [ -z "$CHOICE" ] ; do
DisplayMenu
read CHOICE
case "$CHOICE" in
1)
ListLibrary
;;
2)
CopyBookcase
;;
3)
RenameBookcase
;;
4)
RearrangeBookcase
;;
5)
RemoveBookcase
;;
q|Q|6)
exit 0
;;
*)
echo "
*** Invalid choice, please try again ***
" >&2
sleep 2
;;
esac
cd $CURDIR
CHOICE=
done

View File

@@ -0,0 +1,193 @@
/*
* $XConsortium: valBase.C /main/5 1996/10/29 21:14:58 cde-hal $
*
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
* All rights reserved. Unpublished -- rights reserved under
* the Copyright Laws of the United States. USE OF A COPYRIGHT
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
* OR DISCLOSURE.
*
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
* INTERNATIONAL, LTD.
*
* RESTRICTED RIGHTS LEGEND
* Use, duplication, or disclosure by the Government is subject
* to the restrictions as set forth in subparagraph (c)(l)(ii)
* of the Rights in Technical Data and Computer Software clause
* at DFARS 252.227-7013.
*
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
* 1315 Dell Avenue
* Campbell, CA 95008
*
*/
#include <iostream.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
// MMDB header file
#include "oliasdb/mmdb.h"
#include "oliasdb/asciiIn_filters.h"
// DDK header file
#include "olGlobal.h"
// Debuggging macro
int dbgLevel;
#ifdef DEBUG
#define DBG(level) if ( dbgLevel >= level )
#else
#define DBG(level) if (0)
#endif
//------------------------------------------------
int dbgInit()
{
char *dbgStr;
dbgStr = getenv("OL_DEBUG");
return ( dbgStr ? atoi ( dbgStr ) : 0 );
}
//------------------------------------------------
main(int argc, char **argv)
{
INIT_EXCEPTIONS();
OLIAS_DB mmdb_handle;
info_lib *InfoLib;
char checkVersionStr [ 16 ];
char installVersionStr [ 16 ];
char locatorStr[64];
dbgLevel = dbgInit();
try {
if ( argc < 2 ) {
cerr << "Usage : valBase checkBase installBase\n";
exit (1);
}
char *checkBaseStr = argv[1];
char *installBaseStr = argv[2];
DBG(10) cerr << "(DEBUG) checkBase = " << checkBaseStr << endl;
DBG(10) cerr << "(DEBUG) installBase = " << installBaseStr << endl;
// first construct the info_base ptr for installBase
InfoLib = mmdb_handle.openInfoLib(getenv("MMDB_PATH"));
assert ( InfoLib != NULL );
info_base *installBase = InfoLib->get_info_base ( installBaseStr );
if ( !installBase )
throw(stringException("NULL infobase ptr for installation infobase"));
// construct the info_base ptr for checkBase
info_base *checkBase = InfoLib->get_info_base ( checkBaseStr );
if ( !checkBase )
throw(stringException("NULL infobase ptr for check infobase"));
// check the data version number
mm_version &checkVersion = checkBase->data_version();
short major_version_check = checkVersion.major_version();
short minor_version_check = checkVersion.minor_version();
sprintf ( checkVersionStr, "%d%d", major_version_check,
minor_version_check );
int checkVersionNum = atoi ( checkVersionStr );
DBG(10) cerr << "(DEBUG) checkBaseVersion = " << checkVersionNum << endl;
mm_version &installVersion = installBase->data_version();
short major_version_install = installVersion.major_version();
short minor_version_install = installVersion.minor_version();
sprintf ( installVersionStr, "%d%d", major_version_install,
minor_version_install );
int installVersionNum = atoi ( installVersionStr );
DBG(10) cerr << "(DEBUG) installVersionNum = " << installVersionNum << endl;
// Now perform the version checking
if ( installVersionNum == 10 ) {
if ( checkVersionNum >= 11 ) {
cerr << "(ERROR) Data version mismatch\n";
cerr << " " << checkBaseStr << " version = "
<< major_version_check << "." << minor_version_check << endl;
cerr << " " << installBaseStr << " version = "
<< major_version_install << "." << minor_version_install << endl;
exit ( 1 );
}
}
else if ( checkVersionNum == 10 ) {
if ( installVersionNum >= 11 ) {
cerr << "(ERROR) Data version mismatch\n";
cerr << " " << checkBaseStr << " version = "
<< major_version_check << "." << minor_version_check << endl;
cerr << " " << installBaseStr << " version = "
<< major_version_install << "." << minor_version_install << endl;
exit ( 1 );
}
}
// Now to check locators
iterator *it = checkBase->first(LOCATOR_SET_NAME, LOCATOR_CODE );
int DupLocFound=0;
while ( *it ) {
locator_smart_ptr x(checkBase, checkBase->get_oid(*it));
strcpy ( locatorStr, x.inside_node_locator_str() );
DBG(10) cerr << "(DEBUG) locatorStr = " << locatorStr
<< endl;
// check this locator value with the installation infobase
locator_smart_ptr loc(installBase, locatorStr);
if (! strcmp(loc.inside_node_locator_str(), locatorStr))
{
cerr << "(ERROR) Duplicate locator [ " << locatorStr
<< " ] found in " << installBaseStr << endl;
DupLocFound = 1;
}
checkBase->next(*it);
}
// clean up phase
delete it;
delete InfoLib;
if ( DupLocFound ) {
exit ( 1 );
}
exit (0);
}
catch ( mmdbException &, e )
{
debug(cerr, e );
abort();
}
end_try;
}