Blame Customize

Packit Service 603f59
#!/bin/sh
Packit Service 603f59
#
Packit Service 603f59
# $Id: Customize,v 1.9 2005/05/11 13:02:18 abe Exp $
Packit Service 603f59
#
Packit Service 603f59
# Customize: customize dialect's machine.h header file.
Packit Service 603f59
#
Packit Service 603f59
# Allows easy modification of some important compile-time definitions for
Packit Service 603f59
# lsof, made in the dialect's machine.h header file, including:
Packit Service 603f59
#
Packit Service 603f59
#	HASSECURITY	the security option
Packit Service 603f59
#	HASNOSOCKSECURITY
Packit Service 603f59
#			the socket oberalization of HASSECURITY
Packit Service 603f59
#	HASDCACHE	enabling/disabling the device cache file
Packit Service 603f59
#			(Note: changing the device cache file option isn't
Packit Service 603f59
#			       offered when machine.h contains NEVER_HASDCACHE
Packit Service 603f59
#			       anywhere, including in a comment.)
Packit Service 603f59
#	HASENVDC	enabling/disabling device cache path from environment
Packit Service 603f59
#	HASKERNIDCK	enabling/disabling the kernel identity check
Packit Service 603f59
#			(not done for some dialects)
Packit Service 603f59
#	HASPERSDC	enabling/disabling personal device cache path
Packit Service 603f59
#			construction
Packit Service 603f59
#	HASPERSDCPATH	enabling/disabling additional personal device cache
Packit Service 603f59
#			path component
Packit Service 603f59
#	HASSYSDC	enabling/disabling system-wide device cache file path
Packit Service 603f59
#	HASXOPT_ROOT	enabling/disabling root use of the -X option
Packit Service 603f59
#	WARNDEVACCESS	enabling inaccessible /dev node warnings
Packit Service 603f59
#			(Note: changing the inaccessible /dev/node warning
Packit Service 603f59
#			       option isn't offered when machine.h contains
Packit Service 603f59
#			       NEVER_WARNDEVACCESS anywhere, including in a
Packit Service 603f59
#			       comment.)
Packit Service 603f59
#	WARNINGSTATE	enable/disabling default warning message state
Packit Service 603f59
#
Packit Service 603f59
# Usage: Customize [dialect_directory]
Packit Service 603f59
#
Packit Service 603f59
# where: dialect_directory (optional) is the directory in which the dialect's
Packit Service 603f59
#	 dialect's sources, Makefile and scripts are found
Packit Service 603f59
Packit Service 603f59
OLD=machine.h
Packit Service 603f59
NEW=new_machine.h
Packit Service 603f59
Packit Service 603f59
# Save optional dialect directory.
Packit Service 603f59
Packit Service 603f59
if test $# -eq 1
Packit Service 603f59
then
Packit Service 603f59
  DialDir=$1
Packit Service 603f59
else
Packit Service 603f59
  DialDir=""
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Establish trap and stty handling.
Packit Service 603f59
Packit Service 603f59
ISIG=":"
Packit Service 603f59
trap 'rm -f $NEW; $ISIG; exit 1' 1 2 3 15
Packit Service 603f59
stty -a 2>&1 | grep isig > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  stty -a 2>&1 | egrep -e -isig > /dev/null
Packit Service 603f59
  if test $? -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    ISIG="stty -isig"
Packit Service 603f59
    stty isig
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Decide how to use echo.
Packit Service 603f59
Packit Service 603f59
ECHO=`echo -n ""`
Packit Service 603f59
if test "X$ECHO" = "X-n "
Packit Service 603f59
then
Packit Service 603f59
  EC="\c"
Packit Service 603f59
  EO=""
Packit Service 603f59
else
Packit Service 603f59
  EC=""
Packit Service 603f59
  EO="-n"
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Decide how to use tail(1).
Packit Service 603f59
Packit Service 603f59
TMP1=`tail -n 1 $0 2> /dev/null`
Packit Service 603f59
if test $? -eq 0 -a "X$TMP1" = "X#LAST_LINE"
Packit Service 603f59
then
Packit Service 603f59
  TA="-n 1"
Packit Service 603f59
else
Packit Service 603f59
  TA="-1"
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Display the introduction and basic explanation.
Packit Service 603f59
Packit Service 603f59
cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
You may now customize the machine.h header file for this UNIX
Packit Service 603f59
dialect.  The customizations will take effect when you compile
Packit Service 603f59
lsof.  You may also choose to skip customization and proceed to
Packit Service 603f59
the compilation of lsof.
Packit Service 603f59
Packit Service 603f59
If you don't know if you need to customize or want to know more
Packit Service 603f59
about what you can customize, consult the 00DCACHE, 00FAQ, 00PORTING,
Packit Service 603f59
and 00README files of the lsof distribution.  You might also find
Packit Service 603f59
it helpful to examine the machine.h header file for the dialect
Packit Service 603f59
you're customizing.
Packit Service 603f59
Packit Service 603f59
You don't need to use this procedure to customize lsof; you can
Packit Service 603f59
edit the machine.h header file directly.  If you later decide you
Packit Service 603f59
want to use this procedure to customize machine.h, execute the
Packit Service 603f59
./Customize script.
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
END=0
Packit Service 603f59
while test $END -eq 0
Packit Service 603f59
do
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo $EO "Do you want to customize (y|n) [y]? $EC"
Packit Service 603f59
  read ANS EXCESS
