mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-11 22:20:49 +02:00
change `read -d' on a tty when the delimiter is not a newline to set the terminal EOL character instead of putting the terminal into character-at-a-time mode; change some calls to atoi to use strol instead
This commit is contained in:
+19
-7
@@ -6289,18 +6289,21 @@ void
|
||||
sv_optind (const char *name)
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
char *tt;
|
||||
char *t, *e;
|
||||
int s;
|
||||
|
||||
var = find_variable ("OPTIND");
|
||||
tt = var ? get_variable_value (var) : (char *)NULL;
|
||||
t = var ? get_variable_value (var) : (char *)NULL;
|
||||
|
||||
/* Assume that if var->context < variable_context and variable_context > 0
|
||||
then we are restoring the variables's previous state while returning
|
||||
from a function. */
|
||||
if (tt && *tt)
|
||||
if (t && *t)
|
||||
{
|
||||
s = atoi (tt);
|
||||
s = (int)strtol (t, &e, 10);
|
||||
|
||||
if (e == t || *e != '\0')
|
||||
return; /* non-numeric value is a no-op */
|
||||
|
||||
/* According to POSIX, setting OPTIND=1 resets the internal state
|
||||
of getopt (). */
|
||||
@@ -6315,10 +6318,19 @@ sv_optind (const char *name)
|
||||
void
|
||||
sv_opterr (const char *name)
|
||||
{
|
||||
char *tt;
|
||||
char *tt, *e;
|
||||
int n;
|
||||
|
||||
tt = get_string_value ("OPTERR");
|
||||
sh_opterr = (tt && *tt) ? atoi (tt) : 1;
|
||||
if (tt == 0 || *tt == 0)
|
||||
n = 1;
|
||||
else
|
||||
{
|
||||
n = (int)strtol (tt, &e, 10);
|
||||
if (e == tt || *e != '\0')
|
||||
n = 1;
|
||||
}
|
||||
sh_opterr = n;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -6583,7 +6595,7 @@ sv_childmax (const char *name)
|
||||
int s;
|
||||
|
||||
tt = get_string_value (name);
|
||||
s = (tt && *tt) ? atoi (tt) : 0;
|
||||
s = (tt && *tt) ? (int)strtol (tt, (char **)NULL, 10) : 0;
|
||||
set_maxchild (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user