#!/bin/sh
#
#  DO NOT EDIT THIS FILE - it has been generated
#
# Install modified versions of certain ANSI-incompatible system header
# files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search.
#
# This script contains 118 fixup scripts.
#
# See README-fixinc for more information.
#
#  fixincludes copyright (c) 1998, 1999, 2000
#  The Free Software Foundation, Inc.
#
# fixincludes is free software.
# 
# You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 2, or (at your option) any later version.
# 
# fixincludes is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with fixincludes.  See the file "COPYING".  If not,
# write to:  The Free Software Foundation, Inc.,
#            59 Temple Place - Suite 330,
#            Boston,  MA  02111-1307, USA.
#
# # # # # # # # # # # # # # # # # # # # #
#
# Directory in which to store the results.
# Fail if no arg to specify a directory for the output.
if [ "x$1" = "x" ]
then
  echo fixincludes: no output directory specified
  exit 1
fi

LIB=${1}
shift

# Make sure it exists.
if [ ! -d $LIB ]; then
  mkdir $LIB || {
    echo fixincludes:  output dir '`'$LIB"' cannot be created"
    exit 1
  }
else
  ( cd $LIB && touch DONE && rm DONE ) || {
    echo fixincludes:  output dir '`'$LIB"' is an invalid directory"
    exit 1
  }
fi

FIXTESTS=$PWD/fixinc/fixtests
FIXFIXES=$PWD/fixinc/fixfixes

if test -z "$VERBOSE"
then
  VERBOSE=2
  export VERBOSE
else
  case "$VERBOSE" in
  [0-9] ) : ;;
  * )  VERBOSE=3 ;;
  esac
fi

# Define what target system we're fixing.
#
if test -r ./Makefile; then
  target_canonical="`sed -n -e 's,^target[ 	]*=[ 	]*\(.*\)$,\1,p' < Makefile`"
fi

# If not from the Makefile, then try config.guess
#
if test -z "${target_canonical}" ; then
  if test -x ./config.guess ; then
    target_canonical="`config.guess`" ; fi
  test -z "${target_canonical}" && target_canonical=unknown
fi
export target_canonical

# # # # # # # # # # # # # # # # # # # # #
#
# Define PWDCMD as a command to use to get the working dir
# in the form that we want.
PWDCMD=pwd

case "`$PWDCMD`" in
//*)
    # On an Apollo, discard everything before `/usr'.
    PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
    ;;
esac

# Original directory.
ORIGDIR=`${PWDCMD}`

# Make LIB absolute only if needed to avoid problems with the amd.
case $LIB in
/*)
    ;;
*)
    cd $LIB; LIB=`${PWDCMD}`
    ;;
esac

if test $VERBOSE -gt 0
then echo Fixing headers into ${LIB} for ${target_canonical} target ; fi

# Determine whether this system has symbolic links.
if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
  rm -f $LIB/ShouldNotExist
  LINKS=true
elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
  rm -f /tmp/ShouldNotExist
  LINKS=true
else
  LINKS=false
fi

# # # # # # # # # # # # # # # # # # # # #
#
#  Search each input directory for broken header files.
#  This loop ends near the end of the file.
#
if test $# -eq 0
then
    INPUTLIST="/usr/include"
else
    INPUTLIST="$@"
fi

for INPUT in ${INPUTLIST} ; do

cd ${ORIGDIR}

#  Make sure a directory exists before changing into it,
#  otherwise Solaris2 will fail-exit the script.
#
if [ ! -d ${INPUT} ]; then
  continue
fi
cd ${INPUT}

INPUT=`${PWDCMD}`

#
# # # # # # # # # # # # # # # # # # # # #
#
if test $VERBOSE -gt 1
then echo Finding directories and links to directories ; fi

# Find all directories and all symlinks that point to directories.
# Put the list in $all_dirs.
# Each time we find a symlink, add it to newdirs
# so that we do another find within the dir the link points to.
# Note that $all_dirs may have duplicates in it;
# later parts of this file are supposed to ignore them.
dirs="."
levels=2
all_dirs=""
search_dirs=""

while [ -n "$dirs" ] && [ $levels -gt 0 ]
do
  levels=`expr $levels - 1`
  newdirs=
  for d in $dirs
  do
    if test $VERBOSE -gt 1
    then echo " Searching $INPUT/$d" ; fi

    # Find all directories under $d, relative to $d, excluding $d itself.
    # (The /. is needed after $d in case $d is a symlink.)
    all_dirs="$all_dirs `find $d/. -type d -print | \
               sed -e '/\/\.$/d' -e 's@/./@/@g'`"
    # Find all links to directories.
    # Using `-exec test -d' in find fails on some systems,
    # and trying to run test via sh fails on others,
    # so this is the simplest alternative left.
    # First find all the links, then test each one.
    theselinks=
    $LINKS && \
      theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'`
    for d1 in $theselinks --dummy--
    do
      # If the link points to a directory,
      # add that dir to $newdirs
      if [ -d $d1 ]
      then
        all_dirs="$all_dirs $d1"
        if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
        then
          newdirs="$newdirs $d1"
          search_dirs="$search_dirs $d1"
        fi
      fi
    done
  done

  dirs="$newdirs"
done

# # # # # # # # # # # # # # # # # # # # #
#
dirs=
if test $VERBOSE -gt 2
then echo "All directories (including links to directories):"
     echo $all_dirs
fi

for file in $all_dirs; do
  rm -rf $LIB/$file
  if [ ! -d $LIB/$file ]
  then mkdir $LIB/$file
  fi
done
mkdir $LIB/root

# # # # # # # # # # # # # # # # # # # # #
#
# treetops gets an alternating list
# of old directories to copy
# and the new directories to copy to.
treetops=". ${LIB}"

if $LINKS; then
  if test $VERBOSE -gt 1
  then echo 'Making symbolic directory links' ; fi
  cwd=`${PWDCMD}`

  for sym_link in $search_dirs; do
    cd ${INPUT}
    dest=`ls -ld ${sym_link} | sed -n 's/.*-> //p'`

    # In case $dest is relative, get to ${sym_link}'s dir first.
    #
    cd ./`echo ${sym_link} | sed 's;/[^/]*$;;'`

    # Check that the target directory exists.
    # Redirections changed to avoid bug in sh on Ultrix.
    #
    (cd $dest) > /dev/null 2>&1
    if [ $? = 0 ]; then
      cd $dest

      # full_dest_dir gets the dir that the link actually leads to.
      #
      full_dest_dir=`${PWDCMD}`

      # Canonicalize ${INPUT} now to minimize the time an
      # automounter has to change the result of ${PWDCMD}.
      #
      cinput=`cd ${INPUT}; ${PWDCMD}`

      # If a link points to ., make a similar link to .
      #
      if [ ${full_dest_dir} = ${cinput} ]; then
        if test $VERBOSE -gt 2
        then echo ${sym_link} '->' . ': Making self link' ; fi
        rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
        ln -s . ${LIB}/${sym_link} > /dev/null 2>&1

      # If link leads back into ${INPUT},
      # make a similar link here.
      #
      elif expr ${full_dest_dir} : "${cinput}/.*" > /dev/null; then
        # Y gets the actual target dir name, relative to ${INPUT}.
        y=`echo ${full_dest_dir} | sed -n "s&${cinput}/&&p"`
        # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
        dots=`echo "${sym_link}" |
          sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
        if test $VERBOSE -gt 2
        then echo ${sym_link} '->' $dots$y ': Making local link' ; fi
        rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
        ln -s $dots$y ${LIB}/${sym_link} > /dev/null 2>&1

      else
        # If the link is to a dir $target outside ${INPUT},
        # repoint the link at ${INPUT}/root$target
        # and process $target into ${INPUT}/root$target
        # treat this directory as if it actually contained the files.
        #
        if test $VERBOSE -gt 2
        then echo ${sym_link} '->' root${full_dest_dir} ': Making rooted link'
        fi
        if [ -d $LIB/root${full_dest_dir} ]
        then true
        else
          dirname=root${full_dest_dir}/
          dirmade=.
          cd $LIB
          while [ x$dirname != x ]; do
            component=`echo $dirname | sed -e 's|/.*$||'`
            mkdir $component >/dev/null 2>&1
            cd $component
            dirmade=$dirmade/$component
            dirname=`echo $dirname | sed -e 's|[^/]*/||'`
          done
        fi

        # Duplicate directory structure created in ${LIB}/${sym_link} in new
        # root area.
        #
        for file2 in $all_dirs; do
          case $file2 in
            ${sym_link}/*)
              dupdir=${LIB}/root${full_dest_dir}/`echo $file2 |
                      sed -n "s|^${sym_link}/||p"`
              if test $VERBOSE -gt 2
              then echo "Duplicating ${sym_link}'s ${dupdir}" ; fi
              if [ -d ${dupdir} ]
              then true
              else
                mkdir ${dupdir}
              fi
              ;;
            *)
              ;;
          esac
        done

        # Get the path from ${LIB} to ${sym_link}, accounting for symlinks.
        #
        parent=`echo "${sym_link}" | sed -e 's@/[^/]*$@@'`
        libabs=`cd ${LIB}; ${PWDCMD}`
        file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`

        # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
        #
        dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
        rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
        ln -s ${dots}root${full_dest_dir} ${LIB}/${sym_link} > /dev/null 2>&1
        treetops="$treetops ${sym_link} ${LIB}/root${full_dest_dir}"
      fi
    fi
  done
fi

# # # # # # # # # # # # # # # # # # # # #
#
required=
set x $treetops
shift
while [ $# != 0 ]; do
  # $1 is an old directory to copy, and $2 is the new directory to copy to.
  #
  SRCDIR=`cd ${INPUT} ; cd $1 ; ${PWDCMD}`
  export SRCDIR

  FIND_BASE=$1
  export FIND_BASE
  shift

  DESTDIR=`cd $1;${PWDCMD}`
  export DESTDIR
  shift

  # The same dir can appear more than once in treetops.
  # There's no need to scan it more than once.
  #
  if [ -f ${DESTDIR}/DONE ]
  then continue ; fi

  touch ${DESTDIR}/DONE
  if test $VERBOSE -gt 1
  then echo Fixing directory ${SRCDIR} into ${DESTDIR} ; fi

  # Check files which are symlinks as well as those which are files.
  #
  cd ${INPUT}
  files=`if $LINKS; then
    find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
  else
    find ${FIND_BASE}/. -name '*.h' -type f -print
  fi | \
    sed -e 's;/\./;/;g' -e 's;//*;/;g' `

  echo Checking header files
  for file in $files; do

    # Skip unreadable files, symlinks to directories and glibc files
    if test ! -r "${file}" || test -d "${file}/." ; then
      continue
    fi

    fixlist=""
    DESTFILE=${DESTDIR}/`echo ${file} | sed "s;${FIND_BASE}/;;" `

    #
    # Fix Aaa_Ki_Iface
    #
    case "${file}" in ./sys/ki_iface.h )
    if ( test -n "`egrep 'These definitions are for HP Internal developers' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAA_ki_iface bypassing file ${file}"
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aaa_Ki
    #
    case "${file}" in ./sys/ki.h )
    if ( test -n "`egrep '11.00 HP-UX LP64' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAA_ki bypassing file ${file}"
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aaa_Ki_Calls
    #
    case "${file}" in ./sys/ki_calls.h )
    if ( test -n "`egrep 'kthread_create_caller_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAA_ki_calls bypassing file ${file}"
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aaa_Ki_Defs
    #
    case "${file}" in ./sys/ki_defs.h )
    if ( test -n "`egrep 'Kernel Instrumentation Definitions' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAA_ki_defs bypassing file ${file}"
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aaa_Bad_Fixes
    #
    case "${file}" in ./sundev/ipi_error.h )
    echo "AAA_bad_fixes bypassing file ${file}"
    continue

    ;; # case end for file name test
    esac


    #
    # Fix Aaa_Time
    #
    case "${file}" in ./sys/time.h )
    if ( test -n "`egrep '11.0 and later representation of ki time' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAA_time bypassing file ${file}"
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Dgux_Int_Varargs
    #
    case "${file}" in ./_int_varargs.h )
    echo "AAB_dgux_int_varargs replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
#ifndef __INT_VARARGS_H
#define __INT_VARARGS_H

/************************************************************************/
/* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio.   */
/************************************************************************/