Packit Service 603f59
  if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
  then
Packit Service 603f59
    exit 0
Packit Service 603f59
  fi
Packit Service 603f59
  if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
Packit Service 603f59
  then
Packit Service 603f59
    echo ""
Packit Service 603f59
    echo "Customizing ..."
Packit Service 603f59
    END=1
Packit Service 603f59
  else
Packit Service 603f59
    echo ""
Packit Service 603f59
    echo "Please answer y|n [y]."
Packit Service 603f59
  fi
Packit Service 603f59
done
Packit Service 603f59
Packit Service 603f59
# See if $OLD exists.
Packit Service 603f59
Packit Service 603f59
if test ! -r $OLD
Packit Service 603f59
then
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "FATAL: The file \"$OLD\" doesn't exist.  Customization can't"
Packit Service 603f59
  echo "continue without it."
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "Did you run the Configure script?"
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "Customize quits."
Packit Service 603f59
  echo ""
Packit Service 603f59
  exit 1
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# See if $NEW exists.
Packit Service 603f59
Packit Service 603f59
if test -r $NEW
Packit Service 603f59
then
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "====================================================================="
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "WARNING: \"$NEW\" exists.  Customization will replace it."
Packit Service 603f59
  END=0
Packit Service 603f59
  while test $END -eq 0
Packit Service 603f59
  do
Packit Service 603f59
    echo ""
Packit Service 603f59
    echo $EO "Do you want to remove $NEW (y|n) [y]? $EC"
Packit Service 603f59
    read ANS EXCESS
Packit Service 603f59
    if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "Removing $NEW"
Packit Service 603f59
      echo ""
Packit Service 603f59
      rm -f $NEW
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
      then
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "FATAL: Customize quits; it must be able to create \"$NEW\"."
Packit Service 603f59
        echo ""
Packit Service 603f59
        exit 1
Packit Service 603f59
      else
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "Please answer y|n [y]."
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  done
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Process HASSECURITY.
Packit Service 603f59
Packit Service 603f59
cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
When HASSECURITY is enabled, only the root user may use lsof to
Packit Service 603f59
examine all open files; other users may examine only the files
Packit Service 603f59
belonging to the real user ID of their lsof process.  If
Packit Service 603f59
HASNOSOCKSECURITY is also defined, anyone may list anyone else's
Packit Service 603f59
open socket files, provided their listing is selected with the "-i"
Packit Service 603f59
option.
Packit Service 603f59
Packit Service 603f59
When HASSECURITY is disabled, anyone may use lsof to examine all
Packit Service 603f59
open files.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
grep HASSECURITY $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  echo "HASSECURITY is enabled."
Packit Service 603f59
  NSEC=1
Packit Service 603f59
else
Packit Service 603f59
  echo "HASSECURITY is disabled."
Packit Service 603f59
  NSEC=0
Packit Service 603f59
fi
Packit Service 603f59
END=0
Packit Service 603f59
while test $END -eq 0
Packit Service 603f59
do
Packit Service 603f59
  echo ""
Packit Service 603f59
  if test $NSEC -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    echo $EO "Disable HASSECURITY (y|n) [n]? $EC"
Packit Service 603f59
  else
Packit Service 603f59
    echo $EO "Enable HASSECURITY (y|n) [n]? $EC"
Packit Service 603f59
  fi
Packit Service 603f59
  read ANS EXCESS
Packit Service 603f59
  if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
  then
Packit Service 603f59
    echo ""
Packit Service 603f59
    if test $NSEC -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      NSEC=0
Packit Service 603f59
      echo "HASSECURITY will be disabled."
Packit Service 603f59
    else
Packit Service 603f59
      NSEC=1
Packit Service 603f59
      echo "HASSECURITY will be enabled."
Packit Service 603f59
    fi
Packit Service 603f59
    END=1
Packit Service 603f59
  else
Packit Service 603f59
    if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "HASSECURITY will not be changed."
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "Please answer y|n [n]."
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
done
Packit Service 603f59
Packit Service 603f59
# If HASSECURITY is enabled, see if HASNOSOCKSECURITY should also be defined.
Packit Service 603f59
Packit Service 603f59
if test $NSEC -eq 1
Packit Service 603f59
then
Packit Service 603f59
  cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
====================================================================
Packit Service 603f59
Packit Service 603f59
When HASSECURITY is enabled, you may also define HASNOSOCKSECURITY.
Packit Service 603f59
Packit Service 603f59
When both are defined, no one but root may list all of anyone else's
Packit Service 603f59
open files -- only their own open files -- but anyone may list
Packit Service 603f59
anyone else's open socket files.
Packit Service 603f59
Packit Service 603f59
This option is useful with ntop (http://www.ntop.org).
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
  grep HASNOSOCKSECURITY $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
  if test $? -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    echo "HASNOSOCKSECURITY is enabled."
Packit Service 603f59
    SOCKSEC=1
Packit Service 603f59
  else
Packit Service 603f59
    echo "HASNOSOCKSECURITY is disabled."
Packit Service 603f59
    SOCKSEC=0
Packit Service 603f59
  fi
Packit Service 603f59
  END=0
Packit Service 603f59
  while test $END -eq 0
Packit Service 603f59
  do
Packit Service 603f59
    echo ""
Packit Service 603f59
    if test $SOCKSEC -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo $EO "Disable HASNOSOCKSECURITY (y|n) [n]? $EC"
Packit Service 603f59
    else
Packit Service 603f59
      echo $EO "Enable HASNOSOCKSECURITY (y|n) [n]? $EC"
Packit Service 603f59
    fi
Packit Service 603f59
    read ANS EXCESS
Packit Service 603f59
    if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      if test $SOCKSEC -eq 1
Packit Service 603f59
      then
Packit Service 603f59
        SOCKSEC=0
Packit Service 603f59
        echo "HASNOSOCKSECURITY will be disabled."
Packit Service 603f59
      else
Packit Service 603f59
        SOCKSEC=1
Packit Service 603f59
        echo "HASNOSOCKSECURITY will be enabled."
Packit Service 603f59
      fi
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
      then
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "HASNOSOCKSECURITY will not be changed."
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "Please answer y|n [n]."
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  done
Packit Service 603f59
else
Packit Service 603f59
  SOCKSEC=0
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Process WARNINGSTATE.
Packit Service 603f59
Packit Service 603f59
cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
When WARNINGSTATE is enabled, lsof will will issue whatever warning
Packit Service 603f59
messages it finds necessary.  When WARNINGSTATE is disabled, lsof
Packit Service 603f59
will issue no warning messages.  For individual uses of lsof, -w
Packit Service 603f59
disables warning state and +w enables it.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
grep WARNINGSTATE $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  echo "WARNINGSTATE is disabled."
Packit Service 603f59
  WST=0
Packit Service 603f59
else
Packit Service 603f59
  echo "WARNINGSTATE is enabled."
Packit Service 603f59
  WST=1
Packit Service 603f59
fi
Packit Service 603f59
END=0
Packit Service 603f59
NWST=$WST
Packit Service 603f59
while test $END -eq 0
Packit Service 603f59
do
Packit Service 603f59
  echo ""
Packit Service 603f59
  if test $NWST -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    echo $EO "Enable WARNINGSTATE? (y|n) [n]? $EC"
Packit Service 603f59
  else
Packit Service 603f59
    echo $EO "Disable WARNINGSTATE? (y|n) [n]? $EC"
Packit Service 603f59
  fi
Packit Service 603f59
  read ANS EXCESS
Packit Service 603f59
  if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
  then
Packit Service 603f59
    echo ""
Packit Service 603f59
    if test $NWST -eq 0
Packit Service 603f59
    then
Packit Service 603f59
      echo "WARNINGSTATE will be enabled."
Packit Service 603f59
      NWST=1
Packit Service 603f59
    else
Packit Service 603f59
      echo "WARNINGSTATE will be disabled."
Packit Service 603f59
      NWST=0
Packit Service 603f59
    fi
Packit Service 603f59
    END=1
Packit Service 603f59
  else
Packit Service 603f59
    if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "WARNINGSTATE will not be changed."
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "Please answer y|n [n]."
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
done
Packit Service 603f59
Packit Service 603f59
# Process WARNDEVACCESS, unless the dialect's machine.h header file contains
Packit Service 603f59
# NEVER_WARNDEVACCESS.
Packit Service 603f59
Packit Service 603f59
grep NEVER_WARNDEVACCESS $OLD > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  NEVERWDA=1
Packit Service 603f59
  NWDA=0
Packit Service 603f59
else
Packit Service 603f59
  NEVERWDA=0
Packit Service 603f59
  cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
When WARNDEVACCESS is enabled, lsof will issue warning messages
Packit Service 603f59
when it can't access nodes in /dev (or /devices), subject to the
Packit Service 603f59
default or explicit (-w) WARNINGSTATE.
Packit Service 603f59
Packit Service 603f59
When WARNDEVACCESS is disabled, lsof will silently skip nodes in
Packit Service 603f59
/dev (or /devices) that it can't access.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
  grep WARNDEVACCESS $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
  if test $? -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    echo "WARNDEVACCESS is enabled."
Packit Service 603f59
    WDA=1
Packit Service 603f59
  else
Packit Service 603f59
    echo "WARNDEVACCESS is disabled."
Packit Service 603f59
    WDA=0
Packit Service 603f59
  fi
Packit Service 603f59
  END=0
Packit Service 603f59
  NWDA=$WDA
Packit Service 603f59
  while test $END -eq 0
Packit Service 603f59
  do
Packit Service 603f59
    echo ""
Packit Service 603f59
    if test $NWDA -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo $EO "Disable WARNDEVACCESS (y|n) [n]? $EC"
Packit Service 603f59
    else
Packit Service 603f59
      echo $EO "Enable WARNDEVACCESS (y|n) [n]? $EC"
Packit Service 603f59
    fi
Packit Service 603f59
    read ANS EXCESS
Packit Service 603f59
    if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      if test $NWDA -eq 1
Packit Service 603f59
      then
Packit Service 603f59
        echo "WARNDEVACCESS will be disabled."
Packit Service 603f59
        NWDA=0
Packit Service 603f59
      else
Packit Service 603f59
        echo "WARNDEVACCESS will be enabled."
Packit Service 603f59
        NWDA=1
Packit Service 603f59
      fi
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	echo ""
Packit Service 603f59
	echo "WARNDEVACCESS will not be changed."
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "Please answer y|n [n]."
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  done
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Process HASDCACHE, unless the dialect's machine.h header file contains
Packit Service 603f59
# NEVER_HASDCACHE.
Packit Service 603f59
Packit Service 603f59
ENVV=""
Packit Service 603f59
ENVN=0
Packit Service 603f59
PDCV=""
Packit Service 603f59
PDCN=0
Packit Service 603f59
PDCPV=""
Packit Service 603f59
PDCPN=0
Packit Service 603f59
SDCV=""
Packit Service 603f59
SDCN=0
Packit Service 603f59
grep NEVER_HASDCACHE $OLD > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  NEVERDC=1
Packit Service 603f59
  CDC=0
Packit Service 603f59
  DC=0
Packit Service 603f59
  NDC=0
Packit Service 603f59
else
Packit Service 603f59
  NEVERDC=0
Packit Service 603f59
  cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
When HASDCACHE is enabled, lsof will write a device cache file that
Packit Service 603f59
contains information about the nodes in /dev (or /devices).  The
Packit Service 603f59
options HASENVDC, HASPERSDC, HASPERSDCPATH, and HASSYSDC define
Packit Service 603f59
the device cache file path.
Packit Service 603f59
Packit Service 603f59
When HASDCACHE is disabled, lsof won't write a device cache file.
Packit Service 603f59
Packit Service 603f59
Consult the 00DCACHE and 00FAQ files of the lsof distribution for
Packit Service 603f59
more information.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
  grep HASDCACHE $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
  if test $? -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    echo "HASDCACHE is enabled."
Packit Service 603f59
    DC=1
Packit Service 603f59
  else
Packit Service 603f59
    echo "HASDCACHE is disabled."
Packit Service 603f59
    DC=0
Packit Service 603f59
  fi
Packit Service 603f59
  END=0
Packit Service 603f59
  NDC=$DC
Packit Service 603f59
  while test $END -eq 0
Packit Service 603f59
  do
Packit Service 603f59
    echo ""
Packit Service 603f59
    if test $NDC -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo $EO "Disable HASDCACHE (y|n) [n]? $EC"
Packit Service 603f59
    else
Packit Service 603f59
      echo $EO "Enable HASDCACHE (y|n) [n]? $EC"
Packit Service 603f59
    fi
Packit Service 603f59
    read ANS EXCESS
Packit Service 603f59
    if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      if test $NDC -eq 1
Packit Service 603f59
      then
Packit Service 603f59
        echo "HASDCACHE will be disabled."
Packit Service 603f59
        NDC=0
Packit Service 603f59
      else
Packit Service 603f59
        echo "HASDCACHE will be enabled."
Packit Service 603f59
        NDC=1
Packit Service 603f59
      fi
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	echo ""
Packit Service 603f59
	echo "HASDCACHE will not be changed."
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        echo ""
Packit Service 603f59
        echo "Please answer y|n [n]."
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  done
Packit Service 603f59
Packit Service 603f59
  # See if other device cache options need to be declared.
Packit Service 603f59
Packit Service 603f59
  if test $DC -eq 1 -a $NDC -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
You have decided that HASDCACHE should be defined.  There are other
Packit Service 603f59
definitions associated with HASDCACHE that specify options for the
Packit Service 603f59
formation of the device cache file path.  You may change them.
Packit Service 603f59
Packit Service 603f59
Consult the 00DCACHE and 00FAQ files of the lsof distribution for
Packit Service 603f59
more information.
Packit Service 603f59
Packit Service 603f59
The current path options are:
Packit Service 603f59
  
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    grep HASENVDC $OLD | tail $TA | egrep "^#define"
Packit Service 603f59
    egrep "HASPERSDC$|HASPERSDC[ 	]" $OLD | tail $TA | egrep "^#define"
Packit Service 603f59
    grep HASPERSDCPATH $OLD | tail $TA | egrep "^#define"
Packit Service 603f59
    grep HASSYSDC $OLD | tail $TA | egrep "^#define"
Packit Service 603f59
    END=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to change path options (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
      then
Packit Service 603f59
        CDC=1
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
        then
Packit Service 603f59
	  CDC=0
Packit Service 603f59
	  END=1
Packit Service 603f59
        else
Packit Service 603f59
	  if test "X$ANS" = "X"
Packit Service 603f59
	  then
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "The path options will not be changed."
Packit Service 603f59
	    CDC=0
Packit Service 603f59
	    END=1
Packit Service 603f59
	  else
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "Please answer y|n [n]."
Packit Service 603f59
	  fi
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
  else
Packit Service 603f59
    CDC=0
Packit Service 603f59
  fi
Packit Service 603f59
  if test \( $NDC -eq 1 -a $DC -eq 0 \) -o \( $DC -eq 1 -a $CDC -eq 1 \)
Packit Service 603f59
  then
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
You may specify for HASENVDC the name of the environment variable
Packit Service 603f59
from which lsof should take the device cache file path for non-root
Packit Service 603f59
users.  Press ENTER to use the current value of HASENVDC:
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    echo $EO "        $EC"
Packit Service 603f59
    TMP1=`grep HASENVDC $OLD | tail $TA | egrep "^#define"`
Packit Service 603f59
    if test "X$TMP1" != "X"
Packit Service 603f59
    then
Packit Service 603f59
      TMP1=`echo "$TMP1" | sed 's/^#define[ 	]HASENVDC[ 	]"\([^"]*\)".*$/\1/'`
Packit Service 603f59
      echo "$TMP1"
Packit Service 603f59
    else
Packit Service 603f59
      echo "no current HASENVDC value"
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    GV=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to define a name for HASENVDC (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
      then
Packit Service 603f59
        ENVV=""
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
        then
Packit Service 603f59
	  GV=1
Packit Service 603f59
	  END=1
Packit Service 603f59
        else
Packit Service 603f59
	  if test "X$ANS" = "X"
Packit Service 603f59
	  then
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "HASENVDC will not be changed."
Packit Service 603f59
	    ENVV=$TMP1
Packit Service 603f59
	    END=1
Packit Service 603f59
	  else
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "Please answer y|n [n]."
Packit Service 603f59
	  fi
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    if test $GV -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Please enter the HASENVDC name (no quotes): $EC"
Packit Service 603f59
      read TMP1 EXCESS
Packit Service 603f59
      ENVV=`echo $TMP1 | sed 's/^\"//' | sed 's/\"$//'`
Packit Service 603f59
      if test "X$ENVV" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	ENVN=1
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
HASPERSDC is a format that specifies how the personal device cache
Packit Service 603f59
path is constructed.  Consult the 00DCACHE and 00FAQ files of the
Packit Service 603f59
lsof distribution for information on the conversions supported in
Packit Service 603f59
HASPERSDC.  Press ENTER to use the curent HASPERSDC format:
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    echo $EO "        $EC"
Packit Service 603f59
    TMP1=`egrep "HASPERSDC$|HASPERSDC[ 	]" $OLD | tail $TA | egrep "^#define"`
Packit Service 603f59
    if test "X$TMP1" != "X"
Packit Service 603f59
    then
Packit Service 603f59
      TMP1=`echo "$TMP1" | sed 's/^#define[ 	]HASPERSDC[ 	]"\([^"]*\)".*$/\1/'`
Packit Service 603f59
      echo "$TMP1"
Packit Service 603f59
    else
Packit Service 603f59
      echo "no current HASPERSDC format"
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    GV=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to define a format for HASPERSDC (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
      then
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
        then
Packit Service 603f59
	  GV=1
Packit Service 603f59
	  END=1
Packit Service 603f59
        else
Packit Service 603f59
	  if test "X$ANS" = "X"
Packit Service 603f59
	  then
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "HASPERSDC will not be changed."
Packit Service 603f59
	    PDCV=$TMP1
Packit Service 603f59
	    END=1
Packit Service 603f59
	  else
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "Please answer y|n [n]."
Packit Service 603f59
	  fi
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    if test $GV -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Please enter the HASPERSDC format (no quotes): $EC"
Packit Service 603f59
      read TMP1 EXCESS
Packit Service 603f59
      PDCV=`echo $TMP1 | sed 's/^\"//' | sed 's/\"$//'`
Packit Service 603f59
      if test "X$PDCV" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	PDCN=1
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
Specify for HASPERSDCPATH the name of the environment variable from
Packit Service 603f59
which lsof should take a path name component to insert at the %p
Packit Service 603f59
conversion in the HASPERSDC format.
Packit Service 603f59
Packit Service 603f59
Consult the 00FAQ and 00DCACHE files of the lsof distribution for
Packit Service 603f59
more information on HASPERSDCPATH usage.
Packit Service 603f59
Packit Service 603f59
Press ENTER to use the current value for HASPERSDCPATH:
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    echo $EO "        $EC"
Packit Service 603f59
    TMP1=`grep HASPERSDCPATH $OLD | tail $TA | egrep "^#define"`
Packit Service 603f59
    if test "X$TMP1" != "X"
Packit Service 603f59
    then
Packit Service 603f59
      TMP1=`echo "$TMP1" | sed 's/^#define[ 	]HASPERSDCPATH[ 	]"\([^"]*\)".*$/\1/'`
Packit Service 603f59
      echo "$TMP1"
Packit Service 603f59
    else
Packit Service 603f59
      echo "no current HASPERSDCPATH value"
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    GV=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to change HASPERSDCPATH (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	echo ""
Packit Service 603f59
	echo "HASPERSDCPATH will not be changed."
Packit Service 603f59
	PDCPV=$TMP1
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
        then
Packit Service 603f59
	  GV=1
Packit Service 603f59
	  END=1
Packit Service 603f59
	else
Packit Service 603f59
	  echo ""
Packit Service 603f59
	  echo "Please answer y|n [n]."
Packit Service 603f59
	fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    if test $GV -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Please enter the HASPERSDCPATH name (no quotes): $EC"
Packit Service 603f59
      read TMP1 EXCESS
Packit Service 603f59
      PDCPV=`echo $TMP1 | sed 's/^\"//' | sed 's/\"$//'`
Packit Service 603f59
      if test "X$PDCPV" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	PDCPN=1
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
Specify for HASSYSDC the system-wide device cache file path.  Press
Packit Service 603f59
ENTER to use the current HASSYSDC value:
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    echo $EO "        $EC"
Packit Service 603f59
    TMP1=`grep HASSYSDC $OLD | tail $TA | egrep "^#define"`
Packit Service 603f59
    if test "X$TMP1" != "X"
Packit Service 603f59
    then
Packit Service 603f59
      TMP1=`echo "$TMP1" | sed 's/^#define[ 	]HASSYSDC[ 	]"\([^"]*\)".*$/\1/'`
Packit Service 603f59
      echo "$TMP1"
Packit Service 603f59
    else
Packit Service 603f59
      echo "no current HASSYSDC value"
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    GV=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to define a system-device path (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
      then
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
        then
Packit Service 603f59
	  GV=1
Packit Service 603f59
	  END=1
Packit Service 603f59
        else
Packit Service 603f59
	  if test "X$ANS" = "X"
Packit Service 603f59
	  then
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "No HASSYSDC change will be made."
Packit Service 603f59
	    SDCV=$TMP1
Packit Service 603f59
	    END=1
Packit Service 603f59
	  else
Packit Service 603f59
	    echo ""
Packit Service 603f59
	    echo "Please answer y|n [n]."
Packit Service 603f59
	  fi
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    if test $GV -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Please enter the system-wide path (no quotes): $EC"
Packit Service 603f59
      read TMP1 EXCESS
Packit Service 603f59
      SDCV=`echo $TMP1 | sed 's/^\"//' | sed 's/\"$//'`
Packit Service 603f59
      if test "X$SDCV" = "X"
Packit Service 603f59
      then
Packit Service 603f59
	SDCN=1
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# If HASXOPT is defined, and HASXOPT_ROOT is mentioned,
Packit Service 603f59
# ask about changing HASXOPT_ROOT.
Packit Service 603f59
Packit Service 603f59
HXRC=0
Packit Service 603f59
grep HASXOPT $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
if test $? -eq 0
Packit Service 603f59
then
Packit Service 603f59
  grep HASXOPT_ROOT $OLD > /dev/null
Packit Service 603f59
  if test $? -eq 0
Packit Service 603f59
  then
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
HASXOPT is defined.  If the dialect for which you are customizing
Packit Service 603f59
appears in the following list, you may want to change the definition
Packit Service 603f59
of HASXOPT_ROOT to restrict the use of the X option to lsof processes
Packit Service 603f59
whose real user ID is root, or enable use of it by all user IDs.
Packit Service 603f59
Packit Service 603f59
  AIX           the -X option enables the risky operation of letting
Packit Service 603f59
		lsof read library entry structures with readx().
Packit Service 603f59
		If HASXOPT_ROOT is defined, only processes whose
Packit Service 603f59
		real user ID is root will be allowed to use -X.
Packit Service 603f59
		If HASXOPT_ROOT is undefined, any process will be
Packit Service 603f59
		allowed to use -X.  Consult the 00FAQ file of the
Packit Service 603f59
		lsof distribution for more information on why
Packit Service 603f59
		readx() may be risky.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    grep HASXOPT_ROOT $OLD | tail $TA | egrep "^#define" > /dev/null
Packit Service 603f59
    if test $? -eq 0
Packit Service 603f59
    then
Packit Service 603f59
      echo "HASXOPT_ROOT is defined."
Packit Service 603f59
      HXR="undefine"
Packit Service 603f59
      HXRS=1
Packit Service 603f59
    else
Packit Service 603f59
      echo "HASXOPT_ROOT is not defined."
Packit Service 603f59
      HXR="define"
Packit Service 603f59
      HXRS=0
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo $EO "Do you want to $HXR HASXOPT_ROOT (y|n) [n]? $EC"
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
      then
Packit Service 603f59
        HXRA=1
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
        then
Packit Service 603f59
	  echo ""
Packit Service 603f59
	  echo "HASXOPT_ROOT will not be changed."
Packit Service 603f59
          HXRA=0
Packit Service 603f59
          END=1
Packit Service 603f59
        else
Packit Service 603f59
          echo ""
Packit Service 603f59
          echo "Please answer y|n [n]."
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    if test $HXRA -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      HXRC=1
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Process HASKERNIDCK.  Skip processing for selected dialect directories.
Packit Service 603f59
Packit Service 603f59
case $DialDir in
Packit Service 603f59
  linux/proc)
Packit Service 603f59
    NIDCK=0
Packit Service 603f59
    ;;
Packit Service 603f59
  *)
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
=====================================================================
Packit Service 603f59
Packit Service 603f59
When HASKERNIDCK is enabled, lsof compares the identity of the
Packit Service 603f59
kernel where it was built to the identity of the kernel where it
Packit Service 603f59
is running.  This check can detect an lsof executable inappropriate
Packit Service 603f59
for the system on which it is being run.
Packit Service 603f59
Packit Service 603f59
The kernel identity check can take considerable time on some UNIX
Packit Service 603f59
dialects -- e.g., AIX -- so there may be occasions when it is
Packit Service 603f59
desirable to disable it, in spite of the increased risk of using
Packit Service 603f59
an inappropriate lsof executable.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    grep HASKERNIDCK $OLD | tail $TA | grep "^#define" > /dev/null
Packit Service 603f59
    if test $? -eq 0
Packit Service 603f59
    then
Packit Service 603f59
      echo "HASKERNIDCK is enabled."
Packit Service 603f59
      IDCK=1
Packit Service 603f59
    else
Packit Service 603f59
      echo "HASKERNIDCK is disabled."
Packit Service 603f59
      IDCK=0
Packit Service 603f59
    fi
Packit Service 603f59
    END=0
Packit Service 603f59
    NIDCK=$IDCK
Packit Service 603f59
    while test $END -eq 0
Packit Service 603f59
    do
Packit Service 603f59
      echo ""
Packit Service 603f59
      if test $NIDCK -eq 1
Packit Service 603f59
      then
Packit Service 603f59
        echo $EO "Disable HASKERNIDCK (y|n) [n]? $EC"
Packit Service 603f59
      else
Packit Service 603f59
        echo $EO "Enable HASKERNIDCK (y|n) [n]? $EC"
Packit Service 603f59
      fi
Packit Service 603f59
      read ANS EXCESS
Packit Service 603f59
      if test "X$ANS" = "Xy" -o "X$ANS" = "XY"
Packit Service 603f59
      then
Packit Service 603f59
        echo ""
Packit Service 603f59
        if test $NIDCK -eq 1
Packit Service 603f59
        then
Packit Service 603f59
          NIDCK=0
Packit Service 603f59
          echo "HASKERNIDCK will be disabled."
Packit Service 603f59
        else
Packit Service 603f59
          NIDCK=1
Packit Service 603f59
          echo "HASKERNIDCK will be enabled."
Packit Service 603f59
        fi
Packit Service 603f59
        END=1
Packit Service 603f59
      else
Packit Service 603f59
        if test "X$ANS" = "Xn" -o "X$ANS" = "XN" -o "X$ANS" = "X"
Packit Service 603f59
        then
Packit Service 603f59
          echo ""
Packit Service 603f59
          echo "HASKERNIDCK will not be changed."
Packit Service 603f59
          END=1
Packit Service 603f59
          NIDCK=$IDCK
Packit Service 603f59
        else
Packit Service 603f59
          echo ""
Packit Service 603f59
          echo "Please answer y|n [n]."
Packit Service 603f59
        fi
Packit Service 603f59
      fi
Packit Service 603f59
    done
Packit Service 603f59
    ;;
Packit Service 603f59
esac
Packit Service 603f59
Packit Service 603f59
# Initialize new machine.h.
Packit Service 603f59
Packit Service 603f59
rm -f $NEW
Packit Service 603f59
cp $OLD $NEW
Packit Service 603f59
chmod 0644 $NEW
Packit Service 603f59
echo "" >> $NEW
Packit Service 603f59
echo "/*" >> $NEW
Packit Service 603f59
echo $EO " * Added by Customize on $EC" >> $NEW
Packit Service 603f59
date >> $NEW
Packit Service 603f59
echo " */" >> $NEW
Packit Service 603f59
echo "" >> $NEW
Packit Service 603f59
Packit Service 603f59
# Change HASSECURITY and HASNOSOCKSECURITY, as required.
Packit Service 603f59
Packit Service 603f59
echo "#undef	HASSECURITY" >> $NEW
Packit Service 603f59
echo "#undef	HASNOSOCKSECURITY" >> $NEW
Packit Service 603f59
if test $NSEC -eq 1
Packit Service 603f59
then
Packit Service 603f59
  echo "#define	HASSECURITY	1" >> $NEW
Packit Service 603f59
  if test $SOCKSEC -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    echo "#define	HASNOSOCKSECURITY	1" >> $NEW
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Change WARNDEVACCESS, as required.
Packit Service 603f59
Packit Service 603f59
if test $NEVERWDA -eq 0
Packit Service 603f59
then
Packit Service 603f59
  echo "#undef	WARNDEVACCESS" >> $NEW
Packit Service 603f59
  if test $NWDA -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    echo "#define	WARNDEVACCESS	1" >> $NEW
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Change WARNINGSTATE, as required.
Packit Service 603f59
Packit Service 603f59
echo "#undef	WARNINGSTATE" >> $NEW
Packit Service 603f59
if test $NWST -eq 0
Packit Service 603f59
then
Packit Service 603f59
  echo "#define	WARNINGSTATE	1" >> $NEW
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Change device cache definitions, as required.
Packit Service 603f59
Packit Service 603f59
if test \( $NDC -eq 1 -a $DC -eq 0 \) -o \( $DC -eq 1 -a $CDC -eq 1 \)
Packit Service 603f59
then
Packit Service 603f59
  if test "X$ENVV" = "X" -a "X$PDCV" = "X" -a "X$SDCV" = "X"
Packit Service 603f59
  then
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
FATAL: HASDCACHE is defined, but there is no definition for
Packit Service 603f59
       any of HASENVDC, HASPERSDC, or HASSYSDC
Packit Service 603f59
Packit Service 603f59
       No new machine.h has been created.
Packit Service 603f59
Packit Service 603f59
       Customize quits.
Packit Service 603f59
Packit Service 603f59
       Restart Customize and define at least one of HASENVDC,
Packit Service 603f59
       HASPERSDC, or HASSYSDC.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    rm -f $NEW
Packit Service 603f59
    exit 1
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
if test "X$PDCV" != "X"
Packit Service 603f59
then
Packit Service 603f59
  echo "$PDCV" | grep "%p" > /dev/null
Packit Service 603f59
  if test $? -eq 0 -a $PDCPN -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    cat << .CAT_MARK
Packit Service 603f59
Packit Service 603f59
FATAL: HASDCACHE is defined and HASPERSDC has a %p conversion,
Packit Service 603f59
       but HASPERSDCPATH is NULL.
Packit Service 603f59
Packit Service 603f59
       No new machine.h has been created.
Packit Service 603f59
Packit Service 603f59
       Customize quits.
Packit Service 603f59
Packit Service 603f59
       Restart Customize and define HASPERSDCPATH.
Packit Service 603f59
Packit Service 603f59
.CAT_MARK
Packit Service 603f59
Packit Service 603f59
    rm -f $NEW
Packit Service 603f59
    exit 1
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
echo "#undef	HASDCACHE" >> $NEW
Packit Service 603f59
if test $NEVERDC -eq 1
Packit Service 603f59
then
Packit Service 603f59
  echo "#undef	HASENVDC" >> $NEW
Packit Service 603f59
  echo "#undef	HASPERSDC" >> $NEW
Packit Service 603f59
  echo "#undef	HASPERSDCPATH" >> $NEW
Packit Service 603f59
  echo "#undef	HASSYSDC" >> $NEW
Packit Service 603f59
else
Packit Service 603f59
  if test $NDC -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    echo "#define	HASDCACHE	1" >> $NEW
Packit Service 603f59
    if test "X$ENVV" != "X" -o $ENVN -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo "#undef	HASENVDC" >> $NEW
Packit Service 603f59
      if test $ENVN -eq 0
Packit Service 603f59
      then
Packit Service 603f59
        echo "#define	HASENVDC	\"$ENVV\"" >> $NEW
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    if test "X$PDCV" != "X" -o $PDCN -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo "#undef	HASPERSDC" >> $NEW
Packit Service 603f59
      if test $PDCN -eq 0
Packit Service 603f59
      then
Packit Service 603f59
        echo "#define	HASPERSDC	\"$PDCV\"" >> $NEW
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    if test "X$PDCPV" != "X" -o $PDCPN -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo "#undef	HASPERSDCPATH" >> $NEW
Packit Service 603f59
      if test $PDCPN -eq 0
Packit Service 603f59
      then
Packit Service 603f59
        echo "#define	HASPERSDCPATH	\"$PDCPV\"" >> $NEW
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
    if test "X$SDCV" != "X" -o $SDCN -eq 1
Packit Service 603f59
    then
Packit Service 603f59
      echo "#undef	HASSYSDC" >> $NEW
Packit Service 603f59
      if test $SDCN -eq 0
Packit Service 603f59
      then
Packit Service 603f59
        echo "#define	HASSYSDC	\"$SDCV\"" >> $NEW
Packit Service 603f59
      fi
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Change HASXOPT_ROOT, as required.
Packit Service 603f59
Packit Service 603f59
if test $HXRC -eq 1
Packit Service 603f59
then
Packit Service 603f59
  if test $HXRS -eq 1
Packit Service 603f59
  then
Packit Service 603f59
    echo "#undef	HASXOPT_ROOT" >> $NEW
Packit Service 603f59
  else
Packit Service 603f59
    echo "#define	HASXOPT_ROOT	1" >> $NEW
Packit Service 603f59
  fi
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Change HASKERNIDCK, as required.
Packit Service 603f59
Packit Service 603f59
echo "#undef	HASKERNIDCK" >> $NEW
Packit Service 603f59
if test $NIDCK -eq 1
Packit Service 603f59
then
Packit Service 603f59
  echo "#define	HASKERNIDCK	1" >> $NEW
Packit Service 603f59
fi
Packit Service 603f59
Packit Service 603f59
# Replace the current machine.h with the new one, as requested.
Packit Service 603f59
Packit Service 603f59
echo ""
Packit Service 603f59
echo "====================================================================="
Packit Service 603f59
echo ""
Packit Service 603f59
echo "A new $OLD file has been created in \"$NEW\"."
Packit Service 603f59
END=0
Packit Service 603f59
while test $END -eq 0
Packit Service 603f59
do
Packit Service 603f59
  echo ""
Packit Service 603f59
  echo "Do you want to rename $OLD to ${OLD}.old and replace it with"
Packit Service 603f59
  echo $EO "$NEW (y|n) [y]? $EC"
Packit Service 603f59
  read ANS EXCESS
Packit Service 603f59
  if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
Packit Service 603f59
  then
Packit Service 603f59
    END=1
Packit Service 603f59
  else
Packit Service 603f59
    if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
Packit Service 603f59
    then
Packit Service 603f59
      rm -f ${OLD}.old
Packit Service 603f59
      mv $OLD ${OLD}.old
Packit Service 603f59
      mv $NEW $OLD
Packit Service 603f59
      END=1
Packit Service 603f59
    else
Packit Service 603f59
      echo ""
Packit Service 603f59
      echo "Please answer y|n [y]."
Packit Service 603f59
    fi
Packit Service 603f59
  fi
Packit Service 603f59
done
Packit Service 603f59
echo ""
Packit Service 603f59
echo "You may now run the make command -- e.g.,"
Packit Service 603f59
echo ""
Packit Service 603f59
echo "        $ make"
Packit Service 603f59
echo ""
Packit Service 603f59
exit 0
Packit Service 603f59
#LAST_LINE