Imported from ../bash-2.02.tar.gz.
This commit is contained in:
parent
e8ce775db8
commit
cce855bc5b
323 changed files with 33916 additions and 12321 deletions
13
flags.c
13
flags.c
|
|
@ -209,8 +209,8 @@ find_flag (name)
|
|||
}
|
||||
|
||||
/* Change the state of a flag, and return it's original value, or return
|
||||
FLAG_ERROR if there is no flag called NAME. ON_OR_OFF should be one
|
||||
of FLAG_ON or FLAG_OFF. */
|
||||
FLAG_ERROR if there is no flag FLAG. ON_OR_OFF must be either
|
||||
FLAG_ON or FLAG_OFF. */
|
||||
int
|
||||
change_flag (flag, on_or_off)
|
||||
int flag;
|
||||
|
|
@ -226,17 +226,12 @@ change_flag (flag, on_or_off)
|
|||
return (FLAG_ERROR);
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
if (value == (int *)FLAG_UNKNOWN)
|
||||
if ((value == (int *)FLAG_UNKNOWN) || (on_or_off != FLAG_ON && on_or_off != FLAG_OFF))
|
||||
return (FLAG_ERROR);
|
||||
|
||||
old_value = *value;
|
||||
|
||||
if (on_or_off == FLAG_ON)
|
||||
*value = 1;
|
||||
else if (on_or_off == FLAG_OFF)
|
||||
*value = 0;
|
||||
else
|
||||
return (FLAG_ERROR);
|
||||
*value = (on_or_off == FLAG_ON) ? 1 : 0;
|
||||
|
||||
/* Special cases for a few flags. */
|
||||
switch (flag)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue