Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
725471d2
Commit
725471d2
authored
Aug 05, 1998
by
Bruce Korb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to allow bypassing tests for certain machines
From-SVN: r21614
parent
7c3b5ba5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
320 additions
and
264 deletions
+320
-264
contrib/fixinc/Makefile
+2
-2
contrib/fixinc/fixincl.c
+295
-257
contrib/fixinc/fixincl.tpl
+21
-3
contrib/fixinc/mkfixinc.sh
+2
-2
No files found.
contrib/fixinc/Makefile
View file @
725471d2
...
@@ -34,7 +34,7 @@ regex.o: regex.c
...
@@ -34,7 +34,7 @@ regex.o: regex.c
-
$(CC)
-g
-DSTDC_HEADERS
=
1
-c
regex.c
-
$(CC)
-g
-DSTDC_HEADERS
=
1
-c
regex.c
fixincl.o
:
fixincl.x fixincl.c
fixincl.o
:
fixincl.x fixincl.c
-
$(CC)
$(CFLAGS)
-o
$@
-c
fixincl.c
-
$(CC)
$(CFLAGS)
'-DTARGET_MACHINE="
$(TARGET)
"'
-o
$@
-c
fixincl.c
server.o
:
server.c server.h
server.o
:
server.c server.h
-
$(CC)
$(CFLAGS)
-o
$@
-c
server.c
-
$(CC)
$(CFLAGS)
-o
$@
-c
server.c
...
@@ -71,7 +71,7 @@ install: $(TARGETS)
...
@@ -71,7 +71,7 @@ install: $(TARGETS)
echo
cp fixincl.sh
$(DESTDIR)
/fixinc.sh
;
\
echo
cp fixincl.sh
$(DESTDIR)
/fixinc.sh
;
\
cp fixincl.sh
$(DESTDIR)
/fixinc.sh
;
\
cp fixincl.sh
$(DESTDIR)
/fixinc.sh
;
\
chmod 555
$(DESTDIR)
/fixinc.sh
;
\
chmod 555
$(DESTDIR)
/fixinc.sh
;
\
rm
-f
$(DESTDIR)
/fixincl
;
\
rm
-f
$(DESTDIR)
/fixincl
;
\
echo
cp fixincl
$(DESTDIR)
;
\
echo
cp fixincl
$(DESTDIR)
;
\
cp fixincl
$(DESTDIR)
;
\
cp fixincl
$(DESTDIR)
;
\
chmod 555
$(DESTDIR)
/fixincl
;
\
chmod 555
$(DESTDIR)
/fixincl
;
\
...
...
contrib/fixinc/fixincl.c
View file @
725471d2
...
@@ -73,27 +73,28 @@ struct test_desc
...
@@ -73,27 +73,28 @@ struct test_desc
regex_t
*
pTestRegex
;
regex_t
*
pTestRegex
;
};
};
typedef
enum
{
PATCH_SED
,
PATCH_SHELL
}
tePatch
;
typedef
struct
patch_desc
tPatchDesc
;
typedef
struct
patch_desc
tPatchDesc
;
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
#define FD_SKIP_TEST 0x8000
typedef
struct
fix_desc
tFixDesc
;
typedef
struct
fix_desc
tFixDesc
;
struct
fix_desc
struct
fix_desc
{
{
const
char
*
pzFixName
;
const
char
*
pzFixName
;
/* Name of the fix */
const
char
*
pzFileList
;
const
char
*
pzFileList
;
/* List of files it applies to */
regex_t
*
pListRegex
;
const
char
**
papzMachs
;
/* List of machine/os-es it applies to */
int
testCt
;
regex_t
*
pListRegex
;
tTestDesc
*
pTestDesc
;
int
testCt
;
const
char
**
papzPatchArgs
;
int
fdFlags
;
tTestDesc
*
pTestDesc
;
const
char
**
papzPatchArgs
;
};
};
char
*
pzDestDir
=
(
char
*
)
NULL
;
char
*
pzDestDir
=
(
char
*
)
NULL
;
char
*
pzSrcDir
=
(
char
*
)
NULL
;
char
*
pzSrcDir
=
(
char
*
)
NULL
;
char
zMachine
[]
=
TARGET_MACHINE
;
pid_t
chainHead
=
(
pid_t
)
-
1
;
pid_t
chainHead
=
(
pid_t
)
-
1
;
...
@@ -127,16 +128,16 @@ main (argc, argv)
...
@@ -127,16 +128,16 @@ main (argc, argv)
if
(
argc
!=
1
)
if
(
argc
!=
1
)
{
{
if
(
argc
!=
2
)
if
(
argc
!=
2
)
{
{
fputs
(
"fixincl ERROR: files specified on command line (not stdin)
\n
"
,
fputs
(
"fixincl ERROR: files specified on command line (not stdin)
\n
"
,
stderr
);
stderr
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
if
(
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
{
{
fputs
(
"$Id: fixincl.c,v 1.3 1998/06/02 07:00:12
korbb Exp $
\n
"
,
stderr
);
fputs
(
"$Id: fixincl.c,v 1.4 1998/08/05 10:20:11
korbb Exp $
\n
"
,
stderr
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
freopen
(
argv
[
1
],
"r"
,
stdin
);
freopen
(
argv
[
1
],
"r"
,
stdin
);
...
@@ -146,7 +147,7 @@ main (argc, argv)
...
@@ -146,7 +147,7 @@ main (argc, argv)
if
(
pzDestDir
==
(
char
*
)
NULL
)
if
(
pzDestDir
==
(
char
*
)
NULL
)
{
{
fprintf
(
stderr
,
"fixincl ERROR: %s cannot find destination dir
\n
"
fprintf
(
stderr
,
"fixincl ERROR: %s cannot find destination dir
\n
"
"
\t
(`DESTDIR' must be an environment variable)
\n
"
,
*
argv
);
"
\t
(`DESTDIR' must be an environment variable)
\n
"
,
*
argv
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -154,7 +155,7 @@ main (argc, argv)
...
@@ -154,7 +155,7 @@ main (argc, argv)
if
(
pzSrcDir
==
(
char
*
)
NULL
)
if
(
pzSrcDir
==
(
char
*
)
NULL
)
{
{
fprintf
(
stderr
,
"fixincl ERROR: %s cannot find source dir
\n
"
fprintf
(
stderr
,
"fixincl ERROR: %s cannot find source dir
\n
"
"
\t
(`SRCDIR' must be an environment variable)
\n
"
,
*
argv
);
"
\t
(`SRCDIR' must be an environment variable)
\n
"
,
*
argv
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -172,36 +173,36 @@ main (argc, argv)
...
@@ -172,36 +173,36 @@ main (argc, argv)
* parent to skip forward? Pipes and files behave differently.)
* parent to skip forward? Pipes and files behave differently.)
*/
*/
for
(
fileNameCt
=
0
,
pzBuf
=
zFileNameBuf
;
for
(
fileNameCt
=
0
,
pzBuf
=
zFileNameBuf
;
(
fileNameCt
<
128
)
(
fileNameCt
<
128
)
&&
(
pzBuf
&&
(
pzBuf
<
(
zFileNameBuf
+
sizeof
(
zFileNameBuf
)
-
MAXPATHLEN
));
<
(
zFileNameBuf
+
sizeof
(
zFileNameBuf
)
-
MAXPATHLEN
));
)
)
{
{
if
(
fgets
(
pzBuf
,
MAXPATHLEN
,
stdin
)
==
(
char
*
)
NULL
)
if
(
fgets
(
pzBuf
,
MAXPATHLEN
,
stdin
)
==
(
char
*
)
NULL
)
break
;
break
;
while
(
isspace
(
*
pzBuf
))
while
(
isspace
(
*
pzBuf
))
pzBuf
++
;
pzBuf
++
;
apzNames
[
fileNameCt
++
]
=
pzBuf
;
apzNames
[
fileNameCt
++
]
=
pzBuf
;
pzBuf
+=
strlen
(
pzBuf
);
pzBuf
+=
strlen
(
pzBuf
);
while
(
isspace
(
pzBuf
[
-
1
]))
while
(
isspace
(
pzBuf
[
-
1
]))
pzBuf
--
;
pzBuf
--
;
*
pzBuf
++
=
'\0'
;
*
pzBuf
++
=
'\0'
;
}
}
if
(
fileNameCt
==
0
)
if
(
fileNameCt
==
0
)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
child
=
fork
();
child
=
fork
();
if
(
child
==
NULLPROCESS
)
if
(
child
==
NULLPROCESS
)
break
;
break
;
if
(
child
==
NOPROCESS
)
if
(
child
==
NOPROCESS
)
{
{
fprintf
(
stderr
,
"Error %d (%s) forking in main
\n
"
,
fprintf
(
stderr
,
"Error %d (%s) forking in main
\n
"
,
errno
,
strerror
(
errno
));
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
waitpid
(
child
,
(
int
*
)
NULL
,
0
);
waitpid
(
child
,
(
int
*
)
NULL
,
0
);
}
}
...
@@ -219,21 +220,21 @@ main (argc, argv)
...
@@ -219,21 +220,21 @@ main (argc, argv)
char
*
pzFile
=
apzNames
[
loopCt
];
char
*
pzFile
=
apzNames
[
loopCt
];
if
(
access
(
pzFile
,
R_OK
)
!=
0
)
if
(
access
(
pzFile
,
R_OK
)
!=
0
)
{
{
int
erno
=
errno
;
int
erno
=
errno
;
fprintf
(
stderr
,
"Cannot access %s from %s
\n\t
error %d (%s)
\n
"
,
fprintf
(
stderr
,
"Cannot access %s from %s
\n\t
error %d (%s)
\n
"
,
pzFile
,
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
),
pzFile
,
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
),
erno
,
strerror
(
erno
));
erno
,
strerror
(
erno
));
}
}
else
if
(
pzData
=
loadFile
(
pzFile
),
else
if
(
pzData
=
loadFile
(
pzFile
),
(
pzData
!=
(
char
*
)
NULL
))
(
pzData
!=
(
char
*
)
NULL
))
{
{
if
(
strstr
(
pzData
,
zGnuLib
)
==
(
char
*
)
NULL
)
if
(
strstr
(
pzData
,
zGnuLib
)
==
(
char
*
)
NULL
)
process
(
pzData
,
pzDestDir
,
pzFile
);
process
(
pzData
,
pzDestDir
,
pzFile
);
free
((
void
*
)
pzData
);
free
((
void
*
)
pzData
);
}
}
}
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
...
@@ -251,9 +252,9 @@ loadFile (pzFile)
...
@@ -251,9 +252,9 @@ loadFile (pzFile)
struct
stat
stbf
;
struct
stat
stbf
;
if
(
stat
(
pzFile
,
&
stbf
)
!=
0
)
if
(
stat
(
pzFile
,
&
stbf
)
!=
0
)
{
{
fprintf
(
stderr
,
"error %d (%s) stat-ing %s
\n
"
,
fprintf
(
stderr
,
"error %d (%s) stat-ing %s
\n
"
,
errno
,
strerror
(
errno
),
pzFile
);
errno
,
strerror
(
errno
),
pzFile
);
return
(
char
*
)
NULL
;
return
(
char
*
)
NULL
;
}
}
fileSize
=
stbf
.
st_size
;
fileSize
=
stbf
.
st_size
;
}
}
...
@@ -264,7 +265,7 @@ loadFile (pzFile)
...
@@ -264,7 +265,7 @@ loadFile (pzFile)
if
(
pzDta
==
(
char
*
)
NULL
)
if
(
pzDta
==
(
char
*
)
NULL
)
{
{
fprintf
(
stderr
,
"error: could not malloc %d bytes
\n
"
,
fprintf
(
stderr
,
"error: could not malloc %d bytes
\n
"
,
fileSize
);
fileSize
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -275,33 +276,33 @@ loadFile (pzFile)
...
@@ -275,33 +276,33 @@ loadFile (pzFile)
if
(
fp
==
(
FILE
*
)
NULL
)
if
(
fp
==
(
FILE
*
)
NULL
)
{
{
fprintf
(
stderr
,
"error %d (%s) opening %s
\n
"
,
errno
,
fprintf
(
stderr
,
"error %d (%s) opening %s
\n
"
,
errno
,
strerror
(
errno
),
pzFile
);
strerror
(
errno
),
pzFile
);
free
((
void
*
)
pzDta
);
free
((
void
*
)
pzDta
);
return
(
char
*
)
NULL
;
return
(
char
*
)
NULL
;
}
}
do
do
{
{
size_t
sizeRead
=
fread
((
void
*
)
readPtr
,
1
,
sizeLeft
,
fp
);
size_t
sizeRead
=
fread
((
void
*
)
readPtr
,
1
,
sizeLeft
,
fp
);
if
(
sizeRead
==
0
)
if
(
sizeRead
==
0
)
{
{
if
(
feof
(
fp
))
if
(
feof
(
fp
))
break
;
break
;
if
(
ferror
(
fp
))
if
(
ferror
(
fp
))
{
{
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
errno
,
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
errno
,
strerror
(
errno
),
pzFile
);
strerror
(
errno
),
pzFile
);
free
((
void
*
)
pzDta
);
free
((
void
*
)
pzDta
);
fclose
(
fp
);
fclose
(
fp
);
return
(
char
*
)
NULL
;
return
(
char
*
)
NULL
;
}
}
}
}
readPtr
+=
sizeRead
;
readPtr
+=
sizeRead
;
sizeLeft
-=
sizeRead
;
sizeLeft
-=
sizeRead
;
}
}
while
(
sizeLeft
!=
0
);
while
(
sizeLeft
!=
0
);
...
@@ -316,7 +317,7 @@ void
...
@@ -316,7 +317,7 @@ void
runCompiles
()
runCompiles
()
{
{
tSCC
zBadComp
[]
=
"fixincl ERROR: cannot compile %s regex for %s
\n
"
tSCC
zBadComp
[]
=
"fixincl ERROR: cannot compile %s regex for %s
\n
"
"
\t
expr = `%s'
\n
"
"
\t
error %s
\n
"
;
"
\t
expr = `%s'
\n
"
"
\t
error %s
\n
"
;
tFixDesc
*
pFD
=
fixDescList
;
tFixDesc
*
pFD
=
fixDescList
;
int
fixCt
=
FIX_COUNT
;
int
fixCt
=
FIX_COUNT
;
tTestDesc
*
pTD
;
tTestDesc
*
pTD
;
...
@@ -328,61 +329,95 @@ runCompiles ()
...
@@ -328,61 +329,95 @@ runCompiles ()
if
(
pRegex
==
(
regex_t
*
)
NULL
)
if
(
pRegex
==
(
regex_t
*
)
NULL
)
{
{
fprintf
(
stderr
,
"fixincl ERROR: cannot allocate %d bytes for regex
\n
"
,
fprintf
(
stderr
,
"fixincl ERROR: cannot allocate %d bytes for regex
\n
"
,
REGEX_COUNT
*
sizeof
(
regex_t
));
REGEX_COUNT
*
sizeof
(
regex_t
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
re_set_syntax
(
RE_SYNTAX_EGREP
);
re_set_syntax
(
RE_SYNTAX_EGREP
);
pzErr
=
re_compile_pattern
(
zInclQuote
,
strlen
(
zInclQuote
),
pzErr
=
re_compile_pattern
(
zInclQuote
,
strlen
(
zInclQuote
),
&
inclQuoteRegex
);
&
inclQuoteRegex
);
if
(
pzErr
!=
(
char
*
)
NULL
)
if
(
pzErr
!=
(
char
*
)
NULL
)
{
{
fprintf
(
stderr
,
zBadComp
,
"quoted include"
,
"runCompiles"
,
fprintf
(
stderr
,
zBadComp
,
"quoted include"
,
"runCompiles"
,
zInclQuote
,
pzErr
);
zInclQuote
,
pzErr
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
/*
/*
* FOR every fixup, ...
* FOR every fixup, ...
*/
*/
for
(;;)
do
{
{
pTD
=
pFD
->
pTestDesc
;
pTD
=
pFD
->
pTestDesc
;
tstCt
=
pFD
->
testCt
;
tstCt
=
pFD
->
testCt
;
if
(
pFD
->
papzMachs
!=
(
const
char
**
)
NULL
)
{
const
char
**
papzMachs
=
pFD
->
papzMachs
;
char
*
pz
=
zFileNameBuf
;
char
*
pzSep
=
""
;
tCC
*
pzIfTrue
;
tCC
*
pzIfFalse
;
tSCC
zSkip
[]
=
"skip"
;
tSCC
zRun
[]
=
"run"
;
sprintf
(
pz
,
"case %s in
\n
"
,
zMachine
);
pz
+=
strlen
(
pz
);
if
(
pFD
->
fdFlags
&
FD_MACH_IFNOT
)
{
pzIfTrue
=
zSkip
;
pzIfFalse
=
zRun
;
}
else
{
pzIfTrue
=
zRun
;
pzIfFalse
=
zSkip
;
}
for
(;;)
{
const
char
*
pzMach
=
*
(
papzMachs
++
);
if
(
pzMach
==
(
const
char
*
)
NULL
)
break
;
sprintf
(
pz
,
"%s %s"
,
pzSep
,
pzMach
);
pz
+=
strlen
(
pz
);
pzSep
=
" |
\\\n
"
;
}
sprintf
(
pz
,
" )
\n
echo %s ;;
\n
* )
\n
echo %s ;;
\n
esac"
,
pzIfTrue
,
pzIfFalse
);
pz
=
runShell
(
zFileNameBuf
);
if
(
*
pz
==
's'
)
{
pFD
->
fdFlags
|=
FD_SKIP_TEST
;
continue
;
}
}
/*
/*
* FOR every test for the fixup, ...
* FOR every test for the fixup, ...
*/
*/
while
(
--
tstCt
>=
0
)
while
(
--
tstCt
>=
0
)
{
{
switch
(
pTD
->
type
)
switch
(
pTD
->
type
)
{
{
case
TT_EGREP
:
case
TT_EGREP
:
case
TT_NEGREP
:
case
TT_NEGREP
:
if
(
--
reCt
<
0
)
if
(
--
reCt
<
0
)
{
{
fputs
(
"out of RE's
\n
"
,
stderr
);
fputs
(
"out of RE's
\n
"
,
stderr
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
pTD
->
pTestRegex
=
pRegex
++
;
pTD
->
pTestRegex
=
pRegex
++
;
pzErr
=
re_compile_pattern
(
pTD
->
pzTest
,
pzErr
=
re_compile_pattern
(
pTD
->
pzTest
,
strlen
(
pTD
->
pzTest
),
strlen
(
pTD
->
pzTest
),
pTD
->
pTestRegex
);
pTD
->
pTestRegex
);
if
(
pzErr
!=
(
char
*
)
NULL
)
if
(
pzErr
!=
(
char
*
)
NULL
)
{
{
fprintf
(
stderr
,
zBadComp
,
"select test"
,
pFD
->
pzFixName
,
fprintf
(
stderr
,
zBadComp
,
"select test"
,
pFD
->
pzFixName
,
pTD
->
pzTest
,
pzErr
);
pTD
->
pzTest
,
pzErr
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
pTD
++
;
pTD
++
;
}
}
if
(
--
fixCt
<=
0
)
break
;
pFD
++
;
}
}
while
(
pFD
++
,
--
fixCt
>
0
);
}
}
...
@@ -405,23 +440,23 @@ createFile (pzFile)
...
@@ -405,23 +440,23 @@ createFile (pzFile)
struct
stat
stbf
;
struct
stat
stbf
;
while
(
pzDir
!=
(
char
*
)
NULL
)
while
(
pzDir
!=
(
char
*
)
NULL
)
{
{
*
pzDir
=
NUL
;
*
pzDir
=
NUL
;
if
(
stat
(
fname
,
&
stbf
)
<
0
)
if
(
stat
(
fname
,
&
stbf
)
<
0
)
{
{
mkdir
(
fname
,
S_IFDIR
|
S_IRWXU
|
S_IRGRP
|
S_IXGRP
mkdir
(
fname
,
S_IFDIR
|
S_IRWXU
|
S_IRGRP
|
S_IXGRP
|
S_IROTH
|
S_IXOTH
);
|
S_IROTH
|
S_IXOTH
);
}
}
*
pzDir
=
'/'
;
*
pzDir
=
'/'
;
pzDir
=
strchr
(
pzDir
+
1
,
'/'
);
pzDir
=
strchr
(
pzDir
+
1
,
'/'
);
}
}
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
);
}
}
if
(
fd
<
0
)
if
(
fd
<
0
)
{
{
fprintf
(
stderr
,
"Error %d (%s) creating %s
\n
"
,
fprintf
(
stderr
,
"Error %d (%s) creating %s
\n
"
,
errno
,
strerror
(
errno
),
fname
);
errno
,
strerror
(
errno
),
fname
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
fprintf
(
stderr
,
"Fixed: %s
\n
"
,
pzFile
);
fprintf
(
stderr
,
"Fixed: %s
\n
"
,
pzFile
);
...
@@ -510,7 +545,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
...
@@ -510,7 +545,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
* Skip forward to the included file name
* Skip forward to the included file name
*/
*/
while
(
isspace
(
*
pzInclQuot
))
while
(
isspace
(
*
pzInclQuot
))
pzInclQuot
++
;
pzInclQuot
++
;
while
(
isspace
(
*++
pzInclQuot
));
while
(
isspace
(
*++
pzInclQuot
));
pzInclQuot
+=
sizeof
(
"include"
)
-
1
;
pzInclQuot
+=
sizeof
(
"include"
)
-
1
;
while
(
*
pzInclQuot
++
!=
'"'
);
while
(
*
pzInclQuot
++
!=
'"'
);
...
@@ -526,7 +561,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
...
@@ -526,7 +561,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
* Append to the directory the relative path of the desired file
* Append to the directory the relative path of the desired file
*/
*/
while
(
*
pzInclQuot
!=
'"'
)
while
(
*
pzInclQuot
!=
'"'
)
putc
(
*
pzInclQuot
++
,
stdout
);
putc
(
*
pzInclQuot
++
,
stdout
);
/*
/*
* Now print the destination directory appended with the relative
* Now print the destination directory appended with the relative
...
@@ -534,7 +569,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
...
@@ -534,7 +569,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
*/
*/
printf
(
" %s/%s/"
,
pzDestDir
,
pzFile
);
printf
(
" %s/%s/"
,
pzDestDir
,
pzFile
);
while
(
*
pzDirEnd
!=
'"'
)
while
(
*
pzDirEnd
!=
'"'
)
putc
(
*
pzDirEnd
++
,
stdout
);
putc
(
*
pzDirEnd
++
,
stdout
);
/*
/*
* End of entry
* End of entry
...
@@ -545,7 +580,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
...
@@ -545,7 +580,7 @@ extractQuotedFiles (pzDta, pzFile, pMatch)
* Find the next entry
* Find the next entry
*/
*/
if
(
regexec
(
&
inclQuoteRegex
,
pzInclQuot
,
1
,
pMatch
,
0
)
!=
0
)
if
(
regexec
(
&
inclQuoteRegex
,
pzInclQuot
,
1
,
pMatch
,
0
)
!=
0
)
break
;
break
;
}
}
}
}
...
@@ -600,29 +635,32 @@ process (pzDta, pzDir, pzFile)
...
@@ -600,29 +635,32 @@ process (pzDta, pzDir, pzFile)
int
tstCt
;
int
tstCt
;
tSuccess
egrepRes
;
tSuccess
egrepRes
;
if
(
pFD
->
fdFlags
&
FD_SKIP_TEST
)
continue
;
/*
/*
* IF there is a file name restriction,
* IF there is a file name restriction,
* THEN ensure the current file name matches one in the pattern
* THEN ensure the current file name matches one in the pattern
*/
*/
if
(
pFD
->
pzFileList
!=
(
char
*
)
NULL
)
if
(
pFD
->
pzFileList
!=
(
char
*
)
NULL
)
{
{
const
char
*
pzFil
=
pzFile
;
const
char
*
pzFil
=
pzFile
;
const
char
*
pzScn
=
pFD
->
pzFileList
;
const
char
*
pzScn
=
pFD
->
pzFileList
;
size_t
nmLen
;
size_t
nmLen
;
while
((
pzFil
[
0
]
==
'.'
)
&&
(
pzFil
[
1
]
==
'/'
))
while
((
pzFil
[
0
]
==
'.'
)
&&
(
pzFil
[
1
]
==
'/'
))
pzFil
+=
2
;
pzFil
+=
2
;
nmLen
=
strlen
(
pzFil
);
nmLen
=
strlen
(
pzFil
);
for
(;;)
for
(;;)
{
{
pzScn
=
strstr
(
pzScn
+
1
,
pzFil
);
pzScn
=
strstr
(
pzScn
+
1
,
pzFil
);
if
(
pzScn
==
(
char
*
)
NULL
)
if
(
pzScn
==
(
char
*
)
NULL
)
goto
nextFix
;
goto
nextFix
;
if
((
pzScn
[
-
1
]
==
'|'
)
&&
(
pzScn
[
nmLen
]
==
'|'
))
if
((
pzScn
[
-
1
]
==
'|'
)
&&
(
pzScn
[
nmLen
]
==
'|'
))
break
;
break
;
}
}
}
}
egrepRes
=
PROBLEM
;
egrepRes
=
PROBLEM
;
...
@@ -631,86 +669,86 @@ process (pzDta, pzDir, pzFile)
...
@@ -631,86 +669,86 @@ process (pzDta, pzDir, pzFile)
* THEN we always run the fixup
* THEN we always run the fixup
*/
*/
for
(
pTD
=
pFD
->
pTestDesc
,
tstCt
=
pFD
->
testCt
;
for
(
pTD
=
pFD
->
pTestDesc
,
tstCt
=
pFD
->
testCt
;
tstCt
--
>
0
;
tstCt
--
>
0
;
pTD
++
)
pTD
++
)
{
{
switch
(
pTD
->
type
)
switch
(
pTD
->
type
)
{
{
case
TT_TEST
:
case
TT_TEST
:
/*
/*
* IF *any* of the shell tests fail,
* IF *any* of the shell tests fail,
* THEN do not process the fix.
* THEN do not process the fix.
*/
*/
if
(
!
SUCCESSFUL
(
testTest
(
pTD
,
pzFile
)))
if
(
!
SUCCESSFUL
(
testTest
(
pTD
,
pzFile
)))
goto
nextFix
;
goto
nextFix
;
break
;
break
;
case
TT_EGREP
:
case
TT_EGREP
:
/*
/*
* IF we have not had a successful egrep test
* IF we have not had a successful egrep test
* *AND* this test does not pass,
* *AND* this test does not pass,
* THEN mark the egrep test as failing. It starts
* THEN mark the egrep test as failing. It starts
* out as a "PROBLEM", meaning that if we do not
* out as a "PROBLEM", meaning that if we do not
* encounter any egrep tests, then we will let it pass.
* encounter any egrep tests, then we will let it pass.
*/
*/
if
((
!
SUCCESSFUL
(
egrepRes
))
if
((
!
SUCCESSFUL
(
egrepRes
))
&&
(
!
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
))))
&&
(
!
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
))))
egrepRes
=
FAILURE
;
egrepRes
=
FAILURE
;
break
;
break
;
case
TT_NEGREP
:
case
TT_NEGREP
:
/*
/*
* IF *any* of the negative egrep tests fail,
* IF *any* of the negative egrep tests fail,
* THEN do not process the fix.
* THEN do not process the fix.
*/
*/
if
(
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
)))
if
(
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
)))
goto
nextFix
;
goto
nextFix
;
break
;
break
;
}
}
}
}
/*
/*
* IF there were no egrep tests *OR* at least one passed, ...
* IF there were no egrep tests *OR* at least one passed, ...
*/
*/
if
(
!
FAILED
(
egrepRes
))
if
(
!
FAILED
(
egrepRes
))
{
{
fprintf
(
stderr
,
"Applying %-32s to %s
\n
"
,
fprintf
(
stderr
,
"Applying %-32s to %s
\n
"
,
pFD
->
pzFixName
,
pzFile
);
pFD
->
pzFixName
,
pzFile
);
if
(
fdp
.
readFd
==
-
1
)
if
(
fdp
.
readFd
==
-
1
)
{
{
fdp
.
readFd
=
open
(
pzFile
,
O_RDONLY
);
fdp
.
readFd
=
open
(
pzFile
,
O_RDONLY
);
if
(
fdp
.
readFd
<
0
)
if
(
fdp
.
readFd
<
0
)
{
{
fprintf
(
stderr
,
"Error %d (%s) opening %s
\n
"
,
errno
,
fprintf
(
stderr
,
"Error %d (%s) opening %s
\n
"
,
errno
,
strerror
(
errno
),
pzFile
);
strerror
(
errno
),
pzFile
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
for
(;;)
for
(;;)
{
{
int
newFd
=
chainOpen
(
fdp
.
readFd
,
int
newFd
=
chainOpen
(
fdp
.
readFd
,
(
tpChar
*
)
pFD
->
papzPatchArgs
,
(
tpChar
*
)
pFD
->
papzPatchArgs
,
(
chainHead
==
-
1
)
(
chainHead
==
-
1
)
?
&
chainHead
:
(
pid_t
*
)
NULL
);
?
&
chainHead
:
(
pid_t
*
)
NULL
);
if
(
newFd
!=
-
1
)
if
(
newFd
!=
-
1
)
{
{
fdp
.
readFd
=
newFd
;
fdp
.
readFd
=
newFd
;
break
;
break
;
}
}
fprintf
(
stderr
,
"Error %d (%s) starting filter process "
fprintf
(
stderr
,
"Error %d (%s) starting filter process "
"for %s
\n
"
,
errno
,
strerror
(
errno
),
"for %s
\n
"
,
errno
,
strerror
(
errno
),
pFD
->
pzFixName
);
pFD
->
pzFixName
);
if
(
errno
!=
EAGAIN
)
if
(
errno
!=
EAGAIN
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
sleep
(
1
);
sleep
(
1
);
}
}
}
}
nextFix
:
;
nextFix
:
;
}
}
...
@@ -729,40 +767,40 @@ process (pzDta, pzDir, pzFile)
...
@@ -729,40 +767,40 @@ process (pzDta, pzDir, pzFile)
for
(;;)
for
(;;)
{
{
int
ch
;
int
ch
;
ch
=
getc
(
inFp
);
ch
=
getc
(
inFp
);
if
(
ch
==
EOF
)
if
(
ch
==
EOF
)
break
;
break
;
if
(
oFp
!=
(
FILE
*
)
NULL
)
if
(
oFp
!=
(
FILE
*
)
NULL
)
putc
(
ch
,
oFp
);
putc
(
ch
,
oFp
);
else
if
(
ch
!=
*
pzCmp
)
else
if
(
ch
!=
*
pzCmp
)
{
{
oFp
=
createFile
(
pzFile
);
oFp
=
createFile
(
pzFile
);
if
(
pzCmp
!=
pzDta
)
if
(
pzCmp
!=
pzDta
)
{
{
char
c
=
*
pzCmp
;
char
c
=
*
pzCmp
;
*
pzCmp
=
NUL
;
*
pzCmp
=
NUL
;
fputs
(
pzDta
,
oFp
);
fputs
(
pzDta
,
oFp
);
*
pzCmp
=
c
;
*
pzCmp
=
c
;
}
}
putc
(
ch
,
oFp
);
putc
(
ch
,
oFp
);
}
}
else
else
pzCmp
++
;
pzCmp
++
;
}
}
if
(
oFp
!=
(
FILE
*
)
NULL
)
if
(
oFp
!=
(
FILE
*
)
NULL
)
{
{
regmatch_t
match
;
regmatch_t
match
;
fchmod
(
fileno
(
oFp
),
S_IRUSR
|
S_IRGRP
|
S_IROTH
);
fchmod
(
fileno
(
oFp
),
S_IRUSR
|
S_IRGRP
|
S_IROTH
);
fclose
(
oFp
);
fclose
(
oFp
);
if
(
regexec
(
&
inclQuoteRegex
,
pzDta
,
1
,
&
match
,
0
)
==
0
)
if
(
regexec
(
&
inclQuoteRegex
,
pzDta
,
1
,
&
match
,
0
)
==
0
)
extractQuotedFiles
(
pzDta
,
pzFile
,
&
match
);
extractQuotedFiles
(
pzDta
,
pzFile
,
&
match
);
}
}
fclose
(
inFp
);
fclose
(
inFp
);
...
...
contrib/fixinc/fixincl.tpl
View file @
725471d2
...
@@ -33,6 +33,20 @@ tSCC z[=hackname _cap=]List[] =[=
...
@@ -33,6 +33,20 @@ tSCC z[=hackname _cap=]List[] =[=
_ELSE =]
_ELSE =]
#define z[=hackname _cap=]List (char*)NULL[=
#define z[=hackname _cap=]List (char*)NULL[=
_ENDIF "files _exist" =]
/*
* Machine/OS name selection pattern
*/[=
_IF mach _exist=]
tSCC* apz[=hackname _cap=]Machs[] = {[=
_FOR mach =]
[=mach _str=],[=
/mach=]
(const char*)NULL };[=
_ELSE =]
#define apz[=hackname _cap=]Machs (const char**)NULL[=
_ENDIF "files _exist" =][=
_ENDIF "files _exist" =][=
_IF exesel _exist=]
_IF exesel _exist=]
...
@@ -143,9 +157,13 @@ tFixDesc fixDescList[ [=_eval fix _count =] ] = {[=
...
@@ -143,9 +157,13 @@ tFixDesc fixDescList[ [=_eval fix _count =] ] = {[=
_FOR fix ",\n" =]
_FOR fix ",\n" =]
{ z[=hackname _cap=]Name, z[=hackname _cap=]List, (regex_t*)NULL,
{ z[=hackname _cap=]Name, z[=hackname _cap=]List,
[=hackname _up=]_TEST_CT, a[=hackname _cap=]Tests,
apz[=hackname _cap=]Machs, (regex_t*)NULL,
apz[=hackname _cap=]Patch }[=
[=hackname _up=]_TEST_CT, [=
_IF not_machine _exist =]FD_MACH_IFNOT[=
_ELSE =]FD_MACH_ONLY[=
_ENDIF =],
a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[=
/fix=]
/fix=]
};
};
contrib/fixinc/mkfixinc.sh
View file @
725471d2
...
@@ -113,7 +113,7 @@ then
...
@@ -113,7 +113,7 @@ then
exit
0
exit
0
fi
fi
echo
$MAKE
install
DESTDIR
=
`
dirname
$dest
`
echo
$MAKE
install
DESTDIR
=
`
dirname
$dest
`
TARGET
=
$machine
$MAKE
install
DESTDIR
=
`
dirname
$dest
`
$MAKE
install
DESTDIR
=
`
dirname
$dest
`
TARGET
=
$machine
exit
1
exit
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment