]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20051013 snapshot
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:52:14 +0000 (13:52 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:52:14 +0000 (13:52 -0500)
23 files changed:
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
builtins/fc.def
doc/bash.0
doc/bash.1
doc/bash.html
doc/bash.ps
doc/builtins.ps
doc/rbash.ps
jobs.c
lib/glob/sm_loop.c
lib/glob/sm_loop.c~ [new file with mode: 0644]
lib/readline/bind.c
lib/readline/bind.c~
lib/readline/readline.h
lib/readline/undo.c
lib/readline/vi_mode.c
redir.c
redir.h
subst.c
support/man2html.c
tests/RUN-ONE-TEST
tests/redir7.sub

index 99213cbf1af2557bf16c68de1f6a6727c743ba3a..55b4501713707c700310576c2d3b9d5c5ea1b0da 100644 (file)
@@ -12216,3 +12216,51 @@ bashline.c
        - in command_word_completion_function, use rl_variable_value to decide
          whether or not we should ignore case, and use strncasecmp instead of
          strncmp where appropriate
+
+                                  10/11
+                                  -----
+builtins/fc.def
+       - fixed a typo when using POSIX_FC_EDIT_COMMAND
+
+redir.h
+       - new flag values for redirections: RX_INTERNAL and RX_USER (currently
+         unused)
+
+redir.c
+       - add_undo_redirect and add_undo_close_redirect now set RX_INTERNAL
+         flag when making new redirects
+       - in do_redirection_internal, only set file descriptors > 2 to CLEXEC
+         if they're marked as RX_INTERNAL
+
+                                  10/12
+                                  -----
+jobs.c
+       - in wait_for_single_pid, if in posix mode, remove the waited-for pid
+         from the list of background pids, forgetting it entirely.  POSIX
+         conformance tests test for this.
+
+lib/readline/{readline.h,vi_mode.c}
+       - new state flag, RL_STATE_VICMDONCE, set after entering vi command
+         mode the first time; reset on each call to readline()
+
+                                  10/13
+                                  -----
+lib/readline/undo.c
+       - in rl_revert_line, make sure that revert-line in vi mode leaves
+         rl_point set to 0 no matter the state of the line buffer
+
+lib/readline/vi_mode.c
+       - when entering vi_command mode for the first time, free any existing
+         undo list so the previous insertions won't be undone by the `U'
+         command.  This is how POSIX.2 says `U' should work (and the test
+         suite tests for it)
+
+lib/readline/bind.c
+       - change rl_parse_and_bind so only `set' commands involving boolean
+         readline variables have trailing whitespace stripped from the value
+         string
+
+                                  10/16
+                                  -----
+lib/glob/sm_loop.c
+       - fix patscan() to correctly scan backslash-escaped characters
index e53aed1d4295b29e9aa7ebd42bc270868d9824c8..1587a9fbf0b3bf00eebed1f26cbbc313ed122577 100644 (file)
@@ -12211,4 +12211,51 @@ bashline.c
          rl_completion_found_quote, but doesn't set rl_completion_quote_character,
          we have an embedded quoted string or backslash-escaped character in
          the passed text.  We need to dequote that before calling
-         filename_completion_function
+         filename_completion_function.  So far, this is in place only for
+         absolute program names (those containing a `/')
+       - in command_word_completion_function, use rl_variable_value to decide
+         whether or not we should ignore case, and use strncasecmp instead of
+         strncmp where appropriate
+
+                                  10/11
+                                  -----
+builtins/fc.def
+       - fixed a typo when using POSIX_FC_EDIT_COMMAND
+
+redir.h
+       - new flag values for redirections: RX_INTERNAL and RX_USER (currently
+         unused)
+
+redir.c
+       - add_undo_redirect and add_undo_close_redirect now set RX_INTERNAL
+         flag when making new redirects
+       - in do_redirection_internal, only set file descriptors > 2 to CLEXEC
+         if they're marked as RX_INTERNAL
+
+                                  10/12
+                                  -----
+jobs.c
+       - in wait_for_single_pid, if in posix mode, remove the waited-for pid
+         from the list of background pids, forgetting it entirely.  POSIX
+         conformance tests test for this.
+
+lib/readline/{readline.h,vi_mode.c}
+       - new state flag, RL_STATE_VICMDONCE, set after entering vi command
+         mode the first time; reset on each call to readline()
+
+                                  10/13
+                                  -----
+lib/readline/undo.c
+       - in rl_revert_line, make sure that revert-line in vi mode leaves
+         rl_point set to 0 no matter the state of the line buffer
+
+lib/readline/vi_mode.c
+       - when entering vi_command mode for the first time, free any existing
+         undo list so the previous insertions won't be undone by the `U'
+         command.  This is how POSIX.2 says `U' should work (and the test
+         suite tests for it)
+
+lib/readline/bind.c
+       - change rl_parse_and_bind so only `set' commands involving boolean
+         readline variables have trailing whitespace stripped from the value
+         string
index 7e2da01fdb045cabfc04abcd87a82137613c67c0..ebe368326c2480cbeeaaea1055116dcc51fcfe26 100644 (file)
@@ -383,7 +383,7 @@ fc_builtin (list)
     {
       fcedit = posixly_correct ? POSIX_FC_EDIT_COMMAND : FC_EDIT_COMMAND;
       command = (char *)xmalloc (3 + strlen (fcedit) + strlen (fn));
-      sprintf (command, "%s %s", FC_EDIT_COMMAND, fn);
+      sprintf (command, "%s %s", fcedit, fn);
     }
   retval = parse_and_execute (command, "fc", SEVAL_NOHIST);
   if (retval != EXECUTION_SUCCESS)
index aaf441e69ed9b806f89b6b5b169a6c53ba650dae..ecf8ae2e85d61ec79ad6bd7619c32cbe1d4be7a2 100644 (file)
@@ -4818,7 +4818,7 @@ A\bAU\bUT\bTH\bHO\bOR\bRS\bS
        bfox@gnu.org
 
        Chet Ramey, Case Western Reserve University
-       chet@po.CWRU.Edu
+       chet@po.cwru.edu
 
 B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
        If you find a bug in b\bba\bas\bsh\bh,\b, you should report it.  But first, you should
@@ -4844,7 +4844,7 @@ B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
        it provides for filing a bug report.
 
        Comments and bug reports concerning this manual page should be directed
-       to _\bc_\bh_\be_\bt_\b@_\bp_\bo_\b._\bC_\bW_\bR_\bU_\b._\bE_\bd_\bu.
+       to _\bc_\bh_\be_\bt_\b@_\bp_\bo_\b._\bc_\bw_\br_\bu_\b._\be_\bd_\bu.
 
 B\bBU\bUG\bGS\bS
        It's too big and too slow.
index 86a5e676b81a67a3c7ce4cc2d77c711029367871..40e1fbd3ec5a2325c1fa33b0e6a317e7c330a823 100644 (file)
@@ -4,7 +4,7 @@
 .\"    Chet Ramey
 .\"    Information Network Services
 .\"    Case Western Reserve University
-.\"    chet@po.CWRU.Edu
+.\"    chet@po.cwru.edu
 .\"
 .\"    Last Change: Sat Aug 27 13:28:44 EDT 2005
 .\"
@@ -8788,7 +8788,7 @@ bfox@gnu.org
 .PP
 Chet Ramey, Case Western Reserve University
 .br
-chet@po.CWRU.Edu
+chet@po.cwru.edu
 .SH BUG REPORTS
 If you find a bug in
 .B bash,
@@ -8829,7 +8829,7 @@ it provides for filing a bug report.
 .PP
 Comments and bug reports concerning
 this manual page should be directed to
-.IR chet@po.CWRU.Edu .
+.IR chet@po.cwru.edu .
 .SH BUGS
 .PP
 It's too big and too slow.
index 5004b56cdf4b0edfdcc22b7266a9bc7259bfe347..9c69fcc4273d4b4800c122c1c61734ed32ff8342 100644 (file)
@@ -2,7 +2,9 @@
 <TITLE>BASH(1) Manual Page</TITLE>
 </HEAD>
 <BODY><TABLE WIDTH=100%>
-<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2005 Aug 27<TH ALIGN=RIGHT>BASH(1)
+<TR>
+<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2005 Aug 27<TH ALIGN=RIGHT width=33%>BASH(1)
+</TR>
 </TABLE>
 <BR><A HREF="#index">Index</A>
 <HR>
 
 
 <A NAME="lbAB">&nbsp;</A>
-<H2>NAME</H2>
+<H3>NAME</H3>
 
 bash - GNU Bourne-Again SHell
 <A NAME="lbAC">&nbsp;</A>
-<H2>SYNOPSIS</H2>
+<H3>SYNOPSIS</H3>
 
 <B>bash</B>
 
 [options]
 [file]
 <A NAME="lbAD">&nbsp;</A>
-<H2>COPYRIGHT</H2>
+<H3>COPYRIGHT</H3>
 
 
 Bash is Copyright &#169; 1989-2005 by the Free Software Foundation, Inc.
 <A NAME="lbAE">&nbsp;</A>
-<H2>DESCRIPTION</H2>
+<H3>DESCRIPTION</H3>
 
 <B>Bash</B>
 
@@ -62,7 +64,7 @@ POSIX Shell and Tools specification (IEEE Working Group 1003.2).
 
 can be configured to be POSIX-conformant by default.
 <A NAME="lbAF">&nbsp;</A>
-<H2>OPTIONS</H2>
+<H3>OPTIONS</H3>
 
 In addition to the single-character shell options documented in the
 description of the <B>set</B> builtin command, <B>bash</B>
@@ -297,7 +299,7 @@ on the standard output and exit successfully.
 
 </DL>
 <A NAME="lbAG">&nbsp;</A>
-<H2>ARGUMENTS</H2>
+<H3>ARGUMENTS</H3>
 
 If arguments remain after option processing, and neither the
 <B>-c</B>
@@ -328,7 +330,7 @@ if no file is found, then the shell searches the directories in
 </FONT>
 for the script.
 <A NAME="lbAH">&nbsp;</A>
-<H2>INVOCATION</H2>
+<H3>INVOCATION</H3>
 
 A <I>login shell</I> is one whose first character of argument zero is a
 <B>-</B>,
@@ -559,7 +561,7 @@ and the effective user id is set to the real user id.
 If the <B>-p</B> option is supplied at invocation, the startup behavior is
 the same, but the effective user id is not reset.
 <A NAME="lbAI">&nbsp;</A>
-<H2>DEFINITIONS</H2>
+<H3>DEFINITIONS</H3>
 
 <P>
 
@@ -621,7 +623,7 @@ symbols:
 
 </DL>
 <A NAME="lbAJ">&nbsp;</A>
-<H2>RESERVED WORDS</H2>
+<H3>RESERVED WORDS</H3>
 
 <I>Reserved words</I> are words that have a special meaning to the shell.
 The following words are recognized as reserved when unquoted and either
@@ -648,10 +650,10 @@ command:
 
 
 <A NAME="lbAK">&nbsp;</A>
-<H2>SHELL GRAMMAR</H2>
+<H3>SHELL GRAMMAR</H3>
 
 <A NAME="lbAL">&nbsp;</A>
-<H3>Simple Commands</H3>
+<H4>Simple Commands</H4>
 
 <P>
 
@@ -667,7 +669,7 @@ The return value of a <I>simple command</I> is its exit status, or
 <I>n</I>.
 
 <A NAME="lbAM">&nbsp;</A>
-<H3>Pipelines</H3>
+<H4>Pipelines</H4>
 
 <P>
 
@@ -737,7 +739,7 @@ below.
 Each command in a pipeline is executed as a separate process (i.e., in a
 subshell).
 <A NAME="lbAN">&nbsp;</A>
-<H3>Lists</H3>
+<H4>Lists</H4>
 
 <P>
 
@@ -838,7 +840,7 @@ returns a non-zero exit status.  The return status of
 AND and OR lists is the exit status of the last command
 executed in the list.
 <A NAME="lbAO">&nbsp;</A>
-<H3>Compound Commands</H3>
+<H4>Compound Commands</H4>
 
 <P>
 
@@ -1093,7 +1095,7 @@ of the last <B>do</B> <I>list</I> command executed, or zero if
 none was executed.
 </DL>
 <A NAME="lbAP">&nbsp;</A>
-<H3>Shell Function Definitions</H3>
+<H4>Shell Function Definitions</H4>
 
 <P>
 
@@ -1129,7 +1131,7 @@ last command executed in the body.  (See
 below.)
 </DL>
 <A NAME="lbAQ">&nbsp;</A>
-<H2>COMMENTS</H2>
+<H3>COMMENTS</H3>
 
 In a non-interactive shell, or an interactive shell in which the
 <B>interactive_comments</B>
@@ -1153,7 +1155,7 @@ option enabled does not allow comments.  The
 
 option is on by default in interactive shells.
 <A NAME="lbAR">&nbsp;</A>
-<H2>QUOTING</H2>
+<H3>QUOTING</H3>
 
 <I>Quoting</I> is used to remove the special meaning of certain
 characters or words to the shell.  Quoting can be used to 
@@ -1334,7 +1336,7 @@ is ignored.
 If the string is translated and replaced, the replacement is
 double-quoted.
 <A NAME="lbAS">&nbsp;</A>
-<H2>PARAMETERS</H2>
+<H3>PARAMETERS</H3>
 
 A
 <I>parameter</I>
@@ -1449,7 +1451,7 @@ appended to the array beginning at one greater than the array's maximum index.
 When applied to a string-valued variable, <I>value</I> is expanded and
 appended to the variable's value.
 <A NAME="lbAT">&nbsp;</A>
-<H3>Positional Parameters</H3>
+<H4>Positional Parameters</H4>
 
 <P>
 
@@ -1478,7 +1480,7 @@ digit is expanded, it must be enclosed in braces (see
 </FONT>
 below).
 <A NAME="lbAU">&nbsp;</A>
-<H3>Special Parameters</H3>
+<H4>Special Parameters</H4>
 
 <P>
 
@@ -1601,7 +1603,7 @@ currently being checked.
 
 </DL>
 <A NAME="lbAV">&nbsp;</A>
-<H3>Shell Variables</H3>
+<H4>Shell Variables</H4>
 
 <P>
 
@@ -2627,7 +2629,7 @@ parser to treat the rest of the line as a comment.
 
 </DL>
 <A NAME="lbAW">&nbsp;</A>
-<H3>Arrays</H3>
+<H4>Arrays</H4>
 
 <B>Bash</B>
 
@@ -2749,7 +2751,7 @@ and
 builtins display array values in a way that allows them to be
 reused as assignments.
 <A NAME="lbAX">&nbsp;</A>
-<H2>EXPANSION</H2>
+<H3>EXPANSION</H3>
 
 Expansion is performed on the command line after it has been split into
 words.  There are seven kinds of expansion performed:
@@ -2791,7 +2793,7 @@ as explained above (see
 
 </FONT>
 <A NAME="lbAY">&nbsp;</A>
-<H3>Brace Expansion</H3>
+<H4>Brace Expansion</H4>
 
 <P>
 
@@ -2906,7 +2908,7 @@ command (see
 </FONT>
 below).
 <A NAME="lbAZ">&nbsp;</A>
-<H3>Tilde Expansion</H3>
+<H4>Tilde Expansion</H4>
 
 <P>
 
@@ -2977,7 +2979,7 @@ and
 </FONT>
 and the shell assigns the expanded value.
 <A NAME="lbBA">&nbsp;</A>
-<H3>Parameter Expansion</H3>
+<H4>Parameter Expansion</H4>
 
 <P>
 
@@ -3268,7 +3270,7 @@ the substitution operation is applied to each member of the
 array in turn, and the expansion is the resultant list.
 </DL>
 <A NAME="lbBB">&nbsp;</A>
-<H3>Command Substitution</H3>
+<H4>Command Substitution</H4>
 
 <P>
 
@@ -3322,7 +3324,7 @@ escape the inner backquotes with backslashes.
 If the substitution appears within double quotes, word splitting and
 pathname expansion are not performed on the results.
 <A NAME="lbBC">&nbsp;</A>
-<H3>Arithmetic Expansion</H3>
+<H4>Arithmetic Expansion</H4>
 
 <P>
 
@@ -3358,7 +3360,7 @@ is invalid,
 
 prints a message indicating failure and no substitution occurs.
 <A NAME="lbBD">&nbsp;</A>
-<H3>Process Substitution</H3>
+<H4>Process Substitution</H4>
 
 <P>
 
@@ -3382,7 +3384,7 @@ simultaneously with parameter and variable expansion,
 command substitution,
 and arithmetic expansion.
 <A NAME="lbBE">&nbsp;</A>
-<H3>Word Splitting</H3>
+<H4>Word Splitting</H4>
 
 <P>
 
@@ -3471,7 +3473,7 @@ null argument results and is retained.
 Note that if no expansion occurs, no splitting
 is performed.
 <A NAME="lbBF">&nbsp;</A>
-<H3>Pathname Expansion</H3>
+<H4>Pathname Expansion</H4>
 
 <P>
 
@@ -3746,7 +3748,7 @@ Matches anything except one of the given patterns
 
 
 <A NAME="lbBG">&nbsp;</A>
-<H3>Quote Removal</H3>
+<H4>Quote Removal</H4>
 
 <P>
 
@@ -3759,7 +3761,7 @@ characters
 and <B>&quot;</B> that did not result from one of the above
 expansions are removed.
 <A NAME="lbBH">&nbsp;</A>
-<H2>REDIRECTION</H2>
+<H3>REDIRECTION</H3>
 
 Before a command is executed, its input and output
 may be
@@ -3878,7 +3880,7 @@ Redirections using file descriptors greater than 9 should be used with
 care, as they may conflict with file descriptors the shell uses
 internally.
 <A NAME="lbBI">&nbsp;</A>
-<H3>Redirecting Input</H3>
+<H4>Redirecting Input</H4>
 
 <P>
 
@@ -3903,7 +3905,7 @@ The general format for redirecting input is:
 </DL>
 
 <A NAME="lbBJ">&nbsp;</A>
-<H3>Redirecting Output</H3>
+<H4>Redirecting Output</H4>
 
 <P>
 
@@ -3957,7 +3959,7 @@ option to the
 builtin command is not enabled, the redirection is attempted even
 if the file named by <I>word</I> exists.
 <A NAME="lbBK">&nbsp;</A>
-<H3>Appending Redirected Output</H3>
+<H4>Appending Redirected Output</H4>
 
 <P>
 
@@ -3985,7 +3987,7 @@ The general format for appending output is:
 <P>
 
 <A NAME="lbBL">&nbsp;</A>
-<H3>Redirecting Standard Output and Standard Error</H3>
+<H4>Redirecting Standard Output and Standard Error</H4>
 
 <P>
 
@@ -4025,7 +4027,7 @@ This is semantically equivalent to
 </DL>
 
 <A NAME="lbBM">&nbsp;</A>
-<H3>Here Documents</H3>
+<H4>Here Documents</H4>
 
 <P>
 
@@ -4097,7 +4099,7 @@ This allows
 here-documents within shell scripts to be indented in a
 natural fashion.
 <A NAME="lbBN">&nbsp;</A>
-<H3>Here Strings</H3>
+<H4>Here Strings</H4>
 
 A variant of here documents, the format is:
 <DL COMPACT><DT><DD>
@@ -4114,7 +4116,7 @@ A variant of here documents, the format is:
 The <I>word</I> is expanded and supplied to the command on its standard
 input.
 <A NAME="lbBO">&nbsp;</A>
-<H3>Duplicating File Descriptors</H3>
+<H4>Duplicating File Descriptors</H4>
 
 <P>
 
@@ -4175,7 +4177,7 @@ As a special case, if <I>n</I> is omitted, and <I>word</I> does not
 expand to one or more digits, the standard output and standard
 error are redirected as described previously.
 <A NAME="lbBP">&nbsp;</A>
-<H3>Moving File Descriptors</H3>
+<H4>Moving File Descriptors</H4>
 
 <P>
 
@@ -4209,7 +4211,7 @@ moves the file descriptor <I>digit</I> to file descriptor
 
 or the standard output (file descriptor 1) if <I>n</I> is not specified.
 <A NAME="lbBQ">&nbsp;</A>
-<H3>Opening File Descriptors for Reading and Writing</H3>
+<H4>Opening File Descriptors for Reading and Writing</H4>
 
 <P>
 
@@ -4233,7 +4235,7 @@ or on file descriptor 0 if
 
 is not specified.  If the file does not exist, it is created.
 <A NAME="lbBR">&nbsp;</A>
-<H2>ALIASES</H2>
+<H3>ALIASES</H3>
 
 <I>Aliases</I> allow a string to be substituted for a word when it is used
 as the first word of a simple command.
@@ -4335,7 +4337,7 @@ in compound commands.
 For almost every purpose, aliases are superseded by
 shell functions.
 <A NAME="lbBS">&nbsp;</A>
-<H2>FUNCTIONS</H2>
+<H3>FUNCTIONS</H3>
 
 A shell function, defined as described above under
 <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
@@ -4449,7 +4451,7 @@ Care should be taken in cases where this may cause a problem.
 Functions may be recursive.  No limit is imposed on the number
 of recursive calls.
 <A NAME="lbBT">&nbsp;</A>
-<H2>ARITHMETIC EVALUATION</H2>
+<H3>ARITHMETIC EVALUATION</H3>
 
 The shell allows arithmetic expressions to be evaluated, under
 certain circumstances (see the <B>let</B> and <B>declare</B> builtin
@@ -4572,7 +4574,7 @@ Operators are evaluated in order of precedence.  Sub-expressions in
 parentheses are evaluated first and may override the precedence
 rules above.
 <A NAME="lbBU">&nbsp;</A>
-<H2>CONDITIONAL EXPRESSIONS</H2>
+<H3>CONDITIONAL EXPRESSIONS</H3>
 
 Conditional expressions are used by the <B>[[</B> compound command and
 the <B>test</B> and <B>[</B> builtin commands to test file attributes
@@ -4757,7 +4759,7 @@ may be positive or negative integers.
 
 </DL>
 <A NAME="lbBV">&nbsp;</A>
-<H2>SIMPLE COMMAND EXPANSION</H2>
+<H3>SIMPLE COMMAND EXPANSION</H3>
 
 When a simple command is executed, the shell performs the following
 expansions, assignments, and redirections, from left to right.
@@ -4801,7 +4803,7 @@ contained a command substitution, the exit status of the command is
 the exit status of the last command substitution performed.  If there
 were no command substitutions, the command exits with a status of zero.
 <A NAME="lbBW">&nbsp;</A>
-<H2>COMMAND EXECUTION</H2>
+<H3>COMMAND EXECUTION</H3>
 
 After a command has been split into words, if it results in a
 simple command and an optional list of arguments, the following
@@ -4882,7 +4884,7 @@ interpreter name on the first line of the program, followed
 by the name of the program, followed by the command
 arguments, if any.
 <A NAME="lbBX">&nbsp;</A>
-<H2>COMMAND EXECUTION ENVIRONMENT</H2>
+<H3>COMMAND EXECUTION ENVIRONMENT</H3>
 
 The shell has an <I>execution environment</I>, which consists of the
 following:
@@ -4960,7 +4962,7 @@ default standard input for the command is the empty file <I>/dev/null</I>.
 Otherwise, the invoked command inherits the file descriptors of the calling
 shell as modified by redirections.
 <A NAME="lbBY">&nbsp;</A>
-<H2>ENVIRONMENT</H2>
+<H3>ENVIRONMENT</H3>
 
 When a program is invoked it is given an array of strings
 called the
@@ -5037,7 +5039,7 @@ invokes an external command, the variable
 is set to the full file name of the command and passed to that
 command in its environment.
 <A NAME="lbBZ">&nbsp;</A>
-<H2>EXIT STATUS</H2>
+<H3>EXIT STATUS</H3>
 
 For the shell's purposes, a command which exits with a 
 zero exit status has succeeded.  An exit status of zero
@@ -5066,7 +5068,7 @@ executed, unless a syntax error occurs, in which case it exits
 with a non-zero value.  See also the <B>exit</B> builtin
 command below.
 <A NAME="lbCA">&nbsp;</A>
-<H2>SIGNALS</H2>
+<H3>SIGNALS</H3>
 
 When <B>bash</B> is interactive, in the absence of any traps, it ignores
 <FONT SIZE=-1><B>SIGTERM</B>
@@ -5183,7 +5185,7 @@ builtin, the reception of a signal for which a trap has been set will
 cause the <B>wait</B> builtin to return immediately with an exit status
 greater than 128, immediately after which the trap is executed.
 <A NAME="lbCB">&nbsp;</A>
-<H2>JOB CONTROL</H2>
+<H3>JOB CONTROL</H3>
 
 <I>Job control</I>
 
@@ -5407,7 +5409,7 @@ If a second attempt to exit is made without an intervening command,
 the shell does not print another warning, and the stopped
 jobs are terminated.
 <A NAME="lbCC">&nbsp;</A>
-<H2>PROMPTING</H2>
+<H3>PROMPTING</H3>
 
 When executing interactively, 
 <B>bash</B>
@@ -5576,7 +5578,7 @@ command under
 </FONT>
 below).
 <A NAME="lbCD">&nbsp;</A>
-<H2>READLINE</H2>
+<H3>READLINE</H3>
 
 This is the library that handles reading input when using an interactive
 shell, unless the
@@ -5600,7 +5602,7 @@ builtin (see
 </FONT>
 below).
 <A NAME="lbCE">&nbsp;</A>
-<H3>Readline Notation</H3>
+<H4>Readline Notation</H4>
 
 <P>
 
@@ -5646,7 +5648,7 @@ accumulated into one unit, which can be yanked all at once.
 Commands which do not kill text separate the chunks of text
 on the kill ring.
 <A NAME="lbCF">&nbsp;</A>
-<H3>Readline Initialization</H3>
+<H4>Readline Initialization</H4>
 
 <P>
 
@@ -5725,7 +5727,7 @@ and
 In addition to command names, readline allows keys to be bound
 to a string that is inserted when the key is pressed (a <I>macro</I>).
 <A NAME="lbCG">&nbsp;</A>
-<H3>Readline Key Bindings</H3>
+<H4>Readline Key Bindings</H4>
 
 <P>
 
@@ -5932,7 +5934,7 @@ builtin command (see
 </FONT>
 below).
 <A NAME="lbCH">&nbsp;</A>
-<H3>Readline Variables</H3>
+<H4>Readline Variables</H4>
 
 <P>
 
@@ -6158,7 +6160,7 @@ completions.
 
 </DL>
 <A NAME="lbCI">&nbsp;</A>
-<H3>Readline Conditional Constructs</H3>
+<H4>Readline Conditional Constructs</H4>
 
 <P>
 
@@ -6242,7 +6244,7 @@ would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
 
 </DL>
 <A NAME="lbCJ">&nbsp;</A>
-<H3>Searching</H3>
+<H4>Searching</H4>
 
 <P>
 
@@ -6295,7 +6297,7 @@ Non-incremental searches read the entire search string before starting
 to search for matching history lines.  The search string may be
 typed by the user or be part of the contents of the current line.
 <A NAME="lbCK">&nbsp;</A>
-<H3>Readline Command Names</H3>
+<H4>Readline Command Names</H4>
 
 <P>
 
@@ -6307,7 +6309,7 @@ position, and <I>mark</I> refers to a cursor position saved by the
 <B>set-mark</B> command.
 The text between the point and mark is referred to as the <I>region</I>.
 <A NAME="lbCL">&nbsp;</A>
-<H3>Commands for Moving</H3>
+<H4>Commands for Moving</H4>
 
 <P>
 
@@ -6352,7 +6354,7 @@ Refresh the current line.
 
 </DL>
 <A NAME="lbCM">&nbsp;</A>
-<H3>Commands for Manipulating the History</H3>
+<H4>Commands for Manipulating the History</H4>
 
 <P>
 
@@ -6509,7 +6511,7 @@ and <I>emacs</I> as the editor, in that order.
 
 </DL>
 <A NAME="lbCN">&nbsp;</A>
-<H3>Commands for Changing Text</H3>
+<H4>Commands for Changing Text</H4>
 
 <P>
 
@@ -6594,7 +6596,7 @@ before point with a space.  By default, this command is unbound.
 
 </DL>
 <A NAME="lbCO">&nbsp;</A>
-<H3>Killing and Yanking</H3>
+<H4>Killing and Yanking</H4>
 
 <P>
 
@@ -6678,7 +6680,7 @@ or
 
 </DL>
 <A NAME="lbCP">&nbsp;</A>
-<H3>Numeric Arguments</H3>
+<H4>Numeric Arguments</H4>
 
 <P>
 
@@ -6708,7 +6710,7 @@ argument count sixteen, and so on.
 
 </DL>
 <A NAME="lbCQ">&nbsp;</A>
-<H3>Completing</H3>
+<H4>Completing</H4>
 
 <P>
 
@@ -6827,7 +6829,7 @@ above).
 
 </DL>
 <A NAME="lbCR">&nbsp;</A>
-<H3>Keyboard Macros</H3>
+<H4>Keyboard Macros</H4>
 
 <P>
 
@@ -6850,7 +6852,7 @@ in the macro appear as if typed at the keyboard.
 
 </DL>
 <A NAME="lbCS">&nbsp;</A>
-<H3>Miscellaneous</H3>
+<H4>Miscellaneous</H4>
 
 <P>
 
@@ -6990,7 +6992,7 @@ Display version information about the current instance of
 
 </DL>
 <A NAME="lbCT">&nbsp;</A>
-<H3>Programmable Completion</H3>
+<H4>Programmable Completion</H4>
 
 <P>
 
@@ -7164,7 +7166,7 @@ to completed names which are symbolic links to directories, subject to
 the value of the <B>mark-directories</B> readline variable, regardless
 of the setting of the <B>mark-symlinked-directories</B> readline variable.
 <A NAME="lbCU">&nbsp;</A>
-<H2>HISTORY</H2>
+<H3>HISTORY</H3>
 
 When the
 <B>-o history</B>
@@ -7300,7 +7302,7 @@ builtin below under
 </FONT>
 for information on setting and unsetting shell options.
 <A NAME="lbCV">&nbsp;</A>
-<H2>HISTORY EXPANSION</H2>
+<H3>HISTORY EXPANSION</H3>
 
 <P>
 
@@ -7413,7 +7415,7 @@ above under
 <B>Shell Variables</B>).
 
 <A NAME="lbCW">&nbsp;</A>
-<H3>Event Designators</H3>
+<H4>Event Designators</H4>
 
 <P>
 
@@ -7483,7 +7485,7 @@ The entire command line typed so far.
 
 </DL>
 <A NAME="lbCX">&nbsp;</A>
-<H3>Word Designators</H3>
+<H4>Word Designators</H4>
 
 <P>
 
@@ -7560,7 +7562,7 @@ Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
 If a word designator is supplied without an event specification, the
 previous command is used as the event.
 <A NAME="lbCY">&nbsp;</A>
-<H3>Modifiers</H3>
+<H4>Modifiers</H4>
 
 <P>
 
@@ -7665,7 +7667,7 @@ Apply the following `<B>s</B>' modifier once to each word in the event line.
 
 </DL>
 <A NAME="lbCZ">&nbsp;</A>
-<H2>SHELL BUILTIN COMMANDS</H2>
+<H3>SHELL BUILTIN COMMANDS</H3>
 
 
 
@@ -11127,7 +11129,7 @@ process or job waited for.
 
 </DL>
 <A NAME="lbDA">&nbsp;</A>
-<H2>RESTRICTED SHELL</H2>
+<H3>RESTRICTED SHELL</H3>
 
 
 
@@ -11241,7 +11243,7 @@ script.
 
 
 <A NAME="lbDB">&nbsp;</A>
-<H2>SEE ALSO</H2>
+<H3>SEE ALSO</H3>
 
 
 <DL COMPACT>
@@ -11255,7 +11257,7 @@ script.
 
 </DL>
 <A NAME="lbDC">&nbsp;</A>
-<H2>FILES</H2>
+<H3>FILES</H3>
 
 
 <DL COMPACT>
@@ -11292,7 +11294,7 @@ Individual <I>readline</I> initialization file
 
 </DL>
 <A NAME="lbDD">&nbsp;</A>
-<H2>AUTHORS</H2>
+<H3>AUTHORS</H3>
 
 Brian Fox, Free Software Foundation
 <BR>
@@ -11303,9 +11305,9 @@ Brian Fox, Free Software Foundation
 Chet Ramey, Case Western Reserve University
 <BR>
 
-<A HREF="mailto:chet@po.CWRU.Edu">chet@po.CWRU.Edu</A>
+<A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A>
 <A NAME="lbDE">&nbsp;</A>
-<H2>BUG REPORTS</H2>
+<H3>BUG REPORTS</H3>
 
 If you find a bug in
 <B>bash,</B>
@@ -11353,10 +11355,10 @@ it provides for filing a bug report.
 
 Comments and bug reports concerning
 this manual page should be directed to
-<I><A HREF="mailto:chet@po.CWRU.Edu">chet@po.CWRU.Edu</A></I>.
+<I><A HREF="mailto:chet@po.cwru.edu">chet@po.cwru.edu</A></I>.
 
 <A NAME="lbDF">&nbsp;</A>
-<H2>BUGS</H2>
+<H3>BUGS</H3>
 
 <P>
 
@@ -11402,6 +11404,12 @@ Array variables may not (yet) be exported.
 
 
 
+<HR>
+<TABLE WIDTH=100%>
+<TR>
+<TH ALIGN=LEFT width=33%>GNU Bash-3.1-beta1<TH ALIGN=CENTER width=33%>2005 Aug 27<TH ALIGN=RIGHT width=33%>BASH(1)
+</TR>
+</TABLE>
 <HR>
 <A NAME="index">&nbsp;</A><H2>Index</H2>
 <DL>
@@ -11503,6 +11511,6 @@ Array variables may not (yet) be exported.
 </DL>
 <HR>
 This document was created by man2html from bash.1.<BR>
-Time: 03 October 2005 15:07:47 EDT
+Time: 12 October 2005 16:46:47 EDT
 </BODY>
 </HTML>
index 3e4f9fbe94e4987e38435352937cd1e56bbb8a54..0615c0da7880d9410d1390da6f7337be525cdc8b 100644 (file)
@@ -1,6 +1,6 @@
 %!PS-Adobe-3.0
 %%Creator: groff version 1.19.1
-%%CreationDate: Mon Oct  3 15:05:27 2005
+%%CreationDate: Wed Oct 12 16:46:45 2005
 %%DocumentNeededResources: font Times-Roman
 %%+ font Times-Bold
 %%+ font Times-Italic
@@ -7377,8 +7377,8 @@ E F0(initialization \214le)2.5 E F3 -.548(AU)72 554.4 S(THORS).548 E F0
 (Brian F)108 566.4 Q(ox, Free Softw)-.15 E(are F)-.1 E(oundation)-.15 E
 (bfox@gnu.or)108 578.4 Q(g)-.18 E(Chet Rame)108 595.2 Q 1.3 -.65(y, C)
 -.15 H(ase W).65 E(estern Reserv)-.8 E 2.5(eU)-.15 G(ni)-2.5 E -.15(ve)
--.25 G(rsity).15 E(chet@po.CWR)108 607.2 Q(U.Edu)-.4 E F3 -.11(BU)72 624
-2.738(GR).11 G(EPOR)-2.738 E(TS)-.438 E F0 .567(If you \214nd a b)108
+-.25 G(rsity).15 E(chet@po.cwru.edu)108 607.2 Q F3 -.11(BU)72 624 S
+2.738(GR).11 G(EPOR)-2.738 E(TS)-.438 E F0 .567(If you \214nd a b)108
 636 R .568(ug in)-.2 F F1(bash,)3.068 E F0 .568(you should report it.)
 3.068 F .568(But \214rst, you should mak)5.568 F 3.068(es)-.1 G .568
 (ure that it really is a b)-3.068 F .568(ug, and)-.2 F 5.626
@@ -7410,9 +7410,9 @@ E(ug)-.2 E/F2 10/Times-Italic@0 SF(bashb)108.27 148.8 Q(ug)-.2 E F0
 (inserts the \214rst three items automatically into the template it pro)
 2.72 E(vides for \214ling a b)-.15 E(ug report.)-.2 E(Comments and b)108
 165.6 Q(ug reports concerning this manual page should be directed to)-.2
-E F2 -.15(ch)2.5 G(et@po.CWR).15 E -.25(U.)-.4 G(Edu).25 E F0(.).25 E/F3
-10.95/Times-Bold@0 SF -.11(BU)72 182.4 S(GS).11 E F0(It')108 194.4 Q 2.5
-(st)-.55 G(oo big and too slo)-2.5 E -.65(w.)-.25 G 1.868
+E F2 -.15(ch)2.5 G(et@po.cwru.edu).15 E F0(.).25 E/F3 10.95/Times-Bold@0
+SF -.11(BU)72 182.4 S(GS).11 E F0(It')108 194.4 Q 2.5(st)-.55 G
+(oo big and too slo)-2.5 E -.65(w.)-.25 G 1.868
 (There are some subtle dif)108 211.2 R 1.868(ferences between)-.25 F F1
 (bash)4.369 E F0 1.869(and traditional v)4.369 F 1.869(ersions of)-.15 F
 F1(sh)4.369 E F0 4.369(,m)C 1.869(ostly because of the)-4.369 F/F4 9
index 896eaf3ca7716c4951e1279a2c65b81957b8784b..f56bcf83337680760ee623214acd6040b059ec77 100644 (file)
@@ -1,6 +1,6 @@
 %!PS-Adobe-3.0
 %%Creator: groff version 1.19.1
-%%CreationDate: Mon Oct  3 15:05:28 2005
+%%CreationDate: Wed Oct 12 16:46:45 2005
 %%DocumentNeededResources: font Times-Roman
 %%+ font Times-Bold
 %%+ font Times-Italic
index 106c297470d5ea7fe255d46c7d92f7f0772752c8..8589fd2843d20eb1bd48477b37a3edab192d1087 100644 (file)
@@ -1,6 +1,6 @@
 %!PS-Adobe-3.0
 %%Creator: groff version 1.19.1
-%%CreationDate: Mon Oct  3 15:05:28 2005
+%%CreationDate: Wed Oct 12 16:46:46 2005
 %%DocumentNeededResources: font Times-Roman
 %%+ font Times-Bold
 %%DocumentSuppliedResources: procset grops 1.19 1
diff --git a/jobs.c b/jobs.c
index f15a1bdc537c8946658ed0fe50d6e01342b77e00..706e250f69fc5bb5b2cb8058ce6323cd32641f5d 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -1999,7 +1999,10 @@ wait_for_single_pid (pid)
 
   /* If running in posix mode, remove the job from the jobs table immediately */
   if (posixly_correct)
-    cleanup_dead_jobs ();
+    {
+      cleanup_dead_jobs ();
+      bgp_delete (pid);
+    }
 
   return r;
 }
index fcae4e13153b73d3baf284cae6d4efdd80150ea2..6e8cf3af892cd8c47bd9dabf9abf6f7d3a0df84f 100644 (file)
@@ -522,11 +522,11 @@ PATSCAN (string, end, delim)
      CHAR *string, *end;
      INT delim;
 {
-  int pnest, bnest;
+  int pnest, bnest, skip;
   INT cchar;
   CHAR *s, c, *bfirst;
 
-  pnest = bnest = 0;
+  pnest = bnest = skip = 0;
   cchar = 0;
   bfirst = NULL;
 
@@ -534,8 +534,17 @@ PATSCAN (string, end, delim)
     {
       if (s >= end)
        return (s);
+      if (skip)
+       {
+         skip = 0;
+         continue;
+       }
       switch (c)
        {
+       case L('\\'):
+         skip = 1;
+         break;
+
        case L('\0'):
          return ((CHAR *)NULL);
 
diff --git a/lib/glob/sm_loop.c~ b/lib/glob/sm_loop.c~
new file mode 100644 (file)
index 0000000..5b460f0
--- /dev/null
@@ -0,0 +1,754 @@
+/* Copyright (C) 1991-2005 Free Software Foundation, Inc.
+
+   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 2, or (at your option) any later
+   version.
+             
+   Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+   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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+int FCT __P((CHAR *, CHAR *, int));
+
+static int GMATCH __P((CHAR *, CHAR *, CHAR *, CHAR *, int));
+static CHAR *PARSE_COLLSYM __P((CHAR *, INT *));
+static CHAR *BRACKMATCH __P((CHAR *, U_CHAR, int));
+static int EXTMATCH __P((INT, CHAR *, CHAR *, CHAR *, CHAR *, int));
+static CHAR *PATSCAN __P((CHAR *, CHAR *, INT));
+
+int
+FCT (pattern, string, flags)
+     CHAR *pattern;
+     CHAR *string;
+     int flags;
+{
+  CHAR *se, *pe;
+
+  if (string == 0 || pattern == 0)
+    return FNM_NOMATCH;
+
+  se = string + STRLEN ((XCHAR *)string);
+  pe = pattern + STRLEN ((XCHAR *)pattern);
+
+  return (GMATCH (string, se, pattern, pe, flags));
+}
+
+/* Match STRING against the filename pattern PATTERN, returning zero if
+   it matches, FNM_NOMATCH if not.  */
+static int
+GMATCH (string, se, pattern, pe, flags)
+     CHAR *string, *se;
+     CHAR *pattern, *pe;
+     int flags;
+{
+  CHAR *p, *n;         /* pattern, string */
+  INT c;               /* current pattern character - XXX U_CHAR? */
+  INT sc;              /* current string character - XXX U_CHAR? */
+
+  p = pattern;
+  n = string;
+
+  if (string == 0 || pattern == 0)
+    return FNM_NOMATCH;
+
+#if DEBUG_MATCHING
+fprintf(stderr, "gmatch: string = %s; se = %s\n", string, se);
+fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
+#endif
+
+  while (p < pe)
+    {
+      c = *p++;
+      c = FOLD (c);
+
+      sc = n < se ? *n : '\0';
+
+#ifdef EXTENDED_GLOB
+      /* EXTMATCH () will handle recursively calling GMATCH, so we can
+        just return what EXTMATCH() returns. */
+      if ((flags & FNM_EXTMATCH) && *p == L('(') &&
+         (c == L('+') || c == L('*') || c == L('?') || c == L('@') || c == L('!'))) /* ) */
+       {
+         int lflags;
+         /* If we're not matching the start of the string, we're not
+            concerned about the special cases for matching `.' */
+         lflags = (n == string) ? flags : (flags & ~FNM_PERIOD);
+         return (EXTMATCH (c, n, se, p, pe, lflags));
+       }
+#endif /* EXTENDED_GLOB */
+
+      switch (c)
+       {
+       case L('?'):            /* Match single character */
+         if (sc == '\0')
+           return FNM_NOMATCH;
+         else if ((flags & FNM_PATHNAME) && sc == L('/'))
+           /* If we are matching a pathname, `?' can never match a `/'. */
+           return FNM_NOMATCH;
+         else if ((flags & FNM_PERIOD) && sc == L('.') &&
+                  (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
+           /* `?' cannot match a `.' if it is the first character of the
+              string or if it is the first character following a slash and
+              we are matching a pathname. */
+           return FNM_NOMATCH;
+         break;
+
+       case L('\\'):           /* backslash escape removes special meaning */
+         if (p == pe)
+           return FNM_NOMATCH;
+
+         if ((flags & FNM_NOESCAPE) == 0)
+           {
+             c = *p++;
+             /* A trailing `\' cannot match. */
+             if (p > pe)
+               return FNM_NOMATCH;
+             c = FOLD (c);
+           }
+         if (FOLD (sc) != (U_CHAR)c)
+           return FNM_NOMATCH;
+         break;
+
+       case '*':               /* Match zero or more characters */
+         if (p == pe)
+           return 0;
+         
+         if ((flags & FNM_PERIOD) && sc == L('.') &&
+             (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
+           /* `*' cannot match a `.' if it is the first character of the
+              string or if it is the first character following a slash and
+              we are matching a pathname. */
+           return FNM_NOMATCH;
+
+         /* Collapse multiple consecutive `*' and `?', but make sure that
+            one character of the string is consumed for each `?'. */
+         for (c = *p++; (c == L('?') || c == L('*')); c = *p++)
+           {
+             if ((flags & FNM_PATHNAME) && sc == L('/'))
+               /* A slash does not match a wildcard under FNM_PATHNAME. */
+               return FNM_NOMATCH;
+#ifdef EXTENDED_GLOB
+             else if ((flags & FNM_EXTMATCH) && c == L('?') && *p == L('(')) /* ) */
+               {
+                 CHAR *newn;
+                 for (newn = n; newn < se; ++newn)
+                   {
+                     if (EXTMATCH (c, newn, se, p, pe, flags) == 0)
+                       return (0);
+                   }
+                 /* We didn't match.  If we have a `?(...)', that's failure. */
+                 return FNM_NOMATCH;
+               }
+#endif
+             else if (c == L('?'))
+               {
+                 if (sc == L('\0'))
+                   return FNM_NOMATCH;
+                 /* One character of the string is consumed in matching
+                    this ? wildcard, so *??? won't match if there are
+                    fewer than three characters. */
+                 n++;
+                 sc = n < se ? *n : '\0';
+               }
+
+#ifdef EXTENDED_GLOB
+             /* Handle ******(patlist) */
+             if ((flags & FNM_EXTMATCH) && c == L('*') && *p == L('('))  /*)*/
+               {
+                 CHAR *newn;
+                 /* We need to check whether or not the extended glob
+                    pattern matches the remainder of the string.
+                    If it does, we match the entire pattern. */
+                 for (newn = n; newn < se; ++newn)
+                   {
+                     if (EXTMATCH (c, newn, se, p, pe, flags) == 0)
+                       return (0);
+                   }
+                 /* We didn't match the extended glob pattern, but
+                    that's OK, since we can match 0 or more occurrences.
+                    We need to skip the glob pattern and see if we
+                    match the rest of the string. */
+                 newn = PATSCAN (p + 1, pe, 0);
+                 /* If NEWN is 0, we have an ill-formed pattern. */
+                 p = newn ? newn : pe;
+               }
+#endif
+             if (p == pe)
+               break;
+           }
+
+         /* If we've hit the end of the pattern and the last character of
+            the pattern was handled by the loop above, we've succeeded.
+            Otherwise, we need to match that last character. */
+         if (p == pe && (c == L('?') || c == L('*')))
+           return (0);
+
+         /* General case, use recursion. */
+         {
+           U_CHAR c1;
+
+           c1 = ((flags & FNM_NOESCAPE) == 0 && c == L('\\')) ? *p : c;
+           c1 = FOLD (c1);
+           for (--p; n < se; ++n)
+             {
+               /* Only call strmatch if the first character indicates a
+                  possible match.  We can check the first character if
+                  we're not doing an extended glob match. */
+               if ((flags & FNM_EXTMATCH) == 0 && c != L('[') && FOLD (*n) != c1) /*]*/
+                 continue;
+
+               /* If we're doing an extended glob match and the pattern is not
+                  one of the extended glob patterns, we can check the first
+                  character. */
+               if ((flags & FNM_EXTMATCH) && p[1] != L('(') && /*)*/
+                   STRCHR (L("?*+@!"), *p) == 0 && c != L('[') && FOLD (*n) != c1) /*]*/
+                 continue;
+
+               /* Otherwise, we just recurse. */
+               if (GMATCH (n, se, p, pe, flags & ~FNM_PERIOD) == 0)
+                 return (0);
+             }
+           return FNM_NOMATCH;
+         }
+
+       case L('['):
+         {
+           if (sc == L('\0') || n == se)
+             return FNM_NOMATCH;
+
+           /* A character class cannot match a `.' if it is the first
+              character of the string or if it is the first character
+              following a slash and we are matching a pathname. */
+           if ((flags & FNM_PERIOD) && sc == L('.') &&
+               (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
+             return (FNM_NOMATCH);
+
+           p = BRACKMATCH (p, sc, flags);
+           if (p == 0)
+             return FNM_NOMATCH;
+         }
+         break;
+
+       default:
+         if ((U_CHAR)c != FOLD (sc))
+           return (FNM_NOMATCH);
+       }
+
+      ++n;
+    }
+
+  if (n == se)
+    return (0);
+
+  if ((flags & FNM_LEADING_DIR) && *n == L('/'))
+    /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz".  */
+    return 0;
+         
+  return (FNM_NOMATCH);
+}
+
+/* Parse a bracket expression collating symbol ([.sym.]) starting at P, find
+   the value of the symbol, and move P past the collating symbol expression.
+   The value is returned in *VP, if VP is not null. */
+static CHAR *
+PARSE_COLLSYM (p, vp)
+     CHAR *p;
+     INT *vp;
+{
+  register int pc;
+  INT val;
+
+  p++;                         /* move past the `.' */
+         
+  for (pc = 0; p[pc]; pc++)
+    if (p[pc] == L('.') && p[pc+1] == L(']'))
+      break;
+   val = COLLSYM (p, pc);
+   if (vp)
+     *vp = val;
+   return (p + pc + 2);
+}
+
+/* Use prototype definition here because of type promotion. */
+static CHAR *
+#if defined (PROTOTYPES)
+BRACKMATCH (CHAR *p, U_CHAR test, int flags)
+#else
+BRACKMATCH (p, test, flags)
+     CHAR *p;
+     U_CHAR test;
+     int flags;
+#endif
+{
+  register CHAR cstart, cend, c;
+  register int not;    /* Nonzero if the sense of the character class is inverted.  */
+  int brcnt;
+  INT pc;
+  CHAR *savep;
+
+  test = FOLD (test);
+
+  savep = p;
+
+  /* POSIX.2 3.13.1 says that an exclamation mark (`!') shall replace the
+     circumflex (`^') in its role in a `nonmatching list'.  A bracket
+     expression starting with an unquoted circumflex character produces
+     unspecified results.  This implementation treats the two identically. */
+  if (not = (*p == L('!') || *p == L('^')))
+    ++p;
+
+  c = *p++;
+  for (;;)
+    {
+      /* Initialize cstart and cend in case `-' is the last
+        character of the pattern. */
+      cstart = cend = c;
+
+      /* POSIX.2 equivalence class:  [=c=].  See POSIX.2 2.8.3.2.  Find
+        the end of the equivalence class, move the pattern pointer past
+        it, and check for equivalence.  XXX - this handles only
+        single-character equivalence classes, which is wrong, or at
+        least incomplete. */
+      if (c == L('[') && *p == L('=') && p[2] == L('=') && p[3] == L(']'))
+       {
+         pc = FOLD (p[1]);
+         p += 4;
+         if (COLLEQUIV (test, pc))
+           {
+/*[*/        /* Move past the closing `]', since the first thing we do at
+                the `matched:' label is back p up one. */
+             p++;
+             goto matched;
+           }
+         else
+           {
+             c = *p++;
+             if (c == L('\0'))
+               return ((test == L('[')) ? savep : (CHAR *)0); /*]*/
+             c = FOLD (c);
+             continue;
+           }
+       }
+
+      /* POSIX.2 character class expression.  See POSIX.2 2.8.3.2. */
+      if (c == L('[') && *p == L(':'))
+       {
+         CHAR *close, *ccname;
+
+         pc = 0;       /* make sure invalid char classes don't match. */
+         /* Find end of character class name */
+         for (close = p + 1; *close != '\0'; close++)
+           if (*close == L(':') && *(close+1) == L(']'))
+             break;
+
+         if (*close != L('\0'))
+           {
+             ccname = (CHAR *)malloc ((close - p) * sizeof (CHAR));
+             if (ccname == 0)
+               pc = 0;
+             else
+               {
+                 bcopy (p + 1, ccname, (close - p - 1) * sizeof (CHAR));
+                 *(ccname + (close - p - 1)) = L('\0');
+                 pc = IS_CCLASS (test, (XCHAR *)ccname);
+               }
+             if (pc == -1)
+               pc = 0;
+             else
+               p = close + 2;
+
+             free (ccname);
+           }
+           
+         if (pc)
+           {
+/*[*/        /* Move past the closing `]', since the first thing we do at
+                the `matched:' label is back p up one. */
+             p++;
+             goto matched;
+           }
+         else
+           {
+             /* continue the loop here, since this expression can't be
+                the first part of a range expression. */
+             c = *p++;
+             if (c == L('\0'))
+               return ((test == L('[')) ? savep : (CHAR *)0);
+             else if (c == L(']'))
+               break;
+             c = FOLD (c);
+             continue;
+           }
+       }
+      /* POSIX.2 collating symbols.  See POSIX.2 2.8.3.2.  Find the end of
+        the symbol name, make sure it is terminated by `.]', translate
+        the name to a character using the external table, and do the
+        comparison. */
+      if (c == L('[') && *p == L('.'))
+       {
+         p = PARSE_COLLSYM (p, &pc);
+         /* An invalid collating symbol cannot be the first point of a
+            range.  If it is, we set cstart to one greater than `test',
+            so any comparisons later will fail. */
+         cstart = (pc == INVALID) ? test + 1 : pc;
+       }
+
+      if (!(flags & FNM_NOESCAPE) && c == L('\\'))
+       {
+         if (*p == '\0')
+           return (CHAR *)0;
+         cstart = cend = *p++;
+       }
+
+      cstart = cend = FOLD (cstart);
+
+      /* POSIX.2 2.8.3.1.2 says: `An expression containing a `[' that
+        is not preceded by a backslash and is not part of a bracket
+        expression produces undefined results.'  This implementation
+        treats the `[' as just a character to be matched if there is
+        not a closing `]'. */
+      if (c == L('\0'))
+       return ((test == L('[')) ? savep : (CHAR *)0);
+
+      c = *p++;
+      c = FOLD (c);
+
+      if ((flags & FNM_PATHNAME) && c == L('/'))
+       /* [/] can never match when matching a pathname.  */
+       return (CHAR *)0;
+
+      /* This introduces a range, unless the `-' is the last
+        character of the class.  Find the end of the range
+        and move past it. */
+      if (c == L('-') && *p != L(']'))
+       {
+         cend = *p++;
+         if (!(flags & FNM_NOESCAPE) && cend == L('\\'))
+           cend = *p++;
+         if (cend == L('\0'))
+           return (CHAR *)0;
+         if (cend == L('[') && *p == L('.'))
+           {
+             p = PARSE_COLLSYM (p, &pc);
+             /* An invalid collating symbol cannot be the second part of a
+                range expression.  If we get one, we set cend to one fewer
+                than the test character to make sure the range test fails. */
+             cend = (pc == INVALID) ? test - 1 : pc;
+           }
+         cend = FOLD (cend);
+
+         c = *p++;
+
+         /* POSIX.2 2.8.3.2:  ``The ending range point shall collate
+            equal to or higher than the starting range point; otherwise
+            the expression shall be treated as invalid.''  Note that this
+            applies to only the range expression; the rest of the bracket
+            expression is still checked for matches. */
+         if (RANGECMP (cstart, cend) > 0)
+           {
+             if (c == L(']'))
+               break;
+             c = FOLD (c);
+             continue;
+           }
+       }
+
+      if (RANGECMP (test, cstart) >= 0 && RANGECMP (test, cend) <= 0)
+       goto matched;
+
+      if (c == L(']'))
+       break;
+    }
+  /* No match. */
+  return (!not ? (CHAR *)0 : p);
+
+matched:
+  /* Skip the rest of the [...] that already matched.  */
+  c = *--p;
+  brcnt = 1;
+  while (brcnt > 0)
+    {
+      /* A `[' without a matching `]' is just another character to match. */
+      if (c == L('\0'))
+       return ((test == L('[')) ? savep : (CHAR *)0);
+
+      c = *p++;
+      if (c == L('[') && (*p == L('=') || *p == L(':') || *p == L('.')))
+       brcnt++;
+      else if (c == L(']'))
+       brcnt--;
+      else if (!(flags & FNM_NOESCAPE) && c == L('\\'))
+       {
+         if (*p == '\0')
+           return (CHAR *)0;
+         /* XXX 1003.2d11 is unclear if this is right. */
+         ++p;
+       }
+    }
+  return (not ? (CHAR *)0 : p);
+}
+
+#if defined (EXTENDED_GLOB)
+/* ksh-like extended pattern matching:
+
+       [?*+@!](pat-list)
+
+   where pat-list is a list of one or patterns separated by `|'.  Operation
+   is as follows:
+
+       ?(patlist)      match zero or one of the given patterns
+       *(patlist)      match zero or more of the given patterns
+       +(patlist)      match one or more of the given patterns
+       @(patlist)      match exactly one of the given patterns
+       !(patlist)      match anything except one of the given patterns
+*/
+
+/* Scan a pattern starting at STRING and ending at END, keeping track of
+   embedded () and [].  If DELIM is 0, we scan until a matching `)'
+   because we're scanning a `patlist'.  Otherwise, we scan until we see
+   DELIM.  In all cases, we never scan past END.  The return value is the
+   first character after the matching DELIM. */
+static CHAR *
+PATSCAN (string, end, delim)
+     CHAR *string, *end;
+     INT delim;
+{
+  int pnest, bnest;
+  INT cchar;
+  CHAR *s, c, *bfirst;
+
+  pnest = bnest = 0;
+  cchar = 0;
+  bfirst = NULL;
+
+  for (s = string; c = *s; s++)
+    {
+      if (s >= end)
+       return (s);
+      switch (c)
+       {
+       case L('\\'):
+         continue;
+
+       case L('\0'):
+         return ((CHAR *)NULL);
+
+       /* `[' is not special inside a bracket expression, but it may
+          introduce one of the special POSIX bracket expressions
+          ([.SYM.], [=c=], [: ... :]) that needs special handling. */
+       case L('['):
+         if (bnest == 0)
+           {
+             bfirst = s + 1;
+             if (*bfirst == L('!') || *bfirst == L('^'))
+               bfirst++;
+             bnest++;
+           }
+         else if (s[1] == L(':') || s[1] == L('.') || s[1] == L('='))
+           cchar = s[1];
+         break;
+
+       /* `]' is not special if it's the first char (after a leading `!'
+          or `^') in a bracket expression or if it's part of one of the
+          special POSIX bracket expressions ([.SYM.], [=c=], [: ... :]) */
+       case L(']'):
+         if (bnest)
+           {
+             if (cchar && s[-1] == cchar)
+               cchar = 0;
+             else if (s != bfirst)
+               {
+                 bnest--;
+                 bfirst = 0;
+               }
+           }
+         break;
+
+       case L('('):
+         if (bnest == 0)
+           pnest++;
+         break;
+
+       case L(')'):
+         if (bnest == 0 && pnest-- <= 0)
+           return ++s;
+         break;
+
+       case L('|'):
+         if (bnest == 0 && pnest == 0 && delim == L('|'))
+           return ++s;
+         break;
+       }
+    }
+
+  return (NULL);
+}
+
+/* Return 0 if dequoted pattern matches S in the current locale. */
+static int
+STRCOMPARE (p, pe, s, se)
+     CHAR *p, *pe, *s, *se;
+{
+  int ret;
+  CHAR c1, c2;
+
+  c1 = *pe;
+  c2 = *se;
+
+  *pe = *se = '\0';
+#if HAVE_MULTIBYTE || defined (HAVE_STRCOLL)
+  ret = STRCOLL ((XCHAR *)p, (XCHAR *)s);
+#else
+  ret = STRCMP ((XCHAR *)p, (XCHAR *)s);
+#endif
+
+  *pe = c1;
+  *se = c2;
+
+  return (ret == 0 ? ret : FNM_NOMATCH);
+}
+
+/* Match a ksh extended pattern specifier.  Return FNM_NOMATCH on failure or
+   0 on success.  This is handed the entire rest of the pattern and string
+   the first time an extended pattern specifier is encountered, so it calls
+   gmatch recursively. */
+static int
+EXTMATCH (xc, s, se, p, pe, flags)
+     INT xc;           /* select which operation */
+     CHAR *s, *se;
+     CHAR *p, *pe;
+     int flags;
+{
+  CHAR *prest;                 /* pointer to rest of pattern */
+  CHAR *psub;                  /* pointer to sub-pattern */
+  CHAR *pnext;                 /* pointer to next sub-pattern */
+  CHAR *srest;                 /* pointer to rest of string */
+  int m1, m2;
+
+#if DEBUG_MATCHING
+fprintf(stderr, "extmatch: xc = %c\n", xc);
+fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);
+fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
+#endif
+
+  prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */
+  if (prest == 0)
+    /* If PREST is 0, we failed to scan a valid pattern.  In this
+       case, we just want to compare the two as strings. */
+    return (STRCOMPARE (p - 1, pe, s, se));
+
+  switch (xc)
+    {
+    case L('+'):               /* match one or more occurrences */
+    case L('*'):               /* match zero or more occurrences */
+      /* If we can get away with no matches, don't even bother.  Just
+        call GMATCH on the rest of the pattern and return success if
+        it succeeds. */
+      if (xc == L('*') && (GMATCH (s, se, prest, pe, flags) == 0))
+       return 0;
+
+      /* OK, we have to do this the hard way.  First, we make sure one of
+        the subpatterns matches, then we try to match the rest of the
+        string. */
+      for (psub = p + 1; ; psub = pnext)
+       {
+         pnext = PATSCAN (psub, pe, L('|'));
+         for (srest = s; srest <= se; srest++)
+           {
+             /* Match this substring (S -> SREST) against this
+                subpattern (psub -> pnext - 1) */
+             m1 = GMATCH (s, srest, psub, pnext - 1, flags) == 0;
+             /* OK, we matched a subpattern, so make sure the rest of the
+                string matches the rest of the pattern.  Also handle
+                multiple matches of the pattern. */
+             if (m1)
+               m2 = (GMATCH (srest, se, prest, pe, flags) == 0) ||
+                     (s != srest && GMATCH (srest, se, p - 1, pe, flags) == 0);
+             if (m1 && m2)
+               return (0);
+           }
+         if (pnext == prest)
+           break;
+       }
+      return (FNM_NOMATCH);
+
+    case L('?'):               /* match zero or one of the patterns */
+    case L('@'):               /* match exactly one of the patterns */
+      /* If we can get away with no matches, don't even bother.  Just
+        call gmatch on the rest of the pattern and return success if
+        it succeeds. */
+      if (xc == L('?') && (GMATCH (s, se, prest, pe, flags) == 0))
+       return 0;
+
+      /* OK, we have to do this the hard way.  First, we see if one of
+        the subpatterns matches, then, if it does, we try to match the
+        rest of the string. */
+      for (psub = p + 1; ; psub = pnext)
+       {
+         pnext = PATSCAN (psub, pe, L('|'));
+         srest = (prest == pe) ? se : s;
+         for ( ; srest <= se; srest++)
+           {
+             if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 &&
+                 GMATCH (srest, se, prest, pe, flags) == 0)
+               return (0);
+           }
+         if (pnext == prest)
+           break;
+       }
+      return (FNM_NOMATCH);
+
+    case '!':          /* match anything *except* one of the patterns */
+      for (srest = s; srest <= se; srest++)
+       {
+         m1 = 0;
+         for (psub = p + 1; ; psub = pnext)
+           {
+             pnext = PATSCAN (psub, pe, L('|'));
+             /* If one of the patterns matches, just bail immediately. */
+             if (m1 = (GMATCH (s, srest, psub, pnext - 1, flags) == 0))
+               break;
+             if (pnext == prest)
+               break;
+           }
+         if (m1 == 0 && GMATCH (srest, se, prest, pe, flags) == 0)
+           return (0);
+       }
+      return (FNM_NOMATCH);
+    }
+
+  return (FNM_NOMATCH);
+}
+#endif /* EXTENDED_GLOB */
+
+#undef IS_CCLASS
+#undef FOLD
+#undef CHAR
+#undef U_CHAR
+#undef XCHAR
+#undef INT
+#undef INVALID
+#undef FCT
+#undef GMATCH
+#undef COLLSYM
+#undef PARSE_COLLSYM
+#undef PATSCAN
+#undef STRCOMPARE
+#undef EXTMATCH
+#undef BRACKMATCH
+#undef STRCHR
+#undef STRCOLL
+#undef STRLEN
+#undef STRCMP
+#undef COLLEQUIV
+#undef RANGECMP
+#undef L
index 2a6d646de7decb61bc789bf8d87bf21620ed86d7..7559d32f6b36ce40615e8c634584735d95599d26 100644 (file)
@@ -77,6 +77,8 @@ static char *_rl_read_file PARAMS((char *, size_t *));
 static void _rl_init_file_error PARAMS((const char *));
 static int _rl_read_init_file PARAMS((const char *, int));
 static int glean_key_from_name PARAMS((char *));
+static int find_boolean_var PARAMS((const char *));
+
 static char *_rl_get_string_variable_value PARAMS((const char *));
 static int substring_member_of_array PARAMS((char *, const char **));
 
@@ -1206,13 +1208,19 @@ rl_parse_and_bind (string)
        *value++ = '\0';
       while (*value && whitespace (*value)) value++;
 
-      /* remove trailing whitespace */
-      e = value + strlen (value) - 1;
-      while (e >= value && whitespace (*e))
-        e--;
-      e++;             /* skip back to whitespace or EOS */
-      if (*e && e >= value)
-        *e = '\0';
+      /* Strip trailing whitespace from values to boolean variables.  Temp
+        fix until I get a real quoted-string parser here. */
+      i = find_boolean_var (var);
+      if (i >= 0)
+       {
+         /* remove trailing whitespace */
+         e = value + strlen (value) - 1;
+         while (e >= value && whitespace (*e))
+           e--;
+         e++;          /* skip back to whitespace or EOS */
+         if (*e && e >= value)
+           *e = '\0';
+       }
 
       rl_variable_bind (var, value);
       return 0;
index fd4c9fb2d6be7c1973da0ad3784676ad301a9958..ad0d5df7b71fa0661524c649b1dbbf9a2ab2c05a 100644 (file)
@@ -1,6 +1,6 @@
 /* bind.c -- key binding and startup file support for the readline library. */
 
-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
 
    This file is part of the GNU Readline Library, a library for
    reading lines of text with interactive input and history editing.
@@ -77,6 +77,8 @@ static char *_rl_read_file PARAMS((char *, size_t *));
 static void _rl_init_file_error PARAMS((const char *));
 static int _rl_read_init_file PARAMS((const char *, int));
 static int glean_key_from_name PARAMS((char *));
+static int find_boolean_var PARAMS((const char *));
+
 static char *_rl_get_string_variable_value PARAMS((const char *));
 static int substring_member_of_array PARAMS((char *, const char **));
 
@@ -342,7 +344,7 @@ rl_generic_bind (type, keyseq, data, map)
   k.function = 0;
 
   /* If no keys to bind to, exit right away. */
-  if (!keyseq || !*keyseq)
+  if (keyseq == 0 || *keyseq == 0)
     {
       if (type == ISMACR)
        free (data);
@@ -1206,13 +1208,20 @@ rl_parse_and_bind (string)
        *value++ = '\0';
       while (*value && whitespace (*value)) value++;
 
-      /* remove trailing whitespace */
-      e = value + strlen (value) - 1;
-      while (e >= value && whitespace (*e))
-        e--;
-      e++;             /* skip back to whitespace or EOS */
-      if (*e && e >= value)
-        *e = '\0';
+      /* Strip trailing whitespace from values to boolean variables.  Temp
+        fix until I get a real quoted-string parser here. */
+      i = find_boolean_var (var);
+
+      if (i >= 0)
+       {
+         /* remove trailing whitespace */
+         e = value + strlen (value) - 1;
+         while (e >= value && whitespace (*e))
+           e--;
+         e++;          /* skip back to whitespace or EOS */
+         if (*e && e >= value)
+           *e = '\0';
+       }
 
       rl_variable_bind (var, value);
       return 0;
@@ -1507,12 +1516,11 @@ rl_variable_value (name)
     return (*boolean_varlist[i].value ? "on" : "off");
 
   i = find_string_var (name);
+  if (i >= 0)
+    return (_rl_get_string_variable_value (string_varlist[i].name));
 
   /* Unknown variable names return NULL. */
-  if (i < 0)
-    return 0;
-
-  return (_rl_get_string_variable_value (string_varlist[i].name));
+  return 0;
 }
 
 int
index 0ab99c5112fa027aa0c4c6b2cc4f210afe138670..3688c4b826dce0e11e11d62727289630a6570b2f 100644 (file)
@@ -786,6 +786,7 @@ extern int rl_inhibit_completion;
 #define RL_STATE_CALLBACK      0x080000        /* using the callback interface */
 #define RL_STATE_VIMOTION      0x100000        /* reading vi motion arg */
 #define RL_STATE_MULTIKEY      0x200000        /* reading multiple-key command */
+#define RL_STATE_VICMDONCE     0x400000        /* entered vi command mode at least once */
 
 #define RL_STATE_DONE          0x800000        /* done; accepted line */
 
index 25c287b5a2df3df04c7d9fd98f1978949c6d7016..fedfa121fc0d7e68c89da0e5a63ae4ec395c214e 100644 (file)
@@ -237,7 +237,12 @@ rl_revert_line (count, key)
     {
       while (rl_undo_list)
        rl_do_undo ();
+#if defined (VI_MODE)
+      if (rl_editing_mode == vi_mode)
+       rl_point = rl_mark = 0;         /* rl_end should be set correctly */
+#endif
     }
+    
   return 0;
 }
 
index efaef3992b58706cac6bf85f7a80398eb9706b92..2fcc1dc9fa286a695cfc595b9e82962ef66286cc 100644 (file)
@@ -131,6 +131,8 @@ _rl_vi_initialize_line ()
 
   for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++)
     vi_mark_chars[i] = -1;
+
+  RL_UNSETSTATE(RL_STATE_VICMDONCE);
 }
 
 void
@@ -686,6 +688,13 @@ rl_vi_movement_mode (count, key)
 
   _rl_keymap = vi_movement_keymap;
   _rl_vi_done_inserting ();
+
+  /* This is how POSIX.2 says `U' should behave -- everything up until the
+     first time you go into command mode should not be undone. */
+  if (RL_ISSTATE (RL_STATE_VICMDONCE) == 0)
+    rl_free_undo_list ();
+
+  RL_SETSTATE (RL_STATE_VICMDONCE);
   return (0);
 }
 
diff --git a/redir.c b/redir.c
index 08715a0e5e29118a071c47efe8c499921e1723fc..c9e53351e8e42f476725d8e8b98db70b33ee3fd0 100644 (file)
--- a/redir.c
+++ b/redir.c
@@ -630,6 +630,9 @@ do_redirection_internal (redirect, flags)
   redirector = redirect->redirector;
   ri = redirect->instruction;
 
+if (redirect->flags & RX_INTERNAL)
+  flags |= RX_INTERNAL;
+
   if (TRANSLATE_REDIRECT (ri))
     {
       /* We have [N]>&WORD[-] or [N]<&WORD[-].  Expand WORD, then translate
@@ -903,8 +906,13 @@ do_redirection_internal (redirect, flags)
             always be open. */
          /* if ((already_set || set_unconditionally) && (ok_to_set))
                set_it () */
+#if 0
          if (((fcntl (redir_fd, F_GETFD, 0) == 1) || redir_fd < 2 || (flags & RX_CLEXEC)) &&
               (redirector > 2))
+#else
+         if (((fcntl (redir_fd, F_GETFD, 0) == 1) || (redir_fd < 2 && (flags & RX_INTERNAL)) || (flags & RX_CLEXEC)) &&
+              (redirector > 2))
+#endif
            SET_CLOSE_ON_EXEC (redirector);
 
          /* dup-and-close redirection */
@@ -961,6 +969,7 @@ add_undo_redirect (fd)
 
   rd.dest = 0;
   closer = make_redirection (new_fd, r_close_this, rd);
+  closer->flags |= RX_INTERNAL;
   dummy_redirect = copy_redirects (closer);
 
   rd.dest = new_fd;
@@ -968,6 +977,7 @@ add_undo_redirect (fd)
     new_redirect = make_redirection (fd, r_duplicating_input, rd);
   else
     new_redirect = make_redirection (fd, r_duplicating_output, rd);
+  new_redirect->flags |= RX_INTERNAL;
   new_redirect->next = closer;
 
   closer->next = redirection_undo_list;
@@ -1016,6 +1026,7 @@ add_undo_close_redirect (fd)
 
   rd.dest = 0;
   closer = make_redirection (fd, r_close_this, rd);
+  closer->flags |= RX_INTERNAL;
   closer->next = redirection_undo_list;
   redirection_undo_list = closer;
 }
diff --git a/redir.h b/redir.h
index acb91e7c13b87b18f02b6d5068967f9b374a890a..3eb72614709282daea8adc01ae28fbcc05068922 100644 (file)
--- a/redir.h
+++ b/redir.h
@@ -27,6 +27,8 @@
 #define RX_ACTIVE      0x01    /* do it; don't just go through the motions */
 #define RX_UNDOABLE    0x02    /* make a list to undo these redirections */
 #define RX_CLEXEC      0x04    /* set close-on-exec for opened fds > 2 */
+#define RX_INTERNAL    0x08
+#define RX_USER                0x10
 
 extern void redirection_error __P((REDIRECT *, int));
 extern int do_redirections __P((REDIRECT *, int));
diff --git a/subst.c b/subst.c
index fabaf155a37ed01983aab02f461030fb05c026b0..cb7638483bdc5a7e8b48266048e8a586c21e9db8 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -1010,6 +1010,7 @@ extract_array_assignment_list (string, sindex)
       *sindex = slen - 1;
       return ret;
     }
+  return 0;  
 }
 #endif
 
@@ -2325,7 +2326,7 @@ do_assignment_no_expand (string)
   td.flags = W_ASSIGNMENT;
   td.word = string;
 
-  do_assignment_internal (&td, 0);
+  return (do_assignment_internal (&td, 0));
 }
 
 /***************************************************
index d1ed8bc5451f0224c978b5be7634975a70945f5e..2432c13f2ce01a4c7d83d56f8e504371281cd23a 100644 (file)
 
 static char location_base[NULL_TERMINATED(MED_STR_MAX)] = "";
 
+static char th_page_and_sec[128] = { '\0' };
+static char th_datestr[128] = { '\0' };
+static char th_version[128] = { '\0' };
+
 char   *signature = "<HR>\nThis document was created by man2html from %s.<BR>\nTime: %s\n";
 
 /* timeformat for signature */
@@ -2148,6 +2152,26 @@ skip_till_newline(char *c)
        return c;
 }
 
+static void
+outputPageHeader(char *l, char *c, char *r)
+{
+       out_html("<TABLE WIDTH=100%>\n<TR>\n");
+       out_html("<TH ALIGN=LEFT width=33%>");
+       out_html(l);
+       out_html("<TH ALIGN=CENTER width=33%>");
+       out_html(c);
+       out_html("<TH ALIGN=RIGHT width=33%>");
+       out_html(r);
+       out_html("\n</TR>\n</TABLE>\n");
+}
+
+static void
+outputPageFooter(char *l, char *c, char *r)
+{
+       out_html("<HR>\n");
+       outputPageHeader(l, c, r);
+}
+
 static int ifelseval = 0;
 
 static char *
@@ -2836,15 +2860,15 @@ scan_request(char *c)
                        out_html(label);
                        /* &nbsp; for mosaic users */
                        if (mode)
-                               out_html("\">&nbsp;</A>\n<H3>");
+                               out_html("\">&nbsp;</A>\n<H4>");
                        else
-                               out_html("\">&nbsp;</A>\n<H2>");
+                               out_html("\">&nbsp;</A>\n<H3>");
                        mandoc_synopsis = strncmp(c, "SYNOPSIS", 8) == 0;
                        c = mandoc_command ? scan_troff_mandoc(c, 1, NULL) : scan_troff(c, 1, NULL);
                        if (mode)
-                               out_html("</H3>\n");
+                               out_html("</H4>\n");
                        else
-                               out_html("</H2>\n");
+                               out_html("</H3>\n");
                        curpos = 0;
                        break;
                case V('T', 'S'):
@@ -2856,25 +2880,31 @@ scan_request(char *c)
                        if (!output_possible) {
                                sl = fill_words(c + j, wordlist, &words);
                                if (words > 1) {
-                                       char    page_and_sec[128];
-
+                                       char    *t;
                                        for (i = 1; i < words; i++)
                                                wordlist[i][-1] = '\0';
                                        *sl = '\0';
                                        output_possible = 1;
-                                       sprintf(page_and_sec, "%s(%s)", wordlist[0], wordlist[1]);
+                                       sprintf(th_page_and_sec, "%s(%s)", wordlist[0], wordlist[1]);
+                                       if (words > 2) {
+                                               t = unescape(wordlist[2]);
+                                               strncpy(th_datestr, t, sizeof(th_datestr));
+                                               th_datestr[sizeof(th_datestr) - 1] = '\0';
+                                       } else
+                                               th_datestr[0] = '\0';
+                                       if (words > 3) {
+                                               t = unescape(wordlist[3]);
+                                               strncpy(th_version, t, sizeof(th_version));
+                                               th_version[sizeof(th_version) - 1] = '\0';
+                                       } else
+                                               th_version[0] = '\0';
                                        out_html("<HTML><HEAD>\n<TITLE>");
-                                       out_html(page_and_sec);
+                                       out_html(th_page_and_sec);
                                        out_html(" Manual Page");
                                        out_html("</TITLE>\n</HEAD>\n<BODY>");
-                                       out_html("<TABLE WIDTH=100%>\n");
-                                       out_html("<TH ALIGN=LEFT>");
-                                       out_html(page_and_sec);
-                                       out_html("<TH ALIGN=CENTER>");
-                                       out_html(unescape(wordlist[2]));
-                                       out_html("<TH ALIGN=RIGHT>");
-                                       out_html(page_and_sec);
-                                       out_html("\n</TABLE>\n");
+
+                                       outputPageHeader(th_page_and_sec, th_datestr, th_page_and_sec);
+                                       
                                        out_html("<BR><A HREF=\"#index\">Index</A>\n");
                                        *sl = '\n';
                                        out_html("<HR>\n");
@@ -4023,6 +4053,7 @@ main(int argc, char **argv)
        out_html(NEWLINE);
 
        if (output_possible) {
+               outputPageFooter(th_version, th_datestr, th_page_and_sec);
                /* &nbsp; for mosaic users */
                fputs("<HR>\n<A NAME=\"index\">&nbsp;</A><H2>Index</H2>\n<DL>\n", stdout);
                manidx[mip] = 0;
index 72ec06a2c1fd8dde92acea5e8ac773e35f1d061b..3efcf32d68e9722024b6ca9d67f9e81b2aa5ac04 100755 (executable)
@@ -1,4 +1,4 @@
-BUILD_DIR=/usr/local/build/bash/bash-current
+BUILD_DIR=/usr/local/build/chet/bash/bash-current
 THIS_SH=$BUILD_DIR/bash
 PATH=$PATH:$BUILD_DIR
 
index 5b2a1102a7d6e1be4b9564889fbbe4b28f9d5b0e..3fd371c701e5c472e540c759652bee9e36110b0c 100644 (file)
@@ -65,3 +65,5 @@ exec 4>&1 >&3 3>&-
 }`
 echo c4 is $c
 
+# fixed in bash-3.1
+echo 'exec <&3' | ${THIS_SH} 3<&0