Commit 1f414ac4 by Bruce Korb

Merge from fixincl-branch

From-SVN: r25558
parent 9a9f6326
# Makefile for GNU C++ compiler. # Makefile for GNU compilers.
# Copyright (C) 1987, 88, 90-5, 1998 Free Software Foundation, Inc. # Copyright (C) 1998, 1999 Free Software Foundation, Inc.
#This file is part of GNU CC. #This file is part of GNU CC.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
# Its purpose is to build the any-platforms fixinc.sh script. # Its purpose is to build the any-platforms fixinc.sh script.
CFLAGS = -g CFLAGS = -g
FIXINC_DEFS = @fixinc_defs@
CC = @CC@ CC = @CC@
SHELL = /bin/sh SHELL = /bin/sh
...@@ -39,11 +40,11 @@ default : gen ...@@ -39,11 +40,11 @@ default : gen
# Specify the directories to be searched for header files. # Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order. # Both . and srcdir are used, in that order.
INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include
# Always use -I$(srcdir)/config when compiling. # Always use -I$(srcdir)/config when compiling.
.c.o: .c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< $(CC) -c $(CFLAGS) $(FIXINC_DEFS) $(CPPFLAGS) $(INCLUDES) $<
# The only suffixes we want for implicit rules are .c and .o. # The only suffixes we want for implicit rules are .c and .o.
.SUFFIXES: .SUFFIXES:
...@@ -55,12 +56,11 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config ...@@ -55,12 +56,11 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config
## ##
## Makefile for constructing the "best" include fixer we can ## Makefile for constructing the "best" include fixer we can
## ##
## $Id: Makefile.in,v 1.2 1998/12/16 21:18:54 law Exp $
##
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
OBJ = fixincl.o server.o regex.o OBJ = fixincl.o server.o regex.o
HDR = server.h regex.h HDR = server.h regex.h
LIBERTY = ../../libiberty/libiberty.a
SH_TARGET = inclhack.sh fixincl.sh SH_TARGET = inclhack.sh fixincl.sh
BIN_TARGET = fixincl BIN_TARGET = fixincl
...@@ -75,13 +75,13 @@ gen : $(SH_TARGET) fixincl.x ...@@ -75,13 +75,13 @@ gen : $(SH_TARGET) fixincl.x
$(OBJ): $(HDR) $(OBJ): $(HDR)
fixincl: $(OBJ) fixincl: $(OBJ)
@echo $(CC) -o $@ $(OBJ) $(LIB) ; \ @echo $(CC) -o $@ $(OBJ) $(LIBERTY) $(LIB) ; \
if $(CC) -o $@ $(OBJ) $(LIB) ; then : ; else \ if $(CC) -o $@ $(OBJ) $(LIBERTY) $(LIB) ; then : ; else \
rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \ rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \
chmod 777 $@ ; fi chmod 777 $@ ; fi
regex.o: regex.c regex.o: regex.c
-$(CC) $(CFLAGS) -DSTDC_HEADERS=1 -c regex.c -$(CC) $(CFLAGS) $(FIXINC_DEFS) -DSTDC_HEADERS=1 -c $(srcdir)/regex.c
fixincl.o : fixincl.x fixincl.c fixincl.o : fixincl.x fixincl.c
server.o : server.c server.h server.o : server.c server.h
...@@ -92,21 +92,28 @@ fixincl.x: fixincl.tpl inclhack.def ...@@ -92,21 +92,28 @@ fixincl.x: fixincl.tpl inclhack.def
autogen -T $(srcdir)/fixincl.tpl -b fixincl \ autogen -T $(srcdir)/fixincl.tpl -b fixincl \
$(srcdir)/inclhack.def ; \ $(srcdir)/inclhack.def ; \
else echo You need to install autogen ; \ else echo You need to install autogen ; \
$(CP) $(srcdir)/$@ . ; fi if [ `pwd` != `cd $(srcdir) ; pwd` ] ; then \
$(CP) $(srcdir)/$@ . ; \
else touch $@ ; fi ; fi
inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl
@if ( autogen --help > /dev/null 2>&1 ) ; then \ @if ( autogen --help > /dev/null 2>&1 ) ; then \
echo autogen inclhack.def ; \ echo autogen inclhack.def ; \
autogen inclhack.def ; \ autogen -L$(srcdir) $(srcdir)/inclhack.def ; \
else echo You need to install autogen ; \ else echo You need to install autogen ; \
$(CP) $(srcdir)/$@ . ; fi if [ `pwd` != `cd $(srcdir) ; pwd` ] ; then \
$(CP) $(srcdir)/$@ . ; \
else touch $@ ; fi ; fi
fixincl.sh: inclhack.def inclhack.tpl fixincl.sh: inclhack.def inclhack.tpl
@if ( autogen --help > /dev/null 2>&1 ) ; then \ @if ( autogen --help > /dev/null 2>&1 ) ; then \
echo autogen -DPROGRAM=1 -b fixincl inclhack.def ; \ echo autogen -DPROGRAM=1 -b fixincl inclhack.def ; \
autogen -DPROGRAM=1 -b fixincl inclhack.def ; touch $@ ; \ autogen -DPROGRAM=1 -b fixincl -L$(srcdir) \
$(srcdir)/inclhack.def ; touch $@ ; \
else echo You need to install autogen ; \ else echo You need to install autogen ; \
$(CP) $(srcdir)/$@ . ; fi if [ `pwd` != `cd $(srcdir) ; pwd` ] ; then \
$(CP) $(srcdir)/$@ . ; \
else touch $@ ; fi ; fi
clean: clean:
rm -f *.o $(TARGETS) fixincl.x rm -f *.o $(TARGETS) fixincl.x
...@@ -120,13 +127,19 @@ install: $(TARGETS) ...@@ -120,13 +127,19 @@ install: $(TARGETS)
@rm -f ../fixinc.sh ; \ @rm -f ../fixinc.sh ; \
if ( ./fixincl -v > /dev/null 2>&1 ) ; then \ if ( ./fixincl -v > /dev/null 2>&1 ) ; then \
echo cp fixincl.sh ../fixinc.sh ; \ echo cp fixincl.sh ../fixinc.sh ; \
cp fixincl.sh ../fixinc.sh ; \ if [ -f ./fixincl.sh ] ; \
then cp fixincl.sh ../fixinc.sh ; \
else cp $(srcdir)/fixincl.sh ../fixinc.sh ; fi ; \
chmod 555 ../fixinc.sh ; \ chmod 555 ../fixinc.sh ; \
rm -f ../fixincl ; \ rm -f ../fixincl ; \
echo cp fixincl .. ; \ echo cp fixincl .. ; \
cp fixincl .. ; \ cp fixincl .. ; \
chmod 555 ../fixincl ; \ chmod 555 ../fixincl ; \
else \ else \
echo Could not install binary fixincludes. ; \
echo Installing shell script instead. ; \
echo cp inclhack.sh ../fixinc.sh ; \ echo cp inclhack.sh ../fixinc.sh ; \
cp inclhack.sh ../fixinc.sh ; \ if [ -f ./inclhack.sh ] ; \
then cp inclhack.sh ../fixinc.sh ; \
else cp $(srcdir)/inclhack.sh ../fixinc.sh ; fi ; \
fi fi
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# DO NOT EDIT THIS FILE (fixincl.sh) # DO NOT EDIT THIS FILE (fixincl.sh)
# #
# It has been autogen-ed Friday October 16, 1998 at 07:29:49 AM PDT # It has been autogen-ed Wednesday January 27, 1999 at 09:03:56 AM PST
# From the definitions inclhack.def # From the definitions inclhack.def
# and the template file inclhack.tpl # and the template file inclhack.tpl
# #
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 104 fixup scripts. # This script contains 105 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
...@@ -127,10 +127,7 @@ for INPUT in ${INPUTLIST} ; do ...@@ -127,10 +127,7 @@ for INPUT in ${INPUTLIST} ; do
cd ${ORIGDIR} cd ${ORIGDIR}
cd ${INPUT} || { cd ${INPUT} || continue
echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
exit 1
}
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
...@@ -344,18 +341,20 @@ while [ $# != 0 ]; do ...@@ -344,18 +341,20 @@ while [ $# != 0 ]; do
# #
cd ${INPUT} cd ${INPUT}
cd $1 cd $1
if [ -r $2 ] && [ ! -r $3 ]; then if [ -f $2 ] ; then
cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 if [ -r $2 ] && [ ! -r $3 ]; then
chmod +w $3 2>/dev/null cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
chmod a+r $3 2>/dev/null chmod +w $3 2>/dev/null
echo Copied $2 chmod a+r $3 2>/dev/null
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | echo Copied $2
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
do do
dir=`echo $2 | sed -e s'|/[^/]*$||'` dir=`echo $2 | sed -e s'|/[^/]*$||'`
dir2=`echo $3 | sed -e s'|/[^/]*$||'` dir2=`echo $3 | sed -e s'|/[^/]*$||'`
newreq="$newreq $1 $dir/$include $dir2/$include" newreq="$newreq $1 $dir/$include $dir2/$include"
done done
fi
fi fi
shift; shift; shift shift; shift; shift
done done
...@@ -384,6 +383,6 @@ done ...@@ -384,6 +383,6 @@ done
cd $ORIGDIR cd $ORIGDIR
rm -f include/assert.h rm -f include/assert.h
cp ${EGCS_SRCDIR}/assert.h include/assert.h cp ${srcdir}/assert.h include/assert.h || exit 1
chmod a+r include/assert.h chmod a+r include/assert.h
/* /*
* DO NOT EDIT THIS FILE (fixincl.x) * DO NOT EDIT THIS FILE (fixincl.x)
* *
* It has been autogen-ed Friday October 16, 1998 at 07:29:50 AM PDT * It has been autogen-ed Tuesday January 5, 1999 at 09:20:37 AM PST
* From the definitions inclhack.def * From the definitions inclhack.def
* and the template file fixincl.tpl * and the template file fixincl.tpl
* *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* files which are fixed to work correctly with ANSI C and placed in a * files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search. * directory that GNU C will search.
* *
* This script contains 104 fixup scripts. * This script contains 105 fixup scripts.
* *
* See README-fixinc for more information. * See README-fixinc for more information.
* *
...@@ -3005,7 +3005,41 @@ const char* apzUltrix_Ansi_CompatPatch[] = { "sed", ...@@ -3005,7 +3005,41 @@ const char* apzUltrix_Ansi_CompatPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 84 - Ultrix_Atof_Param fix * Description 84 - Ultrix_Fix_Fixproto fix
*/
tSCC zUltrix_Fix_FixprotoName[] =
"Ultrix_Fix_Fixproto";
/*
* File name selection pattern
*/
tSCC zUltrix_Fix_FixprotoList[] =
"|" "sys/utsname.h" "|";
/*
* Machine/OS name selection pattern
*/
#define apzUltrix_Fix_FixprotoMachs (const char**)NULL
/*
* content selection pattern
*/
tSCC zUltrix_Fix_FixprotoSelect0[] =
"ULTRIX";
#define ULTRIX_FIX_FIXPROTO_TEST_CT 1
tTestDesc aUltrix_Fix_FixprotoTests[] = {
{ TT_EGREP, zUltrix_Fix_FixprotoSelect0, (regex_t*)NULL } };
/*
* Fix Command Arguments for Ultrix_Fix_Fixproto
*/
const char* apzUltrix_Fix_FixprotoPatch[] = { "sed",
"-e" "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 85 - Ultrix_Atof_Param fix
*/ */
tSCC zUltrix_Atof_ParamName[] = tSCC zUltrix_Atof_ParamName[] =
"Ultrix_Atof_Param"; "Ultrix_Atof_Param";
...@@ -3034,7 +3068,7 @@ const char* apzUltrix_Atof_ParamPatch[] = { "sed", ...@@ -3034,7 +3068,7 @@ const char* apzUltrix_Atof_ParamPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 85 - Ultrix_Const fix * Description 86 - Ultrix_Const fix
*/ */
tSCC zUltrix_ConstName[] = tSCC zUltrix_ConstName[] =
"Ultrix_Const"; "Ultrix_Const";
...@@ -3067,7 +3101,7 @@ const char* apzUltrix_ConstPatch[] = { "sed", ...@@ -3067,7 +3101,7 @@ const char* apzUltrix_ConstPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 86 - Ultrix_Ifdef fix * Description 87 - Ultrix_Ifdef fix
*/ */
tSCC zUltrix_IfdefName[] = tSCC zUltrix_IfdefName[] =
"Ultrix_Ifdef"; "Ultrix_Ifdef";
...@@ -3100,7 +3134,7 @@ const char* apzUltrix_IfdefPatch[] = { "sed", ...@@ -3100,7 +3134,7 @@ const char* apzUltrix_IfdefPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 87 - Ultrix_Nested_Cmnt fix * Description 88 - Ultrix_Nested_Cmnt fix
*/ */
tSCC zUltrix_Nested_CmntName[] = tSCC zUltrix_Nested_CmntName[] =
"Ultrix_Nested_Cmnt"; "Ultrix_Nested_Cmnt";
...@@ -3125,7 +3159,7 @@ const char* apzUltrix_Nested_CmntPatch[] = { "sed", ...@@ -3125,7 +3159,7 @@ const char* apzUltrix_Nested_CmntPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 88 - Ultrix_Static fix * Description 89 - Ultrix_Static fix
*/ */
tSCC zUltrix_StaticName[] = tSCC zUltrix_StaticName[] =
"Ultrix_Static"; "Ultrix_Static";
...@@ -3160,7 +3194,7 @@ const char* apzUltrix_StaticPatch[] = { "sed", ...@@ -3160,7 +3194,7 @@ const char* apzUltrix_StaticPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 89 - Undefine_Null fix * Description 90 - Undefine_Null fix
*/ */
tSCC zUndefine_NullName[] = tSCC zUndefine_NullName[] =
"Undefine_Null"; "Undefine_Null";
...@@ -3200,7 +3234,7 @@ const char* apzUndefine_NullPatch[] = { "sed", ...@@ -3200,7 +3234,7 @@ const char* apzUndefine_NullPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 90 - Va_I960_Macro fix * Description 91 - Va_I960_Macro fix
*/ */
tSCC zVa_I960_MacroName[] = tSCC zVa_I960_MacroName[] =
"Va_I960_Macro"; "Va_I960_Macro";
...@@ -3236,7 +3270,7 @@ const char* apzVa_I960_MacroPatch[] = { "sed", ...@@ -3236,7 +3270,7 @@ const char* apzVa_I960_MacroPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 91 - Void_Null fix * Description 92 - Void_Null fix
*/ */
tSCC zVoid_NullName[] = tSCC zVoid_NullName[] =
"Void_Null"; "Void_Null";
...@@ -3279,7 +3313,7 @@ const char* apzVoid_NullPatch[] = { "sed", ...@@ -3279,7 +3313,7 @@ const char* apzVoid_NullPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 92 - Vxworks_Gcc_Problem fix * Description 93 - Vxworks_Gcc_Problem fix
*/ */
tSCC zVxworks_Gcc_ProblemName[] = tSCC zVxworks_Gcc_ProblemName[] =
"Vxworks_Gcc_Problem"; "Vxworks_Gcc_Problem";
...@@ -3327,7 +3361,7 @@ const char* apzVxworks_Gcc_ProblemPatch[] = { "sed", ...@@ -3327,7 +3361,7 @@ const char* apzVxworks_Gcc_ProblemPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 93 - Vxworks_Needs_Vxtypes fix * Description 94 - Vxworks_Needs_Vxtypes fix
*/ */
tSCC zVxworks_Needs_VxtypesName[] = tSCC zVxworks_Needs_VxtypesName[] =
"Vxworks_Needs_Vxtypes"; "Vxworks_Needs_Vxtypes";
...@@ -3360,7 +3394,7 @@ const char* apzVxworks_Needs_VxtypesPatch[] = { "sed", ...@@ -3360,7 +3394,7 @@ const char* apzVxworks_Needs_VxtypesPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 94 - Vxworks_Needs_Vxworks fix * Description 95 - Vxworks_Needs_Vxworks fix
*/ */
tSCC zVxworks_Needs_VxworksName[] = tSCC zVxworks_Needs_VxworksName[] =
"Vxworks_Needs_Vxworks"; "Vxworks_Needs_Vxworks";
...@@ -3407,7 +3441,7 @@ const char* apzVxworks_Needs_VxworksPatch[] = { "sed", ...@@ -3407,7 +3441,7 @@ const char* apzVxworks_Needs_VxworksPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 95 - Vxworks_Time fix * Description 96 - Vxworks_Time fix
*/ */
tSCC zVxworks_TimeName[] = tSCC zVxworks_TimeName[] =
"Vxworks_Time"; "Vxworks_Time";
...@@ -3456,7 +3490,7 @@ const char* apzVxworks_TimePatch[] = { "sed", ...@@ -3456,7 +3490,7 @@ const char* apzVxworks_TimePatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 96 - X11_Class fix * Description 97 - X11_Class fix
*/ */
tSCC zX11_ClassName[] = tSCC zX11_ClassName[] =
"X11_Class"; "X11_Class";
...@@ -3494,7 +3528,7 @@ const char* apzX11_ClassPatch[] = { "sed", ...@@ -3494,7 +3528,7 @@ const char* apzX11_ClassPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 97 - X11_Class_Usage fix * Description 98 - X11_Class_Usage fix
*/ */
tSCC zX11_Class_UsageName[] = tSCC zX11_Class_UsageName[] =
"X11_Class_Usage"; "X11_Class_Usage";
...@@ -3527,7 +3561,7 @@ const char* apzX11_Class_UsagePatch[] = { "sed", ...@@ -3527,7 +3561,7 @@ const char* apzX11_Class_UsagePatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 98 - X11_New fix * Description 99 - X11_New fix
*/ */
tSCC zX11_NewName[] = tSCC zX11_NewName[] =
"X11_New"; "X11_New";
...@@ -3566,7 +3600,7 @@ const char* apzX11_NewPatch[] = { "sed", ...@@ -3566,7 +3600,7 @@ const char* apzX11_NewPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 99 - X11_Sprintf fix * Description 100 - X11_Sprintf fix
*/ */
tSCC zX11_SprintfName[] = tSCC zX11_SprintfName[] =
"X11_Sprintf"; "X11_Sprintf";
...@@ -3593,7 +3627,7 @@ const char* apzX11_SprintfPatch[] = { "sed", ...@@ -3593,7 +3627,7 @@ const char* apzX11_SprintfPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 100 - Zzz_Ki_Iface fix * Description 101 - Zzz_Ki_Iface fix
*/ */
tSCC zZzz_Ki_IfaceName[] = tSCC zZzz_Ki_IfaceName[] =
"Zzz_Ki_Iface"; "Zzz_Ki_Iface";
...@@ -3628,7 +3662,7 @@ const char* apzZzz_Ki_IfacePatch[] = { "sh", "-c", ...@@ -3628,7 +3662,7 @@ const char* apzZzz_Ki_IfacePatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 101 - Zzz_Ki fix * Description 102 - Zzz_Ki fix
*/ */
tSCC zZzz_KiName[] = tSCC zZzz_KiName[] =
"Zzz_Ki"; "Zzz_Ki";
...@@ -3663,7 +3697,7 @@ const char* apzZzz_KiPatch[] = { "sh", "-c", ...@@ -3663,7 +3697,7 @@ const char* apzZzz_KiPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 102 - Zzz_Ki_Calls fix * Description 103 - Zzz_Ki_Calls fix
*/ */
tSCC zZzz_Ki_CallsName[] = tSCC zZzz_Ki_CallsName[] =
"Zzz_Ki_Calls"; "Zzz_Ki_Calls";
...@@ -3698,7 +3732,7 @@ const char* apzZzz_Ki_CallsPatch[] = { "sh", "-c", ...@@ -3698,7 +3732,7 @@ const char* apzZzz_Ki_CallsPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 103 - Zzz_Ki_Defs fix * Description 104 - Zzz_Ki_Defs fix
*/ */
tSCC zZzz_Ki_DefsName[] = tSCC zZzz_Ki_DefsName[] =
"Zzz_Ki_Defs"; "Zzz_Ki_Defs";
...@@ -3733,7 +3767,7 @@ const char* apzZzz_Ki_DefsPatch[] = { "sh", "-c", ...@@ -3733,7 +3767,7 @@ const char* apzZzz_Ki_DefsPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Description 104 - Zzz_Time fix * Description 105 - Zzz_Time fix
*/ */
tSCC zZzz_TimeName[] = tSCC zZzz_TimeName[] =
"Zzz_Time"; "Zzz_Time";
...@@ -3770,9 +3804,9 @@ const char* apzZzz_TimePatch[] = { "sh", "-c", ...@@ -3770,9 +3804,9 @@ const char* apzZzz_TimePatch[] = { "sh", "-c",
* *
* List of all fixes * List of all fixes
*/ */
#define REGEX_COUNT 75 #define REGEX_COUNT 76
#define FIX_COUNT 104 #define FIX_COUNT 105
tFixDesc fixDescList[ 104 ] = { tFixDesc fixDescList[ 105 ] = {
{ zAix_SyswaitName, zAix_SyswaitList, { zAix_SyswaitName, zAix_SyswaitList,
apzAix_SyswaitMachs, (regex_t*)NULL, apzAix_SyswaitMachs, (regex_t*)NULL,
AIX_SYSWAIT_TEST_CT, FD_MACH_ONLY, AIX_SYSWAIT_TEST_CT, FD_MACH_ONLY,
...@@ -4188,6 +4222,11 @@ tFixDesc fixDescList[ 104 ] = { ...@@ -4188,6 +4222,11 @@ tFixDesc fixDescList[ 104 ] = {
ULTRIX_ANSI_COMPAT_TEST_CT, FD_MACH_ONLY, ULTRIX_ANSI_COMPAT_TEST_CT, FD_MACH_ONLY,
aUltrix_Ansi_CompatTests, apzUltrix_Ansi_CompatPatch }, aUltrix_Ansi_CompatTests, apzUltrix_Ansi_CompatPatch },
{ zUltrix_Fix_FixprotoName, zUltrix_Fix_FixprotoList,
apzUltrix_Fix_FixprotoMachs, (regex_t*)NULL,
ULTRIX_FIX_FIXPROTO_TEST_CT, FD_MACH_ONLY,
aUltrix_Fix_FixprotoTests, apzUltrix_Fix_FixprotoPatch },
{ zUltrix_Atof_ParamName, zUltrix_Atof_ParamList, { zUltrix_Atof_ParamName, zUltrix_Atof_ParamList,
apzUltrix_Atof_ParamMachs, (regex_t*)NULL, apzUltrix_Atof_ParamMachs, (regex_t*)NULL,
ULTRIX_ATOF_PARAM_TEST_CT, FD_MACH_ONLY, ULTRIX_ATOF_PARAM_TEST_CT, FD_MACH_ONLY,
......
[= autogen template include =] [= autogen template include =]
[= [=
# $Id: hackshell.tpl,v 1.2 1998/12/16 21:19:08 law Exp $
# #
# This file contanes the shell template replacement for the # This file contanes the shell template replacement for the
# fixincl program. It is the repetitive guts of the fixincludes logic. # fixincl program. It is the repetitive guts of the fixincludes logic.
......
/* -*- Mode: C -*- $Id: inclhack.def,v 1.2 1998/12/16 21:19:09 law Exp $ */ /* -*- Mode: C -*- */
autogen definitions inclhack; autogen definitions inclhack;
...@@ -2007,6 +2007,19 @@ fix = { ...@@ -2007,6 +2007,19 @@ fix = {
/* /*
* Ultrix V4.[35] puts the declaration of uname before the definition
* of struct utsname, so the prototype (added by fixproto) causes havoc.
*/
fix = {
hackname = ultrix_fix_fixproto;
files = sys/utsname.h;
select = ULTRIX;
sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n";
};
/*
* parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R. * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
* also get rid of bogus inline definitions in HP-UX 8.0 * also get rid of bogus inline definitions in HP-UX 8.0
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# DO NOT EDIT THIS FILE (inclhack.sh) # DO NOT EDIT THIS FILE (inclhack.sh)
# #
# It has been autogen-ed Friday October 16, 1998 at 07:29:49 AM PDT # It has been autogen-ed Wednesday January 27, 1999 at 09:03:36 AM PST
# From the definitions inclhack.def # From the definitions inclhack.def
# and the template file inclhack.tpl # and the template file inclhack.tpl
# #
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 104 fixup scripts. # This script contains 105 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
...@@ -125,10 +125,7 @@ for INPUT in ${INPUTLIST} ; do ...@@ -125,10 +125,7 @@ for INPUT in ${INPUTLIST} ; do
cd ${ORIGDIR} cd ${ORIGDIR}
cd ${INPUT} || { cd ${INPUT} || continue
echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
exit 1
}
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
...@@ -2464,7 +2461,30 @@ extern unsigned int\ ...@@ -2464,7 +2461,30 @@ extern unsigned int\
# #
# Fix 84: Ultrix_Atof_Param # Fix 84: 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 ${DESTDIR}/$file ]
then infile=$file
else infile=${DESTDIR}/$file ; fi
sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\
struct utsname;
' \
< $infile > ${DESTDIR}/$file.
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
fi # end of selection 'if'
;; # case end for file name test
esac
#
# Fix 85: Ultrix_Atof_Param
# #
case "$file" in ./math.h ) case "$file" in ./math.h )
fixlist="${fixlist} fixlist="${fixlist}
...@@ -2486,7 +2506,7 @@ extern unsigned int\ ...@@ -2486,7 +2506,7 @@ extern unsigned int\
# #
# Fix 85: Ultrix_Const # Fix 86: Ultrix_Const
# #
case "$file" in ./stdio.h ) case "$file" in ./stdio.h )
fixlist="${fixlist} fixlist="${fixlist}
...@@ -2512,7 +2532,7 @@ extern unsigned int\ ...@@ -2512,7 +2532,7 @@ extern unsigned int\
# #
# Fix 86: Ultrix_Ifdef # Fix 87: Ultrix_Ifdef
# #
case "$file" in ./sys/file.h ) case "$file" in ./sys/file.h )
if ( test -n "`egrep '#ifdef KERNEL' $file`" if ( test -n "`egrep '#ifdef KERNEL' $file`"
...@@ -2533,7 +2553,7 @@ extern unsigned int\ ...@@ -2533,7 +2553,7 @@ extern unsigned int\
# #
# Fix 87: Ultrix_Nested_Cmnt # Fix 88: Ultrix_Nested_Cmnt
# #
case "$file" in ./rpc/svc.h ) case "$file" in ./rpc/svc.h )
fixlist="${fixlist} fixlist="${fixlist}
...@@ -2551,7 +2571,7 @@ extern unsigned int\ ...@@ -2551,7 +2571,7 @@ extern unsigned int\
# #
# Fix 88: Ultrix_Static # Fix 89: Ultrix_Static
# #
case "$file" in ./machine/cpu.h ) case "$file" in ./machine/cpu.h )
if ( test -n "`egrep '#include \"r[34]_cpu' $file`" if ( test -n "`egrep '#include \"r[34]_cpu' $file`"
...@@ -2574,7 +2594,7 @@ extern unsigned int\ ...@@ -2574,7 +2594,7 @@ extern unsigned int\
# #
# Fix 89: Undefine_Null # Fix 90: Undefine_Null
# #
if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' $file`" -a \ if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' $file`" -a \
-z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' $file`" -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' $file`"
...@@ -2595,7 +2615,7 @@ extern unsigned int\ ...@@ -2595,7 +2615,7 @@ extern unsigned int\
# #
# Fix 90: Va_I960_Macro # Fix 91: Va_I960_Macro
# #
case "$file" in ./arch/i960/archI960.h ) case "$file" in ./arch/i960/archI960.h )
if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' $file`" if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' $file`"
...@@ -2619,7 +2639,7 @@ extern unsigned int\ ...@@ -2619,7 +2639,7 @@ extern unsigned int\
# #
# Fix 91: Void_Null # Fix 92: Void_Null
# #
case "$file" in ./curses.h | \ case "$file" in ./curses.h | \
./dbm.h | \ ./dbm.h | \
...@@ -2650,7 +2670,7 @@ extern unsigned int\ ...@@ -2650,7 +2670,7 @@ extern unsigned int\
# #
# Fix 92: Vxworks_Gcc_Problem # Fix 93: Vxworks_Gcc_Problem
# #
case "$file" in ./types/vxTypesBase.h ) case "$file" in ./types/vxTypesBase.h )
if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' $file`" if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' $file`"
...@@ -2692,7 +2712,7 @@ extern unsigned int\ ...@@ -2692,7 +2712,7 @@ extern unsigned int\
# #
# Fix 93: Vxworks_Needs_Vxtypes # Fix 94: Vxworks_Needs_Vxtypes
# #
case "$file" in ./time.h ) case "$file" in ./time.h )
if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' $file`" if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' $file`"
...@@ -2713,7 +2733,7 @@ extern unsigned int\ ...@@ -2713,7 +2733,7 @@ extern unsigned int\
# #
# Fix 94: Vxworks_Needs_Vxworks # Fix 95: Vxworks_Needs_Vxworks
# #
case "$file" in ./sys/stat.h ) case "$file" in ./sys/stat.h )
if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' $file`" -a \ if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' $file`" -a \
...@@ -2739,7 +2759,7 @@ extern unsigned int\ ...@@ -2739,7 +2759,7 @@ extern unsigned int\
# #
# Fix 95: Vxworks_Time # Fix 96: Vxworks_Time
# #
case "$file" in ./time.h ) case "$file" in ./time.h )
if ( test -n "`egrep 'VOIDFUNCPTR' $file`" -a \ if ( test -n "`egrep 'VOIDFUNCPTR' $file`" -a \
...@@ -2771,7 +2791,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\ ...@@ -2771,7 +2791,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
# #
# Fix 96: X11_Class # Fix 97: X11_Class
# #
case "$file" in ./X11/ShellP.h ) case "$file" in ./X11/ShellP.h )
if ( test -z "`egrep '__cplusplus' $file`" if ( test -z "`egrep '__cplusplus' $file`"
...@@ -2799,7 +2819,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\ ...@@ -2799,7 +2819,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
# #
# Fix 97: X11_Class_Usage # Fix 98: X11_Class_Usage
# #
case "$file" in ./Xm/BaseClassI.h ) case "$file" in ./Xm/BaseClassI.h )
if ( test -z "`egrep '__cplusplus' $file`" if ( test -z "`egrep '__cplusplus' $file`"
...@@ -2820,7 +2840,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\ ...@@ -2820,7 +2840,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
# #
# Fix 98: X11_New # Fix 99: X11_New
# #
case "$file" in ./Xm/Traversal.h ) case "$file" in ./Xm/Traversal.h )
if ( test -z "`egrep '__cplusplus' $file`" if ( test -z "`egrep '__cplusplus' $file`"
...@@ -2849,7 +2869,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\ ...@@ -2849,7 +2869,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
# #
# Fix 99: X11_Sprintf # Fix 100: X11_Sprintf
# #
case "$file" in ./X11*/Xmu.h ) case "$file" in ./X11*/Xmu.h )
fixlist="${fixlist} fixlist="${fixlist}
...@@ -2869,7 +2889,7 @@ extern char * sprintf();\ ...@@ -2869,7 +2889,7 @@ extern char * sprintf();\
# #
# Fix 100: Zzz_Ki_Iface # Fix 101: Zzz_Ki_Iface
# #
case "$file" in ./sys/ki_iface.h ) case "$file" in ./sys/ki_iface.h )
if ( test -n "`egrep 'These definitions are for HP Internal developers' $file`" if ( test -n "`egrep 'These definitions are for HP Internal developers' $file`"
...@@ -2896,7 +2916,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file. ...@@ -2896,7 +2916,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
# #
# Fix 101: Zzz_Ki # Fix 102: Zzz_Ki
# #
case "$file" in ./sys/ki.h ) case "$file" in ./sys/ki.h )
if ( test -n "`egrep '11.00 HP-UX LP64' $file`" if ( test -n "`egrep '11.00 HP-UX LP64' $file`"
...@@ -2923,7 +2943,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file. ...@@ -2923,7 +2943,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
# #
# Fix 102: Zzz_Ki_Calls # Fix 103: Zzz_Ki_Calls
# #
case "$file" in ./sys/ki_calls.h ) case "$file" in ./sys/ki_calls.h )
if ( test -n "`egrep 'KI_MAX_PROCS is an arbitrary number' $file`" if ( test -n "`egrep 'KI_MAX_PROCS is an arbitrary number' $file`"
...@@ -2950,7 +2970,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file. ...@@ -2950,7 +2970,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
# #
# Fix 103: Zzz_Ki_Defs # Fix 104: Zzz_Ki_Defs
# #
case "$file" in ./sys/ki_defs.h ) case "$file" in ./sys/ki_defs.h )
if ( test -n "`egrep 'Kernel Instrumentation Definitions' $file`" if ( test -n "`egrep 'Kernel Instrumentation Definitions' $file`"
...@@ -2977,7 +2997,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file. ...@@ -2977,7 +2997,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
# #
# Fix 104: Zzz_Time # Fix 105: Zzz_Time
# #
case "$file" in ./sys/time.h ) case "$file" in ./sys/time.h )
if ( test -n "`egrep 'For CASPEC, look in' $file`" if ( test -n "`egrep 'For CASPEC, look in' $file`"
...@@ -3041,18 +3061,20 @@ while [ $# != 0 ]; do ...@@ -3041,18 +3061,20 @@ while [ $# != 0 ]; do
# #
cd ${INPUT} cd ${INPUT}
cd $1 cd $1
if [ -r $2 ] && [ ! -r $3 ]; then if [ -f $2 ] ; then
cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 if [ -r $2 ] && [ ! -r $3 ]; then
chmod +w $3 2>/dev/null cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
chmod a+r $3 2>/dev/null chmod +w $3 2>/dev/null
echo Copied $2 chmod a+r $3 2>/dev/null
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | echo Copied $2
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
do do
dir=`echo $2 | sed -e s'|/[^/]*$||'` dir=`echo $2 | sed -e s'|/[^/]*$||'`
dir2=`echo $3 | sed -e s'|/[^/]*$||'` dir2=`echo $3 | sed -e s'|/[^/]*$||'`
newreq="$newreq $1 $dir/$include $dir2/$include" newreq="$newreq $1 $dir/$include $dir2/$include"
done done
fi
fi fi
shift; shift; shift shift; shift; shift
done done
...@@ -3081,6 +3103,6 @@ done ...@@ -3081,6 +3103,6 @@ done
cd $ORIGDIR cd $ORIGDIR
rm -f include/assert.h rm -f include/assert.h
cp ${EGCS_SRCDIR}/assert.h include/assert.h cp ${srcdir}/assert.h include/assert.h || exit 1
chmod a+r include/assert.h chmod a+r include/assert.h
[= autogen template -*- Mode: ksh -*- [= autogen template -*- Mode: ksh -*-
sh sh
# #
# $Id: inclhack.tpl,v 1.2 1998/12/16 21:19:11 law Exp $
# #
=] =]
#!/bin/sh #!/bin/sh
...@@ -116,10 +115,7 @@ for INPUT in ${INPUTLIST} ; do ...@@ -116,10 +115,7 @@ for INPUT in ${INPUTLIST} ; do
cd ${ORIGDIR} cd ${ORIGDIR}
cd ${INPUT} || { cd ${INPUT} || continue
echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
exit 1
}
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
...@@ -342,18 +338,20 @@ while [ $# != 0 ]; do ...@@ -342,18 +338,20 @@ while [ $# != 0 ]; do
# #
cd ${INPUT} cd ${INPUT}
cd $1 cd $1
if [ -r $2 ] && [ ! -r $3 ]; then if [ -f $2 ] ; then
cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 if [ -r $2 ] && [ ! -r $3 ]; then
chmod +w $3 2>/dev/null cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
chmod a+r $3 2>/dev/null chmod +w $3 2>/dev/null
echo Copied $2 chmod a+r $3 2>/dev/null
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | echo Copied $2
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
do do
dir=`echo $2 | sed -e s'|/[^/]*$||'` dir=`echo $2 | sed -e s'|/[^/]*$||'`
dir2=`echo $3 | sed -e s'|/[^/]*$||'` dir2=`echo $3 | sed -e s'|/[^/]*$||'`
newreq="$newreq $1 $dir/$include $dir2/$include" newreq="$newreq $1 $dir/$include $dir2/$include"
done done
fi
fi fi
shift; shift; shift shift; shift; shift
done done
...@@ -382,7 +380,7 @@ done ...@@ -382,7 +380,7 @@ done
cd $ORIGDIR cd $ORIGDIR
rm -f include/assert.h rm -f include/assert.h
cp ${EGCS_SRCDIR}/assert.h include/assert.h cp ${srcdir}/assert.h include/assert.h || exit 1
chmod a+r include/assert.h chmod a+r include/assert.h
[= [=
......
...@@ -7,8 +7,10 @@ then ...@@ -7,8 +7,10 @@ then
exit 1 exit 1
fi fi
echo constructing fixinc.sh for $machine target=../fixinc.sh
fixincludes="../fixinc.sh"
echo constructing ${target} for $machine
fixincludes="${target}"
case $machine in case $machine in
*-*-gnu*) *-*-gnu*)
...@@ -103,21 +105,47 @@ case $machine in ...@@ -103,21 +105,47 @@ case $machine in
;; ;;
esac esac
# IF there is no include fixing,
# THEN create a no-op fixer and exit
#
if test -z "$fixincludes" if test -z "$fixincludes"
then then
cat > ../fixinc.sh <<- _EOF_ cat > ${target} <<- _EOF_
#! /bin/sh #! /bin/sh
exit 0 exit 0
_EOF_ _EOF_
exit 0 exit 0
fi fi
if test -f "$fixincludes" # IF the fixer is supplied in our source directory,
# THEN copy that into place
#
if test -f ${srcdir}/"${fixincludes}"
then then
echo copying $fixincludes to ../fixinc.sh echo copying ${srcdir}/$fixincludes to ${target}
cp $fixincludes ../fixinc.sh cp ${srcdir}/$fixincludes ${target}
exit 0 exit 0
fi fi
echo $MAKE install # OK. We gotta make the thing.
$MAKE install || cp inclhack.sh .. #
echo $MAKE SHELL=\"$SHELL\" install
# make and install either the binary or the default script
#
$MAKE SHELL="$SHELL" install && exit 0
# Where is our inclhack script? That is the backup
# in case we are unable to make a working binary.
#
if test -f ./inclhack.sh
then
INCLHACK=./inclhack.sh
else
INCLHACK=${srcdir}/inclhack.sh
fi
echo Could not install binary fixincludes.
echo Installing shell script instead.
cp ${INCLHACK} ${target}
/*
* server.c Set up and handle communications with a server process.
*
* Server Handling copyright 1992-1999 The Free Software Foundation
*
* Server Handling 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.
*
* Server Handling 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 Server Handling. See the file "COPYING". If not,
* write to: The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* As a special exception, The Free Software Foundation gives
* permission for additional uses of the text contained in his release
* of ServerHandler.
*
* The exception is that, if you link the ServerHandler library with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the ServerHandler library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by The Free
* Software Foundation under the name ServerHandler. If you copy code
* from other sources under the General Public License into a copy of
* ServerHandler, as the General Public License permits, the exception
* does not apply to the code that you add in this way. To avoid
* misleading anyone as to the status of such modified files, you must
* delete this exception notice from them.
*
* If you write modifications of your own for ServerHandler, it is your
* choice whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*/
#include "config.h"
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/param.h>
#include "server.h"
/* If this particular system's header files define the macro `MAXPATHLEN',
we happily take advantage of it; otherwise we use a value which ought
to be large enough. */
#ifndef MAXPATHLEN
# define MAXPATHLEN 4096
#endif
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
#ifdef DEBUG
#define STATIC
#else
#define STATIC static
#endif
#ifndef tSCC
#define tSCC static const char
#endif
#ifndef NUL
#define NUL '\0'
#endif
STATIC t_pchar def_args[] =
{ (char *) NULL, (char *) NULL };
/*
* chain_open
*
* Given an FD for an inferior process to use as stdin,
* start that process and return a NEW FD that that process
* will use for its stdout. Requires the argument vector
* for the new process and, optionally, a pointer to a place
* to store the child's process id.
*/
int
chain_open (stdin_fd, pp_args, p_child)
int stdin_fd;
t_pchar *pp_args;
pid_t *p_child;
{
t_fd_pair stdout_pair = {-1, -1};
pid_t ch_id;
char *pz_cmd;
/*
* Create a pipe it will be the child process' stdout,
* and the parent will read from it.
*/
if (pipe ((int *) &stdout_pair) < 0)
{
if (p_child != (pid_t *) NULL)
*p_child = NOPROCESS;
return -1;
}
/*
* If we did not get an arg list, use the default
*/
if (pp_args == (t_pchar *) NULL)
pp_args = def_args;
/*
* If the arg list does not have a program,
* assume the "SHELL" from the environment, or, failing
* that, then sh. Set argv[0] to whatever we decided on.
*/
if (pz_cmd = *pp_args,
(pz_cmd == (char *) NULL) || (*pz_cmd == '\0'))
{
pz_cmd = getenv ("SHELL");
if (pz_cmd == (char *) NULL)
pz_cmd = "sh";
}
#ifdef DEBUG_PRINT
printf ("START: %s\n", pz_cmd);
{
int idx = 0;
while (pp_args[++idx] != (char *) NULL)
printf (" ARG %2d: %s\n", idx, pp_args[idx]);
}
#endif
/*
* Call fork() and see which process we become
*/
ch_id = fork ();
switch (ch_id)
{
case NOPROCESS: /* parent - error in call */
close (stdout_pair.read_fd);
close (stdout_pair.write_fd);
if (p_child != (pid_t *) NULL)
*p_child = NOPROCESS;
return -1;
default: /* parent - return opposite FD's */
if (p_child != (pid_t *) NULL)
*p_child = ch_id;
#ifdef DEBUG_PRINT
printf ("for pid %d: stdin from %d, stdout to %d\n"
"for parent: read from %d\n",
ch_id, stdin_fd, stdout_pair.write_fd, stdout_pair.read_fd);
#endif
close (stdin_fd);
close (stdout_pair.write_fd);
return stdout_pair.read_fd;
case NULLPROCESS: /* child - continue processing */
break;
}
/*
* Close the pipe end handed back to the parent process
*/
close (stdout_pair.read_fd);
/*
* Close our current stdin and stdout
*/
close (STDIN_FILENO);
close (STDOUT_FILENO);
/*
* Make the fd passed in the stdin, and the write end of
* the new pipe become the stdout.
*/
fcntl (stdout_pair.write_fd, F_DUPFD, STDOUT_FILENO);
fcntl (stdin_fd, F_DUPFD, STDIN_FILENO);
if (*pp_args == (char *) NULL)
*pp_args = pz_cmd;
execvp (pz_cmd, pp_args);
fprintf (stderr, "Error %d: Could not execvp( '%s', ... ): %s\n",
errno, pz_cmd, strerror (errno));
exit (EXIT_PANIC);
}
/*
* proc2_open
*
* Given a pointer to an argument vector, start a process and
* place its stdin and stdout file descriptors into an fd pair
* structure. The "write_fd" connects to the inferior process
* stdin, and the "read_fd" connects to its stdout. The calling
* process should write to "write_fd" and read from "read_fd".
* The return value is the process id of the created process.
*/
pid_t
proc2_open (p_pair, pp_args)
t_fd_pair *p_pair;
t_pchar *pp_args;
{
pid_t ch_id;
/* Create a bi-directional pipe. Writes on 0 arrive on 1 and vice
versa, so the parent and child processes will read and write to
opposite FD's. */
if (pipe ((int *) p_pair) < 0)
return NOPROCESS;
p_pair->read_fd = chain_open (p_pair->read_fd, pp_args, &ch_id);
if (ch_id == NOPROCESS)
close (p_pair->write_fd);
return ch_id;
}
/*
* proc2_fopen
*
* Identical to "proc2_open()", except that the "fd"'s are
* "fdopen(3)"-ed into file pointers instead.
*/
pid_t
proc2_fopen (pf_pair, pp_args)
t_pf_pair *pf_pair;
t_pchar *pp_args;
{
t_fd_pair fd_pair;
pid_t ch_id = proc2_open (&fd_pair, pp_args);
if (ch_id == NOPROCESS)
return ch_id;
pf_pair->pf_read = fdopen (fd_pair.read_fd, "r");
pf_pair->pf_write = fdopen (fd_pair.write_fd, "w");
return ch_id;
}
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#pragma alloca #pragma alloca
#endif #endif
/* $Id: regex.c,v 1.3 1999/01/11 13:34:23 law Exp $ */
#define _GNU_SOURCE #define _GNU_SOURCE
/* We need this for `regex.h', and perhaps for the Emacs include files. */ /* We need this for `regex.h', and perhaps for the Emacs include files. */
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
Foundation, 59 Temple Place - Suite 330, Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* $Id: regex.h,v 1.3 1999/01/11 13:34:25 law Exp $ */
#ifndef __REGEXP_LIBRARY_H__ #ifndef __REGEXP_LIBRARY_H__
#define __REGEXP_LIBRARY_H__ #define __REGEXP_LIBRARY_H__
......
/* /*
* $Id: server.h,v 1.2 1998/12/16 21:19:17 law Exp $ * server.c Set up and handle communications with a server process.
* *
* Server Handling copyright 1992-1998 Bruce Korb * Server Handling copyright 1992-1999 The Free Software Foundation
* *
* Server Handling is free software. * Server Handling is free software.
* You may redistribute it and/or modify it under the terms of the * You may redistribute it and/or modify it under the terms of the
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
* 59 Temple Place - Suite 330, * 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
* *
* As a special exception, Bruce Korb gives permission for additional * As a special exception, The Free Software Foundation gives
* uses of the text contained in his release of ServerHandler. * permission for additional uses of the text contained in his release
* of ServerHandler.
* *
* The exception is that, if you link the ServerHandler library with other * The exception is that, if you link the ServerHandler library with other
* files to produce an executable, this does not by itself cause the * files to produce an executable, this does not by itself cause the
...@@ -32,12 +33,13 @@ ...@@ -32,12 +33,13 @@
* This exception does not however invalidate any other reasons why * This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License. * the executable file might be covered by the GNU General Public License.
* *
* This exception applies only to the code released by Bruce Korb under * This exception applies only to the code released by The Free
* the name ServerHandler. If you copy code from other sources under the * Software Foundation under the name ServerHandler. If you copy code
* General Public License into a copy of ServerHandler, as the General Public * from other sources under the General Public License into a copy of
* License permits, the exception does not apply to the code that you add * ServerHandler, as the General Public License permits, the exception
* in this way. To avoid misleading anyone as to the status of such * does not apply to the code that you add in this way. To avoid
* modified files, you must delete this exception notice from them. * misleading anyone as to the status of such modified files, you must
* delete this exception notice from them.
* *
* If you write modifications of your own for ServerHandler, it is your * If you write modifications of your own for ServerHandler, it is your
* choice whether to permit this exception to apply to your modifications. * choice whether to permit this exception to apply to your modifications.
...@@ -48,47 +50,45 @@ ...@@ -48,47 +50,45 @@
#define FIXINC_SERVER_H #define FIXINC_SERVER_H
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
/* /*
* Dual pipe opening of a child process * Dual pipe opening of a child process
*/ */
typedef struct typedef struct
{ {
int readFd; int read_fd;
int writeFd; int write_fd;
} } t_fd_pair;
tFdPair;
typedef struct typedef struct
{ {
FILE *pfRead; /* parent read fp */ FILE *pf_read; /* parent read fp */
FILE *pfWrite; /* parent write fp */ FILE *pf_write; /* parent write fp */
} } t_pf_pair;
tpfPair;
typedef char *tpChar; typedef char *t_pchar;
#define NOPROCESS ((pid_t)-1) #define NOPROCESS ((pid_t) -1)
#define NULLPROCESS ((pid_t)0) #define NULLPROCESS ((pid_t)0)
#define EXIT_PANIC 99 #define EXIT_PANIC 99
typedef enum typedef enum
{ {
BOOL_FALSE, BOOL_TRUE BOOL_FALSE, BOOL_TRUE
} } bool;
bool;
#define _P_(p) () #define _P_(p) ()
char *runShell _P_ ((const char *pzCmd)); char *run_shell _P_ (( const char *pzCmd));
pid_t p2fopen _P_ ((tpfPair * pfPair, tpChar * ppArgs)); pid_t proc2_fopen _P_ (( t_pf_pair * p_pair, t_pchar * pp_args));
pid_t p2open _P_ ((tFdPair * pPair, tpChar * ppArgs)); pid_t proc2_open _P_ (( t_fd_pair * p_pair, t_pchar * pp_args));
int int chain_open _P_ (( int in_fd,
chainOpen _P_ ((int stdinFd, t_pchar * pp_args,
tpChar * ppArgs, pid_t * p_child));
pid_t * pChild));
#endif /* FIXINC_SERVER_H */ #endif /* FIXINC_SERVER_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment