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
1f414ac4
Commit
1f414ac4
authored
Mar 03, 1999
by
Bruce Korb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge from fixincl-branch
From-SVN: r25558
parent
9a9f6326
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1329 additions
and
919 deletions
+1329
-919
gcc/fixinc/Makefile.in
+29
-16
gcc/fixinc/fixincl.c
+664
-461
gcc/fixinc/fixincl.sh
+6
-7
gcc/fixinc/fixincl.x
+65
-26
gcc/fixinc/hackshell.tpl
+0
-1
gcc/fixinc/inclhack.def
+14
-1
gcc/fixinc/inclhack.sh
+50
-28
gcc/fixinc/inclhack.tpl
+4
-6
gcc/fixinc/mkfixinc.sh
+36
-8
gcc/fixinc/procopen.c
+260
-0
gcc/fixinc/regex.c
+0
-2
gcc/fixinc/regex.h
+0
-2
gcc/fixinc/server.c
+169
-329
gcc/fixinc/server.h
+32
-32
No files found.
gcc/fixinc/Makefile.in
View file @
1f414ac4
# Makefile for GNU
C++ compiler
.
# Copyright (C) 19
87, 88, 90-5, 1998
Free Software Foundation, Inc.
# Makefile for GNU
compilers
.
# Copyright (C) 19
98, 1999
Free Software Foundation, Inc.
#This file is part of GNU CC.
...
...
@@ -22,6 +22,7 @@
# Its purpose is to build the any-platforms fixinc.sh script.
CFLAGS
=
-g
FIXINC_DEFS
=
@fixinc_defs@
CC
=
@CC@
SHELL
=
/bin/sh
...
...
@@ -39,11 +40,11 @@ default : gen
# Specify the directories to be searched for header files.
# 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.
.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.
.SUFFIXES
:
...
...
@@ -55,12 +56,11 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config
##
## 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
HDR
=
server.h regex.h
LIBERTY
=
../../libiberty/libiberty.a
SH_TARGET
=
inclhack.sh fixincl.sh
BIN_TARGET
=
fixincl
...
...
@@ -75,13 +75,13 @@ gen : $(SH_TARGET) fixincl.x
$(OBJ)
:
$(HDR)
fixincl
:
$(OBJ)
@
echo
$(CC)
-o
$@
$(OBJ)
$(LIB)
;
\
if
$(CC)
-o
$@
$(OBJ)
$(LIB)
;
then
:
;
else
\
@
echo
$(CC)
-o
$@
$(OBJ)
$(LIB
ERTY)
$(LIB
)
;
\
if
$(CC)
-o
$@
$(OBJ)
$(LIB
ERTY)
$(LIB
)
;
then
:
;
else
\
rm
-f
$@
;
(
echo
"#! /bin/sh"
;
echo exit
1
)
>
$@
;
\
chmod 777
$@
;
fi
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
server.o
:
server.c server.h
...
...
@@ -92,21 +92,28 @@ fixincl.x: fixincl.tpl inclhack.def
autogen
-T
$(srcdir)
/fixincl.tpl
-b
fixincl
\
$(srcdir)
/inclhack.def
;
\
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
@
if
(
autogen
--help
>
/dev/null 2>&1
)
;
then
\
echo
autogen inclhack.def
;
\
autogen inclhack.def
;
\
autogen
-L
$(srcdir)
$(srcdir)
/
inclhack.def
;
\
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
@
if
(
autogen
--help
>
/dev/null 2>&1
)
;
then
\
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
;
\
$(CP)
$(srcdir)
/
$@
.
;
fi
if
[
`
pwd
`
!=
`
cd
$(srcdir)
;
pwd
`
]
;
then
\
$(CP)
$(srcdir)
/
$@
.
;
\
else
touch
$@
;
fi
;
fi
clean
:
rm
-f
*
.o
$(TARGETS)
fixincl.x
...
...
@@ -120,13 +127,19 @@ install: $(TARGETS)
@
rm
-f
../fixinc.sh
;
\
if
(
./fixincl
-v
>
/dev/null 2>&1
)
;
then
\
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
;
\
rm
-f
../fixincl
;
\
echo
cp fixincl ..
;
\
cp fixincl ..
;
\
chmod 555 ../fixincl
;
\
else
\
echo
Could not install binary fixincludes.
;
\
echo
Installing shell script instead.
;
\
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
gcc/fixinc/fixincl.c
View file @
1f414ac4
/*
* $Id: fixincl.c,v 1.2 1998/12/16 21:19:03 law Exp $
*
* 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.
*
* See README-fixinc for more information.
*
* fixincl 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.
*
* fixincl 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 fixincl. See the file "COPYING". If not,
* write to: The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* 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. */
#ifdef FIXINC_BROKEN
/* The fixincl program is known to not run properly on this particular
system. Instead of producing a probably broken executable, we force
a compilation error and let the mkfixinc.sh script install the
inclhack.sh shell script instead. */
# include "The fixincl program does not work properly on this system!"
#endif
#include "config.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#i
nclude <sys/types.h>
#i
fdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <signal.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <ctype.h>
#include "regex.h"
#include "server.h"
static
const
char
program_id
[]
=
"fixincl version 1.0"
;
#define MINIMUM_MAXIMUM_LINES 128
/* 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
#define NAME_TABLE_SIZE (MINIMUM_MAXIMUM_LINES * MAXPATHLEN)
char
*
file_name_buf
;
#define tSCC static const char
#define tCC const char
#define tSC static char
typedef
int
t
S
uccess
;
typedef
int
t
_s
uccess
;
#define FAILURE
((tSuccess)
-1)
#define SUCCESS
((tSuccess) 0)
#define PROBLEM
((tSuccess) 1)
#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 SUCCEEDED(
p)
((p) == SUCCESS)
#define SUCCESSFUL(
p) SUCCEEDED (p
)
#define FAILED(
p) ((p) <
SUCCESS)
#define HADGLITCH(
p) ((p) >
SUCCESS)
#define NUL '\0'
/* Test Descriptor
Each fix may have associated tests that determine
whether the fix needs to be applied or not.
Each test has a type (from the te_test_type enumeration);
associated test text; and, if the test is TT_EGREP or
the negated form TT_NEGREP, a pointer to the compiled
version of the text string.
*/
typedef
enum
{
{
TT_TEST
,
TT_EGREP
,
TT_NEGREP
}
teTestType
;
}
te_test_type
;
typedef
struct
test_desc
tTestDesc
;
struct
test_desc
{
teTestT
ype
type
;
const
char
*
pzTes
t
;
regex_t
*
pTestR
egex
;
};
{
te_test_t
ype
type
;
const
char
*
pz_test_tex
t
;
regex_t
*
p_test_r
egex
;
};
typedef
struct
patch_desc
tPatchDesc
;
/* Fix Descriptor
Everything you ever wanted to know about how to apply
a particular fix (which files, how to qualify them,
how to actually make the fix, etc...)
*/
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
#define FD_SKIP_TEST 0x8000
typedef
struct
fix_desc
tFixDesc
;
struct
fix_desc
{
const
char
*
pzFixName
;
/* Name of the fix */
const
char
*
pzFileList
;
/* List of files it applies to */
const
char
**
papzMachs
;
/* List of machine/os-es it applies to */
regex_t
*
pListRegex
;
int
testCt
;
int
fdFlags
;
tTestDesc
*
pTestDesc
;
const
char
**
papzPatchArgs
;
};
char
*
pzDestDir
=
(
char
*
)
NULL
;
char
*
pzSrcDir
=
(
char
*
)
NULL
;
char
*
pzMachine
=
(
char
*
)
NULL
;
pid_t
chainHead
=
(
pid_t
)
-
1
;
const
char
zInclQuote
[]
=
"^[
\t
]*#[
\t
]*include[
\t
]*
\"
[^/]"
;
regex_t
inclQuoteRegex
;
char
zFileNameBuf
[
0x8000
];
char
*
loadFile
(
const
char
*
pzFile
);
void
process
(
char
*
data
,
const
char
*
dir
,
const
char
*
file
);
void
runCompiles
(
void
);
{
const
char
*
fix_name
;
/* Name of the fix */
const
char
*
file_list
;
/* List of files it applies to */
const
char
**
papz_machs
;
/* List of machine/os-es it applies to */
regex_t
*
unused
;
int
test_ct
;
int
fd_flags
;
tTestDesc
*
p_test_desc
;
const
char
**
patch_args
;
};
/* Working environment strings. Essentially, invocation 'options'. */
char
*
pz_dest_dir
=
NULL
;
char
*
pz_src_dir
=
NULL
;
char
*
pz_machine
=
NULL
;
pid_t
process_chain_head
=
(
pid_t
)
-
1
;
const
char
incl_quote_pat
[]
=
"^[
\t
]*#[
\t
]*include[
\t
]*
\"
[^/]"
;
regex_t
incl_quote_re
;
char
*
load_file
(
const
char
*
pzFile
);
void
process
(
char
*
data
,
const
char
*
file
);
void
run_compiles
(
void
);
#include "fixincl.x"
/* * * * * * * * * * * * * * * * * * *
*
* MAIN ROUTINE
*/
int
main
(
argc
,
argv
)
int
argc
;
char
**
argv
;
{
static
const
char
zGnuLib
[]
=
static
const
char
gnu_lib_mark
[]
=
"This file is part of the GNU C Library"
;
static
const
char
zVarNotF
ound
[]
=
static
const
char
var_not_f
ound
[]
=
"fixincl ERROR: %s environment variable not defined
\n
"
;
#ifndef NO_BOGOSITY_LIMITS
# define BOGUS_LIMIT
256
size_t
loop
C
t
;
# define BOGUS_LIMIT
MINIMUM_MAXIMUM_LINES
size_t
loop
_c
t
;
#endif
char
*
apz
N
ames
[
BOGUS_LIMIT
];
size_t
file
NameC
t
;
char
*
apz
_n
ames
[
BOGUS_LIMIT
];
size_t
file
_name_c
t
;
if
(
argc
!=
1
)
/* Before anything else, ensure we can allocate our file name buffer. */
file_name_buf
=
(
char
*
)
malloc
(
NAME_TABLE_SIZE
);
if
(
file_name_buf
==
(
char
*
)
NULL
)
{
if
(
argc
!=
2
)
{
fputs
(
"fixincl ERROR: too many command line arguments
\n
"
,
stderr
);
fprintf
(
stderr
,
"fixincl cannot allocate 0x%08X bytes
\n
"
,
NAME_TABLE_SIZE
);
exit
(
EXIT_FAILURE
);
}
switch
(
argc
)
{
case
1
:
break
;
case
2
:
if
(
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
{
fputs
(
"$Id: fixincl.c,v 1.2 1998/12/16 21:19:03 law Exp $
\n
"
,
stderr
);
exit
(
EXIT_SUCCESS
);
}
static
const
char
zFmt
[]
=
"echo '%s'"
;
/* The 'version' option is really used to test that:
1. The program loads correctly (no missing libraries)
2. we can correctly run our server shell process
3. that we can compile all the regular expressions.
*/
run_compiles
();
sprintf
(
file_name_buf
,
zFmt
,
program_id
);
fputs
(
file_name_buf
+
5
,
stdout
);
exit
(
strcmp
(
run_shell
(
file_name_buf
),
program_id
));
}
freopen
(
argv
[
1
],
"r"
,
stdin
);
break
;
default
:
fputs
(
"fixincl ERROR: too many command line arguments
\n
"
,
stderr
);
exit
(
EXIT_FAILURE
);
}
{
static
const
char
zV
ar
[]
=
"TARGET_MACHINE"
;
pz
Machine
=
getenv
(
zVar
);
if
(
pz
Machine
==
(
char
*
)
NULL
)
static
const
char
v
ar
[]
=
"TARGET_MACHINE"
;
pz
_machine
=
getenv
(
var
);
if
(
pz
_machine
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
zVarNotFound
,
zVar
);
fprintf
(
stderr
,
var_not_found
,
var
);
exit
(
EXIT_FAILURE
);
}
}
{
static
const
char
zV
ar
[]
=
"DESTDIR"
;
pz
DestDir
=
getenv
(
zVar
);
if
(
pz
DestDir
==
(
char
*
)
NULL
)
static
const
char
v
ar
[]
=
"DESTDIR"
;
pz
_dest_dir
=
getenv
(
var
);
if
(
pz
_dest_dir
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
zVarNotFound
,
zVar
);
fprintf
(
stderr
,
var_not_found
,
var
);
exit
(
EXIT_FAILURE
);
}
}
{
static
const
char
zV
ar
[]
=
"SRCDIR"
;
pz
SrcDir
=
getenv
(
zVar
);
if
(
pz
SrcDir
==
(
char
*
)
NULL
)
static
const
char
v
ar
[]
=
"SRCDIR"
;
pz
_src_dir
=
getenv
(
var
);
if
(
pz
_src_dir
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
zVarNotFound
,
zVar
);
fprintf
(
stderr
,
var_not_found
,
var
);
exit
(
EXIT_FAILURE
);
}
}
runCompiles
();
/* Compile all the regular expressions now.
That way, it is done only once for the whole run.
*/
run_compiles
();
signal
(
SIGQUIT
,
SIG_IGN
);
signal
(
SIGIOT
,
SIG_IGN
);
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGALRM
,
SIG_IGN
);
signal
(
SIGTERM
,
SIG_IGN
);
signal
(
SIGCHLD
,
SIG_IGN
);
signal
(
SIGQUIT
,
SIG_IGN
);
signal
(
SIGIOT
,
SIG_IGN
);
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGALRM
,
SIG_IGN
);
signal
(
SIGTERM
,
SIG_IGN
);
#ifndef NO_BOGOSITY_LIMITS
/* Some systems only allow so many calls to fork(2).
This is inadequate for this program. Consequently,
we must let a grandfather process spawn children
that then spawn all the processes that do the real work.
*/
for
(;;)
{
char
*
pz
B
uf
;
char
*
pz
_b
uf
;
pid_t
child
;
/*
* Only the parent process can read from stdin without
* confusing the world. (How does the child tell the
* parent to skip forward? Pipes and files behave differently.)
*/
for
(
fileNameCt
=
0
,
pzBuf
=
zFileNameBuf
;
(
fileNameCt
<
BOGUS_LIMIT
)
&&
(
pzBuf
<
(
zFileNameBuf
+
sizeof
(
zFileNameBuf
)
-
MAXPATHLEN
));
)
/* Only the parent process can read from stdin without confusing
the world. (How does the child tell the parent to skip
forward? Pipes and files behave differently.) */
file_name_ct
=
0
;
pz_buf
=
file_name_buf
;
while
(
(
file_name_ct
<
BOGUS_LIMIT
)
&&
(
pz_buf
<
(
file_name_buf
+
NAME_TABLE_SIZE
-
MAXPATHLEN
)))
{
if
(
fgets
(
pzBuf
,
MAXPATHLEN
,
stdin
)
==
(
char
*
)
NULL
)
if
(
fgets
(
pz_buf
,
MAXPATHLEN
,
stdin
)
==
(
char
*
)
NULL
)
break
;
while
(
isspace
(
*
pzBuf
))
pzBuf
++
;
apzNames
[
fileNameCt
++
]
=
pzBuf
;
pzBuf
+=
strlen
(
pzBuf
);
while
(
isspace
(
pzBuf
[
-
1
]))
pzBuf
--
;
*
pzBuf
++
=
'\0'
;
while
(
isspace
(
*
pz_buf
))
pz_buf
++
;
if
((
*
pz_buf
==
'\0'
)
||
(
*
pz_buf
==
'#'
))
continue
;
apz_names
[
file_name_ct
++
]
=
pz_buf
;
pz_buf
+=
strlen
(
pz_buf
);
while
(
isspace
(
pz_buf
[
-
1
]))
pz_buf
--
;
*
pz_buf
++
=
'\0'
;
}
if
(
fileNameCt
==
0
)
/* IF we did not get any files this time thru
THEN we must be done. */
if
(
file_name_ct
==
0
)
return
EXIT_SUCCESS
;
child
=
fork
();
...
...
@@ -226,37 +298,53 @@ main (argc, argv)
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
#ifdef DEBUG
fprintf
(
stderr
,
"Waiting for %d to complete %d files
\n
"
,
child
,
file_name_ct
);
#endif
{
int
status
;
pid_t
dead_kid
=
wait
(
&
status
);
waitpid
(
child
,
(
int
*
)
NULL
,
0
);
if
(
dead_kid
!=
child
)
fprintf
(
stderr
,
"fixincl woke up from a strange child %d (not %d)
\n
"
,
dead_kid
,
child
);
#ifdef DEBUG
else
fprintf
(
stderr
,
"child finished %d files %s
\n
"
,
file_name_ct
,
status
?
strerror
(
status
&
0xFF
)
:
"ok"
);
#endif
}
}
#else
#error "NON-BOGUS LIMITS NOT SUPPORTED?!?!"
#endif
/*
* For every file specified in stdandard in
* (except as throttled for bogus reasons)...
#ifdef DEBUG
fprintf
(
stderr
,
"Child start -- processing %d files
\n
"
,
file_name_ct
);
#endif
/* For every file specified in stdandard in
(except as throttled for bogus reasons)...
*/
for
(
loop
Ct
=
0
;
loopCt
<
fileNameCt
;
loopC
t
++
)
for
(
loop
_ct
=
0
;
loop_ct
<
file_name_ct
;
loop_c
t
++
)
{
char
*
pz
D
ata
;
char
*
pz
File
=
apzNames
[
loopC
t
];
char
*
pz
_d
ata
;
char
*
pz
_file_name
=
apz_names
[
loop_c
t
];
if
(
access
(
pz
Fil
e
,
R_OK
)
!=
0
)
if
(
access
(
pz
_file_nam
e
,
R_OK
)
!=
0
)
{
int
erno
=
errno
;
fprintf
(
stderr
,
"Cannot access %s from %s
\n\t
error %d (%s)
\n
"
,
pz
Fil
e
,
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
),
pz
_file_nam
e
,
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
),
erno
,
strerror
(
erno
));
}
else
if
(
pzData
=
loadFile
(
pzFile
),
(
pzData
!=
(
char
*
)
NULL
))
else
if
(
pz_data
=
load_file
(
pz_file_name
),
(
pz_data
!=
(
char
*
)
NULL
))
{
if
(
strstr
(
pzData
,
zGnuLib
)
==
(
char
*
)
NULL
)
process
(
pzData
,
pzDestDir
,
pzFile
);
free
((
void
*
)
pzData
);
if
(
strstr
(
pz_data
,
gnu_lib_mark
)
==
(
char
*
)
NULL
)
process
(
pz_data
,
pz_file_name
);
free
((
void
*
)
pz_data
);
}
}
...
...
@@ -264,50 +352,57 @@ main (argc, argv)
}
/* * * * * * * * * * * * *
load_file loads all the contents of a file into malloc-ed memory.
Its argument is the name 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
(
pzFil
e
)
const
char
*
pz
Fil
e
;
load
_file
(
pz_file_nam
e
)
const
char
*
pz
_file_nam
e
;
{
char
*
pz
D
ta
;
size_t
file
S
ize
;
char
*
pz
_da
ta
;
size_t
file
_s
ize
;
{
struct
stat
stbf
;
if
(
stat
(
pzFile
,
&
stbf
)
!=
0
)
if
(
stat
(
pz_file_name
,
&
stbf
)
!=
0
)
{
fprintf
(
stderr
,
"error %d (%s) stat-ing %s
\n
"
,
errno
,
strerror
(
errno
),
pz
Fil
e
);
errno
,
strerror
(
errno
),
pz
_file_nam
e
);
return
(
char
*
)
NULL
;
}
file
S
ize
=
stbf
.
st_size
;
file
_s
ize
=
stbf
.
st_size
;
}
if
(
file
S
ize
==
0
)
if
(
file
_s
ize
==
0
)
return
(
char
*
)
NULL
;
pz
Dta
=
(
char
*
)
malloc
((
fileS
ize
+
16
)
&
~
0x00F
);
if
(
pz
D
ta
==
(
char
*
)
NULL
)
pz
_data
=
(
char
*
)
malloc
((
file_s
ize
+
16
)
&
~
0x00F
);
if
(
pz
_da
ta
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
"error: could not malloc %d bytes
\n
"
,
file
S
ize
);
file
_s
ize
);
exit
(
EXIT_FAILURE
);
}
{
FILE
*
fp
=
fopen
(
pz
Fil
e
,
"r"
);
size_t
size
Left
=
fileS
ize
;
char
*
read
Ptr
=
pzD
ta
;
FILE
*
fp
=
fopen
(
pz
_file_nam
e
,
"r"
);
size_t
size
_left
=
file_s
ize
;
char
*
read
_ptr
=
pz_da
ta
;
if
(
fp
==
(
FILE
*
)
NULL
)
{
fprintf
(
stderr
,
"error %d (%s) opening %s
\n
"
,
errno
,
strerror
(
errno
),
pz
Fil
e
);
free
((
void
*
)
pz
D
ta
);
strerror
(
errno
),
pz
_file_nam
e
);
free
((
void
*
)
pz
_da
ta
);
return
(
char
*
)
NULL
;
}
do
{
size_t
sizeRead
=
fread
((
void
*
)
read
Ptr
,
1
,
sizeL
eft
,
fp
);
size_t
sizeRead
=
fread
((
void
*
)
read
_ptr
,
1
,
size_l
eft
,
fp
);
if
(
sizeRead
==
0
)
{
...
...
@@ -317,164 +412,215 @@ loadFile (pzFile)
if
(
ferror
(
fp
))
{
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
errno
,
strerror
(
errno
),
pz
Fil
e
);
free
((
void
*
)
pz
D
ta
);
strerror
(
errno
),
pz
_file_nam
e
);
free
((
void
*
)
pz
_da
ta
);
fclose
(
fp
);
return
(
char
*
)
NULL
;
}
}
read
P
tr
+=
sizeRead
;
size
L
eft
-=
sizeRead
;
read
_p
tr
+=
sizeRead
;
size
_l
eft
-=
sizeRead
;
}
while
(
size
L
eft
!=
0
);
while
(
size
_l
eft
!=
0
);
*
read
P
tr
=
'\0'
;
*
read
_p
tr
=
'\0'
;
fclose
(
fp
);
return
pzDta
;
}
return
pz_data
;
}
/* * * * * * * * * * * * *
run_compiles run all the regexp compiles for all the fixes once.
*/
void
run
C
ompiles
()
run
_c
ompiles
()
{
tSCC
z
BadC
omp
[]
=
"fixincl ERROR: cannot compile %s regex for %s
\n
"
tSCC
z
_bad_c
omp
[]
=
"fixincl ERROR: cannot compile %s regex for %s
\n
"
"
\t
expr = `%s'
\n
"
"
\t
error %s
\n
"
;
tFixDesc
*
p
FD
=
fixDescList
;
int
fix
C
t
=
FIX_COUNT
;
tTestDesc
*
p
TD
;
int
t
stC
t
;
int
re
C
t
=
REGEX_COUNT
;
const
char
*
pz
E
rr
;
regex_t
*
p
Regex
=
(
regex_t
*
)
malloc
(
REGEX_COUNT
*
sizeof
(
regex_t
));
if
(
p
Regex
==
(
regex_t
*
)
NULL
)
tFixDesc
*
p
_fixd
=
fixDescList
;
int
fix
_c
t
=
FIX_COUNT
;
tTestDesc
*
p
_test
;
int
t
est_c
t
;
int
re
_c
t
=
REGEX_COUNT
;
const
char
*
pz
_e
rr
;
regex_t
*
p
_re
=
(
regex_t
*
)
malloc
(
REGEX_COUNT
*
sizeof
(
regex_t
));
if
(
p
_re
==
(
regex_t
*
)
NULL
)
{
fprintf
(
stderr
,
"fixincl ERROR: cannot allocate %d bytes for regex
\n
"
,
REGEX_COUNT
*
sizeof
(
regex_t
));
exit
(
EXIT_FAILURE
);
}
/* The patterns we search for are all egrep patterns.
In the shell version of this program, we invoke egrep
with the supplied pattern. Here, we will run
re_compile_pattern, but it must be using the same rules. */
re_set_syntax
(
RE_SYNTAX_EGREP
);
pz
Err
=
re_compile_pattern
(
zInclQuote
,
strlen
(
zInclQuote
)
,
&
incl
QuoteRegex
);
if
(
pz
E
rr
!=
(
char
*
)
NULL
)
pz
_err
=
re_compile_pattern
(
incl_quote_pat
,
sizeof
(
incl_quote_pat
)
-
1
,
&
incl
_quote_re
);
if
(
pz
_e
rr
!=
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
z
BadComp
,
"quoted include"
,
"runC
ompiles"
,
zInclQuote
,
pzE
rr
);
fprintf
(
stderr
,
z
_bad_comp
,
"quoted include"
,
"run_c
ompiles"
,
incl_quote_pat
,
pz_e
rr
);
exit
(
EXIT_FAILURE
);
}
/*
* FOR every fixup, ...
*/
/* FOR every fixup, ... */
do
{
p
TD
=
pFD
->
pTestD
esc
;
t
stCt
=
pFD
->
testC
t
;
p
_test
=
p_fixd
->
p_test_d
esc
;
t
est_ct
=
p_fixd
->
test_c
t
;
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"
;
/* IF the machine type pointer is not NULL (we are not in test mode)
AND this test is for or not done on particular machines
THEN ... */
sprintf
(
pz
,
"case %s in
\n
"
,
pzMachine
);
pz
+=
strlen
(
pz
);
if
(
pFD
->
fdFlags
&
FD_MACH_IFNOT
)
{
pzIfTrue
=
zSkip
;
pzIfFalse
=
zRun
;
}
else
{
pzIfTrue
=
zRun
;
pzIfFalse
=
zSkip
;
if
(
(
pz_machine
!=
NULL
)
&&
(
p_fixd
->
papz_machs
!=
(
const
char
**
)
NULL
)
)
{
const
char
**
papz_machs
=
p_fixd
->
papz_machs
;
char
*
pz
=
file_name_buf
;
char
*
pz_sep
=
""
;
tCC
*
pz_if_true
;
tCC
*
pz_if_false
;
tSCC
skip
[]
=
"skip"
;
tSCC
run
[]
=
"run"
;
/* Construct a shell script that looks like this:
case our-cpu-platform-os in
tests-cpu-platform-os-pattern )
echo run ;;
* )
echo skip ;;
esac
where 'run' and 'skip' may be reversed, depending on
the sense of the test. */
sprintf
(
pz
,
"case %s in
\n
"
,
pz_machine
);
pz
+=
strlen
(
pz
);
if
(
p_fixd
->
fd_flags
&
FD_MACH_IFNOT
)
{
pz_if_true
=
skip
;
pz_if_false
=
run
;
}
else
{
pz_if_true
=
run
;
pz_if_false
=
skip
;
}
for
(;;)
{
const
char
*
pzMach
=
*
(
papzMachs
++
);
if
(
pzMach
==
(
const
char
*
)
NULL
)
/* FOR any additional machine names to test for,
insert the " | \\\n" glue and the machine pattern. */
for
(;;)
{
const
char
*
pz_mach
=
*
(
papz_machs
++
);
if
(
pz_mach
==
(
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
;
sprintf
(
pz
,
"%s %s"
,
pz_sep
,
pz_mach
);
pz
+=
strlen
(
pz
);
pz_sep
=
" |
\\\n
"
;
}
sprintf
(
pz
,
" )
\n
echo %s ;;
\n
* )
\n
echo %s ;;
\n
esac"
,
pz_if_true
,
pz_if_false
);
/* Run the script.
The result will start either with 's' or 'r'. */
pz
=
run_shell
(
file_name_buf
);
if
(
*
pz
==
's'
)
{
p_fixd
->
fd_flags
|=
FD_SKIP_TEST
;
continue
;
}
}
/*
* FOR every test for the fixup, ...
*/
while
(
--
tstCt
>=
0
)
/* FOR every test for the fixup, ... */
while
(
--
test_ct
>=
0
)
{
switch
(
p
TD
->
type
)
switch
(
p
_test
->
type
)
{
case
TT_EGREP
:
case
TT_NEGREP
:
if
(
--
reCt
<
0
)
/* You might consider putting the following under #ifdef.
The number of re's used is computed by autogen.
So, it is static and known at compile time. */
if
(
--
re_ct
<
0
)
{
fputs
(
"out of RE's
\n
"
,
stderr
);
exit
(
EXIT_FAILURE
);
}
p
TD
->
pTestRegex
=
pRegex
++
;
pz
Err
=
re_compile_pattern
(
pTD
->
pzTes
t
,
strlen
(
p
TD
->
pzTes
t
),
p
TD
->
pTestR
egex
);
if
(
pz
E
rr
!=
(
char
*
)
NULL
)
p
_test
->
p_test_regex
=
p_re
++
;
pz
_err
=
re_compile_pattern
(
p_test
->
pz_test_tex
t
,
strlen
(
p
_test
->
pz_test_tex
t
),
p
_test
->
p_test_r
egex
);
if
(
pz
_e
rr
!=
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
z
BadComp
,
"select test"
,
pFD
->
pzFixN
ame
,
p
TD
->
pzTest
,
pzE
rr
);
fprintf
(
stderr
,
z
_bad_comp
,
"select test"
,
p_fixd
->
fix_n
ame
,
p
_test
->
pz_test_text
,
pz_e
rr
);
exit
(
EXIT_FAILURE
);
}
}
p
TD
++
;
p
_test
++
;
}
}
while
(
p
FD
++
,
--
fixC
t
>
0
);
while
(
p
_fixd
++
,
--
fix_c
t
>
0
);
}
/* * * * * * * * * * * * *
create_file Create the output modified file.
Input: the name of the file to create
Returns: a file pointer to the new, open file */
#define S_IRALL (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
FILE
*
create
File
(
pzFil
e
)
const
char
*
pz
Fil
e
;
create
_file
(
pz_file_nam
e
)
const
char
*
pz
_file_nam
e
;
{
int
fd
;
FILE
*
pf
;
char
fname
[
MAXPATHLEN
];
sprintf
(
fname
,
"%s/%s"
,
pzDestDir
,
pzFile
);
unlink
(
fname
);
sprintf
(
fname
,
"%s/%s"
,
pz_dest_dir
,
pz_file_name
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
/* We may need to create the directories needed... */
if
((
fd
<
0
)
&&
(
errno
==
ENOENT
))
{
char
*
pz
D
ir
=
strchr
(
fname
+
1
,
'/'
);
char
*
pz
_d
ir
=
strchr
(
fname
+
1
,
'/'
);
struct
stat
stbf
;
while
(
pz
D
ir
!=
(
char
*
)
NULL
)
while
(
pz
_d
ir
!=
(
char
*
)
NULL
)
{
*
pz
D
ir
=
NUL
;
*
pz
_d
ir
=
NUL
;
if
(
stat
(
fname
,
&
stbf
)
<
0
)
{
mkdir
(
fname
,
S_IFDIR
|
S_IRWXU
|
S_IRGRP
|
S_IXGRP
|
S_IROTH
|
S_IXOTH
);
}
*
pz
D
ir
=
'/'
;
pz
Dir
=
strchr
(
pzD
ir
+
1
,
'/'
);
*
pz
_d
ir
=
'/'
;
pz
_dir
=
strchr
(
pz_d
ir
+
1
,
'/'
);
}
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
);
/* Now, lets try the open again... */
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
}
if
(
fd
<
0
)
{
...
...
@@ -482,353 +628,410 @@ createFile (pzFile)
errno
,
strerror
(
errno
),
fname
);
exit
(
EXIT_FAILURE
);
}
fprintf
(
stderr
,
"Fixed: %s
\n
"
,
pz
Fil
e
);
fprintf
(
stderr
,
"Fixed: %s
\n
"
,
pz
_file_nam
e
);
pf
=
fdopen
(
fd
,
"w"
);
#ifdef LATER
{
static
const
char
zHdr
[]
=
"/*
\n
"
" * DO NOT EDIT THIS FILE.
\n
"
" *
\n
"
" * It has been auto-edited by fixincludes from /usr/include/%s
\n
"
" * This had to be done to correct non-standard usages in the
\n
"
" * original, manufacturer supplied header file.
\n
"
" */
\n\n
"
;
static
const
char
hdr
[]
=
"/* DO NOT EDIT THIS FILE.
\n\n
"
" It has been auto-edited by fixincludes from /usr/include/%s
\n
"
" This had to be done to correct non-standard usages in the
\n
"
" original, manufacturer supplied header file. */
\n\n
"
;
fprintf
(
pf
,
zHdr
,
pzFil
e
);
fprintf
(
pf
,
hdr
,
pz_file_nam
e
);
}
#endif
return
pf
;
}
tSuccess
testTest
(
pTest
,
pzFile
)
tTestDesc
*
pTest
;
char
*
pzFile
;
{
char
*
pzRes
;
tSuccess
res
=
FAILURE
;
static
char
zCmdBuf
[
4096
];
tSCC
zCmdFmt
[]
=
"file=%s
\n
if ( test %s ) > /dev/null 2>&1
\n
"
"then echo TRUE
\n
"
"else echo FALSE
\n
"
"fi"
;
/* * * * * * * * * * * * *
sprintf
(
zCmdBuf
,
zCmdFmt
,
pzFile
,
pTest
->
pzTest
);
pzRes
=
runShell
(
zCmdBuf
);
if
(
*
pzRes
==
'T'
)
test_test make sure a shell-style test expression passes.
Input: a pointer to the descriptor of the test to run and
the name of the file that we might want to fix
Result: SUCCESS or FAILURE, depending on the result of the
shell script we run. */
t_success
test_test
(
p_test
,
pz_file_name
)
tTestDesc
*
p_test
;
char
*
pz_file_name
;
{
char
*
pz_res
;
t_success
res
=
FAILURE
;
static
char
cmd_buf
[
4096
];
tSCC
cmd_fmt
[]
=
"file=%s
\n
"
"if ( test %s ) > /dev/null 2>&1
\n
"
"then echo TRUE
\n
"
"else echo FALSE
\n
"
"fi"
;
sprintf
(
cmd_buf
,
cmd_fmt
,
pz_file_name
,
p_test
->
pz_test_text
);
pz_res
=
run_shell
(
cmd_buf
);
if
(
*
pz_res
==
'T'
)
res
=
SUCCESS
;
free
((
void
*
)
pz
R
es
);
free
((
void
*
)
pz
_r
es
);
return
res
;
}
tSuccess
egrepTest
(
pzDta
,
pTest
)
char
*
pzDta
;
tTestDesc
*
pTest
;
/* * * * * * * * * * * * *
egrep_test make sure an egrep expression is found in the file text.
Input: a pointer to the descriptor of the test to run and
the pointer to the contents of the file under suspicion
Result: SUCCESS if the pattern is found, FAILURE otherwise
The caller may choose 'FAILURE' as 'SUCCESS' if the sense of the test
is inverted. */
t_success
egrep_test
(
pz_data
,
p_test
)
char
*
pz_data
;
tTestDesc
*
p_test
;
{
regmatch_t
match
;
#ifndef NO_BOGOSITY
if
(
pTest
->
pTestRegex
==
0
)
fprintf
(
stderr
,
"fixincl ERROR RE not compiled: `%s'
\n
"
,
pTest
->
pzTest
);
if
(
p_test
->
p_test_regex
==
0
)
fprintf
(
stderr
,
"fixincl ERROR RE not compiled: `%s'
\n
"
,
p_test
->
pz_test_text
);
#endif
if
(
regexec
(
p
Test
->
pTestRegex
,
pzD
ta
,
1
,
&
match
,
0
)
==
0
)
if
(
regexec
(
p
_test
->
p_test_regex
,
pz_da
ta
,
1
,
&
match
,
0
)
==
0
)
return
SUCCESS
;
return
FAILURE
;
}
/* * * * * * * * * * * * *
*
extract_quoted_files
The syntax, `#include "file.h"' specifies that the compiler is to
search the local directory of the current file before the include
list. Consequently, if we have modified a header and stored it in
another directory, any files that are included by that modified
file in that fashion must also be copied into this new directory.
This routine finds those flavors of #include and for each one found
emits a triple of:
1. source directory of the original file
2. the relative path file name of the #includ-ed file
3. the full destination path for this file
Input: the text of the file, the file name and a pointer to the
match list where the match information was stored.
Result: internally nothing. The results are written to stdout
for interpretation by the invoking shell */
void
extract
QuotedFiles
(
pzDta
,
pzFile
,
pM
atch
)
char
*
pz
D
ta
;
const
char
*
pz
Fil
e
;
regmatch_t
*
p
M
atch
;
extract
_quoted_files
(
pz_data
,
pz_file_name
,
p_re_m
atch
)
char
*
pz
_da
ta
;
const
char
*
pz
_file_nam
e
;
regmatch_t
*
p
_re_m
atch
;
{
char
*
pz
DirEnd
=
strrchr
(
pzFil
e
,
'/'
);
char
*
pz
InclQuot
=
pzD
ta
;
char
*
pz
_dir_end
=
strrchr
(
pz_file_nam
e
,
'/'
);
char
*
pz
_incl_quot
=
pz_da
ta
;
fprintf
(
stderr
,
"Quoted includes in %s
\n
"
,
pz
Fil
e
);
fprintf
(
stderr
,
"Quoted includes in %s
\n
"
,
pz
_file_nam
e
);
/*
* Set "pzFile" to point to the containing subdirectory of the source
* If there is none, then it is in our current direcory, ".".
*/
if
(
pzDirEnd
==
(
char
*
)
NULL
)
pzFile
=
"."
;
/* Set "pz_file_name" to point to the containing subdirectory of the source
If there is none, then it is in our current direcory, ".". */
if
(
pz_dir_end
==
(
char
*
)
NULL
)
pz_file_name
=
"."
;
else
*
pz
DirE
nd
=
'\0'
;
*
pz
_dir_e
nd
=
'\0'
;
for
(;;)
{
pzInclQuot
+=
pMatch
->
rm_so
;
/*
* Skip forward to the included file name
*/
while
(
isspace
(
*
pzInclQuot
))
pzInclQuot
++
;
while
(
isspace
(
*++
pzInclQuot
));
pzInclQuot
+=
sizeof
(
"include"
)
-
1
;
while
(
*
pzInclQuot
++
!=
'"'
);
/*
* Print the source directory and the subdirectory of the file
* in question.
*/
printf
(
"%s %s/"
,
pzSrcDir
,
pzFile
);
pzDirEnd
=
pzInclQuot
;
/*
* Append to the directory the relative path of the desired file
*/
while
(
*
pzInclQuot
!=
'"'
)
putc
(
*
pzInclQuot
++
,
stdout
);
/*
* Now print the destination directory appended with the relative
* path of the desired file
*/
printf
(
" %s/%s/"
,
pzDestDir
,
pzFile
);
while
(
*
pzDirEnd
!=
'"'
)
putc
(
*
pzDirEnd
++
,
stdout
);
/*
* End of entry
*/
pz_incl_quot
+=
p_re_match
->
rm_so
;
/* Skip forward to the included file name */
while
(
isspace
(
*
pz_incl_quot
))
pz_incl_quot
++
;
while
(
isspace
(
*++
pz_incl_quot
))
;
pz_incl_quot
+=
sizeof
(
"include"
)
-
1
;
while
(
*
pz_incl_quot
++
!=
'"'
)
;
/* Print the source directory and the subdirectory of the file
in question. */
printf
(
"%s %s/"
,
pz_src_dir
,
pz_file_name
);
pz_dir_end
=
pz_incl_quot
;
/* Append to the directory the relative path of the desired file */
while
(
*
pz_incl_quot
!=
'"'
)
putc
(
*
pz_incl_quot
++
,
stdout
);
/* Now print the destination directory appended with the
relative path of the desired file */
printf
(
" %s/%s/"
,
pz_dest_dir
,
pz_file_name
);
while
(
*
pz_dir_end
!=
'"'
)
putc
(
*
pz_dir_end
++
,
stdout
);
/* End of entry */
putc
(
'\n'
,
stdout
);
/*
* Find the next entry
*/
if
(
regexec
(
&
inclQuoteRegex
,
pzInclQuot
,
1
,
pMatch
,
0
)
!=
0
)
/* Find the next entry */
if
(
regexec
(
&
incl_quote_re
,
pz_incl_quot
,
1
,
p_re_match
,
0
)
!=
0
)
break
;
}
}
/*
* Process the potential fixes for a particular include file
*/
/* * * * * * * * * * * * *
Process the potential fixes for a particular include file.
Input: the original text of the file and the file's name
Result: none. A new file may or may not be created. */
void
process
(
pzDta
,
pzDir
,
pzFile
)
char
*
pzDta
;
const
char
*
pzDir
;
const
char
*
pzFile
;
process
(
pz_data
,
pz_file_name
)
char
*
pz_data
;
const
char
*
pz_file_name
;
{
static
char
zEnvFile
[
1024
]
=
{
"file="
};
tFixDesc
*
pFD
=
fixDescList
;
int
todoCt
=
FIX_COUNT
;
tFdPair
fdp
=
{
-
1
,
-
1
};
static
char
env_current_file
[
1024
]
=
{
"file="
};
tFixDesc
*
p_fixd
=
fixDescList
;
int
todo_ct
=
FIX_COUNT
;
t_fd_pair
fdp
=
{
-
1
,
-
1
};
/*
* IF this is the first time through,
* THEN put the 'file' environment variable into the environment.
* This is used by some of the subject shell scripts and tests.
*/
if
(
zEnvFile
[
5
]
==
NUL
)
putenv
(
zEnvFile
);
/* IF this is the first time through,
THEN put the 'file' environment variable into the environment.
This is used by some of the subject shell scripts and tests. */
/*
* Ghastly as it is, this actually updates the value of the variable:
*
* putenv(3C) C Library Functions putenv(3C)
*
* DESCRIPTION
* putenv() makes the value of the environment variable name
* equal to value by altering an existing variable or creating
* a new one. In either case, the string pointed to by string
* becomes part of the environment, so altering the string will
* change the environment. string points to a string of the
* form ``name=value.'' The space used by string is no longer
* used once a new string-defining name is passed to putenv().
*/
strcpy
(
zEnvFile
+
5
,
pzFile
);
chainHead
=
NOPROCESS
;
if
(
env_current_file
[
5
]
==
NUL
)
putenv
(
env_current_file
);
/*
* For every fix in our fix list, ...
Ghastly as it is, this actually updates the value of the variable:
putenv(3C) C Library Functions putenv(3C)
DESCRIPTION
putenv() makes the value of the environment variable name
equal to value by altering an existing variable or creating
a new one. In either case, the string pointed to by string
becomes part of the environment, so altering the string will
change the environment. string points to a string of the
form ``name=value.'' The space used by string is no longer
used once a new string-defining name is passed to putenv().
*/
for
(;
todoCt
>
0
;
pFD
++
,
todoCt
--
)
strcpy
(
env_current_file
+
5
,
pz_file_name
);
process_chain_head
=
NOPROCESS
;
/* For every fix in our fix list, ... */
for
(;
todo_ct
>
0
;
p_fixd
++
,
todo_ct
--
)
{
tTestDesc
*
pTD
;
int
tstCt
;
tSuccess
egrepRes
;
tTestDesc
*
p_test
;
int
test_ct
;
if
(
p
FD
->
fdF
lags
&
FD_SKIP_TEST
)
if
(
p
_fixd
->
fd_f
lags
&
FD_SKIP_TEST
)
continue
;
/*
* IF there is a file name restriction,
* THEN ensure the current file name matches one in the pattern
*/
if
(
pFD
->
pzFileList
!=
(
char
*
)
NULL
)
/* IF there is a file name restriction,
THEN ensure the current file name matches one in the pattern */
if
(
p_fixd
->
file_list
!=
(
char
*
)
NULL
)
{
const
char
*
pz
Fil
=
pzFil
e
;
const
char
*
pz
Scn
=
pFD
->
pzFileL
ist
;
size_t
n
mL
en
;
const
char
*
pz
_fname
=
pz_file_nam
e
;
const
char
*
pz
_scan
=
p_fixd
->
file_l
ist
;
size_t
n
ame_l
en
;
while
((
pz
Fil
[
0
]
==
'.'
)
&&
(
pzFil
[
1
]
==
'/'
))
pz
Fil
+=
2
;
n
mLen
=
strlen
(
pzFil
);
while
((
pz
_fname
[
0
]
==
'.'
)
&&
(
pz_fname
[
1
]
==
'/'
))
pz
_fname
+=
2
;
n
ame_len
=
strlen
(
pz_fname
);
for
(;;)
{
pzScn
=
strstr
(
pzScn
+
1
,
pzFil
);
if
(
pzScn
==
(
char
*
)
NULL
)
goto
nextFix
;
pz_scan
=
strstr
(
pz_scan
+
1
,
pz_fname
);
/* IF we can't match the string at all,
THEN bail */
if
(
pz_scan
==
(
char
*
)
NULL
)
goto
next_fix
;
/* IF the match is surrounded by the '|' markers,
THEN we found a full match -- time to run the tests */
if
((
pz
Scn
[
-
1
]
==
'|'
)
&&
(
pzScn
[
nmL
en
]
==
'|'
))
if
((
pz
_scan
[
-
1
]
==
'|'
)
&&
(
pz_scan
[
name_l
en
]
==
'|'
))
break
;
}
}
egrepRes
=
PROBLEM
;
/* FOR each test, see if it fails.
IF it does fail, then we go on to the next test */
/*
* IF there are no tests
* THEN we always run the fixup
*/
for
(
pTD
=
pFD
->
pTestDesc
,
tstCt
=
pFD
->
testCt
;
tstCt
--
>
0
;
pTD
++
)
for
(
p_test
=
p_fixd
->
p_test_desc
,
test_ct
=
p_fixd
->
test_ct
;
test_ct
--
>
0
;
p_test
++
)
{
switch
(
pTD
->
type
)
#ifdef DEBUG
static
const
char
z_test_fail
[]
=
"%16s test %2d failed for %s
\n
"
;
#endif
switch
(
p_test
->
type
)
{
case
TT_TEST
:
/*
* IF *any* of the shell tests fail,
* THEN do not process the fix.
*/
if
(
!
SUCCESSFUL
(
testTest
(
pTD
,
pzFile
)))
goto
nextFix
;
if
(
!
SUCCESSFUL
(
test_test
(
p_test
,
pz_file_name
)))
{
#ifdef DEBUG
fprintf
(
stderr
,
z_test_fail
,
p_fixd
->
fix_name
,
p_fixd
->
test_ct
-
test_ct
,
pz_file_name
);
#endif
goto
next_fix
;
}
break
;
case
TT_EGREP
:
/*
* IF we have not had a successful egrep test
* *AND* this test does not pass,
* THEN mark the egrep test as failing. It starts
* out as a "PROBLEM", meaning that if we do not
* encounter any egrep tests, then we will let it pass.
*/
if
((
!
SUCCESSFUL
(
egrepRes
))
&&
(
!
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
))))
egrepRes
=
FAILURE
;
if
(
!
SUCCESSFUL
(
egrep_test
(
pz_data
,
p_test
)))
{
#ifdef DEBUG
fprintf
(
stderr
,
z_test_fail
,
p_fixd
->
fix_name
,
p_fixd
->
test_ct
-
test_ct
,
pz_file_name
);
#endif
goto
next_fix
;
}
break
;
case
TT_NEGREP
:
/*
* IF *any* of the negative egrep tests fail,
* THEN do not process the fix.
*/
if
(
SUCCESSFUL
(
egrepTest
(
pzDta
,
pTD
)))
goto
nextFix
;
if
(
SUCCESSFUL
(
egrep_test
(
pz_data
,
p_test
)))
{
#ifdef DEBUG
fprintf
(
stderr
,
z_test_fail
,
p_fixd
->
fix_name
,
p_fixd
->
test_ct
-
test_ct
,
pz_file_name
);
#endif
goto
next_fix
;
}
break
;
}
}
/*
* IF there were no egrep tests *OR* at least one passed, ...
*/
if
(
!
FAILED
(
egrepRes
))
{
fprintf
(
stderr
,
"Applying %-32s to %s
\n
"
,
pFD
->
pzFixName
,
pzFil
e
);
p_fixd
->
fix_name
,
pz_file_nam
e
);
if
(
fdp
.
readFd
==
-
1
)
/* IF we do not have a read pointer,
THEN this is the first fix for the current file.
Open the source file. That will be used as stdin for
the first fix. Any subsequent fixes will use the
stdout descriptor of the previous fix as its stdin. */
if
(
fdp
.
read_fd
==
-
1
)
{
fdp
.
readFd
=
open
(
pzFil
e
,
O_RDONLY
);
if
(
fdp
.
readF
d
<
0
)
fdp
.
read_fd
=
open
(
pz_file_nam
e
,
O_RDONLY
);
if
(
fdp
.
read_f
d
<
0
)
{
fprintf
(
stderr
,
"Error %d (%s) opening %s
\n
"
,
errno
,
strerror
(
errno
),
pzFil
e
);
strerror
(
errno
),
pz_file_nam
e
);
exit
(
EXIT_FAILURE
);
}
}
/* This loop should only cycle for 1/2 of one loop.
"chain_open" starts a process that uses "fdp.read_fd" as
its stdin and returns the new fd this process will use
for stdout. */
for
(;;)
{
int
newFd
=
chainOpen
(
fdp
.
readFd
,
(
tpChar
*
)
pFD
->
papzPatchArgs
,
(
chainHead
==
-
1
)
?
&
chainHead
:
(
pid_t
*
)
NULL
);
if
(
newFd
!=
-
1
)
static
int
failCt
=
0
;
int
fd
=
chain_open
(
fdp
.
read_fd
,
(
t_pchar
*
)
p_fixd
->
patch_args
,
(
process_chain_head
==
-
1
)
?
&
process_chain_head
:
(
pid_t
*
)
NULL
);
if
(
fd
!=
-
1
)
{
fdp
.
readFd
=
newF
d
;
fdp
.
read_fd
=
f
d
;
break
;
}
fprintf
(
stderr
,
"Error %d (%s) starting filter process "
"for %s
\n
"
,
errno
,
strerror
(
errno
),
pFD
->
pzFixN
ame
);
p_fixd
->
fix_n
ame
);
if
(
errno
!=
EAGAIN
)
if
((
errno
!=
EAGAIN
)
||
(
++
failCt
>
10
)
)
exit
(
EXIT_FAILURE
);
sleep
(
1
);
}
}
nextFix
:
;
next_fix
:
;
}
/*
* IF after all the tests we did not start any patch programs,
* THEN quit now.
*/
if
(
fdp
.
readFd
<
0
)
/* IF after all the tests we did not start any patch programs,
THEN quit now. */
if
(
fdp
.
read_fd
<
0
)
return
;
/* OK. We have work to do. Read back in the output
of the filtering chain. Compare each byte as we read it with
the contents of the original file. As soon as we find any
difference, we will create the output file, write out all
the matched text and then copy any remaining data from the
output of the filter chain.
*/
{
FILE
*
in
Fp
=
fdopen
(
fdp
.
readF
d
,
"r"
);
FILE
*
o
F
p
=
(
FILE
*
)
NULL
;
char
*
pz
Cmp
=
pzD
ta
;
FILE
*
in
_fp
=
fdopen
(
fdp
.
read_f
d
,
"r"
);
FILE
*
o
ut_f
p
=
(
FILE
*
)
NULL
;
char
*
pz
_cmp
=
pz_da
ta
;
for
(;;)
{
int
ch
;
ch
=
getc
(
in
F
p
);
ch
=
getc
(
in
_f
p
);
if
(
ch
==
EOF
)
break
;
if
(
oFp
!=
(
FILE
*
)
NULL
)
putc
(
ch
,
oFp
);
/* IF we are emitting the output
THEN emit this character, too.
*/
if
(
out_fp
!=
(
FILE
*
)
NULL
)
putc
(
ch
,
out_fp
);
else
if
(
ch
!=
*
pzCmp
)
/* ELSE if this character does not match the original,
THEN now is the time to start the output.
*/
else
if
(
ch
!=
*
pz_cmp
)
{
oFp
=
createFile
(
pzFile
);
if
(
pzCmp
!=
pzDta
)
out_fp
=
create_file
(
pz_file_name
);
/* IF there are matched data, write it all now. */
if
(
pz_cmp
!=
pz_data
)
{
char
c
=
*
pzCmp
;
*
pzCmp
=
NUL
;
fputs
(
pzDta
,
oFp
);
*
pzCmp
=
c
;
char
c
=
*
pz_cmp
;
*
pz_cmp
=
NUL
;
fputs
(
pz_data
,
out_fp
);
*
pz_cmp
=
c
;
}
putc
(
ch
,
oFp
);
/* Emit the current unmatching character */
putc
(
ch
,
out_fp
);
}
else
pzCmp
++
;
/* ELSE the character matches. Advance the compare ptr */
pz_cmp
++
;
}
if
(
oFp
!=
(
FILE
*
)
NULL
)
/* IF we created the output file, ... */
if
(
out_fp
!=
(
FILE
*
)
NULL
)
{
regmatch_t
match
;
fchmod
(
fileno
(
oFp
),
S_IRUSR
|
S_IRGRP
|
S_IROTH
);
fclose
(
oFp
);
if
(
regexec
(
&
inclQuoteRegex
,
pzDta
,
1
,
&
match
,
0
)
==
0
)
extractQuotedFiles
(
pzDta
,
pzFile
,
&
match
);
/* Close the file and see if we have to worry about
`#include "file.h"' constructs. */
fclose
(
out_fp
);
if
(
regexec
(
&
incl_quote_re
,
pz_data
,
1
,
&
match
,
0
)
==
0
)
extract_quoted_files
(
pz_data
,
pz_file_name
,
&
match
);
}
fclose
(
inFp
);
fclose
(
in_fp
);
}
close
(
fdp
.
readFd
);
close
(
fdp
.
read_fd
);
/* probably redundant, but I'm paranoid */
}
gcc/fixinc/fixincl.sh
View file @
1f414ac4
...
...
@@ -2,7 +2,7 @@
#
# DO NOT EDIT THIS FILE (fixincl.sh)
#
# It has been autogen-ed
Friday October 16, 1998 at 07:29:49 AM PD
T
# It has been autogen-ed
Wednesday January 27, 1999 at 09:03:56 AM PS
T
# From the definitions inclhack.def
# and the template file inclhack.tpl
#
...
...
@@ -10,7 +10,7 @@
# files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search.
#
# This script contains 10
4
fixup scripts.
# This script contains 10
5
fixup scripts.
#
# See README-fixinc for more information.
#
...
...
@@ -127,10 +127,7 @@ for INPUT in ${INPUTLIST} ; do
cd
${
ORIGDIR
}
cd
${
INPUT
}
||
{
echo
'fixincludes: input dir `'
$INPUT
"' is an invalid directory"
exit
1
}
cd
${
INPUT
}
||
continue
#
# # # # # # # # # # # # # # # # # # # # #
...
...
@@ -344,6 +341,7 @@ while [ $# != 0 ]; do
#
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
...
...
@@ -357,6 +355,7 @@ while [ $# != 0 ]; do
newreq
=
"
$newreq
$1
$dir
/
$include
$dir2
/
$include
"
done
fi
fi
shift
;
shift
;
shift
done
set
x
$newreq
...
...
@@ -384,6 +383,6 @@ done
cd
$ORIGDIR
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
gcc/fixinc/fixincl.x
View file @
1f414ac4
/*
* DO NOT EDIT THIS FILE (fixincl.x)
*
* It has been autogen-ed
Friday October 16, 1998 at 07:29:50 AM PD
T
* It has been autogen-ed
Tuesday January 5, 1999 at 09:20:37 AM PS
T
* From the definitions inclhack.def
* and the template file fixincl.tpl
*
...
...
@@ -9,7 +9,7 @@
* files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search.
*
* This script contains 10
4
fixup scripts.
* This script contains 10
5
fixup scripts.
*
* See README-fixinc for more information.
*
...
...
@@ -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[] =
"Ultrix_Atof_Param";
...
...
@@ -3034,7 +3068,7 @@ const char* apzUltrix_Atof_ParamPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 8
5
- Ultrix_Const fix
* Description 8
6
- Ultrix_Const fix
*/
tSCC zUltrix_ConstName[] =
"Ultrix_Const";
...
...
@@ -3067,7 +3101,7 @@ const char* apzUltrix_ConstPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 8
6
- Ultrix_Ifdef fix
* Description 8
7
- Ultrix_Ifdef fix
*/
tSCC zUltrix_IfdefName[] =
"Ultrix_Ifdef";
...
...
@@ -3100,7 +3134,7 @@ const char* apzUltrix_IfdefPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 8
7
- Ultrix_Nested_Cmnt fix
* Description 8
8
- Ultrix_Nested_Cmnt fix
*/
tSCC zUltrix_Nested_CmntName[] =
"Ultrix_Nested_Cmnt";
...
...
@@ -3125,7 +3159,7 @@ const char* apzUltrix_Nested_CmntPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 8
8
- Ultrix_Static fix
* Description 8
9
- Ultrix_Static fix
*/
tSCC zUltrix_StaticName[] =
"Ultrix_Static";
...
...
@@ -3160,7 +3194,7 @@ const char* apzUltrix_StaticPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description
89
- Undefine_Null fix
* Description
90
- Undefine_Null fix
*/
tSCC zUndefine_NullName[] =
"Undefine_Null";
...
...
@@ -3200,7 +3234,7 @@ const char* apzUndefine_NullPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
0
- Va_I960_Macro fix
* Description 9
1
- Va_I960_Macro fix
*/
tSCC zVa_I960_MacroName[] =
"Va_I960_Macro";
...
...
@@ -3236,7 +3270,7 @@ const char* apzVa_I960_MacroPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
1
- Void_Null fix
* Description 9
2
- Void_Null fix
*/
tSCC zVoid_NullName[] =
"Void_Null";
...
...
@@ -3279,7 +3313,7 @@ const char* apzVoid_NullPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
2
- Vxworks_Gcc_Problem fix
* Description 9
3
- Vxworks_Gcc_Problem fix
*/
tSCC zVxworks_Gcc_ProblemName[] =
"Vxworks_Gcc_Problem";
...
...
@@ -3327,7 +3361,7 @@ const char* apzVxworks_Gcc_ProblemPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
3
- Vxworks_Needs_Vxtypes fix
* Description 9
4
- Vxworks_Needs_Vxtypes fix
*/
tSCC zVxworks_Needs_VxtypesName[] =
"Vxworks_Needs_Vxtypes";
...
...
@@ -3360,7 +3394,7 @@ const char* apzVxworks_Needs_VxtypesPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
4
- Vxworks_Needs_Vxworks fix
* Description 9
5
- Vxworks_Needs_Vxworks fix
*/
tSCC zVxworks_Needs_VxworksName[] =
"Vxworks_Needs_Vxworks";
...
...
@@ -3407,7 +3441,7 @@ const char* apzVxworks_Needs_VxworksPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
5
- Vxworks_Time fix
* Description 9
6
- Vxworks_Time fix
*/
tSCC zVxworks_TimeName[] =
"Vxworks_Time";
...
...
@@ -3456,7 +3490,7 @@ const char* apzVxworks_TimePatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
6
- X11_Class fix
* Description 9
7
- X11_Class fix
*/
tSCC zX11_ClassName[] =
"X11_Class";
...
...
@@ -3494,7 +3528,7 @@ const char* apzX11_ClassPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
7
- X11_Class_Usage fix
* Description 9
8
- X11_Class_Usage fix
*/
tSCC zX11_Class_UsageName[] =
"X11_Class_Usage";
...
...
@@ -3527,7 +3561,7 @@ const char* apzX11_Class_UsagePatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 9
8
- X11_New fix
* Description 9
9
- X11_New fix
*/
tSCC zX11_NewName[] =
"X11_New";
...
...
@@ -3566,7 +3600,7 @@ const char* apzX11_NewPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description
99
- X11_Sprintf fix
* Description
100
- X11_Sprintf fix
*/
tSCC zX11_SprintfName[] =
"X11_Sprintf";
...
...
@@ -3593,7 +3627,7 @@ const char* apzX11_SprintfPatch[] = { "sed",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 10
0
- Zzz_Ki_Iface fix
* Description 10
1
- Zzz_Ki_Iface fix
*/
tSCC zZzz_Ki_IfaceName[] =
"Zzz_Ki_Iface";
...
...
@@ -3628,7 +3662,7 @@ const char* apzZzz_Ki_IfacePatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 10
1
- Zzz_Ki fix
* Description 10
2
- Zzz_Ki fix
*/
tSCC zZzz_KiName[] =
"Zzz_Ki";
...
...
@@ -3663,7 +3697,7 @@ const char* apzZzz_KiPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 10
2
- Zzz_Ki_Calls fix
* Description 10
3
- Zzz_Ki_Calls fix
*/
tSCC zZzz_Ki_CallsName[] =
"Zzz_Ki_Calls";
...
...
@@ -3698,7 +3732,7 @@ const char* apzZzz_Ki_CallsPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 10
3
- Zzz_Ki_Defs fix
* Description 10
4
- Zzz_Ki_Defs fix
*/
tSCC zZzz_Ki_DefsName[] =
"Zzz_Ki_Defs";
...
...
@@ -3733,7 +3767,7 @@ const char* apzZzz_Ki_DefsPatch[] = { "sh", "-c",
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description 10
4
- Zzz_Time fix
* Description 10
5
- Zzz_Time fix
*/
tSCC zZzz_TimeName[] =
"Zzz_Time";
...
...
@@ -3770,9 +3804,9 @@ const char* apzZzz_TimePatch[] = { "sh", "-c",
*
* List of all fixes
*/
#define REGEX_COUNT 7
5
#define FIX_COUNT 10
4
tFixDesc fixDescList[ 10
4
] = {
#define REGEX_COUNT 7
6
#define FIX_COUNT 10
5
tFixDesc fixDescList[ 10
5
] = {
{ zAix_SyswaitName, zAix_SyswaitList,
apzAix_SyswaitMachs, (regex_t*)NULL,
AIX_SYSWAIT_TEST_CT, FD_MACH_ONLY,
...
...
@@ -4188,6 +4222,11 @@ tFixDesc fixDescList[ 104 ] = {
ULTRIX_ANSI_COMPAT_TEST_CT, FD_MACH_ONLY,
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,
apzUltrix_Atof_ParamMachs, (regex_t*)NULL,
ULTRIX_ATOF_PARAM_TEST_CT, FD_MACH_ONLY,
...
...
gcc/fixinc/hackshell.tpl
View file @
1f414ac4
[= 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
# fixincl program. It is the repetitive guts of the fixincludes logic.
...
...
gcc/fixinc/inclhack.def
View file @
1f414ac4
/* -*- Mode: C -*-
$Id: inclhack.def,v 1.2 1998/12/16 21:19:09 law Exp $
*/
/* -*- Mode: C -*- */
autogen definitions inclhack;
...
...
@@ -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.
* also get rid of bogus inline definitions in HP-UX 8.0
*/
...
...
gcc/fixinc/inclhack.sh
View file @
1f414ac4
...
...
@@ -2,7 +2,7 @@
#
# DO NOT EDIT THIS FILE (inclhack.sh)
#
# It has been autogen-ed
Friday October 16, 1998 at 07:29:49 AM PD
T
# It has been autogen-ed
Wednesday January 27, 1999 at 09:03:36 AM PS
T
# From the definitions inclhack.def
# and the template file inclhack.tpl
#
...
...
@@ -10,7 +10,7 @@
# files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search.
#
# This script contains 10
4
fixup scripts.
# This script contains 10
5
fixup scripts.
#
# See README-fixinc for more information.
#
...
...
@@ -125,10 +125,7 @@ for INPUT in ${INPUTLIST} ; do
cd
${
ORIGDIR
}
cd
${
INPUT
}
||
{
echo
'fixincludes: input dir `'
$INPUT
"' is an invalid directory"
exit
1
}
cd
${
INPUT
}
||
continue
#
# # # # # # # # # # # # # # # # # # # # #
...
...
@@ -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
)
fixlist
=
"
${
fixlist
}
...
...
@@ -2486,7 +2506,7 @@ extern unsigned int\
#
# Fix 8
5
: Ultrix_Const
# Fix 8
6
: Ultrix_Const
#
case
"
$file
"
in
./stdio.h
)
fixlist
=
"
${
fixlist
}
...
...
@@ -2512,7 +2532,7 @@ extern unsigned int\
#
# Fix 8
6
: Ultrix_Ifdef
# Fix 8
7
: Ultrix_Ifdef
#
case
"
$file
"
in
./sys/file.h
)
if
(
test
-n
"
`
egrep
'#ifdef KERNEL'
$file
`
"
...
...
@@ -2533,7 +2553,7 @@ extern unsigned int\
#
# Fix 8
7
: Ultrix_Nested_Cmnt
# Fix 8
8
: Ultrix_Nested_Cmnt
#
case
"
$file
"
in
./rpc/svc.h
)
fixlist
=
"
${
fixlist
}
...
...
@@ -2551,7 +2571,7 @@ extern unsigned int\
#
# Fix 8
8
: Ultrix_Static
# Fix 8
9
: Ultrix_Static
#
case
"
$file
"
in
./machine/cpu.h
)
if
(
test
-n
"
`
egrep
'#include \"r[34]_cpu'
$file
`
"
...
...
@@ -2574,7 +2594,7 @@ extern unsigned int\
#
# Fix
89
: Undefine_Null
# Fix
90
: Undefine_Null
#
if
(
test
-n
"
`
egrep
'^#[ ]*define[ ]*[ ]NULL[ ]'
$file
`
"
-a
\
-z
"
`
egrep
'#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])'
$file
`
"
...
...
@@ -2595,7 +2615,7 @@ extern unsigned int\
#
# Fix 9
0
: Va_I960_Macro
# Fix 9
1
: Va_I960_Macro
#
case
"
$file
"
in
./arch/i960/archI960.h
)
if
(
test
-n
"
`
egrep
'__(vsiz|vali|vpad|alignof__)'
$file
`
"
...
...
@@ -2619,7 +2639,7 @@ extern unsigned int\
#
# Fix 9
1
: Void_Null
# Fix 9
2
: Void_Null
#
case
"
$file
"
in
./curses.h
|
\
./dbm.h
|
\
...
...
@@ -2650,7 +2670,7 @@ extern unsigned int\
#
# Fix 9
2
: Vxworks_Gcc_Problem
# Fix 9
3
: Vxworks_Gcc_Problem
#
case
"
$file
"
in
./types/vxTypesBase.h
)
if
(
test
-n
"
`
egrep
'__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__'
$file
`
"
...
...
@@ -2692,7 +2712,7 @@ extern unsigned int\
#
# Fix 9
3
: Vxworks_Needs_Vxtypes
# Fix 9
4
: Vxworks_Needs_Vxtypes
#
case
"
$file
"
in
./time.h
)
if
(
test
-n
"
`
egrep
'uint_t[ ][ ]*_clocks_per_sec'
$file
`
"
...
...
@@ -2713,7 +2733,7 @@ extern unsigned int\
#
# Fix 9
4
: Vxworks_Needs_Vxworks
# Fix 9
5
: Vxworks_Needs_Vxworks
#
case
"
$file
"
in
./sys/stat.h
)
if
(
test
-n
"
`
egrep
'#[ ]define[ ][ ]*__INCstath'
$file
`
"
-a
\
...
...
@@ -2739,7 +2759,7 @@ extern unsigned int\
#
# Fix 9
5
: Vxworks_Time
# Fix 9
6
: Vxworks_Time
#
case
"
$file
"
in
./time.h
)
if
(
test
-n
"
`
egrep
'VOIDFUNCPTR'
$file
`
"
-a
\
...
...
@@ -2771,7 +2791,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
#
# Fix 9
6
: X11_Class
# Fix 9
7
: X11_Class
#
case
"
$file
"
in
./X11/ShellP.h
)
if
(
test
-z
"
`
egrep
'__cplusplus'
$file
`
"
...
...
@@ -2799,7 +2819,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
#
# Fix 9
7
: X11_Class_Usage
# Fix 9
8
: X11_Class_Usage
#
case
"
$file
"
in
./Xm/BaseClassI.h
)
if
(
test
-z
"
`
egrep
'__cplusplus'
$file
`
"
...
...
@@ -2820,7 +2840,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
#
# Fix 9
8
: X11_New
# Fix 9
9
: X11_New
#
case
"
$file
"
in
./Xm/Traversal.h
)
if
(
test
-z
"
`
egrep
'__cplusplus'
$file
`
"
...
...
@@ -2849,7 +2869,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\
#
# Fix
99
: X11_Sprintf
# Fix
100
: X11_Sprintf
#
case
"
$file
"
in
./X11
*
/Xmu.h
)
fixlist
=
"
${
fixlist
}
...
...
@@ -2869,7 +2889,7 @@ extern char * sprintf();\
#
# Fix 10
0
: Zzz_Ki_Iface
# Fix 10
1
: Zzz_Ki_Iface
#
case
"
$file
"
in
./sys/ki_iface.h
)
if
(
test
-n
"
`
egrep
'These definitions are for HP Internal developers'
$file
`
"
...
...
@@ -2896,7 +2916,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
#
# Fix 10
1
: Zzz_Ki
# Fix 10
2
: Zzz_Ki
#
case
"
$file
"
in
./sys/ki.h
)
if
(
test
-n
"
`
egrep
'11.00 HP-UX LP64'
$file
`
"
...
...
@@ -2923,7 +2943,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
#
# Fix 10
2
: Zzz_Ki_Calls
# Fix 10
3
: Zzz_Ki_Calls
#
case
"
$file
"
in
./sys/ki_calls.h
)
if
(
test
-n
"
`
egrep
'KI_MAX_PROCS is an arbitrary number'
$file
`
"
...
...
@@ -2950,7 +2970,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
#
# Fix 10
3
: Zzz_Ki_Defs
# Fix 10
4
: Zzz_Ki_Defs
#
case
"
$file
"
in
./sys/ki_defs.h
)
if
(
test
-n
"
`
egrep
'Kernel Instrumentation Definitions'
$file
`
"
...
...
@@ -2977,7 +2997,7 @@ cat > /dev/null ) < $infile > ${DESTDIR}/$file.
#
# Fix 10
4
: Zzz_Time
# Fix 10
5
: Zzz_Time
#
case
"
$file
"
in
./sys/time.h
)
if
(
test
-n
"
`
egrep
'For CASPEC, look in'
$file
`
"
...
...
@@ -3041,6 +3061,7 @@ while [ $# != 0 ]; do
#
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
...
...
@@ -3054,6 +3075,7 @@ while [ $# != 0 ]; do
newreq
=
"
$newreq
$1
$dir
/
$include
$dir2
/
$include
"
done
fi
fi
shift
;
shift
;
shift
done
set
x
$newreq
...
...
@@ -3081,6 +3103,6 @@ done
cd
$ORIGDIR
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
gcc/fixinc/inclhack.tpl
View file @
1f414ac4
[= autogen template -*- Mode: ksh -*-
sh
#
# $Id: inclhack.tpl,v 1.2 1998/12/16 21:19:11 law Exp $
#
=]
#!/bin/sh
...
...
@@ -116,10 +115,7 @@ for INPUT in ${INPUTLIST} ; do
cd $
{
ORIGDIR
}
cd $
{
INPUT
}
|| {
echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
exit 1
}
cd $
{
INPUT
}
|| continue
#
# # # # # # # # # # # # # # # # # # # # #
...
...
@@ -342,6 +338,7 @@ while [ $# != 0 ]; do
#
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
...
...
@@ -355,6 +352,7 @@ while [ $# != 0 ]; do
newreq="$newreq $1 $dir/$include $dir2/$include"
done
fi
fi
shift; shift; shift
done
set x $newreq
...
...
@@ -382,7 +380,7 @@ done
cd $ORIGDIR
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
[=
...
...
gcc/fixinc/mkfixinc.sh
View file @
1f414ac4
...
...
@@ -7,8 +7,10 @@ then
exit
1
fi
echo
constructing fixinc.sh
for
$machine
fixincludes
=
"../fixinc.sh"
target
=
../fixinc.sh
echo
constructing
${
target
}
for
$machine
fixincludes
=
"
${
target
}
"
case
$machine
in
*
-
*
-gnu
*
)
...
...
@@ -103,21 +105,47 @@ case $machine in
;;
esac
# IF there is no include fixing,
# THEN create a no-op fixer and exit
#
if
test
-z
"
$fixincludes
"
then
cat
>
../fixinc.sh
<<-
_EOF_
cat
>
${
target
}
<<-
_EOF_
#! /bin/sh
exit 0
_EOF_
exit
0
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
echo
copying
$
fixincludes
to ../fixinc.sh
cp
$
fixincludes
../fixinc.sh
echo
copying
$
{
srcdir
}
/
$fixincludes
to
${
target
}
cp
$
{
srcdir
}
/
$fixincludes
${
target
}
exit
0
fi
echo
$MAKE
install
$MAKE
install
||
cp inclhack.sh ..
# OK. We gotta make the thing.
#
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
}
gcc/fixinc/procopen.c
0 → 100644
View file @
1f414ac4
/*
* 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
;
}
gcc/fixinc/regex.c
View file @
1f414ac4
...
...
@@ -25,8 +25,6 @@
#pragma alloca
#endif
/* $Id: regex.c,v 1.3 1999/01/11 13:34:23 law Exp $ */
#define _GNU_SOURCE
/* We need this for `regex.h', and perhaps for the Emacs include files. */
...
...
gcc/fixinc/regex.h
View file @
1f414ac4
...
...
@@ -18,8 +18,6 @@
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* $Id: regex.h,v 1.3 1999/01/11 13:34:25 law Exp $ */
#ifndef __REGEXP_LIBRARY_H__
#define __REGEXP_LIBRARY_H__
...
...
gcc/fixinc/server.c
View file @
1f414ac4
/*
*
$Id: server.c,v 1.2 1998/12/16 21:19:16 law Exp $
*
server.c Set up and handle communications with a server process.
*
* Server Handling copyright 1992-199
8 Bruce Korb
* Server Handling copyright 1992-199
9 The Free Software Foundation
*
* Server Handling is free software.
* You may redistribute it and/or modify it under the terms of the
...
...
@@ -20,8 +20,9 @@
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* As a special exception, Bruce Korb gives permission for additional
* uses of the text contained in his release of ServerHandler.
* 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
...
...
@@ -32,19 +33,24 @@
* 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 Bruce Korb 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.
* 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>
...
...
@@ -54,6 +60,20 @@
#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
...
...
@@ -66,398 +86,218 @@
#define NUL '\0'
#endif
STATIC
bool
read
PipeT
imeout
;
STATIC
bool
read
_pipe_t
imeout
;
STATIC
t
pChar
defA
rgs
[]
=
{
(
char
*
)
NULL
,
"-p"
,
(
char
*
)
NULL
};
STATIC
t
pfPair
serverP
air
=
{
(
FILE
*
)
NULL
,
(
FILE
*
)
NULL
};
STATIC
pid_t
server
I
d
=
NULLPROCESS
;
STATIC
t
_pchar
def_a
rgs
[]
=
{
(
char
*
)
NULL
,
(
char
*
)
NULL
};
STATIC
t
_pf_pair
server_p
air
=
{
(
FILE
*
)
NULL
,
(
FILE
*
)
NULL
};
STATIC
pid_t
server
_i
d
=
NULLPROCESS
;
/*
* Arbitrary text that should not be found in the shell output.
* It must be a single line and appear verbatim at the start of
* the terminating output line.
*/
tSCC
zDone
[]
=
"ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd"
;
STATIC
tpChar
pCurDir
=
(
char
*
)
NULL
;
/*
* chainOpen
*
* 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
chainOpen
(
stdinFd
,
ppArgs
,
pChild
)
int
stdinFd
;
tpChar
*
ppArgs
;
pid_t
*
pChild
;
{
tFdPair
stdoutPair
=
{
-
1
,
-
1
};
pid_t
chId
;
char
*
pzCmd
;
/*
* Create a pipe it will be the child process' stdout,
* and the parent will read from it.
*/
if
((
pipe
((
int
*
)
&
stdoutPair
)
<
0
))
{
if
(
pChild
!=
(
pid_t
*
)
NULL
)
*
pChild
=
NOPROCESS
;
return
-
1
;
}
/*
* If we did not get an arg list, use the default
*/
if
(
ppArgs
==
(
tpChar
*
)
NULL
)
ppArgs
=
defArgs
;
/*
* 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
(
pzCmd
=
*
ppArgs
,
(
pzCmd
==
(
char
*
)
NULL
)
||
(
*
pzCmd
==
'\0'
))
{
pzCmd
=
getenv
(
"SHELL"
);
if
(
pzCmd
==
(
char
*
)
NULL
)
pzCmd
=
"sh"
;
}
#ifdef DEBUG_PRINT
printf
(
"START: %s
\n
"
,
pzCmd
);
{
int
idx
=
0
;
while
(
ppArgs
[
++
idx
]
!=
(
char
*
)
NULL
)
printf
(
" ARG %2d: %s
\n
"
,
idx
,
ppArgs
[
idx
]);
}
#endif
/*
* Call fork() and see which process we become
*/
chId
=
fork
();
switch
(
chId
)
{
case
NOPROCESS
:
/* parent - error in call */
close
(
stdoutPair
.
readFd
);
close
(
stdoutPair
.
writeFd
);
if
(
pChild
!=
(
pid_t
*
)
NULL
)
*
pChild
=
NOPROCESS
;
return
-
1
;
default
:
/* parent - return opposite FD's */
if
(
pChild
!=
(
pid_t
*
)
NULL
)
*
pChild
=
chId
;
#ifdef DEBUG_PRINT
printf
(
"for pid %d: stdin from %d, stdout to %d
\n
"
"for parent: read from %d
\n
"
,
chId
,
stdinFd
,
stdoutPair
.
writeFd
,
stdoutPair
.
readFd
);
#endif
close
(
stdinFd
);
close
(
stdoutPair
.
writeFd
);
return
stdoutPair
.
readFd
;
case
NULLPROCESS
:
/* child - continue processing */
break
;
}
/*
* Close the pipe end handed back to the parent process
*/
close
(
stdoutPair
.
readFd
);
/*
* 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
(
stdoutPair
.
writeFd
,
F_DUPFD
,
STDOUT_FILENO
);
fcntl
(
stdinFd
,
F_DUPFD
,
STDIN_FILENO
);
if
(
*
ppArgs
==
(
char
*
)
NULL
)
*
ppArgs
=
pzCmd
;
execvp
(
pzCmd
,
ppArgs
);
fprintf
(
stderr
,
"Error %d: Could not execvp( '%s', ... ): %s
\n
"
,
errno
,
pzCmd
,
strerror
(
errno
));
exit
(
EXIT_PANIC
);
}
/*
* p2open
*
* Given a pointer to an argument vector, start a process and
* place its stdin and stdout file descriptors into an fd pair
* structure. The "writeFd" connects to the inferior process
* stdin, and the "readFd" connects to its stdout. The calling
* process should write to "writeFd" and read from "readFd".
* The return value is the process id of the created process.
*/
pid_t
p2open
(
pPair
,
ppArgs
)
tFdPair
*
pPair
;
tpChar
*
ppArgs
;
{
pid_t
chId
;
/*
* 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
*
)
pPair
)
<
0
)
return
NOPROCESS
;
pPair
->
readFd
=
chainOpen
(
pPair
->
readFd
,
ppArgs
,
&
chId
);
if
(
chId
==
NOPROCESS
)
close
(
pPair
->
writeFd
);
return
chId
;
}
/*
* p2fopen
*
* Identical to "p2open()", except that the "fd"'s are "fdopen(3)"-ed
* into file pointers instead.
*/
pid_t
p2fopen
(
pfPair
,
ppArgs
)
tpfPair
*
pfPair
;
tpChar
*
ppArgs
;
{
tFdPair
fdPair
;
pid_t
chId
=
p2open
(
&
fdPair
,
ppArgs
);
if
(
chId
==
NOPROCESS
)
return
chId
;
pfPair
->
pfRead
=
fdopen
(
fdPair
.
readFd
,
"r"
);
pfPair
->
pfWrite
=
fdopen
(
fdPair
.
writeFd
,
"w"
);
return
chId
;
}
tSCC
z_done
[]
=
"ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd"
;
STATIC
t_pchar
p_cur_dir
=
(
char
*
)
NULL
;
/*
* load
D
ata
* load
_d
ata
*
* Read data from a file pointer (a pipe to a process in this context)
* until we either get EOF or we get a marker line back.
* The read data are stored in a malloc-ed string that is truncated
* to size at the end. Input is assumed to be an ASCII string.
*/
STATIC
char
*
load
D
ata
(
fp
)
static
char
*
load
_d
ata
(
fp
)
FILE
*
fp
;
{
char
*
pz
T
ext
;
size_t
text
S
ize
;
char
*
pz
S
can
;
char
z
L
ine
[
1024
];
char
*
pz
_t
ext
;
size_t
text
_s
ize
;
char
*
pz
_s
can
;
char
z
_l
ine
[
1024
];
textSize
=
sizeof
(
zLine
)
*
2
;
pzScan
=
\
pzText
=
malloc
(
textSize
);
text_size
=
sizeof
(
z_line
)
*
2
;
pz_scan
=
pz_text
=
malloc
(
text_size
);
if
(
pz
T
ext
==
(
char
*
)
NULL
)
return
pzText
;
if
(
pz
_t
ext
==
(
char
*
)
NULL
)
return
(
char
*
)
NULL
;
for
(;;)
{
size_t
used
C
t
;
size_t
used
_c
t
;
alarm
(
10
);
read
PipeT
imeout
=
BOOL_FALSE
;
if
(
fgets
(
z
Line
,
sizeof
(
zL
ine
),
fp
)
==
(
char
*
)
NULL
)
read
_pipe_t
imeout
=
BOOL_FALSE
;
if
(
fgets
(
z
_line
,
sizeof
(
z_l
ine
),
fp
)
==
(
char
*
)
NULL
)
break
;
if
(
strncmp
(
z
Line
,
zDone
,
sizeof
(
zD
one
)
-
1
)
==
0
)
if
(
strncmp
(
z
_line
,
z_done
,
sizeof
(
z_d
one
)
-
1
)
==
0
)
break
;
strcpy
(
pz
Scan
,
zL
ine
);
pz
Scan
+=
strlen
(
zL
ine
);
used
Ct
=
(
size_t
)
(
pzScan
-
pzT
ext
);
strcpy
(
pz
_scan
,
z_l
ine
);
pz
_scan
+=
strlen
(
z_l
ine
);
used
_ct
=
(
size_t
)
(
pz_scan
-
pz_t
ext
);
if
(
text
Size
-
usedCt
<
sizeof
(
zL
ine
))
if
(
text
_size
-
used_ct
<
sizeof
(
z_l
ine
))
{
size_t
off
=
(
size_t
)
(
pzScan
-
pzText
);
size_t
off
=
(
size_t
)
(
pz_scan
-
pz_text
);
void
*
p
;
textSize
+=
4096
;
p
=
realloc
((
void
*
)
pzText
,
textSize
);
text_size
+=
4096
;
p
=
realloc
((
void
*
)
pz_text
,
text_size
);
if
(
p
==
(
void
*
)
NULL
)
{
fprintf
(
stderr
,
"Failed to get 0x%08X bytes
\n
"
,
textS
ize
);
free
((
void
*
)
pzT
ext
);
fprintf
(
stderr
,
"Failed to get 0x%08X bytes
\n
"
,
text_s
ize
);
free
((
void
*
)
pz_t
ext
);
return
(
char
*
)
NULL
;
}
pzText
=
(
char
*
)
p
;
pzScan
=
pzText
+
off
;
pz_text
=
(
char
*
)
p
;
pz_scan
=
pz_text
+
off
;
}
}
alarm
(
0
);
if
(
read
PipeT
imeout
)
if
(
read
_pipe_t
imeout
)
{
free
((
void
*
)
pz
T
ext
);
free
((
void
*
)
pz
_t
ext
);
return
(
char
*
)
NULL
;
}
while
((
pz
Scan
>
pzText
)
&&
isspace
(
pzS
can
[
-
1
]))
pz
S
can
--
;
*
pz
S
can
=
NUL
;
return
realloc
((
void
*
)
pz
Text
,
strlen
(
pzT
ext
)
+
1
);
while
((
pz
_scan
>
pz_text
)
&&
isspace
(
pz_s
can
[
-
1
]))
pz
_s
can
--
;
*
pz
_s
can
=
NUL
;
return
realloc
((
void
*
)
pz
_text
,
strlen
(
pz_t
ext
)
+
1
);
}
/*
* SHELL SERVER PROCESS CODE
* close_server
*
* Make certain the server process is dead, close the
* pipes to it and from it, finally NULL out the file pointers
*/
#ifdef DONT_HAVE_SIGSEND
typedef
enum
static
void
close_server
()
{
P_ALL
,
P_PID
,
P_GID
,
P_UID
,
P_PGID
,
P_SID
,
P_CID
kill
((
pid_t
)
server_id
,
SIGKILL
);
server_id
=
NULLPROCESS
;
fclose
(
server_pair
.
pf_read
);
fclose
(
server_pair
.
pf_write
);
server_pair
.
pf_read
=
server_pair
.
pf_write
=
(
FILE
*
)
NULL
;
}
idtype_t
;
typedef
long
id_t
;
STATIC
int
sigsend
(
idtype
,
id
,
sig
)
idtype_t
idtype
;
id_t
id
;
int
sig
;
{
switch
(
idtype
)
{
case
P_PID
:
kill
((
pid_t
)
id
,
sig
);
break
;
case
P_ALL
:
case
P_GID
:
case
P_UID
:
case
P_PGID
:
case
P_SID
:
case
P_CID
:
errno
=
EINVAL
;
return
-
1
;
/*NOTREACHED */
}
return
0
;
}
#endif
/* HAVE_SIGSEND */
STATIC
void
closeServer
()
{
kill
(
(
pid_t
)
serverId
,
SIGKILL
);
serverId
=
NULLPROCESS
;
fclose
(
serverPair
.
pfRead
);
fclose
(
serverPair
.
pfWrite
);
serverPair
.
pfRead
=
serverPair
.
pfWrite
=
(
FILE
*
)
NULL
;
}
struct
sigaction
savePipeAction
;
struct
sigaction
saveAlrmAction
;
struct
sigaction
currentAction
;
STATIC
void
sigHandler
(
signo
)
/*
* sig_handler really only handles the timeout and pipe signals.
* This ensures that we do not wait forever on a request
* to our server, and also that if the server dies, we do not
* die from a sigpipe problem.
*/
static
void
sig_handler
(
signo
)
int
signo
;
{
close
S
erver
();
read
PipeT
imeout
=
BOOL_TRUE
;
close
_s
erver
();
read
_pipe_t
imeout
=
BOOL_TRUE
;
}
STATIC
void
serverSetup
()
/*
* server_setup Establish the signal handler for PIPE and ALARM.
* Also establishes the current directory to give to the
* server process at the start of every server command.
*/
static
void
server_setup
()
{
#ifndef SA_SIGINFO
# define SA_SIGINFO 0
#else
currentAction
.
sa_sigaction
=
#endif
currentAction
.
sa_handler
=
sigHandler
;
currentAction
.
sa_flags
=
SA_SIGINFO
;
sigemptyset
(
&
currentAction
.
sa_mask
);
static
int
atexit_done
=
0
;
if
(
atexit_done
++
==
0
)
atexit
(
&
close_server
);
sigaction
(
SIGPIPE
,
&
currentAction
,
&
savePipeAction
);
sigaction
(
SIGALRM
,
&
currentAction
,
&
saveAlrmAction
);
atexit
(
&
closeServer
);
signal
(
SIGPIPE
,
sig_handler
);
signal
(
SIGALRM
,
sig_handler
);
fputs
(
"trap :
INT
\n
"
,
serverPair
.
pfW
rite
);
fflush
(
server
Pair
.
pfW
rite
);
p
CurD
ir
=
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
+
1
);
fputs
(
"trap :
1
\n
"
,
server_pair
.
pf_w
rite
);
fflush
(
server
_pair
.
pf_w
rite
);
p
_cur_d
ir
=
getcwd
((
char
*
)
NULL
,
MAXPATHLEN
+
1
);
}
/*
* run_shell
*
* Run a shell command on the server. The command string
* passed in is wrapped inside the sequence:
*
* cd <original directory>
* <command string>
* echo
* echo <end-of-command-marker>
*
* This ensures that all commands start at a known place in
* the directory structure, that any incomplete output lines
* are completed and that our special marker sequence appears on
* a line by itself. We have chosen a marker that is
* excessively unlikely to be reproduced in normal output:
*
* "ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd"
*/
char
*
run
Shell
(
pzC
md
)
const
char
*
pz
C
md
;
run
_shell
(
pz_c
md
)
const
char
*
pz
_c
md
;
{
tSCC
zNil
[]
=
""
;
/* IF the shell server process is not running yet,
THEN try to start it. */
if
(
server_id
==
NULLPROCESS
)
{
server_id
=
proc2_fopen
(
&
server_pair
,
def_args
);
if
(
server_id
>
0
)
server_setup
();
}
/*
* IF the shell server process is not running yet,
* THEN try to start it.
*/
if
(
serverId
==
NULLPROCESS
)
/* IF it is still not running, THEN return the nil string. */
if
(
server_id
<=
0
)
{
serverId
=
p2fopen
(
&
serverPair
,
defArgs
);
if
(
serverId
>
0
)
serverSetup
();
char
*
pz
=
(
char
*
)
malloc
(
1
);
if
(
pz
!=
(
char
*
)
NULL
)
*
pz
=
'\0'
;
return
pz
;
}
/*
* IF it is still not running,
* THEN return the nil string.
*/
if
(
serverId
<=
0
)
return
(
char
*
)
zNil
;
/*
Make sure the process will pay attention to us, send the
supplied command, and then have it output a special marker that
we can find. */
fprintf
(
server_pair
.
pf_write
,
"
\\
cd %s
\n
%s
\n\n
echo
\n
echo %s
\n
"
,
p_cur_dir
,
pz_cmd
,
z_done
);
fflush
(
server_pair
.
pf_write
)
;
/*
* Make sure the process will pay attention to us,
* send the supplied command, and then
* have it output a special marker that we can find.
*/
fprintf
(
serverPair
.
pfWrite
,
"
\\
cd %s
\n
%s
\n\n
echo
\n
echo %s
\n
"
,
pCurDir
,
pzCmd
,
zDone
);
fflush
(
serverPair
.
pfWrite
);
if
(
serverId
==
NULLPROCESS
)
return
(
char
*
)
NULL
;
/* IF the server died and we received a SIGPIPE,
THEN return an empty string. */
if
(
server_id
==
NULLPROCESS
)
{
char
*
pz
=
(
char
*
)
malloc
(
1
);
/*
* Now try to read back all the data. If we fail due to either
* a sigpipe or sigalrm (timeout), we will return the nil string.
*/
if
(
pz
!=
(
char
*
)
NULL
)
*
pz
=
'\0'
;
return
pz
;
}
/* Now try to read back all the data. If we fail due to either a
sigpipe or sigalrm (timeout), we will return the nil string. */
{
char
*
pz
=
loadData
(
serverPair
.
pfRead
);
char
*
pz
=
load_data
(
server_pair
.
pf_read
);
if
(
pz
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
"CLOSING SHELL SERVER - command failure:
\n\t
%s
\n
"
,
pzCmd
);
closeServer
();
pz
=
(
char
*
)
zNil
;
pz_cmd
);
close_server
();
pz
=
(
char
*
)
malloc
(
1
);
if
(
pz
!=
(
char
*
)
NULL
)
*
pz
=
'\0'
;
}
return
pz
;
}
...
...
gcc/fixinc/server.h
View file @
1f414ac4
/*
*
$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-199
8 Bruce Korb
* Server Handling copyright 1992-199
9 The Free Software Foundation
*
* Server Handling is free software.
* You may redistribute it and/or modify it under the terms of the
...
...
@@ -20,8 +20,9 @@
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* As a special exception, Bruce Korb gives permission for additional
* uses of the text contained in his release of ServerHandler.
* 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
...
...
@@ -32,12 +33,13 @@
* 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 Bruce Korb 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.
* 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.
...
...
@@ -48,47 +50,45 @@
#define FIXINC_SERVER_H
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
* Dual pipe opening of a child process
*/
typedef
struct
{
int
readFd
;
int
writeFd
;
}
tFdPair
;
{
int
read_fd
;
int
write_fd
;
}
t_fd_pair
;
typedef
struct
{
FILE
*
pfRead
;
/* parent read fp */
FILE
*
pfWrite
;
/* parent write fp */
}
tpfPair
;
{
FILE
*
pf_read
;
/* parent read fp */
FILE
*
pf_write
;
/* parent write fp */
}
t_pf_pair
;
typedef
char
*
t
pC
har
;
typedef
char
*
t
_pc
har
;
#define NOPROCESS
((pid_t)
-1)
#define NOPROCESS
((pid_t)
-1)
#define NULLPROCESS ((pid_t)0)
#define EXIT_PANIC 99
typedef
enum
{
{
BOOL_FALSE
,
BOOL_TRUE
}
bool
;
}
bool
;
#define _P_(p) ()
char
*
runShell
_P_
((
const
char
*
pzCmd
));
pid_t
p2fopen
_P_
((
tpfPair
*
pfPair
,
tpChar
*
ppArgs
));
pid_t
p2open
_P_
((
tFdPair
*
pPair
,
tpChar
*
ppArgs
));
int
chainOpen
_P_
((
int
stdinFd
,
tpChar
*
ppArgs
,
pid_t
*
pChild
));
char
*
run_shell
_P_
((
const
char
*
pzCmd
));
pid_t
proc2_fopen
_P_
((
t_pf_pair
*
p_pair
,
t_pchar
*
pp_args
));
pid_t
proc2_open
_P_
((
t_fd_pair
*
p_pair
,
t_pchar
*
pp_args
));
int
chain_open
_P_
((
int
in_fd
,
t_pchar
*
pp_args
,
pid_t
*
p_child
));
#endif
/* FIXINC_SERVER_H */
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