Remove references to setenv/putenv

From-SVN: r27312
This commit is contained in:
Bruce Korb 1999-06-02 07:08:54 +00:00 committed by Bruce Korb
parent 079bd08eb2
commit bb78620135
4 changed files with 88 additions and 61 deletions

View File

@ -1,3 +1,13 @@
Wed Jun 2 07:07 1999 Bruce Korb <ddsinc09@ix.netcom.com
*fixinc/fixincl.c(global def): Add FD_SHELL_SCRIPT to mark
fixes that need "file=xxx\n" prepended before invocation
(start_fixer - new): starting the fixer process is complex enough
to warrent its own routine. It prepends the "file=xxx\n" stuff.
(process): uses the new routine; omit usage of putenv()
*fixinc/fixincl.tpl: mark shell scripts with FD_SHELL_SCRIPT
*fixinc/fixincl.x: regenerate
Wed Jun 2 02:29:07 1999 Jeffrey A Law (law@cygnus.com)
* README, configure.in, gcc.1, gcc.texi: Update name (egcs -> gcc)

View File

@ -104,6 +104,7 @@ typedef struct patch_desc tPatchDesc;
*/
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
#define FD_SHELL_SCRIPT 0x0002
#define FD_SKIP_TEST 0x8000
typedef struct fix_desc tFixDesc;
@ -910,6 +911,70 @@ extract_quoted_files (pz_data, pz_file_name, p_re_match)
}
/* * * * * * * * * * * * *
This loop should only cycle for 1/2 of one loop.
"chain_open" starts a process that uses "read_fd" as
its stdin and returns the new fd this process will use
for stdout. */
int
start_fixer (read_fd, p_fixd, pz_file_name)
int read_fd;
tFixDesc* p_fixd;
char* pz_file_name;
{
tSCC z_err[] = "Error %d (%s) starting filter process for %s\n";
tCC* pz_cmd_save;
char* pz_cmd;
if ((p_fixd->fd_flags & FD_SHELL_SCRIPT) == 0)
pz_cmd = (char*)NULL;
else
{
tSCC z_cmd_fmt[] = "file='%s'\n%s";
pz_cmd = (char*)xmalloc (strlen (p_fixd->patch_args[2])
+ sizeof( z_cmd_fmt )
+ strlen( pz_file_name ));
sprintf (pz_cmd, z_cmd_fmt, pz_file_name, p_fixd->patch_args[2]);
pz_cmd_save = p_fixd->patch_args[2];
p_fixd->patch_args[2] = pz_cmd;
}
for (;;)
{
static int failCt = 0;
int fd;
fd = chain_open (read_fd,
(t_pchar *) p_fixd->patch_args,
(process_chain_head == -1)
? &process_chain_head : (pid_t *) NULL);
if (fd != -1)
{
read_fd = fd;
break;
}
fprintf (stderr, z_err, errno, strerror (errno),
p_fixd->fix_name);
if ((errno != EAGAIN) || (++failCt > 10))
exit (EXIT_FAILURE);
sleep (1);
}
if (pz_cmd != (char*)NULL)
{
free ((void*)pz_cmd);
p_fixd->patch_args[2] = pz_cmd_save;
}
return read_fd;
}
/* * * * * * * * * * * * *
Process the potential fixes for a particular include file.
@ -927,30 +992,6 @@ process (pz_data, pz_file_name)
int read_fd = -1;
int num_children = 0;
/* 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 (env_current_file[0] == NUL) {
strcpy (env_current_file, "file=");
putenv (env_current_file);
}
/*
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 (env_current_file + 5, pz_file_name);
process_chain_head = NOPROCESS;
fprintf (stderr, "%-50s \r", pz_file_name );
/* For every fix in our fix list, ... */
@ -1059,34 +1100,8 @@ process (pz_data, pz_file_name)
}
}
/* This loop should only cycle for 1/2 of one loop.
"chain_open" starts a process that uses "read_fd" as
its stdin and returns the new fd this process will use
for stdout. */
for (;;)
{
tSCC z_err[] = "Error %d (%s) starting filter process for %s\n";
static int failCt = 0;
int fd = chain_open (read_fd,
(t_pchar *) p_fixd->patch_args,
(process_chain_head == -1)
? &process_chain_head : (pid_t *) NULL);
if (fd != -1)
{
read_fd = fd;
read_fd = start_fixer (read_fd, p_fixd, pz_file_name);
num_children++;
break;
}
fprintf (stderr, z_err, errno, strerror (errno),
p_fixd->fix_name);
if ((errno != EAGAIN) || (++failCt > 10))
exit (EXIT_FAILURE);
sleep (1);
}
next_fix:
;