/*
** This file is a DG internal header.  Never include this
** file directly.
*/

#ifndef ___int_features_h
#include &lt;sys/_int_features.h&gt;
#endif

#if !(defined(_VA_LIST) || defined(_VA_LIST_))
#define _VA_LIST
#define _VA_LIST_

#ifdef __LINT__

#ifdef __STDC__
typedef void * va_list;
#else
typedef char * va_list;
#endif

#else
#if _M88K_ANY

#if defined(__DCC__)

typedef struct {
      int     next_arg;
      int     *mem_ptr;
      int     *reg_ptr;
} va_list;

#else  /* ! defined(__DCC__) */

typedef struct {
      int  __va_arg;       /* argument number */
      int *__va_stk;       /* start of args passed on stack */
      int *__va_reg;       /* start of args passed in regs */
} va_list;

#endif  /* ! defined(__DCC__) */

#elif _IX86_ANY

#if defined(__GNUC__) || defined(__STDC__)
typedef void * va_list;
#else
typedef char * va_list;
#endif

#endif  /*  _IX86_ANY */

#endif /* __LINT__ */
#endif /*  !(defined(_VA_LIST) || defined(_VA_LIST_)) */
#endif /*  #ifndef __INT_VARARGS_H  */

_EOF_
    continue

    ;; # case end for file name test
    esac


    #
    # Fix Aab_Fd_Zero_Asm_Posix_Types_H
    #
    case "${file}" in ./asm/posix_types.h )
    case "$target_canonical" in i[34567]86-*-linux-gnu* )
    if ( test -z "`egrep '} while' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAB_fd_zero_asm_posix_types_h replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
/* This file fixes a bug in the __FD_ZERO macro
   for older versions of the Linux kernel. */
#ifndef _POSIX_TYPES_H_WRAPPER
#include <features.h>
 #include_next <asm/posix_types.h>

#if defined(__FD_ZERO) && !defined(__GLIBC__)
#undef __FD_ZERO
#define __FD_ZERO(fdsetp) \
  do { \
    int __d0, __d1; \
		__asm__ __volatile__("cld ; rep ; stosl" \
			: "=&c" (__d0), "=&D" (__d1) \
			: "a" (0), "0" (__FDSET_LONGS), \
			  "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
  } while (0)
#endif

#define _POSIX_TYPES_H_WRAPPER
#endif /* _POSIX_TYPES_H_WRAPPER */

_EOF_
    continue

    fi # end of bypass 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Fd_Zero_Gnu_Types_H
    #
    case "${file}" in ./gnu/types.h )
    case "$target_canonical" in i[34567]86-*-linux-gnu* )
    echo "AAB_fd_zero_gnu_types_h replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
/* This file fixes a bug in the __FD_ZERO macro present in glibc 1.x. */
#ifndef _TYPES_H_WRAPPER
#include <features.h>
 #include_next <gnu/types.h>

#if defined(__FD_ZERO) && !defined(__GLIBC__)
#undef __FD_ZERO
# define __FD_ZERO(fdsetp) \
  do { \
    int __d0, __d1; \
	__asm__ __volatile__("cld ; rep ; stosl" \
        	: "=&c" (__d0), "=&D" (__d1) \
        	: "a" (0), "0" (__FDSET_LONGS), \
		  "1" ((__fd_set *) (fdsetp)) :"memory"); \
  } while (0)
#endif

#define _TYPES_H_WRAPPER
#endif /* _TYPES_H_WRAPPER */

_EOF_
    continue

    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Fd_Zero_Selectbits_H
    #
    case "${file}" in ./selectbits.h )
    case "$target_canonical" in i[34567]86-*-linux-gnu* )
    echo "AAB_fd_zero_selectbits_h replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
/* This file fixes a bug in the __FD_ZERO macro present in glibc 2.0.x. */
#ifndef _SELECTBITS_H_WRAPPER
#include <features.h>
 #include_next <selectbits.h>

#if defined(__FD_ZERO) && defined(__GLIBC__) \
	&& defined(__GLIBC_MINOR__) && __GLIBC__ == 2 \
	&& __GLIBC_MINOR__ == 0
#undef __FD_ZERO
#define __FD_ZERO(fdsetp) \
  do { \
    int __d0, __d1; \
  __asm__ __volatile__ ("cld; rep; stosl" \
                        : "=&c" (__d0), "=&D" (__d1) \
                        : "a" (0), "0" (sizeof (__fd_set) \
                                        / sizeof (__fd_mask)), \
                          "1" ((__fd_mask *) (fdsetp)) \
                        : "memory"); \
  } while (0)
#endif

#define _SELECTBITS_H_WRAPPER
#endif /* _SELECTBITS_H_WRAPPER */

_EOF_
    continue

    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Sun_Memcpy
    #
    case "${file}" in ./memory.h )
    if ( test -n "`egrep '/\\*	@\\(#\\)(head/memory.h	50.1	 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2	)\\*/' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAB_sun_memcpy replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
/* This file was generated by fixincludes */
#ifndef __memory_h__
#define __memory_h__

#ifdef __STDC__
extern void *memccpy();
extern void *memchr();
extern void *memcpy();
extern void *memset();
#else
extern char *memccpy();
extern char *memchr();
extern char *memcpy();
extern char *memset();
#endif /* __STDC__ */

extern int memcmp();

#endif /* __memory_h__ */

_EOF_
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Svr4_Replace_Byteorder
    #
    case "${file}" in ./sys/byteorder.h )
    case "$target_canonical" in *-*-sysv4* | \
	i[34567]86-*-sysv5* | \
	i[34567]86-*-udk* | \
	i[34567]86-*-solaris2.[0-4] | \
	powerpcle-*-solaris2.[0-4] | \
	sparc-*-solaris2.[0-4] )
    echo "AAB_svr4_replace_byteorder replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
#ifndef _SYS_BYTEORDER_H
#define _SYS_BYTEORDER_H

/* Functions to convert `short' and `long' quantities from host byte order
   to (internet) network byte order (i.e. big-endian).

   Written by Ron Guilmette (rfg@ncd.com).

   This isn't actually used by GCC.  It is installed by fixinc.svr4.

   For big-endian machines these functions are essentially no-ops.

   For little-endian machines, we define the functions using specialized
   asm sequences in cases where doing so yields better code (e.g. i386).  */

#if !defined (__GNUC__) && !defined (__GNUG__)
#error You lose!  This file is only useful with GNU compilers.
#endif

#ifndef __BYTE_ORDER__
/* Byte order defines.  These are as defined on UnixWare 1.1, but with
   double underscores added at the front and back.  */
#define __LITTLE_ENDIAN__   1234
#define __BIG_ENDIAN__      4321
#define __PDP_ENDIAN__      3412
#endif

#ifdef __STDC__
static __inline__ unsigned long htonl (unsigned long);
static __inline__ unsigned short htons (unsigned int);
static __inline__ unsigned long ntohl (unsigned long);
static __inline__ unsigned short ntohs (unsigned int);
#endif /* defined (__STDC__) */

#if defined (__i386__)

#ifndef __BYTE_ORDER__
#define __BYTE_ORDER__ __LITTLE_ENDIAN__
#endif

/* Convert a host long to a network long.  */

/* We must use a new-style function definition, so that this will also
   be valid for C++.  */
static __inline__ unsigned long
htonl (unsigned long __arg)
{
  register unsigned long __result;

  __asm__ ("xchg%B0 %b0,%h0
	ror%L0 $16,%0
	xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
  return __result;
}

/* Convert a host short to a network short.  */

static __inline__ unsigned short
htons (unsigned int __arg)
{
  register unsigned short __result;

  __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
  return __result;
}

#elif ((defined (__i860__) && !defined (__i860_big_endian__))	\
       || defined (__ns32k__) || defined (__vax__)		\
       || defined (__spur__) || defined (__arm__))

#ifndef __BYTE_ORDER__
#define __BYTE_ORDER__ __LITTLE_ENDIAN__
#endif

/* For other little-endian machines, using C code is just as efficient as
   using assembly code.  */

/* Convert a host long to a network long.  */

static __inline__ unsigned long
htonl (unsigned long __arg)
{
  register unsigned long __result;

  __result = (__arg >> 24) & 0x000000ff;
  __result |= (__arg >> 8) & 0x0000ff00;
  __result |= (__arg << 8) & 0x00ff0000;
  __result |= (__arg << 24) & 0xff000000;
  return __result;
}

/* Convert a host short to a network short.  */

static __inline__ unsigned short
htons (unsigned int __arg)
{
  register unsigned short __result;

  __result = (__arg << 8) & 0xff00;
  __result |= (__arg >> 8) & 0x00ff;
  return __result;
}

#else /* must be a big-endian machine */

#ifndef __BYTE_ORDER__
#define __BYTE_ORDER__ __BIG_ENDIAN__
#endif

/* Convert a host long to a network long.  */

static __inline__ unsigned long
htonl (unsigned long __arg)
{
  return __arg;
}

/* Convert a host short to a network short.  */

static __inline__ unsigned short
htons (unsigned int __arg)
{
  return __arg;
}

#endif /* big-endian */

/* Convert a network long to a host long.  */

static __inline__ unsigned long
ntohl (unsigned long __arg)
{
  return htonl (__arg);
}

/* Convert a network short to a host short.  */

static __inline__ unsigned short
ntohs (unsigned int __arg)
{
  return htons (__arg);
}
#endif

_EOF_
    continue

    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Aab_Ultrix_Ansi_Compat
    #
    case "${file}" in ./ansi_compat.h )
    if ( test -n "`egrep 'ULTRIX' ${file}`"
       ) > /dev/null 2>&1 ; then
    echo "AAB_ultrix_ansi_compat replacing file ${file}" >&2
    cat > ${DESTFILE} << '_EOF_'
/* This file intentionally left blank.  */

