#!/usr/bin/env bash
# vim: set et syntax=sh 
#  ------------------------------------------------------------------------
#  Title        : Einige mehrfach verwendete Shell-Funktionen
#                  This is an UNPUBLISHED work COPYRIGHT by
#                               ArtCom GmbH
#                   Haferwende 2; D-28357 Bremen; Germany
#       It may be used, copied, or distributed only as permitted in a
#                              written license.
#  ------------------------------------------------------------------------
#  Created      :       Mon, 29-Aug-94 / 16:42 / (pf)
#  Version      : $Id: .ac-sh-funcs,v 1.76 2018-03-14 11:49:08 tm Exp $
#  Portability  : BASH (might also work with other bourne compatible shells)
#  Usage        : . .ac-sh-funcs
#  Exports      : 
#       OvwDestSuffix() # inits $DESTSUFFIX, $ACSSUFFIX, $PXMSUFFIX
#       Newer (file1, file2) : BOOLEAN # Which file has been modified later
#       ReadRC (rcfile) # Read .rc-Files of ArtCom-Applications
#    also defines the following environment variables, if not present:
#       $HOST           # logical hostname of this computer
#       $LANG           # usually system provided, sometimes changed
#       $LANGUAGE       # three letter ArtCom country code, e.g. = deu, eng ..
#       $OS             # Operating system (z.B. Linux, SCOSV, SUNOS, ...)
#       $BITSLIB        # Defaults to where this software version has been installed.
#       $AC_CUSTOMER    # ArtCom configuration files, Default /etc/opt/artcom
#       $AC_PROJECTS    # ArtCom user data, Default /projects
#       $AC_NODE        # Node specific directory (defaults to $AC_CUSTOMER)
#       $TMP            # Default $AC_PROJECTS/tmp or otherwise /tmp
#       $BITSDAT        # Variable data, Default /var/opt/artcom
#    only from 2002 until 2013:
#       $POSIXLY_CORRECT=1 # Because of our use of the 'du' utility program
#    not anymore.
#       $ARTSC          # Legacy PostScript: Defaults to $BITSLIB/postscript
#       $ICONS          # Legacy: Defaults to $BITSLIB/icons
#    additionally the directories $BITSLIB/bin, $BITSLIB/etc and --if it exists --
#    $AC_PROJECTS/bin will be inserted into the
#    program search path $PATH, if they are not already included.
#    For improved portability between different flavours of Unix:
#       $GREP_IGNCASE   # grep-command including the option for ignore case
#       $ECHO           # echo which interprets escape sequences like \c \n ...
#       $AWK            # New awk (sometimes 'awk', sometimes 'nawk')
#       $LC_NUMERIC     # Independent from the locale we like to use '.' 
#                       # always (even if we rely on external programs like awk)
#       $CANONPWD       # Either the command "/bin/pwd" or the command 
#                       # "/bin/pwd --physical" on newer systems
#  ------------------------------------------------------------------------
#
CANONPWD=`/bin/pwd --physical 2>&1 >/dev/null`
if [ $? -eq 0 -a -z "$CANONPWD" ]
then CANONPWD="/bin/pwd --physical"
else CANONPWD=/bin/pwd
fi
export CANONPWD
# Now the environment needs to be initialized (if not already done):
if [ -z "$ARTCOM_INSTANCE_HOME" ]
then ARTCOM_INSTANCE_HOME="/etc/opt/artcom"; export ARTCOM_INSTANCE_HOME
fi
if [ -z "$ARTCOM_INSTANCE" ]
then ARTCOM_INSTANCE="default"; export ARTCOM_INSTANCE
fi
if [ -z "$AC_SOFTROOT" ]
then export AC_SOFTROOT=/opt/artcom
fi
if [ -z "$BITSLIB" ]
then if [ "$BITSDAT" = "/bitslib/dat" ]
     then export -n BITSDAT ; unset BITSDAT
     fi
     if [ "$BITSENV" = "/customer:/bitslib/env" ]
     then export -n BITSENV ; unset BITSENV
     fi
     if [ "$ICONS" = "/projects/icons:/bitslib/icons" ]
     then export -n ICONS ; unset ICONS
     fi
     if [ -r "$ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE" ]
     then if source "$ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE"
          then : fine
          else echo \
"**** Fatal: Unable to parse instance file $ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE
     Please check the proper shell syntax of your configuration file.
     Please use the template in ${AC_SOFTROOT}/current/env/instance.default
     as a reference" 1>&2
               exit 1
          fi
          if [ -z "$BITSLIB" ]
          then echo \
"**** Fatal: Configuration error in $ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE
     The instance configuration file must at least define BITSLIB.  Aborting" 1>&2
               exit 1
          fi
     else # no explicit instance configuration given.  
          # Determine configuration defaults as usual:
          if [ "$0" = "-bash" ] || [ "$0" = "bash" ]
          then echo "*** Fatal: using .ac-sh-funcs from a login shell does not work" 1>&2
               sleep 2
               exit 1
          fi
          if [ -z "$CALLED_AS" ]
          then CALLED_AS=`basename $0`
	  fi
	  if [ -z "$CALLED_IN" ]
	  then CALLED_IN=`dirname $0`
               # Exception: We need to determine the canonical path here:
               CALLED_IN=`cd $CALLED_IN; $CANONPWD`
               export CALLED_AS CALLED_IN
          fi
          # Scripts including this are normally expected to be installed in 
          # some $BITSLIB/bin or $BITSLIB/service or two levels deep in
          # $BITSLIB/service/bin.  Find out, where exactly:
          if [ -r "$CALLED_IN/.ac-sh-funcs" ] || [ -r "$CALLED_IN/cleanup" ] \
             || [ -r "$CALLED_IN/startVNCserver.sh" ]
          then # $CALLED_IN is $BITSLIB/bin or $BITSLIB/service or 
               # $BITSLIB/vnc :
               BITSLIB=`cd $CALLED_IN; cd ..; pwd` 
               if [ -d "$BITSLIB/bin" ] && [ -d "$BITSLIB/env" ]
               then : fine. found the correct directory
               else # try canonical path instead as a fallback:
                    BITSLIB=`cd $CALLED_IN; cd ..; $CANONPWD`
               fi
               export BITSLIB
          elif [ -r "$CALLED_IN/patternreplace.py" ]
          then # $CALLED_IN is $BITSLIB/service/bin:
               BITSLIB=`cd $CALLED_IN; cd ../..; pwd` 
               if [ -d "$BITSLIB/bin" ] && [ -d "$BITSLIB/env" ]
               then : fine. found the correct directory
               else # try canonical path instead as a fallback:
                    BITSLIB=`cd $CALLED_IN; cd ../..; $CANONPWD`
               fi
               export BITSLIB
          elif [ "$CALLED_IN" = "/etc/init.d" ]
          then # may be a boot startup script symlinked directly from our software directory.  
               # Assume the default configuration and abort, of not available:
               if [ -d ${AC_SOFTROOT}/current ]
               then BITSLIB=${AC_SOFTROOT}/current
                    export BITSLIB
               else echo "**** Fatal: $0: no default ArtCom software available
Aborting" 1>&2
                    exit 1
               fi
          elif [ `basename "$CALLED_IN"` = "tools" ]
          then # ArtCom internal we have a directory tools for certain scripts:
               BITSLIB=`cd $CALLED_IN/../bitslib; pwd`
               export BITSLIB
          else # $CALLED_IN is neither $BITSLIB/bin or $BITSLIB/service/bin.
               # So abort with a suitable message:
               echo \
"**** Fatal: in .ac-sh-funcs: Can not determine value for ArtCom BITSLIB
Aborting" 1>&2
               exit 1
          fi
     fi
fi
if [ -z "$ICONS" ]
then ICONS="$BITSLIB/icons"; export ICONS
fi
if [ -z "$ARTSC" ]
then ARTSC="$BITSLIB/postscript"; export ARTSC
fi
# Refer to DirAcces.MOD procedure EnvVar()
# any changes made here must be done there also:
if [ -z "$AC_CUSTOMER" ]
then if [ -d /etc/opt/artcom ] && [ -w /etc/opt/artcom ]
     then AC_CUSTOMER=/etc/opt/artcom; export AC_CUSTOMER
     elif [ -d ${AC_SOFTROOT}/customer ] && [ -w ${AC_SOFTROOT}/customer ]
     then AC_CUSTOMER=${AC_SOFTROOT}/customer; export AC_CUSTOMER
     elif [ -d /customer ]
     then AC_CUSTOMER=/customer; export AC_CUSTOMER
     else echo "**** Fatal: environment variable AC_CUSTOMER is not set and 
     also no usable customer config directory found.  May be /etc/opt/artcom
     doesn't exist or is not writable by user processes?  Aborting" 1>&2
          exit 1
     fi
fi
if [ -z "$AC_NODE" ]
then AC_NODE="$AC_CUSTOMER"; export AC_NODE
fi
if [ -z "$AC_PROJECTS" ]
then if [ -d /projects ] && [ -w /projects ]
     then AC_PROJECTS=/projects; export AC_PROJECTS
     elif [ -d ${AC_SOFTROOT}/projects ] && [ -w ${AC_SOFTROOT}/projects ]
     then AC_PROJECTS=${AC_SOFTROOT}/projects; export AC_PROJECTS
     elif [ "$CALLED_AS" = "connect2artcom" ] \
          || [ "$CALLED_AS" = "connect2artcom.sh" ]
     then AC_PROJECTS=/tmp; export AC_PROJECTS
     else echo "**** Fatal: environment variable AC_PROJECTS is not set and 
     also no usable projects data directory found.  May be some problem with
     mounting your storage subsystem or a permission problem?
     The following directory must be writeable:" 1>&2
          ls -ld /projects 1>&2
          echo "Aborting" 1>&2
          exit 1
     fi
fi
if [ -z "$BITSENV" ]
then BITSENV="$AC_CUSTOMER:$BITSLIB/env"; export BITSENV
fi
if [ -z "$TMP" ]
then if [ -r "$AC_CUSTOMER/.cshrc" ]
     then TMP=`awk '/setenv TMP/ { print $3 }' < "$AC_CUSTOMER/.cshrc"`
          # For migration to cluster setups: don't believe old settings:
          if [ "$TMP" = "/projects/tmp" ] && [ ! "$AC_PROJECTS" = "/projects" ]
          then unset TMP
          fi
     fi
     if [ -n "$TMP" ] && [ -d "$TMP" ]
     then :
     elif [ -d "$AC_PROJECTS/tmp" ]
     then TMP="$AC_PROJECTS/tmp"
     else TMP=/tmp 
     fi
     export TMP
fi
# Several programs need a common directory to communicate which each
# other.  The path to this ArtCom-var directory is kept in $BITSDAT:
# But this directory should not be created, during tests in the source
# tree:
if [ -z "$BITSDAT" ] && [ `basename $BITSLIB` = "bitslib.src" ]
then BITSDAT="$BITSLIB/../../bitslib/dat"
     export BITSDAT
fi
if [ -z "$BITSDAT" ]
then if [ -w ${AC_SOFTROOT}/var ]
     then BITSDAT=${AC_SOFTROOT}/var
     elif [ -w /var/opt/artcom ]
     then BITSDAT=/var/opt/artcom
     else BITSDAT="`(cd $BITSLIB/..; pwd)`/var"
          if [ ! -w "$BITSDAT" ]
	  then BITSDAT="/tmp/tmp.ArtCom.Installer.bitsdat"
	  fi
     fi
     if [ -w "$BITSDAT" ] || mkdir -p "$BITSDAT" 2>/dev/null 
     then chmod 2777 "$BITSDAT" 2>/dev/null
     else # The software seems to be running from a read-only mounted device
          # (for example from CDR).  Choose another place for variable data:
          BITSDAT="$TMP/bitsdat-"`echo "$BITSLIB" | sed 's|/|_|g'`
          # If the directory $BITSDAT is not already there, create it now:
          if [ ! -d "$BITSDAT" ]
          then echo "++++ environment variable BITSDAT is not set or 
     the variable data directory is not writable.  May you are trying 
     new version from CDR?  Trying to create a temporary data directory as:
     $BITSDAT" 1>&2
               if mkdir -p "$BITSDAT" && chmod 2777 "$BITSDAT"
               then echo "**** Fatal: Unable to create $BITSDAT.  Aborting" 1>&2
                    exit 1
               fi
          fi
     fi
     export BITSDAT
fi
if [ ! -w "$BITSDAT" ]
then if [ -d "$BITSDAT" ]
     then echo "**** Fatal: $BITSDAT not writable.  Aborting" 1>&2
     else echo "**** Fatal: $BITSDAT does not exist.  Aborting" 1>&2
     fi
     exit 1
fi
mkdir -p "$BITSDAT/tmp" && chmod 2777 "$BITSDAT/tmp" 2>/dev/null
#
if [ -z "$HOST" ] 
then HOST=`uname -n | sed 's/\.[^\.]*//g'`
     # the sed command strips a domain name which might be present 
     # due to some misconfugaration.
     export HOST
fi
# In some early network setups there used to be a certain pathname convention
# using the path prefix /nfs/<hostname> to address local files from remote:
if [ -z "$AC_NFS_PREFIX_BEHAVIOUR" ]
then AC_NFS_PREFIX="" ; export AC_NFS_PREFIX
else AC_NFS_PREFIX="/nfs/$HOST" ; export AC_NFS_PREFIX
fi
# Fge bestimmte Verzeichnisse vorne in den Suchpfad ein, wenn sie
# darin noch nicht enthalten sind:
for PROGDIR in ${AC_PROJECTS}/bin ${BITSLIB}/etc ${BITSLIB}/bin \
               /usr/local/bin ; do
    if [ -d "$PROGDIR" ]
    then echo ":$PATH:" | grep ':'"$PROGDIR"':' >/dev/null ||
              PATH="$PROGDIR:$PATH"
    fi
done
# Theoretically now all ArtCom programs should be available through
# $PATH.  Theoretically!  If not then produce some helpful messages:
export PATH
if ! command -v .ac-sh-funcs >/dev/null
then echo "**** Fatal: No ArtCom programs found in PATH=$PATH" 1>&2
     if [ -r "$ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE" ]
     then echo "*** Hint: An instance configuration file was used: \
                $ARTCOM_INSTANCE_HOME/instance.$ARTCOM_INSTANCE" 1>&2
     fi
     echo "*** Hint: BITSLIB was set to: $BITSLIB" 1>&2
fi

# Some programs call the 'du' utility to determine used disk space.
# Linux reports sizes in kilo bytes, which is not expected.  This
# environment variable changes that behaviour:
# POSIXLY_CORRECT=1
# export POSIXLY_CORRECT
# From 2013 this is set in wrapper script 'du' in $BITSLIB/bin

# ---- Handling of foreign language settings: ----
if [ -z "$LANG" ]
then # Wenn Daemons per init/upstart gestartet werden, ist LANG nicht gesetzt.
     # Java-Backends brauchen diesen Wert, um das Character Set (Encoding)
     # zu bestimmen, mit dem z.B. Parameter uebergeben werden.
     if [ -f /etc/default/locale ]
     then # Ubuntu/Debian
          . /etc/default/locale
     elif [ -f /etc/profile.d/lang.sh ]
     then # SuSE
          . /etc/profile.d/lang.sh
     elif [ -f /etc/sysconfig/i18n ]
     then # Fedora/CentOS
          . /etc/sysconfig/i18n
     fi
     # hopefully $LANG got a reasonable value here:
     export LANG
fi
if [ -z "$LANGUAGE" ] && [ -n "$LANG" ] && \
   ! grep -q LANGUAGE "$AC_CUSTOMER/.cshrc" 2>/dev/null
   # and no ArtCom setting, see below
then LANGUAGE="$LANG" # use $LANG as fallback to guess the system language
fi
# SuSE Linux 6.4 redefined LANGUAGE as 'German', 'English', ... but we didn't
# wanted to use this setting, since it should only be applied to the language
# SuSEs setup tool YaST was running in.  We accept only values of $LANGUAGE 
# that are valid country codes as defined in the ISO 639 standard and 
# which indicate a language we have translations for available.
# (although some of these might be partly incomplete).  
# see http://en.wikipedia.org/wiki/ISO_639-1 and
#     http://en.wikipedia.org/wiki/ISO_639-2
# for information about country and language codes.
# We strip the encoding ($LANG settings might contain encodings):
case "$LANGUAGE" in
    de_*|de:*|[Gg]er*) LANGUAGE="de"
       ;;
    en_*|en:*|[Ee]ng*) LANGUAGE="en"
       ;;
    es_*|es:*|[Ss]pa*) LANGUAGE="es"
       ;;
    fr_*|fr:*) LANGUAGE="fr"
       ;;
    it_*|it:*) LANGUAGE="it"
       ;;
    pl_*|pl:*) LANGUAGE="pl"
       ;;
    pt_*|pt:*) LANGUAGE="pt"
       ;;
    ca_ES) LANGUAGE="ca"
       ;;
    de|deu|en|eng|es|spa|fr|fra|pt|por|it|ita|pl|pol|ca|cat) : # see below
       ;;
    # otherwise ignore this LANGUAGE setting because we don't have 
    # translations available for it anyway:
    *) LANGUAGE=
       ;;