View File

@ -179,6 +179,8 @@ _FOR fix ",\n" =]
[=hackname _up=]_TEST_CT, [=
_IF not_machine _exist =]FD_MACH_IFNOT[=
_ELSE =]FD_MACH_ONLY[=
_ENDIF =][=
_IF shell _exist =] | FD_SHELL_SCRIPT[=
_ENDIF =],
a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[=

View File

@ -4039,7 +4039,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zM88k_Multi_InclName, zM88k_Multi_InclList,
apzM88k_Multi_InclMachs, (regex_t*)NULL,
M88K_MULTI_INCL_TEST_CT, FD_MACH_ONLY,
M88K_MULTI_INCL_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aM88k_Multi_InclTests, apzM88k_Multi_InclPatch },
{ zMachine_NameName, zMachine_NameList,
@ -4054,7 +4054,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zMath_Gcc_IfndefsName, zMath_Gcc_IfndefsList,
apzMath_Gcc_IfndefsMachs, (regex_t*)NULL,
MATH_GCC_IFNDEFS_TEST_CT, FD_MACH_ONLY,
MATH_GCC_IFNDEFS_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aMath_Gcc_IfndefsTests, apzMath_Gcc_IfndefsPatch },
{ zNested_CommentName, zNested_CommentList,
@ -4134,7 +4134,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zStdio_Va_ListName, zStdio_Va_ListList,
apzStdio_Va_ListMachs, (regex_t*)NULL,
STDIO_VA_LIST_TEST_CT, FD_MACH_ONLY,
STDIO_VA_LIST_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aStdio_Va_ListTests, apzStdio_Va_ListPatch },
{ zSun_Bogus_IfdefName, zSun_Bogus_IfdefList,
@ -4309,31 +4309,31 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
{ zZzz_Ki_IfaceName, zZzz_Ki_IfaceList,
apzZzz_Ki_IfaceMachs, (regex_t*)NULL,
ZZZ_KI_IFACE_TEST_CT, FD_MACH_ONLY,
ZZZ_KI_IFACE_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_Ki_IfaceTests, apzZzz_Ki_IfacePatch },
{ zZzz_KiName, zZzz_KiList,
apzZzz_KiMachs, (regex_t*)NULL,
ZZZ_KI_TEST_CT, FD_MACH_ONLY,
ZZZ_KI_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_KiTests, apzZzz_KiPatch },
{ zZzz_Ki_CallsName, zZzz_Ki_CallsList,
apzZzz_Ki_CallsMachs, (regex_t*)NULL,
ZZZ_KI_CALLS_TEST_CT, FD_MACH_ONLY,
ZZZ_KI_CALLS_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_Ki_CallsTests, apzZzz_Ki_CallsPatch },
{ zZzz_Ki_DefsName, zZzz_Ki_DefsList,
apzZzz_Ki_DefsMachs, (regex_t*)NULL,
ZZZ_KI_DEFS_TEST_CT, FD_MACH_ONLY,
ZZZ_KI_DEFS_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_Ki_DefsTests, apzZzz_Ki_DefsPatch },
{ zZzz_Bad_FixesName, zZzz_Bad_FixesList,
apzZzz_Bad_FixesMachs, (regex_t*)NULL,
ZZZ_BAD_FIXES_TEST_CT, FD_MACH_ONLY,
ZZZ_BAD_FIXES_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_Bad_FixesTests, apzZzz_Bad_FixesPatch },
{ zZzz_TimeName, zZzz_TimeList,
apzZzz_TimeMachs, (regex_t*)NULL,
ZZZ_TIME_TEST_CT, FD_MACH_ONLY,
ZZZ_TIME_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aZzz_TimeTests, apzZzz_TimePatch }
};