re PR libfortran/20788 (Loading libgfortran.so clobbers C redirection of stdin/stdout/stderr)

PR libfortran/20788
	* runtime/environ.c (init_unsigned_integer): Function for
	environment variables we want to be positive.
	(init_integer): Function to allow negative environment
	variables (e.g. for GFORTRAN_STDIN_UNIT).

From-SVN: r97946
This commit is contained in:
Francois-Xavier Coudert 2005-04-10 12:37:59 +02:00 committed by François-Xavier Coudert
parent eb232f4ef1
commit 64d5075d0b
2 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2005-04-10 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20788
* runtime/environ.c (init_unsigned_integer): Function for
environment variables we want to be positive.
(init_integer): Function to allow negative environment
variables (e.g. for GFORTRAN_STDIN_UNIT).
2005-04-10 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/17992

View File

@ -97,13 +97,41 @@ var_source (variable * v)
}
/* init_integer()-- Initialize an integer environment variable */
/* init_integer()-- Initialize an integer environment variable. */
static void
init_integer (variable * v)
{
char *p, *q;
p = getenv (v->name);
if (p == NULL)
goto set_default;
for (q = p; *q; q++)
if (!isdigit (*q) && (p != q || *q != '-'))
{
v->bad = 1;
goto set_default;
}
*v->var = atoi (p);
return;
set_default:
*v->var = v->value;
return;
}
/* init_unsigned_integer()-- Initialize an integer environment variable
which has to be positive. */
static void
init_unsigned_integer (variable * v)
{
char *p, *q;
p = getenv (v->name);
if (p == NULL)
goto set_default;
@ -467,7 +495,7 @@ static variable variable_table[] = {
"Print optional plus signs in numbers where permitted. Default FALSE."},
{"GFORTRAN_DEFAULT_RECL", DEFAULT_RECL, &options.default_recl,
init_integer, show_integer,
init_integer, show_unsigned_integer,
"Default maximum record length for sequential files. Most useful for\n"
"adjusting line length of preconnected units. Default "
stringize (DEFAULT_RECL)},