Commit 5abc1f74 by Bruce Korb Committed by Bruce Korb

Merge from no_bogosity

From-SVN: r29918
parent 9e15ef05
Tue Oct 12 07:38:41 1999 Bruce Korb <autogen@linuxbox.com>
* fixincl/*: Merged "no_bogosity" branch
Mon Oct 11 20:18:41 1999 Jim Wilson <wilson@cygnus.com>
* genoutput.c: Include toplev.h.
......
......@@ -22,7 +22,7 @@
# Its purpose is to build the any-platforms fixinc.sh script.
CFLAGS = -g
FIXINC_DEFS = @fixinc_defs@
FIXINC_DEFS = $(CFLAGS) $(CPPFLAGS) @fixinc_defs@ $(INCLUDES)
CC = @CC@
SHELL = /bin/sh
......@@ -45,7 +45,7 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)
# Always use -I$(srcdir)/config when compiling.
.c.o:
$(CC) -c $(CFLAGS) $(FIXINC_DEFS) $(CPPFLAGS) $(INCLUDES) $<
$(CC) -c $(FIXINC_DEFS) $<
# The only suffixes we want for implicit rules are .c and .o.
.SUFFIXES:
......@@ -59,28 +59,37 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)
##
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
OBJ = fixincl.o server.o gnu-regex.o procopen.o
HDR = server.h gnu-regex.h
LIBERTY = ../../libiberty/libiberty.a
LIBOBJ = gnu-regex.o fixlib.o $(LIBERTY)
FIOBJ = fixincl.o server.o procopen.o $(LIBOBJ)
HDR = server.h gnu-regex.h fixlib.h
SH_TARGET = inclhack.sh fixincl.sh
BIN_TARGET = fixincl
AG_TEXT = $(SH_TARGET) fixincl.x \
inclhack.def inclhack.tpl hackshell.tpl fixincl.tpl
BIN_TARGET = fixincl fixfixes fixtests
TARGETS = $(SH_TARGET) $(BIN_TARGET)
all : $(TARGETS)
sh : $(SH_TARGET)
gen : $(SH_TARGET) fixincl.x
$(OBJ): $(HDR)
$(FIOBJ): $(HDR)
fixincl: $(OBJ)
@echo $(CC) -o $@ $(OBJ) $(LIBERTY) $(LIB) ; \
if $(CC) -o $@ $(OBJ) $(LIBERTY) $(LIB) ; then : ; else \
fixincl: $(FIOBJ)
@echo $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; \
if $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; then : ; else \
rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \
chmod 777 $@ ; fi
fixfixes: fixfixes.c $(LIBOBJ)
$(CC) -o $@ $(FIXINC_DEFS) -DMAIN \
$(srcdir)/fixfixes.c $(LIBOBJ) $(LIB)
fixtests: fixtests.c $(LIBOBJ)
$(CC) -o $@ $(FIXINC_DEFS) -DMAIN \
$(srcdir)/fixtests.c $(LIBOBJ) $(LIB)
gnu-regex.o: gnu-regex.c
-$(CC) $(CFLAGS) $(FIXINC_DEFS) $(INCLUDES) -DREGEX_MALLOC \
-c $(srcdir)/gnu-regex.c
......
/*
Test to see if a particular fix should be applied to a header file.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
= = = = = = = = = = = = = = = = = = = = = = = = =
NOTE TO DEVELOPERS
The routines you write here must work closely with both the fixincl.c
and the test_need.c program.
Here are the rules:
1. Every test procedure name must be suffixed with "_fix".
These routines will be referenced from inclhack.def, sans the suffix.
2. Use the "FIX_PROC_HEAD()" macro _with_ the "_fix" suffix
(I cannot use the ## magic from ANSI C) for defining your entry point.
3. Put your test name into the FIXUP_TABLE
4. Do not read anything from stdin. It is closed.
5. Write to stderr only in the event of a reportable error
In such an event, call "exit(1)".
6. If "MAIN" is _not_ defined, then you have access to the fixDescList
entry for the fix in question. This may be useful, for example,
if there are pre-compiled selection expressions stored there.
For example, you may do this if you know that the first
test contains a useful regex. This is okay because, remember,
this code perforce works closely with the inclhack.def fixes!!
tFixDesc* pMyDesc = fixDescList + MY_FIX_NAME_FIXIDX;
tTestDesc* pTestList = pMyDesc->p_test_desc;
regexec (pTestList->p_test_regex, ...)
If MAIN _is_ defined, then you will have to compile it on
your own.
= = = = = = = = = = = = = = = = = = = = = = = = =
This file is part of GNU CC.
GNU CC is free software; you can 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "fixlib.h"
typedef struct {
const char* fix_name;
void (*fix_proc)();
} fix_entry_t;
#define FIXUP_TABLE \
_FT_( "no_double_slash", double_slash_fix )
#define FIX_PROC_HEAD( fix ) \
static void fix ( filname, text ) \
const char* filname; \
char* text;
/*
* Skip over a quoted string. Single quote strings may
* contain multiple characters if the first character is
* a backslash. Especially a backslash followed by octal digits.
* We are not doing a correctness syntax check here.
*/
static char*
print_quote( q, text )
char q;
char* text;
{
fputc( q, stdout );
for (;;)
{
char ch = *(text++);
fputc( ch, stdout );
switch (ch)
{
case '\\':
if (*text == NUL)
goto quote_done;
fputc( *(text++), stdout );
break;
case '"':
case '\'':
if (ch != q)
break;
/*FALLTHROUGH*/
case '\n':
case NUL:
goto quote_done;
}
} quote_done:;
return text;
}
FIX_PROC_HEAD( double_slash_fix )
{
/* Now look for the comment markers in the text */
for (;;)
{
char ch = *(text++);
switch (ch)
{
case '/':
switch (*text) /* do not advance `text' here */
{
case '/':
/*
We found a "//" pair in open text.
Delete text to New-Line
*/
while ((*text != '\n') && (*text != '\0')) text++;
break;
case '*':
{
/* We found a C-style comment. Skip forward to the end */
char* pz = strstr( (--text)+2, "*/" );
if (pz == (char*)NULL)
{
fputs( text, stdout );
goto fix_done;
}
pz += 2;
fwrite (text, (pz - text), 1, stdout );
text = pz;
}
break;
default:
fputc (ch, stdout );
}
break;
case NUL:
goto fix_done;
case '"':
case '\'':
text = print_quote (ch, text );
break;
default:
fputc (ch, stdout );
}
} fix_done:;
fclose (stdout);;
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
test for fix selector
THIS IS THE ONLY EXPORTED ROUTINE
*/
void
apply_fix( fixname, filname )
const char* fixname;
const char* filname;
{
#define _FT_(n,p) { n, p },
static fix_entry_t fix_table[] = { FIXUP_TABLE { NULL, NULL }};
#undef _FT_
#define FIX_TABLE_CT ((sizeof(fix_table)/sizeof(fix_table[0]))-1)
char* buf;
int ct = FIX_TABLE_CT;
fix_entry_t* pfe = fix_table;
for (;;)
{
if (strcmp (pfe->fix_name, fixname) == 0)
break;
if (--ct <= 0)
{
fprintf (stderr, "fixincludes error: the `%s' fix is unknown\n",
fixname );
exit (3);
}
}
buf = load_file_data (stdin);
(*pfe->fix_proc)( filname, buf );
}
#ifdef MAIN
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MAIN ROUTINE
This file is both included in fixincl.c and compiled as a separate
program for use by the inclhack.sh script.
*/
int
main( argc, argv )
int argc;
char** argv;
{
if (argc != 3)
apply_fix ("No test name provided", NULL, NULL, 0 );
apply_fix (argv[2], argv[1]);
return 0;
}
#endif
......@@ -15,12 +15,13 @@ x =]
=] The Free Software Foundation, Inc.
*
[=_eval inclhack "# * " _gpl=]
*[=_EVAL "re_ct=0" _shell=][=
*[=_EVAL "re_ct=0\nmax_mach=0" _shell=][=
_FOR fix =]
*
* Description [=_eval _index 1 + "#%3d -" _printf=] [=hackname _Cap=] fix
* Description of [=hackname _Cap=] fix
*/
#define [=hackname _up #_FIXIDX + #%-32s _printf=] [=_eval _index=]
tSCC z[=hackname _cap=]Name[] =
[=hackname _cap _krstr=];
/*
......@@ -40,11 +41,18 @@ tSCC z[=hackname _cap=]List[] =
_IF mach _exist=]
tSCC* apz[=hackname _cap=]Machs[] = {[=
_EVAL "this_mach=0" _shell =][=
_FOR mach =]
[=mach _krstr=],[=
_EVAL mach _len "this_mach=`expr $this_mach + %d + 5`"
_printf _shell =][=
/mach=]
(const char*)NULL };[=
_EVAL "if [ $this_mach -gt $max_mach ] ; then max_mach=$this_mach ; fi"
_shell =][=
_ELSE =]
#define apz[=hackname _cap=]Machs (const char**)NULL[=
_ENDIF "files _exist" =][=
......@@ -94,24 +102,37 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] =
/test =][=
_ENDIF =][=
_IF c_test _exist=]
/*
* perform the C function call test
*/[=
_FOR c_test =]
tSCC z[=hackname _cap=]FTst[=_eval _index=][] = "[=c_test=]";[=
/c_test =][=
_ENDIF =][=
# Build the array of test descriptions for this fix: =][=
_IF exesel _exist
select _exist |
bypass _exist |
test _exist |
_IF exesel _exist
select _exist |
bypass _exist |
test _exist |
c_test _exist |
=]
#define [=hackname _up =]_TEST_CT [=
_IF exesel _exist =][=
_eval exesel _count
bypass _count +
test _count + =][=
test _count +
c_test _count + =][=
_ELSE =][=
_eval select _count
bypass _count +
test _count + =][=
test _count +
c_test _count + =][=
_ENDIF =]
#define [=hackname _up =]_RE_CT [=
_IF exesel _exist =][=
......@@ -126,11 +147,15 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] =
tTestDesc a[=hackname _cap=]Tests[] = {[=
_FOR test =]
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
/test =][=
_FOR c_test =]
{ TT_FUNCTION, z[=hackname _cap=]FTst[=_eval _index=], 0 /* unused */ },[=
/c_test =][=
_FOR bypass =]
{ TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
{ TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
/bypass =][=
# IF there is an exesel, then use that (those) selection
......@@ -138,12 +163,12 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
=][=
_IF exesel _exist =][=
_FOR exesel =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/exesel =][=
_ELSE =][=
_FOR select =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/select =][=
_ENDIF =] };[=
_ELSE =]
......@@ -156,11 +181,20 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
* Fix Command Arguments for [=hackname _cap=]
*/
const char* apz[=hackname _cap=]Patch[] = {[=
_IF sed _exist =] "sed"[=_FOR sed=],
"-e", [=sed _krstr=][=/sed=][=
_IF sed _exist =] "sed"[=
_FOR sed=],
"-e", [=sed _krstr=][=
/sed=],[=
_ELIF shell _exist =] "sh", "-c",
[=shell _krstr=][=
_ENDIF=],
[=shell _krstr=],[=
_ELIF c_fix _exist =]"[=c_fix=]",[=
_ELIF replace _len =]
[=replace _krstr=],[=
_ENDIF=]
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *[=
......@@ -168,8 +202,16 @@ const char* apz[=hackname _cap=]Patch[] = {[=
*
* List of all fixes
*/
#define REGEX_COUNT [=_eval "echo $re_ct" _shell =]
#define FIX_COUNT [=_eval fix _count =]
[=_EVAL '
echo "#define REGEX_COUNT $re_ct"
echo "#define MACH_LIST_SIZE_LIMIT `expr $max_mach + 128`" ' _shell =][=
# as of this writing, 49 bytes are needed by the case statement format.
We also must allow for the size of the target machine machine name.
This allows for a 79 byte machine name. Better be enough.
=]
#define FIX_COUNT [=_eval fix _count =]
tFixDesc fixDescList[ FIX_COUNT ] = {[=
......@@ -180,7 +222,9 @@ _FOR fix ",\n" =]
_IF not_machine _exist =]FD_MACH_IFNOT[=
_ELSE =]FD_MACH_ONLY[=
_ENDIF =][=
_IF shell _exist =] | FD_SHELL_SCRIPT[=
_IF shell _exist =] | FD_SHELL_SCRIPT[=
_ELIF c_fix _exist =] | FD_SUBROUTINE[=
_ELIF replace _exist =] | FD_REPLACEMENT[=
_ENDIF =],
a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[=
......
#include "fixlib.h"
/* * * * * * * * * * * * *
load_file_data loads all the contents of a file into malloc-ed memory.
Its argument is the file pointer of the file to read in; the returned
result is the NUL terminated contents of the file. The file
is presumed to be an ASCII text file containing no NULs. */
char *
load_file_data (fp)
FILE* fp;
{
char *pz_data = (char*)NULL;
int space_left = -1; /* allow for terminating NUL */
size_t space_used = 0;
do
{
size_t size_read;
if (space_left < 1024)
{
space_left += 4096;
pz_data = realloc ((void*)pz_data, space_left + space_used + 1 );
}
size_read = fread (pz_data + space_used, 1, space_left, fp);
if (size_read == 0)
{
if (feof (fp))
break;
if (ferror (fp))
{
int err = errno;
if (err != EISDIR)
fprintf (stderr, "error %d (%s) reading input\n", err,
strerror (err));
free ((void *) pz_data);
fclose (fp);
return (char *) NULL;
}
}
space_left -= size_read;
space_used += size_read;
} while (! feof (fp));
pz_data = realloc ((void*)pz_data, space_used+1 );
pz_data[ space_used ] = NUL;
fclose (fp);
return pz_data;
}
/* 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.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef FIXINCLUDES_FIXLIB_H
#define FIXINCLUDES_FIXLIB_H
#include "auto-host.h"
#include "gansidecl.h"
#include "system.h"
#include "gnu-regex.h"
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
typedef int t_success;
#define FAILURE (-1)
#define SUCCESS 0
#define PROBLEM 1
#define SUCCEEDED(p) ((p) == SUCCESS)
#define SUCCESSFUL(p) SUCCEEDED (p)
#define FAILED(p) ((p) < SUCCESS)
#define HADGLITCH(p) ((p) > SUCCESS)
#define tSCC static const char
#define tCC const char
#define tSC static char
/* 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 EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#define NUL '\0'
#ifndef NOPROCESS
#define NOPROCESS ((pid_t) -1)
#define NULLPROCESS ((pid_t)0)
#define EXIT_PANIC 99
typedef enum
{
BOOL_FALSE, BOOL_TRUE
} t_bool;
#define _P_(p) ()
#endif
/*
* Exported procedures
*/
char * load_file_data _P_(( FILE* fp ));
#endif /* FIXINCLUDES_FIXLIB_H */
/*
Test to see if a particular fix should be applied to a header file.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
= = = = = = = = = = = = = = = = = = = = = = = = =
NOTE TO DEVELOPERS
The routines you write here must work closely with both the fixincl.c
and the test_need.c program.
Here are the rules:
1. Every test procedure name must be suffixed with "_test".
These routines will be referenced from inclhack.def, sans the suffix.
2. Use the "TEST_FOR_FIX_PROC_HEAD()" macro _with_ the "_test" suffix
(I cannot use the ## magic from ANSI C) for defining your entry point.
3. Put your test name into the FIX_TEST_TABLE
4. Do not write anything to stdout. It may be closed.
5. Write to stderr only in the event of a reportable error
In such an event, call "exit(1)".
= = = = = = = = = = = = = = = = = = = = = = = = =
This file is part of GNU CC.
GNU CC is free software; you can 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "fixlib.h"
typedef int apply_fix_p_t; /* Apply Fix Predicate Type */
#define APPLY_FIX 0
#define SKIP_FIX 1
#define SHOULD_APPLY(afp) ((afp) == APPLY_FIX)
apply_fix_p_t run_test();
typedef struct {
const char* test_name;
apply_fix_p_t (*test_proc)();
} test_entry_t;
#define FIX_TEST_TABLE \
_FT_( "double_slash", double_slash_test )
#define TEST_FOR_FIX_PROC_HEAD( test ) \
static apply_fix_p_t test ( fname, text ) \
const char* fname; \
const char* text;
/*
* Skip over a quoted string. Single quote strings may
* contain multiple characters if the first character is
* a backslash. Especially a backslash followed by octal digits.
* We are not doing a correctness syntax check here.
*/
static const char*
skip_quote( q, text )
char q;
char* text;
{
for (;;)
{
char ch = *(text++);
switch (ch)
{
case '\\':
text++; /* skip over whatever character follows */
break;
case '"':
case '\'':
if (ch != q)
break;
/*FALLTHROUGH*/
case '\n':
case NUL:
goto skip_done;
}
} skip_done:;
return text;
}
TEST_FOR_FIX_PROC_HEAD( double_slash_test )
{
/* First, check to see if the file is in a C++ directory */
if (strstr( fname, "CC/" ) != NULL)
return SKIP_FIX;
if (strstr( fname, "xx/" ) != NULL)
return SKIP_FIX;
if (strstr( fname, "++/" ) != NULL)
return SKIP_FIX;
/* Now look for the comment markers in the text */
for (;;)
{
char ch = *(text++);
switch (ch)
{
case '/':
switch (*text) /* do not advance `text' here */
{
case '/':
/*
We found a "//" pair in open text.
The fix must be applied
*/
return APPLY_FIX;
case '*':
/* We found a C-style comment. Skip forward to the end */
text = strstr( text+1, "*/" );
if (text == (char*)NULL)
goto test_done;
text += 2;
}
break;
case NUL:
goto test_done;
case '"':
case '\'':
text = skip_quote( ch, text );
}
} test_done:;
return SKIP_FIX;
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
test for fix selector
THIS IS THE ONLY EXPORTED ROUTINE
*/
apply_fix_p_t
run_test( tname, fname, text )
const char* tname;
const char* fname;
const char* text;
{
#define _FT_(n,p) { n, p },
static test_entry_t test_table[] = { FIX_TEST_TABLE { NULL, NULL }};
#undef _FT_
#define TEST_TABLE_CT ((sizeof(test_table)/sizeof(test_table[0]))-1)
int ct = TEST_TABLE_CT;
test_entry_t* pte = test_table;
do
{
if (strcmp( pte->test_name, tname ) == 0)
return (*pte->test_proc)( fname, text );
} while (--ct > 0);
fprintf( stderr, "fixincludes error: the `%s' fix test is unknown\n",
tname );
exit( 3 );
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MAIN ROUTINE
This file is both included in fixincl.c and compiled as a separate
program for use by the inclhack.sh script.
*/
#ifdef MAIN
int
main( argc, argv )
int argc;
char** argv;
{
char* fname = *++argv;
char* tname = *++argv;
char* buf;
size_t buf_size = 0;
if (argc != 3)
return run_test( "No test name provided", NULL, NULL, 0 );
fclose( stdin );
fclose( stdout );
buf = load_file_data (fopen (fname, "r"));
return run_test( tname, fname, buf );
}
#endif
......@@ -43,70 +43,54 @@ _FOR fix "\n\n" =]
_ENDIF=][=
# There are three conditional tests: select, bypass and test.
# There are four conditional tests: select, bypass and test c_test.
They may appear as often as desired. They must all pass for
the fix to be applied. "select" and "bypass" are egrep expressions
that must each appear (or not appear) in the target file.
"test" is an arbitrary test program expression that must yield
true or false. It is enclosed in parenthesis to avoid
precedence problems. The output looks like this:
if ( test -n "`egrep 'find-expr' ${file}`" -a
-z "`egrep 'not-find' ${file}`" -a
'(' <some-test-expression> ')'
) > /dev/null 2>&1 ; then
# =][=
true or false. =][=
_IF select _exist =]
if ( test [=
_FOR select " -a \\\n "
=]-n [=select _shrstr "#`egrep %s ${file}`"
_printf _shstr =][=
/select=][=
/select=]
) > /dev/null 2>&1 ; then[=
_ENDIF =][=
_IF bypass _exist =][=
_IF bypass _exist =]
if ( test [=
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s ${file}`"
_printf _shstr =][=
/bypass=][=
_ENDIF=][=
_IF test _exist=][=
_FOR test=] -a \
'(' [=test=] ')'[=
/test=][=
_ENDIF=]
/bypass=]
) > /dev/null 2>&1 ; then[=
_ENDIF =][=
_ELIF test _exist =]
_IF test _exist =]
if ( test [=
_FOR test " -a \\\n "
=]'(' [=test=] ')'[=
/test=][=
_IF bypass _exist=][=
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s ${file}`"
_printf _shstr=][=
/bypass=][=
_ENDIF=]
/test=]
) > /dev/null 2>&1 ; then[=
_ENDIF=][=
_IF c_test _exist =]
if [=
_FOR c_test " && \\\n "
=]${FIXTESTS} ${file} [=c_test=][=
/c_test=]
then[=
_ELIF bypass _exist =]
if ( test [=_FOR bypass " -a \\\n "
=]-z [=bypass _shrstr "#`egrep %s ${file}`"
_printf _shstr=][=/bypass=]
) > /dev/null 2>&1 ; then[=
_ENDIF=]
_ENDIF=][=
_IF replace _exist ! =]
fixlist="${fixlist}
[=hackname=]"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi [=
_ENDIF =][=
_IF sed _exist=][=
_IF shell _exist =][=
......@@ -129,20 +113,50 @@ _FOR fix "\n\n" =]
if test ! -f ${DESTDIR}/fixinc.tmp
then continue ; fi [=
_ELIF c_fix _exist =]
${FIXFIXES} ${file} [=c_fix=] < $infile > ${DESTDIR}/fixinc.tmp[=
_ELIF replace _exist =][=
_IF replace _len 0 > =]
echo "[=hackname _down=] replacing file ${file}" >&2
cat > ${DESTFILE} << '_EOF_'
[=replace=]
_EOF_[=
_ELSE =]
echo "[=hackname _down=] bypassing file ${file}"[=
_ENDIF =]
continue
[=
_ELSE=][=
_ERROR hackname _get "ERROR: %s has no fixup" _printf=][=
_ENDIF=]
_ENDIF=][=
_IF replace _exist ! =]
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}[=
_ENDIF =][=
# Close off any opened "if" or "case" statements in reverse order
# =][=
_IF select _exist test _exist | bypass _exist | =]
fi # end of selection 'if'[=
_IF c_test _exist =]
fi # end of c_test 'if'[=
_ENDIF =][=
_IF test _exist =]
fi # end of test expression 'if'[=
_ENDIF =][=
_IF bypass _exist =]
fi # end of bypass 'if'[=
_ENDIF =][=
_IF select _exist =]
fi # end of select 'if'[=
_ENDIF =][=
_IF mach _exist=]
......
......@@ -44,7 +44,10 @@ else
exit 1
}
fi
[=_IF PROGRAM _env ! =]
FIXTESTS=$PWD/fixinc/fixtests
FIXFIXES=$PWD/fixinc/fixfixes
[=_ENDIF=]
# Define what target system we're fixing.
#
if test -r ./Makefile; then
......
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