MINI MINI MANI MO
:
#
#
# gennfgt generates nnfgt.o
# usage: gennfgt
# Looks for the existence of the libraries and builds the table file.
# generates .s file for SunOS 5, AIXRIOS, SVR4_386, NCR
# .c file for all others
#
if [ "$ORACLE_TRACE" ]; then
set -x
fi
if [ -z "$TMPDIR" ] ;
then
TMPDIR=/tmp
fi
VER=18
LIB=lib
USAGE="usage: $0"
LIBHOME=$ORACLE_HOME/$LIB
TNSLIB=libntns${VER}.a
NISLIB=libnnis${VER}.a
CDSLIB=libncds${VER}.a
LDAPLIB=libnldap${VER}.a
HOSTLIB=libnhost${VER}.a
NATIVELIBS="NISLIB|CDSLIB|LDAPLIB|TNSLIB|HOSTLIB"
# Check the existence of each library
for lib in `echo $NATIVELIBS | sed 's/|/ /g'`
do
eval libname=$`echo $lib`
eval NNFGUSE$lib=false
if [ -f $LIBHOME/$libname ]
then
eval NNFGUSE$lib=true
fi
done
#
# Now begins the big divide between SunOS 5 and the rest of the world...
#
#
# Now begins the big divide between AIXRIOS and the rest of the world...
#
USE_AS=${USE_AS:=true}
if [ "$USE_AS" = "true" ] ; then
true
pointer=long
pointer=quad
emit_string() {
echo "$1: .string \"$2\""
}
saved_phase=0
emit_nnft_entry() {
if [ $phase != $saved_phase ] ; then
entry=0
saved_phase=$phase
fi
case "${phase}${1}" in
1true )
emit_string ".L${entry}_1" "$2"
emit_string ".L${entry}_2" "$4"
emit_string ".L${entry}_3" "$5"
;;
2true )
echo "
.${pointer} .L${entry}_1
.${pointer} $3
.${pointer} .L${entry}_2
.${pointer} .L${entry}_3
.Lnumber_of_entries=.Lnumber_of_entries+1
"
;;
esac
entry=$((entry + 1))
}
emit_prologue() {
case "$phase" in
1 )
echo '/*
**
** This file is GENERATED by gennfgt for Linux x86_64
**
*/
.file "nnfgt.c"
.section .rodata.str1.4, "aMS",@progbits,1
.align 4
.Lnumber_of_entries=0
'
;;
2 )
echo '
.section .data1, "wa", @progbits
.align 32
.globl nnfgtable
nnfgtable:
'
;;
esac;
}
emit_epilogue() {
case "$phase" in
2 )
echo "
.${pointer} 0, 0, 0, 0"
echo '
.type nnfgtable,@object
.size nnfgtable,.-nnfgtable
.section .rodata, "a"
.align 4
.globl nnfgtent
nnfgtent:
.long .Lnumber_of_entries
.type nnfgtent,@object
.size nnfgtent,.-nnfgtent
.section .note.GNU-stack,"",@progbits
.end
'
;;
esac;
}
for phase in 1 2 ; do
emit_prologue
emit_nnft_entry "$NNFGUSETNSLIB" "TNSNAMES" nnftboot "_nnftboot" "nnft"
emit_nnft_entry "$NNFGUSEHOSTLIB" "HOSTNAME" nnfhboot "_nnfhboot" "nnfh"
emit_nnft_entry "$NNFGUSEHOSTLIB" "EZCONNECT" nnfhboot "_nnfhboot" "nnfh"
emit_nnft_entry "$NNFGUSECDSLIB" "DCE" nnfdboot "_nnfdboot" "nnfd"
emit_nnft_entry "$NNFGUSECDSLIB" "CDS" nnfdboot "_nnfdboot" "nnfd"
emit_nnft_entry "$NNFGUSENISLIB" "NIS" nnfyboot "_nnfyboot" "nnfy"
emit_nnft_entry "$NNFGUSELDAPLIB" "LDAP" nnflboot "_nnflboot" "nnfl"
emit_epilogue
done
else # USE_AS
echo '/*'
echo '**'
echo '** This file is GENERATED by gennfgt'
echo '**'
echo '*/
'
echo "#include <sys/types.h>
"
# the following is taken from nnfgt.h and nnfg.h
echo '
struct nnfgtab {
const char *name_nnfgtab;
void (*init_nnfgtab)();
const char *initname_nnfgtab;
const char *initlib_nnfgtab;
};
typedef struct nnfgtab nnfgtab;
'
if [ "$NNFGUSETNSLIB" = "true" ]
then
echo "void nnftboot();"
fi
if [ "$NNFGUSECDSLIB" = "true" ]
then
echo "void nnfdboot();"
fi
if [ "$NNFGUSENISLIB" = "true" ]
then
echo "void nnfyboot();"
fi
if [ "$NNFGUSEHOSTLIB" = "true" ]
then
echo "void nnfhboot();"
fi
if [ "$NNFGUSELDAPLIB" = "true" ]
then
echo "void nnflboot();"
fi
# the protocol table
echo "const nnfgtab nnfgtable[] = {"
if [ "$NNFGUSETNSLIB" = "true" ]
then
echo '
{ (char *) "TNSNAMES" , nnftboot, (char *) "_nnftboot", (char *) "nnft" },
'
fi
if [ "$NNFGUSEHOSTLIB" = "true" ]
then
echo '
{ (char *) "HOSTNAME", nnfhboot, (char *) "_nnfhboot", (char *) "nnfh" },
'
echo '
{ (char *) "EZCONNECT", nnfhboot, (char *) "_nnfhboot", (char *) "nnfh" },
'
fi
#Add the CDS adapter
if [ "$NNFGUSECDSLIB" = "true" ]
then
echo '
{ (char *) "DCE" , nnfdboot, (char *) "_nnfdboot", (char *) "nnfd" },
'
echo '
{ (char *) "CDS" , nnfdboot, (char *) "_nnfdboot", (char *) "nnfd" },
'
fi
# Add the NIS adapter
if [ "$NNFGUSENISLIB" = "true" ]
then
echo '
{ (char *) "NIS" , nnfyboot, (char *) "_nnfyboot", (char *) "nnfy" },
'
fi
#Add LDAP Adapter
if [ "$NNFGUSELDAPLIB" = "true" ]
then
echo '
{ (char *) "LDAP" , nnflboot, (char *) "_nnflboot", (char *) "nnfl" },
'
fi
echo ' { (char *) 0 , 0 , (char *) 0 , (char *) 0 }'
echo '};'
echo '/*'
echo '** no. of adapter table entries'
echo '*/
'
echo '
const int nnfgtent = sizeof(nnfgtable)/sizeof(nnfgtable[0]) - 1;
'
fi # USE_AS
OHA YOOOO