esac
if [ -z "$LANGUAGE" ] 
then # So if we get here, the system language was not recognized or is 
     # not supported by ArtCom (see above).  Check, whether there is a
     # ArtCom language setting:
     if [ -r "$AC_CUSTOMER/.cshrc" ]
     then # use ArtCom language setting (may be changed using Service-Program):
          LANGUAGE=`awk '/setenv LANGUAGE/ { print $3 }' <"$AC_CUSTOMER/.cshrc"`
     fi
     # if not, we have to choose a default language to run in:
     if [ -z "$LANGUAGE" ] 
     then # see http://www.krysstal.com/spoken.html for information about
          # languages spoken by the world population.  Since we currently
          # don't have Mandarin, we should choose English as Default:
          LANGUAGE=eng
     fi
fi
# --- Backward-Compatibility-Hack 1999/10/11 --- may be removed sometime --- :
case "$LANGUAGE" in 
    en|en_*|POSIX) LANGUAGE=eng; export LANGUAGE ;;
    de|de_*) LANGUAGE=deu; export LANGUAGE ;;
    es|es_*) LANGUAGE=spa; export LANGUAGE ;;
    it|it_*) LANGUAGE=ita; export LANGUAGE ;;
    fr|fr_*) LANGUAGE=fra; export LANGUAGE ;;
    pt|pt_*) LANGUAGE=por; export LANGUAGE ;;
    pl|pl_*) LANGUAGE=pol; export LANGUAGE ;;
    ca|ca_ES) LANGUAGE=cat; export LANGUAGE ;;
esac
export LANGUAGE
# ---- end of the language environment variable trickery ----
# 
if [ -z "$OS" ] 
then OS=`uname -s`
     case "$OS" in
         "IRIX")   ;;
         "IRIX64") OS=IRIX;;
         "Linux")  ;;
         "SunOS")  ;;
         "SCOSV")  ;;
         "SCO_SV") OS=SCOSV ;; # Wegen einer historischen Fehlinfo
         "XENIX")  ;;
         *)        if [ "$HOST" = "$OS" ]
                   then OS=SCOSV # Ein altes SCO Unix mit uname Bug 
                   else OS=UNIX  # Any unknown vanilla Unix
                   fi ;;
     esac
     export OS
fi
# -- Choose a default start directory: -----------------------------
if [ -z "$AC_STARTDIR" ] && [ -z "$AC_START_IN_HOME" ]
then AC_STARTDIR="$AC_PROJECTS"
fi
# -- Installationsverzeichnis fr Helios-EtherShare bestimmen: --
if [ -z "$HELIOSDIR" ] && [ -f "/etc/HELIOSInstallPath" ]
then HELIOSDIR=`cat /etc/HELIOSInstallPath`
     if [ ! -x "$HELIOSDIR/bin/dt" ]
     then unset HELIOSDIR
     fi
fi
# -- Einige Sachen fr die erhhte Portabilitt unserer Skripte: ---
GREP_IGNCASE="grep -i"
ECHO=echo
AWK=awk
# For example the german locale would use ',' instead of '.' for
# decimal places in floating point numbers.  We don't want this:
LC_NUMERIC=C
case $OS in 
    Linux)      ECHO="echo -e"
                ;;
    SunOS)      AWK=nawk
                ;;
    IRIX)       :
                ;;
    XENIX)      GREP_IGNCASE="grep -y"
                ;;
esac
export AWK ECHO LC_NUMERIC

# Refer to DirAcces.MOD procedure CheckFlag()
# any changes made here must be done there also:
CheckFlag() {
    FLAG_ENVVAL=`eval 'echo $AC_'$1`
    if [ -z "$FLAG_ENVVAL" ]
    then if [ -f "$AC_CUSTOMER/$1" ]
         then return 0 # True
         else return 1 # False
         fi
    else # Test all permutations of 
         # NO No no oN | OFF Off off oFf ... | FALSE False false FaLsE ... :
         case "$FLAG_ENVVAL" in
             [Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) return 1 ;;
         esac
         return 0 # otherwise True
    fi
}
#
OvwDestSuffix() {
    DESTSUFFIX=".AIu"
    case $SUFFIX in
        .alf|.ALF)            DESTSUFFIX=".AIl" ;; 
        .agf)                 DESTSUFFIX=".AIe" ;;
        .aif)                 DESTSUFFIX=".AIf" ;;
        .atf|.i2k)            DESTSUFFIX=".AIk" ;;
        .ct|.cct|.[i|v]ct)    DESTSUFFIX=".AIt" ;;
        .CT|.CCT|.[I|V]CT)    DESTSUFFIX=".AIt" ;;
                # Damit 'imgmv' usw. auch separierte Bilder transparent
                # bearbeiten knnen, wird hier auch der Suffix .cct wie
                # bei TIFF/IT ausgewertet.  Das ist in 'SIsuffix' nicht 
                # notwendig, da dort ja die Erzeugung der Separationen 
                # transparent durch den Treiber passiert.
        ifp|.fp|.p)           DESTSUFFIX=".AIp" ;;
        IFP|.FP|.P)           DESTSUFFIX=".AIp" ;;
        .gif|.GIF)            DESTSUFFIX=".AIi" ;;
        .lw|.[i|v]lw)         DESTSUFFIX=".AIx" ;;
        .LW|.[I|V]LW)         DESTSUFFIX=".AIx" ;;
        .pdf|.PDF)            DESTSUFFIX=".AIpd" ;;
        .ps|.PS)              DESTSUFFIX=".AIp" ;;
        .pmf)                 DESTSUFFIX=".AIm" ;;
        .rgb)                 DESTSUFFIX=".AIr" ;;
        .rla)                 DESTSUFFIX=".AIw" ;;
        .tif*|.TIF*)          DESTSUFFIX=".AIt" ;;
        .tga|.TGA)            DESTSUFFIX=".AIg" ;;
        .Slw)                 DESTSUFFIX=".AIa" ;;
        .Sct)                 DESTSUFFIX=".AIb" ;;
        .Spg)                 DESTSUFFIX=".AIc" ;;
        # Weitere Suffixes muessen hier nachgetragen werden, sobald 
        # die betreffende Prozedur in SIsuffix angepasst wurde.
        # Umgekehrt mu bei nderungen hier die Prozedur 'OvwSuffix'
        # in 'SIsuffix' symmetrisch mit gepflegt werden!
    esac
    PXMSUFFIX=`echo $DESTSUFFIX | sed 's/\.AI/.PX/'`
    ACSSUFFIX=`echo $DESTSUFFIX | sed 's/\.AI/.AC/'`
    AHFSUFFIX=`echo $DESTSUFFIX | sed 's/\.AI/.AH/'`
    CNTSUFFIX=`echo $DESTSUFFIX | sed 's/\.AI/.CN/'`
    INFSUFFIX=`echo $DESTSUFFIX | sed 's/\.AI/.jt/'`
} # END OvwDestSuffix;

# PROCEDURE Newer (file1, file2) : BOOLEAN;
Newer() {
    if [ ! -f "$1" ]
    then return 1
    elif [ ! -f "$2" ]
    then return 0
    elif ls -tr -- "$1" "$2" | head -n 1 | grep -- "$2" 2>&1 >/dev/null
    then return 0
    else return 1
    fi
} # END Newer;

# PROCEDURE Read_RC_File (rcfile);
Read_RC_File() {
    RCFILE=$1
    if [ ! -r "$RCFILE" ]
    then RCFILE="$HOME/$1"
    fi
    if [ ! -r "$RCFILE" ]
    then RCFILE="$AC_CUSTOMER/$1"
    fi
    if [ -r "$RCFILE" ]
    then TMPINCLUDE="/tmp/ac-shinc.$$"
         # Variablen vom Typ String mssen gesondert behandelt werden :
         sed 's/^S \([^=]*\)= \(.*\)$/\1="\2"/
s/^[A-Z] //
s/= */=/
s/ON$/:/
s/OFF$/false/' < "$RCFILE" > $TMPINCLUDE
         . $TMPINCLUDE
         rm -f $TMPINCLUDE
    fi
} # END Read_RC_File;

# - EOF -