_EOF_
    continue

    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aix_Syswait
    #
    case "${file}" in ./sys/wait.h )
    if ( test -n "`egrep 'bos325,' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      aix_syswait"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^extern pid_t wait3();$/i\
struct rusage;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aix_Volatile
    #
    case "${file}" in ./sys/signal.h )
    if ( test -n "`egrep 'typedef volatile int sig_atomic_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      aix_volatile"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Alpha_Getopt
    #
    case "${file}" in ./stdio.h | \
	./stdlib.h )
    if ( test -n "`egrep 'getopt\\(int, char \\*\\[' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      alpha_getopt"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Alpha_Parens
    #
    case "${file}" in ./sym.h )
    if ( test -n "`egrep '#ifndef\\(__mips64\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      alpha_parens"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Alpha_Sbrk
    #
    case "${file}" in ./unistd.h )
    if ( test -n "`egrep 'char[ 	]*\\*[	 ]*sbrk[ 	]*\\(' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      alpha_sbrk"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/char\([ 	]*\*[	 ]*sbrk[ 	]*(\)/void\1/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Arm_Norcroft_Hint
    #
    case "${file}" in ./X11/Intrinsic.h )
    if ( test -n "`egrep '___type p_type' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      arm_norcroft_hint"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/___type p_type/p_type/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Arm_Wchar
    #
    case "${file}" in ./stdlib.h )
    if ( test -n "`egrep '#[ 	]*define[ 	]*__wchar_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      arm_wchar"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/\(#[ 	]*ifndef[ 	]*\)__wchar_t/\1_GCC_WCHAR_T/' \
        -e 's/\(#[ 	]*define[ 	]*\)__wchar_t/\1_GCC_WCHAR_T/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Aux_Asm
    #
    case "${file}" in ./sys/param.h )
    if ( test -n "`egrep '#ifndef NOINLINE' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      aux_asm"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Avoid_Bool
    #
    case "${file}" in ./curses.h | \
	./curses_colr/curses.h | \
	./term.h | \
	./tinfo.h )
    if ( test -n "`egrep 'char[ 	]+bool|bool[ 	]+char' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep 'we must use the C\\+\\+ compiler'\\''s type' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      avoid_bool"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^#[ 	]*define[ 	][ 	]*bool[ 	][ 	]*char[ 	]*$/i\
#ifndef __cplusplus
' \
        -e '/^#[ 	]*define[ 	][ 	]*bool[ 	][ 	]*char[ 	]*$/a\
#endif
' \
        -e '/^typedef[ 	][ 	]*char[ 	][ 	]*bool[ 	]*;/i\
#ifndef __cplusplus
' \
        -e '/^typedef[ 	][ 	]*char[ 	][ 	]*bool[ 	]*;/a\
#endif
' \
        -e '/^[ ]*typedef[ 	][ 	]*unsigned char[ 	][ 	]*bool[ 	]*;/i\
#ifndef __cplusplus
' \
        -e '/^[ ]*typedef[ 	][ 	]*unsigned char[ 	][ 	]*bool[ 	]*;/a\
#endif
' \
        -e '/^typedef[ 	][ 	]*int[ 	][ 	]*bool[ 	]*;/i\
#ifndef __cplusplus
' \
        -e '/^typedef[ 	][ 	]*int[ 	][ 	]*bool[ 	]*;/a\
#endif
' \
        -e '/^[ ]*typedef[ 	][ 	]*unsigned int[ 	][ 	]*bool[ 	]*;/i\
#ifndef __cplusplus
' \
        -e '/^[ ]*typedef[ 	][ 	]*unsigned int[ 	][ 	]*bool[ 	]*;/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Bad_Struct_Term
    #
    case "${file}" in ./curses.h )
    if ( test -n "`egrep '^[ 	]*typedef[ 	]+struct[ 	]+term[ 	]*;' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      bad_struct_term"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^[ 	]*typedef[ 	][ 	]*\(struct[ 	][ 	]*term[ 	]*;[ 	]*\)$/\1/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Badquote
    #
    case "${file}" in ./sundev/vuid_event.h )
    fixlist="${fixlist}
      badquote"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/doesn'\''t/does not/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Bad_Lval
    #
    case "${file}" in ./libgen.h | \
	./dirent.h | \
	./ftw.h | \
	./grp.h | \
	./ndbm.h | \
	./pthread.h | \
	./pwd.h | \
	./signal.h | \
	./standards.h | \
	./stdlib.h | \
	./string.h | \
	./stropts.h | \
	./time.h | \
	./unistd.h )
    if ( test -n "`egrep '^[ 	]*#[ 	]*pragma[ 	][ 	]*extern_prefix' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      bad_lval"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^[ 	]*#[ 	]*define[ 	]*\([^(]*\)\(([^)]*)\)[ 	]*\(_.\)\1\2[ 	]*$/#define \1 \3\1/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Broken_Assert_Stdio
    #
    case "${file}" in ./assert.h )
    if ( test -n "`egrep 'stderr' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep 'include.*stdio.h' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      broken_assert_stdio"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '1i\
#include <stdio.h>
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Broken_Assert_Stdlib
    #
    case "${file}" in ./assert.h )
    if ( test -n "`egrep 'exit *\\(|abort *\\(' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep 'include.*stdlib.h' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      broken_assert_stdlib"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '1i\
#ifdef __cplusplus\
#include <stdlib.h>\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Broken_Cabs
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep '^extern double cabs' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      broken_cabs"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^extern double cabs();/d' \
        -e '/^extern double cabs(struct dbl_hypot);/d' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Dec_Intern_Asm
    #
    case "${file}" in ./c_asm.h )
    fixlist="${fixlist}
      dec_intern_asm"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^[ 	]*float[ 	]*fasm/i\
#ifdef __DECC
' \
        -e '/^[ 	]*#[ 	]*pragma[ 	]*intrinsic([ 	]*dasm/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Ecd_Cursor
    #
    case "${file}" in ./sunwindow/win_lock.h | \
	./sunwindow/win_cursor.h )
    fixlist="${fixlist}
      ecd_cursor"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/ecd.cursor/ecd_cursor/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Hp_Inline
    #
    case "${file}" in ./sys/spinlock.h )
    if ( test -n "`egrep 'include.*\"\\.\\./machine/' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      hp_inline"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
        -e 's,"../machine/psl.h",<machine/psl.h>,' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Hp_Sysfile
    #
    case "${file}" in ./sys/file.h )
    if ( test -n "`egrep 'HPUX_SOURCE' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      hp_sysfile"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/(\.\.\.)/(struct file *, ...)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Cxx_Unready
    #
    case "${file}" in ./sys/mman.h | \
	./rpc/types.h )
    if ( test -n "`egrep '[^#]+malloc.*;' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep '\"C\"|__BEGIN_DECLS' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      cxx_unready"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '1i\
#ifdef __cplusplus\
extern "C" {\
#endif\

' \
        -e '$a\
#ifdef __cplusplus\
}\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Hpux_Maxint
    #
    case "${file}" in ./sys/param.h )
    fixlist="${fixlist}
      hpux_maxint"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^#[ 	]*define[ 	]*MAXINT[ 	]/i\
#ifndef MAXINT
' \
        -e '/^#[ 	]*define[ 	]*MAXINT[ 	]/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Hpux_Systime
    #
    case "${file}" in ./sys/time.h )
    if ( test -n "`egrep '^extern struct sigevent;' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      hpux_systime"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^extern struct sigevent;/struct sigevent;/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Hpux8_Bogus_Inlines
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep 'inline' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      hpux8_bogus_inlines"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
        -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
        -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
        -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Hpux11_Uint32_C
    #
    case "${file}" in ./inttypes.h )
    if ( test -n "`egrep '^#define UINT32_C\\(__c\\)[ 	]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      hpux11_uint32_c"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^#define UINT32_C(__c)\([ 	]*\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\1__CONCAT__(__c,ul)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Isc_Omits_With_Stdc
    #
    case "${file}" in ./stdio.h | \
	./math.h | \
	./ctype.h | \
	./sys/limits.h | \
	./sys/fcntl.h | \
	./sys/dirent.h )
    if ( test -n "`egrep 'defined(__STDC__) && !defined(_POSIX_SOURCE)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      isc_omits_with_stdc"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Io_Use_Quotes
    #
    if ( test -n "`egrep 'define[ 	]+[A-Z0-9_]+[ 	]+[A-Z0-9_]+IO[A-Z]*[ 	]*\\( *[^,'\\'']' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      io_use_quotes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ${FIXFIXES} ${file} IO_use < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'


    #
    # Fix Io_Def_Quotes
    #
    if ( test -n "`egrep 'define[ 	]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\''\\1'\\''' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      io_def_quotes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ${FIXFIXES} ${file} IO_defn < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'


    #
    # Fix Ctrl_Use_Quotes
    #
    if ( test -n "`egrep 'define[ 	]+[A-Z0-9_]+[ 	]+[A-Z0-9_]+CTRL[ 	]*\\( *[^,'\\'']' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ctrl_use_quotes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ${FIXFIXES} ${file} CTRL_use < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'


    #
    # Fix Ctrl_Def_Quotes
    #
    if ( test -n "`egrep 'define[ 	]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\''\\1'\\''' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ctrl_def_quotes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ${FIXFIXES} ${file} CTRL_defn < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'


    #
    # Fix Ip_Missing_Semi
    #
    case "${file}" in ./netinet/ip.h )
    if ( test -n "`egrep '}$' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ip_missing_semi"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^struct/,/^};/s/}$/};/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Irix_Multiline_Cmnt
    #
    case "${file}" in ./sys/types.h )
    fixlist="${fixlist}
      irix_multiline_cmnt"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@type of the result@type of the result */@' \
        -e 's@of the sizeof@/* of the sizeof@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Irix_Sockaddr
    #
    case "${file}" in ./rpc/auth.h )
    if ( test -n "`egrep 'authdes_create.*struct sockaddr' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep '<sys/socket.h>' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      irix_sockaddr"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/authdes_create.*struct sockaddr/i\
struct sockaddr;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Irix_Struct__File
    #
    case "${file}" in ./rpc/xdr.h )
    fixlist="${fixlist}
      irix_struct__file"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/xdrstdio_create.*struct __file_s/i\
struct __file_s;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Irix_Asm_Apostrophe
    #
    case "${file}" in ./sys/asm.h )
    if ( test -n "`egrep '^[ 	]*#.*[Ww]e'\\''re' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      irix_asm_apostrophe"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^[ 	]*#/s/\([Ww]e\)'\''re/\1 are/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Isc_Fmod
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep 'fmod\\(double\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      isc_fmod"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/fmod(double)/fmod(double, double)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Motorola_Nested
    #
    case "${file}" in ./limits.h | \
	./sys/limits.h )
    case "$target_canonical" in m68k-motorola-sysv* )
    fixlist="${fixlist}
      motorola_nested"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@^\(#undef[ 	][ 	]*PIPE_BUF[ 	]*/\* max # bytes atomic in write to a\)$@\1 */@' \
        -e 's@\(/\*#define	HUGE_VAL	3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Isc_Sys_Limits
    #
    case "${file}" in ./sys/limits.h )
    if ( test -n "`egrep 'CHILD_MAX' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      isc_sys_limits"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/CHILD_MAX/s,/\* Max, Max,' \
        -e '/OPEN_MAX/s,/\* Max, Max,' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Kandr_Concat
    #
    case "${file}" in ./sparc/asm_linkage.h | \
	./sun3/asm_linkage.h | \
	./sun3x/asm_linkage.h | \
	./sun4/asm_linkage.h | \
	./sun4c/asm_linkage.h | \
	./sun4m/asm_linkage.h | \
	./sun4c/debug/asm_linkage.h | \
	./sun4m/debug/asm_linkage.h | \
	./arm/as_support.h | \
	./arm/mc_type.h | \
	./arm/xcb.h | \
	./dev/chardefmac.h | \
	./dev/ps_irq.h | \
	./dev/screen.h | \
	./dev/scsi.h | \
	./sys/tty.h | \
	./Xm.acorn/XmP.h | \
	./bsd43/bsd43_.h )
    if ( test -n "`egrep '/\\*\\*/' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      kandr_concat"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's|/\*\*/|##|g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Limits_Ifndefs
    #
    case "${file}" in ./limits.h | \
	./sys/limits.h )
    if ( test -z "`egrep 'ifndef[ 	]+FLT_MIN' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      limits_ifndefs"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/[ 	]FLT_MIN[ 	]/i\
#ifndef FLT_MIN
' \
        -e '/[ 	]FLT_MIN[ 	]/a\
#endif
' \
        -e '/[ 	]FLT_MAX[ 	]/i\
#ifndef FLT_MAX
' \
        -e '/[ 	]FLT_MAX[ 	]/a\
#endif
' \
        -e '/[ 	]FLT_DIG[ 	]/i\
#ifndef FLT_DIG
' \
        -e '/[ 	]FLT_DIG[ 	]/a\
#endif
' \
        -e '/[ 	]DBL_MIN[ 	]/i\
#ifndef DBL_MIN
' \
        -e '/[ 	]DBL_MIN[ 	]/a\
#endif
' \
        -e '/[ 	]DBL_MAX[ 	]/i\
#ifndef DBL_MAX
' \
        -e '/[ 	]DBL_MAX[ 	]/a\
#endif
' \
        -e '/[ 	]DBL_DIG[ 	]/i\
#ifndef DBL_DIG
' \
        -e '/[ 	]DBL_DIG[ 	]/a\
#endif
' \
        -e '/^\(\/\*#define	HUGE_VAL	3\.[0-9e+]* *\)\/\*/s//\1/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Lynx_Void_Int
    #
    case "${file}" in ./curses.h )
    if ( test -n "`egrep '#[ 	]*define[ 	]+void[ 	]+int' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      lynx_void_int"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/#[ 	]*define[ 	][ 	]*void[ 	]int/d' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Lynxos_Fcntl_Proto
    #
    case "${file}" in ./fcntl.h )
    if ( test -n "`egrep 'fcntl.*\\(int, int, int\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      lynxos_fcntl_proto"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix M88k_Bad_Hypot_Opt
    #
    case "${file}" in ./math.h )
    case "$target_canonical" in m88k-motorola-sysv3* )
    fixlist="${fixlist}
      m88k_bad_hypot_opt"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
        -e '/^extern double hypot();$/a\
\/* Workaround a stupid Motorola optimization if one\
   of x or y is 0.0 and the other is negative!  *\/\
#ifdef __STDC__\
static __inline__ double fake_hypot (double x, double y)\
#else\
static __inline__ double fake_hypot (x, y)\
	double x, y;\
#endif\
{\
	return fabs (hypot (x, y));\
}\
#define hypot	fake_hypot
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix M88k_Bad_S_If
    #
    case "${file}" in ./sys/stat.h )
    case "$target_canonical" in m88k-*-sysv3* )
    if ( test -n "`egrep '#define[ 	]+S_IS[A-Z]*(m)[ 	]' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      m88k_bad_s_if"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^\(#define[ 	]*S_IS[A-Z]*(m)\)[ 	]*(m[ 	]*&[ 	]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ 	]*)/\1 (((m)\&S_IFMT)==\2)/' \
        -e 's/^\(#define[ 	]*S_IS[A-Z]*(m)\)[ 	]*(m[ 	]*&[ 	]*\(0[0-9]*\)[ 	]*)/\1 (((m)\&S_IFMT)==\2)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix M88k_Multi_Incl
    #
    case "${file}" in ./time.h )
    case "$target_canonical" in m88k-tektronix-sysv3* )
    if ( test -z "`egrep '#ifndef' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      m88k_multi_incl"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ( echo Fixing $file, to protect against multiple inclusion. >&2
      cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
      echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
      echo "#define __GCC_GOT_${cpp_wrapper}_"
      cat
      echo "#endif /* ! __GCC_GOT_${cpp_wrapper}_ */" ) < $infile > ${DESTDIR}/fixinc.tmp

    #  Shell scripts have the potential of removing the output
    #  We interpret that to mean the file is not to be altered
    #
    if test ! -f ${DESTDIR}/fixinc.tmp
    then continue ; fi 
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Machine_Ansi_H_Va_List
    #
    case "${file}" in ./machine/ansi.h )
    if ( test -n "`egrep '_BSD_VA_LIST_' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep '__builtin_va_list' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      machine_ansi_h_va_list"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/\(_BSD_VA_LIST_[ 	][ 	]*\).*$/\1__builtin_va_list/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Machine_Name
    #
    if ${FIXTESTS} ${file} machine_name
    then
    fixlist="${fixlist}
      machine_name"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ${FIXFIXES} ${file} machine_name < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of c_test 'if'


    #
    # Fix Math_Exception
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep 'struct exception' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep 'We have a problem when using C\\+\\+' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      math_exception"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '1i\
#ifdef __cplusplus\
#define exception __math_exception\
#endif
' \
        -e '$a\
#ifdef __cplusplus\
#undef exception\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Math_Huge_Val_From_Dbl_Max
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep 'define[ 	]*HUGE_VAL[ 	]*DBL_MAX' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep 'define[ 	]*DBL_MAX' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      math_huge_val_from_dbl_max"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 
    ( 	dbl_max_def=`egrep 'define[ 	]+DBL_MAX[ 	]+.*' float.h 2>/dev/null`

	if ( test -n "${dbl_max_def}" ) > /dev/null 2>&1
	then sed -e '/define[ 	]*HUGE_VAL[ 	]*DBL_MAX/s/DBL_MAX/'"$dbl_max_def/"
	else cat
	fi ) < $infile > ${DESTDIR}/fixinc.tmp

    #  Shell scripts have the potential of removing the output
    #  We interpret that to mean the file is not to be altered
    #
    if test ! -f ${DESTDIR}/fixinc.tmp
    then continue ; fi 
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Math_Huge_Val_Ifndef
    #
    case "${file}" in ./math/math.h )
    if ( test -n "`egrep 'define[ 	]*HUGE_VAL' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      math_huge_val_ifndef"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/define[ 	]HUGE_VAL[ 	]/i\
#ifndef HUGE_VAL
' \
        -e '/define[ 	]HUGE_VAL[ 	]/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Nested_Comment
    #
    case "${file}" in ./rpc/rpc.h )
    fixlist="${fixlist}
      nested_comment"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix News_Os_Recursion
    #
    case "${file}" in ./stdlib.h )
    if ( test -n "`egrep '#include <stdlib.h>' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      news_os_recursion"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^#include <stdlib.h>/i\
#ifdef BOGUS_RECURSION
' \
        -e '/^#include <stdlib.h>/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Next_Math_Prefix
    #
    case "${file}" in ./ansi/math.h )
    if ( test -n "`egrep '^extern.*double.*__const__.*' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      next_math_prefix"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
        -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
        -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
        -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
        -e '/^extern.*double.*__const__.*sin(/s/__const__//' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Next_Template
    #
    case "${file}" in ./bsd/libc.h )
    if ( test -n "`egrep 'template' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      next_template"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/\(.*template\)/s/template//' \
        -e '/extern.*volatile.*void.*abort/s/volatile//' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Next_Volitile
    #
    case "${file}" in ./ansi/stdlib.h )
    if ( test -n "`egrep 'volatile' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      next_volitile"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
        -e '/extern.*volatile.*void.*abort/s/volatile//' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Next_Wait_Union
    #
    case "${file}" in ./sys/wait.h )
    if ( test -n "`egrep 'wait\\(union wait' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      next_wait_union"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@wait(union wait@wait(void@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Nodeent_Syntax
    #
    case "${file}" in ./netdnet/dnetdb.h )
    fixlist="${fixlist}
      nodeent_syntax"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/char.*na_addr *$/char *na_addr;/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Osf_Namespace_A
    #
    case "${file}" in ./reg_types.h | \
	./sys/lc_core.h )
    if ( test '('  -r reg_types.h ')' -a \
              '('  -r sys/lc_core.h ')' -a \
              '('  -n "`grep '} regex_t;' reg_types.h`" ')' -a \
              '('  -z "`grep __regex_t regex.h`" ')'
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      osf_namespace_a"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/regex_t/__regex_t/g' \
        -e 's/regoff_t/__regoff_t/g' \
        -e 's/regmatch_t/__regmatch_t/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of test expression 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Osf_Namespace_B
    #
    case "${file}" in ./regex.h )
    if ( test '('  -r reg_types.h ')' -a \
              '('  -r sys/lc_core.h ')' -a \
              '('  -n "`grep '} regex_t;' reg_types.h`" ')' -a \
              '('  -z "`grep __regex_t regex.h`" ')'
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      osf_namespace_b"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/#include <reg_types.h>/a\
typedef __regex_t	regex_t;\
typedef __regoff_t	regoff_t;\
typedef __regmatch_t	regmatch_t;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of test expression 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Pthread_Page_Size
    #
    case "${file}" in ./pthread.h )
    if ( test -n "`egrep '^int __page_size' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      pthread_page_size"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^int __page_size/extern int __page_size/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Read_Ret_Type
    #
    case "${file}" in ./stdio.h )
    if ( test -n "`egrep 'extern int	.*, fread\\(\\), fwrite\\(\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      read_ret_type"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^\(extern int	fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int	\2;\
\1\3/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Rs6000_Double
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep '[^a-zA-Z_]class\\(' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      rs6000_double"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/class[(]/i\
#ifndef __cplusplus
' \
        -e '/class[(]/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Rs6000_Fchmod
    #
    case "${file}" in ./sys/stat.h )
    if ( test -n "`egrep 'fchmod\\(char' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      rs6000_fchmod"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/fchmod(char \*/fchmod(int/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Rs6000_Param
    #
    case "${file}" in ./stdio.h | \
	./unistd.h )
    if ( test -n "`egrep 'const char new' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      rs6000_param"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sco_Strict_Ansi
    #
    case "$target_canonical" in i?86-*-sco3.2* )
    if ( test -n "`egrep '^[ 	]*#[ 	]*if.*!__STDC__' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sco_strict_ansi"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/!__STDC__/!defined(__STRICT_ANSI__)/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for machine type test
    esac


    #
    # Fix Sco_Static_Func
    #
    case "${file}" in ./sys/stat.h )
    case "$target_canonical" in i?86-*-sco3.2* )
    if ( test -n "`egrep '^static int' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sco_static_func"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^static int/i\
#if __cplusplus\
extern "C" {\
#endif /* __cplusplus */' \
        -e '/^}$/a\
#if __cplusplus\
 }\
#endif /* __cplusplus */' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Sco_Utime
    #
    case "${file}" in ./sys/times.h )
    case "$target_canonical" in i?86-*-sco3.2v4* )
    if ( test -n "`egrep '(const char *, struct utimbuf *);' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sco_utime"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/(const char \*, struct utimbuf \*);/(const char *, const struct utimbuf *);/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Sony_Include
    #
    case "${file}" in ./machine/machparam.h )
    if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sony_include"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Statsswtch
    #
    case "${file}" in ./rpcsvc/rstat.h )
    if ( test -n "`egrep 'boottime$' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      statsswtch"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/boottime$/boottime;/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Stdio_Stdarg_H
    #
    case "${file}" in ./stdio.h )
    if ( test -z "`egrep 'include.*(stdarg.h|machine/ansi.h)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      stdio_stdarg_h"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '1i\
#define __need___va_list\
#include <stdarg.h>
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Stdio_Va_List
    #
    case "${file}" in ./stdio.h )
    if ( test -z "`egrep '__gnuc_va_list|_BSD_VA_LIST_' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      stdio_va_list"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@ va_list @ __gnuc_va_list @
s@ va_list)@ __gnuc_va_list)@
s@ _VA_LIST_));@ __gnuc_va_list));@
s@ va_list@ __not_va_list__@
s@\*va_list@*__not_va_list__@
s@ __va_list)@ __gnuc_va_list)@
s@typedef[ 	]\(.*\)[ 	]va_list[ 	]*;@typedef \1 __not_va_list__;@
s@GNUC_VA_LIST@GNUC_Va_LIST@
s@_NEED___VA_LIST@_NEED___Va_LIST@
s@VA_LIST@DUMMY_VA_LIST@
s@_Va_LIST@_VA_LIST@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Auth_Proto
    #
    case "${file}" in ./rpc/auth.h | \
	./rpc/clnt.h | \
	./rpc/svc.h | \
	./rpc/xdr.h )
    if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_auth_proto"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\
#ifdef __cplusplus\
\1...\2\
#else\
\1\2\
#endif/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Bogus_Ifdef
    #
    case "${file}" in ./hsfs/hsfs_spec.h | \
	./hsfs/iso_spec.h )
    if ( test -n "`egrep '#ifdef __i386__ || __vax__' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_bogus_ifdef"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Bogus_Ifdef_Sun4c
    #
    case "${file}" in ./hsfs/hsnode.h )
    if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_bogus_ifdef_sun4c"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Catmacro
    #
    case "${file}" in ./pixrect/memvar.h )
    if ( test -n "`egrep '^#define[ 	]+CAT\\(a,b\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_catmacro"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^#define[ 	]CAT(a,b)/ i\
#ifdef __STDC__ \
#define CAT(a,b) a##b\
#else
' \
        -e '/^#define[ 	]CAT(a,b)/ a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Malloc
    #
    case "${file}" in ./malloc.h )
    fixlist="${fixlist}
      sun_malloc"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/typedef[ 	]char \*	malloc_t/typedef void \*	malloc_t/g' \
        -e 's/int[ 	][ 	]*free/void	free/g' \
        -e 's/char\([ 	]*\*[ 	]*malloc\)/void\1/g' \
        -e 's/char\([ 	]*\*[ 	]*realloc\)/void\1/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Rusers_Semi
    #
    case "${file}" in ./rpcsvc/rusers.h )
    if ( test -n "`egrep '_cnt$' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_rusers_semi"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sun_Signal
    #
    case "${file}" in ./sys/signal.h | \
	./signal.h )
    if ( test -n "`egrep '^void	\\(\\*signal\\(\\)\\)\\(\\);' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sun_signal"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^void	(\*signal())();$/i\
#ifdef __cplusplus\
void	(*signal(...))(...);\
#else
' \
        -e '/^void	(\*signal())();$/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sunos_Matherr_Decl
    #
    case "${file}" in ./math.h )
    if ( test -z "`egrep 'matherr.*struct exception' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sunos_matherr_decl"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^struct exception/,$b' \
        -e '/matherr/i\
struct exception;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sunos_Strlen
    #
    case "${file}" in ./strings.h )
    if ( test -n "`egrep 'int[ 	]*strlen' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      sunos_strlen"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/int[ 	]*strlen();/__SIZE_TYPE__ strlen();/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Svr4_Getcwd
    #
    case "${file}" in ./stdlib.h | \
	./unistd.h | \
	./prototypes.h )
    if ( test -n "`egrep 'getcwd\\(char \\*, int\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      svr4_getcwd"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Svr4_Profil
    #
    case "${file}" in ./stdlib.h | \
	./unistd.h )
    fixlist="${fixlist}
      svr4_profil"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Systypes
    #
    case "${file}" in ./sys/types.h | \
	./stdlib.h | \
	./sys/stdtypes.h | \
	./stddef.h | \
	./memory.h | \
	./unistd.h )
    if ( test -n "`egrep 'typedef[ 	]+[a-z_][ 	a-z_]*[ 	](size|ptrdiff|wchar)_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      systypes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^[ 	]*\*[ 	]*typedef unsigned int size_t;/N' \
        -e 's/^\([ 	]*\*[ 	]*typedef unsigned int size_t;\n[ 	]*\*\/\)/\1\
#ifndef __SIZE_TYPE__\
#define __SIZE_TYPE__ long unsigned int\
#endif\
typedef __SIZE_TYPE__ size_t;\
/' \
        -e '/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]size_t/i\
#ifndef __SIZE_TYPE__\
#define __SIZE_TYPE__ long unsigned int\
#endif
' \
        -e 's/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]size_t/typedef __SIZE_TYPE__ size_t/' \
        -e '/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]ptrdiff_t/i\
#ifndef __PTRDIFF_TYPE__\
#define __PTRDIFF_TYPE__ long int\
#endif
' \
        -e 's/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
        -e '/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]wchar_t/i\
#ifndef __WCHAR_TYPE__\
#define __WCHAR_TYPE__ int\
#endif\
#ifndef __cplusplus
' \
        -e '/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]wchar_t/a\
#endif
' \
        -e 's/typedef[ 	][ 	]*[a-z_][ 	a-z_]*[ 	]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Systypes_Stdlib_Size_T
    #
    case "${file}" in ./sys/types.h | \
	./stdlib.h )
    if ( test -n "`egrep 'typedef[ 	][ 	]*[A-Za-z_][ 	A-Za-z_]*[ 	]size_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep '_(GCC|BSD)_SIZE_T' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      systypes_stdlib_size_t"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/typedef[ 	][ 	]*[A-Za-z_][ 	A-Za-z_]*[ 	]size_t/i\
#ifndef _GCC_SIZE_T\
#define _GCC_SIZE_T
' \
        -e '/typedef[ 	][ 	]*[A-Za-z_][ 	A-Za-z_]*[ 	]size_t/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Sysv68_String
    #
    case "${file}" in ./string.h )
    fixlist="${fixlist}
      sysv68_string"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/extern[ 	]*int[ 	]*strlen();/extern unsigned int strlen();/' \
        -e 's/extern[ 	]*int[ 	]*ffs[ 	]*(long);/extern int ffs(int);/' \
        -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
        -e '/^extern char$/N' \
        -e 's/^extern char\(\n	\*memccpy(),\)$/extern void\1/' \
        -e '/^	strncmp(),$/N' \
        -e 's/^\(	strncmp()\),\n\(	strlen(),\)$/\1;\
extern unsigned int\
\2/' \
        -e '/^extern int$/N' \
        -e 's/^extern int\(\n	strlen(),\)/extern size_t\1/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Sysz_Stdlib_For_Sun
    #
    case "${file}" in ./stdlib.h )
    fixlist="${fixlist}
      sysz_stdlib_for_sun"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/int	abort/void	abort/g' \
        -e 's/int	free/void	free/g' \
        -e 's/char[ 	]*\*[ 	]*calloc/void \*	calloc/g' \
        -e 's/char[ 	]*\*[ 	]*malloc/void \*	malloc/g' \
        -e 's/char[ 	]*\*[ 	]*realloc/void \*	realloc/g' \
        -e 's/char[ 	]*\*[ 	]*bsearch/void \*	bsearch/g' \
        -e 's/int[ 	][ 	]*exit/void	exit/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Sysz_Stdtypes_For_Sun
    #
    case "${file}" in ./sys/stdtypes.h )
    fixlist="${fixlist}
      sysz_stdtypes_for_sun"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/[	 ]size_t.*;/i\
#ifndef _GCC_SIZE_T\
#define _GCC_SIZE_T
' \
        -e '/[	 ]size_t.*;/a\
