From bb70624e964126b7ac4ff085ba163a9c35ffa18f Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Fri, 17 Mar 2000 21:46:59 +0000 Subject: Imported from ../bash-2.04.tar.gz. --- flags.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'flags.c') diff --git a/flags.c b/flags.c index 19cd3b4e..9cb753a0 100644 --- a/flags.c +++ b/flags.c @@ -7,7 +7,7 @@ This file is part of GNU Bash, the Bourne Again SHell. Bash 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 1, or (at your option) any later +Software Foundation; either version 2, or (at your option) any later version. Bash is distributed in the hope that it will be useful, but WITHOUT ANY @@ -17,7 +17,7 @@ for more details. You should have received a copy of the GNU General Public License along with Bash; see the file COPYING. If not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ /* Flags hacking. */ #include "config.h" @@ -36,6 +36,9 @@ extern int set_job_control (); extern char *shell_name; #endif +/* -c, -s invocation options -- not really flags, but they show up in $- */ +extern int want_pending_command, read_from_stdin; + /* **************************************************************** */ /* */ /* The Standard Sh Flags. */ @@ -219,14 +222,14 @@ change_flag (flag, on_or_off) { int *value, old_value; - value = find_flag (flag); - #if defined (RESTRICTED_SHELL) /* Don't allow "set +r" in a shell which is `restricted'. */ if (restricted && flag == 'r' && on_or_off == FLAG_OFF) return (FLAG_ERROR); #endif /* RESTRICTED_SHELL */ + value = find_flag (flag); + if ((value == (int *)FLAG_UNKNOWN) || (on_or_off != FLAG_ON && on_or_off != FLAG_OFF)) return (FLAG_ERROR); @@ -275,11 +278,16 @@ which_set_flags () char *temp; int i, string_index; - temp = xmalloc (1 + NUM_SHELL_FLAGS); + temp = xmalloc (1 + NUM_SHELL_FLAGS + read_from_stdin + want_pending_command); for (i = string_index = 0; shell_flags[i].name; i++) if (*(shell_flags[i].value)) temp[string_index++] = shell_flags[i].name; + if (want_pending_command) + temp[string_index++] = 'c'; + if (read_from_stdin) + temp[string_index++] = 's'; + temp[string_index] = '\0'; return (temp); } -- cgit v1.2.1