#endif
' \
        -e '/[	 ]ptrdiff_t.*;/i\
#ifndef _GCC_PTRDIFF_T\
#define _GCC_PTRDIFF_T
' \
        -e '/[	 ]ptrdiff_t.*;/a\
#endif
' \
        -e '/[	 ]wchar_t.*;/i\
#ifndef _GCC_WCHAR_T\
#define _GCC_WCHAR_T
' \
        -e '/[	 ]wchar_t.*;/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Tinfo_Cplusplus
    #
    case "${file}" in ./tinfo.h )
    if ( test -n "`egrep '[ 	]_cplusplus' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      tinfo_cplusplus"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/[ 	]_cplusplus/ __cplusplus/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Fix_Fixproto
    #
    case "${file}" in ./sys/utsname.h )
    if ( test -n "`egrep 'ULTRIX' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ultrix_fix_fixproto"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^[ 	]*extern[ 	]*int[ 	]*uname();$/i\
struct utsname;
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Atof_Param
    #
    case "${file}" in ./math.h )
    if ( test -n "`egrep 'atof\\([ 	]*char' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ultrix_atof_param"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@atof(\([ 	]*char[ 	]*\*[^)]*\))@atof(const \1)@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Const
    #
    case "${file}" in ./stdio.h )
    fixlist="${fixlist}
      ultrix_const"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
        -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
        -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
        -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
        -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
        -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
        -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
        -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
        -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Ifdef
    #
    case "${file}" in ./sys/file.h )
    if ( test -n "`egrep '#ifdef KERNEL[ 	]*[^ 	]' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ultrix_ifdef"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Nested_Cmnt
    #
    case "${file}" in ./rpc/svc.h )
    fixlist="${fixlist}
      ultrix_nested_cmnt"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's@^\( \*	int protocol;  \)/\*@\1*/ /*@' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    ;; # case end for file name test
    esac


    #
    # Fix Ultrix_Static
    #
    case "${file}" in ./machine/cpu.h )
    if ( test -n "`egrep '#include \"r[34]_cpu' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      ultrix_static"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
        -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
        -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Undefine_Null
    #
    if ( test -n "`egrep '^#[ 	]*define[ 	]*[ 	]NULL[ 	
]' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test -z "`egrep '#[ 	]*(ifn|un)def[ 	]*[ 	]NULL($|[ 	
])' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      undefine_null"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^#[ 	]*define[ 	][ 	]*NULL[ 	
]/i\
#undef NULL
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    fi # end of select 'if'


    #
    # Fix Unixware7_Byteorder_Fix
    #
    case "${file}" in ./arpa/inet.h )
    case "$target_canonical" in *-*-sysv4* | \
	i[34567]86-*-sysv5* | \
	i[34567]86-*-udk* | \
	i[34567]86-*-solaris2.[0-4] | \
	powerpcle-*-solaris2.[0-4] | \
	sparc-*-solaris2.[0-4] )
    if ( test -n "`egrep 'in_port_t' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      unixware7_byteorder_fix"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/^extern.*htons.*(in_port_t)/d' \
        -e '/^extern.*ntohs.*(in_port_t)/d' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for machine type test
    esac
    ;; # case end for file name test
    esac


    #
    # Fix Va_I960_Macro
    #
    case "${file}" in ./arch/i960/archI960.h )
    if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      va_i960_macro"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/__vsiz/__vxvsiz/' \
        -e 's/__vali/__vxvali/' \
        -e 's/__vpad/__vxvpad/' \
        -e 's/__alignof__/__vxalignof__/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Void_Null
    #
    case "${file}" in ./curses.h | \
	./dbm.h | \
	./locale.h | \
	./stdio.h | \
	./stdlib.h | \
	./string.h | \
	./time.h | \
	./unistd.h | \
	./sys/dir.h | \
	./sys/param.h | \
	./sys/types.h )
    if ( test -n "`egrep '#[ 	]*define[ 	][ 	]*NULL[ 	].*void' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      void_null"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/^#[ 	]*define[ 	]*NULL[ 	]*((void[ 	]*\*)0)/#define NULL 0/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Vxworks_Gcc_Problem
    #
    case "${file}" in ./types/vxTypesBase.h )
    if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      vxworks_gcc_problem"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
        -e '/[ 	]size_t/i\
#ifndef _GCC_SIZE_T\
#define _GCC_SIZE_T
' \
        -e '/[ 	]size_t/a\
#endif
' \
        -e '/[ 	]ptrdiff_t/i\
#ifndef _GCC_PTRDIFF_T\
#define _GCC_PTRDIFF_T
' \
        -e '/[ 	]ptrdiff_t/a\
#endif
' \
        -e '/[ 	]wchar_t/i\
#ifndef _GCC_WCHAR_T\
#define _GCC_WCHAR_T
' \
        -e '/[ 	]wchar_t/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Vxworks_Needs_Vxtypes
    #
    case "${file}" in ./time.h )
    if ( test -n "`egrep 'uint_t[ 	][ 	]*_clocks_per_sec' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      vxworks_needs_vxtypes"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/uint_t/unsigned int/' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Vxworks_Needs_Vxworks
    #
    case "${file}" in ./sys/stat.h )
    if ( test -n "`egrep '#[ 	]define[ 	][ 	]*__INCstath' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test '('  -r types/vxTypesOld.h ')' -a \
              '('  -n "`egrep '#include' $file`" ')' -a \
              '('  -n "`egrep ULONG $file`" ')'
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      vxworks_needs_vxworks"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/#[ 	]define[ 	][ 	]*__INCstath/a\
#include <types/vxTypesOld.h>
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of test expression 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix Vxworks_Time
    #
    case "${file}" in ./time.h )
    if ( test -n "`egrep 'VOIDFUNCPTR' ${file}`"
       ) > /dev/null 2>&1 ; then
    if ( test '('  -r vxWorks.h ')'
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      vxworks_time"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/VOIDFUNCPTR/i\
#ifndef __gcc_VOIDFUNCPTR_defined\
#ifdef __cplusplus\
typedef void (*__gcc_VOIDFUNCPTR) (...);\
#else\
typedef void (*__gcc_VOIDFUNCPTR) ();\
#endif\
#define __gcc_VOIDFUNCPTR_defined\
#endif
' \
        -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of test expression 'if'
    fi # end of select 'if'
    ;; # case end for file name test
    esac


    #
    # Fix X11_Class
    #
    case "${file}" in ./X11/ShellP.h )
    if ( test -z "`egrep '__cplusplus' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      x11_class"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/char \*class;/i\
#ifdef __cplusplus\
	char *c_class;\
#else
' \
        -e '/char \*class;/a\
#endif
' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix X11_Class_Usage
    #
    case "${file}" in ./Xm/BaseClassI.h )
    if ( test -z "`egrep '__cplusplus' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      x11_class_usage"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's/ class[)]/ c_class)/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix X11_New
    #
    case "${file}" in ./Xm/Traversal.h )
    if ( test -z "`egrep '__cplusplus' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      x11_new"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e '/Widget	old, new;/i\
#ifdef __cplusplus\
	Widget	old, c_new;\
#else
' \
        -e '/Widget	old, new;/a\
#endif
' \
        -e 's/Widget new,/Widget c_new,/g' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of bypass 'if'
    ;; # case end for file name test
    esac


    #
    # Fix X11_Sprintf
    #
    case "${file}" in ./X11/Xmu.h | \
	./X11/Xmu/Xmu.h )
    if ( test -n "`egrep 'sprintf\\(\\)' ${file}`"
       ) > /dev/null 2>&1 ; then
    fixlist="${fixlist}
      x11_sprintf"
    if [ ! -r ${DESTFILE} ]
    then infile=${file}
    else infile=${DESTFILE} ; fi 

    sed -e 's,^extern char \*	sprintf();$,#ifndef __STDC__\
extern char *	sprintf();\
#endif /* !defined __STDC__ */,' \
          < $infile > ${DESTDIR}/fixinc.tmp
    rm -f ${DESTFILE}
    mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
    fi # end of select 'if'
    ;; # case end for file name test
    esac
    #  IF the output has been removed OR it is unchanged,
    #  THEN ensure the output is gone
    #  ELSE look for local directory include syntax
    #
    if ( test ! -f ${DESTFILE} || \
         cmp ${file} ${DESTFILE} ) > /dev/null 2>&1
    then
      rm -f ${DESTFILE}
    else
      echo "Fixed ${file}:${fixlist}"

      # Find any include directives that use "file".
      #
      dir=`echo ${file} | sed -e s';/[^/]*$;;'`
      ddir=${DESTDIR}/$dir

      for include in `
         egrep '^[      ]*#[    ]*include[      ]*"[^/]' ${DESTFILE} |
         sed -e 's/^[   ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`
      do
        required="$required ${SRCDIR} $dir/$include ${ddir}/$include"
      done
    fi
  done # for file in $files

done

## Make sure that any include files referenced using double quotes
## exist in the fixed directory.  This comes last since otherwise
## we might end up deleting some of these files "because they don't
## need any change."
set x `echo $required`
shift
while [ $# != 0 ]; do
  newreq=
  while [ $# != 0 ]; do
    # $1 is the directory to copy from,
    # $2 is the unfixed file,
    # $3 is the fixed file name.
    #
    cd ${INPUT}
    cd $1
    if [ -f $2 ] ; then
      if [ -r $2 ] && [ ! -r $3 ]; then
        cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
        chmod +w $3 2>/dev/null
        chmod a+r $3 2>/dev/null
        if test $VERBOSE -gt 2
        then echo Copied $2 ; fi
        for include in `egrep '^[ 	]*#[ 	]*include[ 	]*"[^/]' $3 |
             sed -e 's/^[ 	]*#[ 	]*include[ 	]*"\([^"]*\)".*$/\1/'`
        do
	  dir=`echo $2 | sed -e s'|/[^/]*$||'`
	  dir2=`echo $3 | sed -e s'|/[^/]*$||'`
	  newreq="$newreq $1 $dir/$include $dir2/$include"
        done
      fi
    fi
    shift; shift; shift
  done
  set x $newreq
  shift
done

if test $VERBOSE -gt 2
then echo 'Cleaning up DONE files.' ; fi
cd $LIB
find . -name DONE -exec rm -f '{}' ';'

if test $VERBOSE -gt 1
then echo 'Cleaning up unneeded directories:' ; fi
cd $LIB
all_dirs=`find . -type d \! -name '.' -print | sort -r`
for file in $all_dirs; do
  if rmdir $LIB/$file > /dev/null
  then
    test $VERBOSE -gt 3 && echo "  removed $file"
  fi
done 2> /dev/null

test $VERBOSE -gt 2 && echo "Removing unused symlinks"

all_dirs=`find . -type l -print`
for file in $all_dirs
do
  if ls -lLd $file > /dev/null
  then :
  else rm -f $file
       test $VERBOSE -gt 3 && echo "  removed $file"
       rmdir `dirname $file` > /dev/null && \
         test $VERBOSE -gt 3 && \
         echo "  removed `dirname $file`"
  fi
done 2> /dev/null

if test $VERBOSE -gt 0
then echo fixincludes is done ; fi

# # # # # # # # # # # # # # # # # # # # #
#
# End of for INPUT directories
#
done
#
# # # # # # # # # # # # # # # # # # # # #

if [ x${INSTALL_ASSERT_H} != x ] && [ -f ${srcdir}/assert.h ]
then
  cd $ORIGDIR
  rm -f include/assert.h
  cp ${srcdir}/assert.h include/assert.h || exit 1
  chmod a+r include/assert.h
fi
