mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-28 16:09:51 +02:00
commit bash-20141121 snapshot
This commit is contained in:
+143
-1
@@ -7045,7 +7045,7 @@ lib/readline/bind.c
|
||||
a terminal's `bracketed paste mode'. Code contributed by
|
||||
Daniel Colascione <dancol@dancol.org>
|
||||
|
||||
lib/readline/doc/{readline.3,rluser.texi}
|
||||
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
|
||||
- enable-bracketed-paste: add description
|
||||
|
||||
lib/readline/{readline.c,rlprivate.h}
|
||||
@@ -7267,3 +7267,145 @@ bashline.c
|
||||
- bash_execute_unix_command: if the command returns 124, we redraw
|
||||
the line unconditionally, including all lines of the prompt
|
||||
|
||||
11/18
|
||||
-----
|
||||
builtins/mapfile.def
|
||||
- mapfile_builtin: don't allow a valid array reference through to
|
||||
mapfile(), since it will just create a shell variable with that name.
|
||||
Bug and fix from Eduardo A. Bustamante López <dualbus@gmail.com>
|
||||
|
||||
11/19
|
||||
-----
|
||||
lib/readline/complete.c
|
||||
- _rl_colored_completion_prefix: new variable, if non-zero, and color
|
||||
support is compiled in, and the $LS_COLORS variable exists and
|
||||
contains color definitions, display any common prefix of a set of
|
||||
completions in blue when displaying all the possible completions.
|
||||
Doesn't work with menu-complete, which inserts possible completions
|
||||
inline
|
||||
- colored_prefix_start(), colored_prefix_end(): new functions, used to
|
||||
bracket colored completion prefixes
|
||||
- fnprint: if prefix_bytes is non-zero, and _rl_colored_completion_prefix
|
||||
is > 0, display the first PREFIX_BYTES bytes of the word bracketed
|
||||
by calls to colored_prefix_start and colored_prefix_end
|
||||
- print_filename: if _rl_colored_completion_prefix is > 0, compute the
|
||||
length in bytes of the common prefix and pass that to fnprint
|
||||
|
||||
lib/readline/readline.c
|
||||
- readline_initialize_everything: initialize the colors from $LS_COLORS
|
||||
if _rl_colored_completion_prefix is non-zero
|
||||
|
||||
lib/readline/colors.c
|
||||
- _rl_print_prefix_color: new function, changes text color to that
|
||||
defined for the common prefix of a set of possible completions
|
||||
(currently cyan, same as directories); currently uses C_PREFIX,
|
||||
defined in colors.h as C_DIR
|
||||
|
||||
lib/readline/colors.h
|
||||
- _rl_print_prefix_color: new extern declaration
|
||||
|
||||
lib/readline/bind.c
|
||||
- colored-completion-prefix: new bindable variable, if set, common
|
||||
prefix of a set of possible completions is displayed in color.
|
||||
Feature requested by several, most recently by Richard Neill
|
||||
<rn214@richardneill.org> (in a slightly different form) and
|
||||
Duy Nguyen <pclouds@gmail.com>
|
||||
|
||||
11/20
|
||||
-----
|
||||
builtins/printf.def
|
||||
- printf_builtin: allow null (empty) format strings supplied with
|
||||
-v var to set `var' to the empty string. That is, printf -v var ""
|
||||
is now the same as var="". Change suggested by Mike Frysinger
|
||||
<vapier@gentoo.org>
|
||||
|
||||
pathexp.h
|
||||
- FNMATCH_NOCASEGLOB: macro to decide whether or not to pass
|
||||
FNM_CASEFOLD flag to strmatch depending on whether glob_ignore_case
|
||||
is set; analogout to FNMATCH_IGNCASE
|
||||
|
||||
pathexp.c
|
||||
- glob_name_is_acceptable: use FNMATCH_NOCASEMATCH to determine flags
|
||||
passed to strmatch; if nocaseglob is used to generate glob matches,
|
||||
it should be used to generate ignored matches
|
||||
|
||||
11/21
|
||||
-----
|
||||
pcomplete.c
|
||||
- filter_stringlist: the call to strmatch now honors the setting of
|
||||
nocasematch. Feature request from Ville Skytta <ville.skytta@iki.fi>
|
||||
back in 2010
|
||||
|
||||
doc/bash.1,lib/readline/doc/rluser.texi
|
||||
- complete -X: document that filtering the list of possible completions
|
||||
honors the nocasematch option when performing matching
|
||||
|
||||
lib/glob/gmisc.c
|
||||
- include chartypes.h and strmatch.h for new defines
|
||||
- match_pattern_{wchar,char}: now take new third FLAGS argument, flags
|
||||
have same meanings as strmatch(); intent is to handle case
|
||||
insensitive comparisons under same conditions as strmatch
|
||||
- FOLD: imported case-folding define from sm_loop.c; wide and single-
|
||||
byte character versions
|
||||
- match_pattern_{wchar,char}: use FOLD when comparing characters to
|
||||
honor FNM_CASEFOLD if set in FLAGS argument
|
||||
|
||||
externs.h
|
||||
- match_pattern_{wchar,char}: updated extern declarations
|
||||
|
||||
subst.c
|
||||
- match_{upattern,wpattern}: update strmatch/wcsmatch calls to include
|
||||
FNMATCH_IGNCASE in flags argument
|
||||
- match_{upattern,wpattern}: update match_pattern_{char,wchar} calls
|
||||
to include FNMATCH_IGNCASE in flags argument (consistent with calls
|
||||
to strmatch). This makes pattern substitution word expansion honor
|
||||
nocasematch shell option. Feature requested by Davide Baldini
|
||||
<baldiniebaldini@gmail.com>
|
||||
- match_wpattern: make sure to fold case if necessary when doing simple
|
||||
matching
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- pattern substitution: updated description to include honoring setting
|
||||
of nocasematch when performing matching
|
||||
|
||||
subst.c
|
||||
- expand_word_internal: optimize handling of "$@" idiom by calling
|
||||
list_rest_of_args() and quote_list() directly at the top of the
|
||||
function instead of going through normal code path
|
||||
- cached_quoted_dollar_at: WORD_LIST of quoted positional parameters,
|
||||
used by same code above that optimizes "$@"; if non-null we just
|
||||
return a copy of the list; if null, we save a copy of the list we
|
||||
create
|
||||
- invalidate_cached_quoted_dollar_at: convenience function to allow
|
||||
other parts of the shell (e.g., remember_args()) to destroy the
|
||||
cached list of quoted positional parameter when the positional
|
||||
parameters change
|
||||
|
||||
builtins/common.c
|
||||
- remember_args: call invalidate_cached_quoted_dollar_at()
|
||||
|
||||
builtins/shift.def
|
||||
- shift_builtin: call invalidate_cached_quoted_dollar_at after modifying
|
||||
dollar_vars[]
|
||||
|
||||
builtins/source.def
|
||||
- maybe_pop_dollar_vars: call invalidate_cached_quoted_dollar_at just
|
||||
to be safe
|
||||
|
||||
11/23
|
||||
-----
|
||||
builtins/evalfile.c
|
||||
- _evalfile: return -1 if errno == ENOENT and the flags don't include
|
||||
FEVAL_ENOENTOK. If we print an error message we should return an
|
||||
error
|
||||
- force_execute_file: new function, reads and executes commands from
|
||||
a file but returns an error if file doesn't exist
|
||||
|
||||
builtins/common.h
|
||||
- force_execute_file: new extern declaration
|
||||
|
||||
shell.c
|
||||
- main: call start_debugger even if dollar_vars[1] == 0 if the shell
|
||||
isn't interactive (interactive_shell == 0)
|
||||
- start_debugger: call force_execute_file instead of maybe_execute_file;
|
||||
turn off debugging mode if it returns value < 0
|
||||
|
||||
+7394
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
Starting bash with the `--posix' command-line option or executing
|
||||
`set -o posix' while bash is running will cause bash to conform more
|
||||
closely to the Posix.2 standard by changing the behavior to match that
|
||||
specified by Posix.2 in areas where the bash default differs.
|
||||
|
||||
The following list is what's changed when `posix mode' is in effect:
|
||||
|
||||
1. When a command in the hash table no longer exists, bash will re-search
|
||||
$PATH to find the new location. This is also available with
|
||||
`shopt -s checkhash'.
|
||||
|
||||
2. The >& redirection does not redirect stdout and stderr.
|
||||
|
||||
3. The message printed by the job control code and builtins when a job
|
||||
exits with a non-zero status is `Done(status)'.
|
||||
|
||||
4. Reserved words may not be aliased.
|
||||
|
||||
5. The Posix.2 PS1 and PS2 expansions of `!' -> history number and
|
||||
`!!' -> `!' are enabled, and parameter expansion is performed on
|
||||
the value regardless of the setting of the `promptvars' option.
|
||||
|
||||
6. Interactive comments are enabled by default. (Note that bash has
|
||||
them on by default anyway.)
|
||||
|
||||
7. The Posix.2 startup files are executed ($ENV) rather than the normal
|
||||
bash files.
|
||||
|
||||
8. Tilde expansion is only performed on assignments preceding a command
|
||||
name, rather than on all assignment statements on the line.
|
||||
|
||||
9. The default history file is ~/.sh_history (default value of $HISTFILE).
|
||||
|
||||
10. The output of `kill -l' prints all the signal names on a single line,
|
||||
separated by spaces.
|
||||
|
||||
11. Non-interactive shells exit if `file' in `. file' is not found.
|
||||
|
||||
12. Redirection operators do not perform pathname expansion on the word
|
||||
in the redirection unless the shell is interactive
|
||||
|
||||
13. Function names must be valid shell identifiers. That is, they may not
|
||||
contain characters other than letters, digits, and underscores, and
|
||||
may not start with a digit. Declaring a function with an illegal name
|
||||
causes a fatal syntax error in non-interactive shells.
|
||||
|
||||
14. Posix.2 `special' builtins are found before shell functions during command
|
||||
lookup.
|
||||
|
||||
15. If a Posix.2 special builtin returns an error status, a non-interactive
|
||||
shell exits. The fatal errors are those listed in the POSIX.2 standard,
|
||||
and include things like passing incorrect options, redirection errors,
|
||||
variable assignment errors for assignments preceding the command name,
|
||||
and so on.
|
||||
|
||||
16. The environment passed to executed commands is not sorted. Neither is
|
||||
the output of `set'. This is not strictly Posix.2 behavior, but sh
|
||||
does it this way. Ksh does not. It's not necessary to sort the
|
||||
environment; no program should rely on it being sorted.
|
||||
|
||||
17. If the `cd' builtin finds a directory to change to using $CDPATH, the
|
||||
value it assigns to $PWD does not contain any symbolic links, as if
|
||||
`cd -P' had been executed.
|
||||
|
||||
18. A non-interactive shell exits with an error status if a variable
|
||||
assignment error occurs when no command name follows the assignment
|
||||
statements. A variable assignment error occurs, for example, when
|
||||
trying to assign a value to a read-only variable.
|
||||
|
||||
19. A non-interactive shell exits with an error status if the iteration
|
||||
variable in a for statement or the selection variable in a select
|
||||
statement is a read-only variable.
|
||||
|
||||
20. Process substitution is not available.
|
||||
|
||||
21. Assignment statements preceding POSIX.2 `special' builtins persist in
|
||||
the shell environment after the builtin completes.
|
||||
|
||||
There is other Posix.2 behavior that bash does not implement. Specifically:
|
||||
|
||||
1. Assignment statements affect the execution environment of all builtins,
|
||||
not just special ones.
|
||||
@@ -0,0 +1,544 @@
|
||||
This file is set.def, from which is created set.c.
|
||||
It implements the "set" and "unset" builtins in Bash.
|
||||
|
||||
Copyright (C) 1987, 1989, 1991 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$PRODUCES set.c
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../shell.h"
|
||||
#include "../flags.h"
|
||||
|
||||
#include "bashgetopt.h"
|
||||
|
||||
extern int interactive;
|
||||
extern int noclobber, posixly_correct;
|
||||
#if defined (READLINE)
|
||||
extern int rl_editing_mode, no_line_editing;
|
||||
#endif /* READLINE */
|
||||
|
||||
$BUILTIN set
|
||||
$FUNCTION set_builtin
|
||||
$SHORT_DOC set [--abefhkmnptuvxldBCHP] [-o option] [arg ...]
|
||||
-a Mark variables which are modified or created for export.
|
||||
-b Notify of job termination immediately.
|
||||
-e Exit immediately if a command exits with a non-zero status.
|
||||
-f Disable file name generation (globbing).
|
||||
-h Locate and remember function commands as functions are
|
||||
defined. Function commands are normally looked up when
|
||||
the function is executed.
|
||||
-i Force the shell to be an "interactive" one. Interactive shells
|
||||
always read `~/.bashrc' on startup.
|
||||
-k All keyword arguments are placed in the environment for a
|
||||
command, not just those that precede the command name.
|
||||
-m Job control is enabled.
|
||||
-n Read commands but do not execute them.
|
||||
-o option-name
|
||||
Set the variable corresponding to option-name:
|
||||
allexport same as -a
|
||||
braceexpand same as -B
|
||||
#if defined (READLINE)
|
||||
emacs use an emacs-style line editing interface
|
||||
#endif /* READLINE */
|
||||
errexit same as -e
|
||||
histexpand same as -H
|
||||
ignoreeof the shell will not exit upon reading EOF
|
||||
interactive-comments
|
||||
allow comments to appear in interactive commands
|
||||
monitor same as -m
|
||||
noclobber disallow redirection to existing files
|
||||
noexec same as -n
|
||||
noglob same as -f
|
||||
nohash same as -d
|
||||
notify save as -b
|
||||
nounset same as -u
|
||||
physical same as -P
|
||||
posix change the behavior of bash where the default
|
||||
operation differs from the 1003.2 standard to
|
||||
match the standard
|
||||
privileged same as -p
|
||||
verbose same as -v
|
||||
#if defined (READLINE)
|
||||
vi use a vi-style line editing interface
|
||||
#endif /* READLINE */
|
||||
xtrace same as -x
|
||||
-p Turned on whenever the real and effective user ids do not match.
|
||||
Disables processing of the $ENV file and importing of shell
|
||||
functions. Turning this option off causes the effective uid and
|
||||
gid to be set to the real uid and gid.
|
||||
-t Exit after reading and executing one command.
|
||||
-u Treat unset variables as an error when substituting.
|
||||
-v Print shell input lines as they are read.
|
||||
-x Print commands and their arguments as they are executed.
|
||||
-l Save and restore the binding of the NAME in a FOR command.
|
||||
-d Disable the hashing of commands that are looked up for execution.
|
||||
Normally, commands are remembered in a hash table, and once
|
||||
found, do not have to be looked up again.
|
||||
#if defined (BRACE_EXPANSION)
|
||||
-B the shell will perform brace expansion
|
||||
#endif /* BRACE_EXPANSION */
|
||||
#if defined (BANG_HISTORY)
|
||||
-H Enable ! style history substitution. This flag is on
|
||||
by default.
|
||||
#endif /* BANG_HISTORY */
|
||||
-C If set, disallow existing regular files to be overwritten
|
||||
by redirection of output.
|
||||
-P If set, do not follow symbolic links when executing commands
|
||||
such as cd which change the current directory.
|
||||
|
||||
Using + rather than - causes these flags to be turned off. The
|
||||
flags can also be used upon invocation of the shell. The current
|
||||
set of flags may be found in $-. The remaining n ARGs are positional
|
||||
parameters and are assigned, in order, to $1, $2, .. $n. If no
|
||||
ARGs are given, all shell variables are printed.
|
||||
$END
|
||||
|
||||
/* An a-list used to match long options for set -o to the corresponding
|
||||
option letter. */
|
||||
struct {
|
||||
char *name;
|
||||
int letter;
|
||||
} o_options[] = {
|
||||
{ "allexport", 'a' },
|
||||
#if defined (BRACE_EXPANSION)
|
||||
{ "braceexpand",'B' },
|
||||
#endif
|
||||
{ "errexit", 'e' },
|
||||
{ "histexpand", 'H' },
|
||||
{ "monitor", 'm' },
|
||||
{ "noexec", 'n' },
|
||||
{ "noglob", 'f' },
|
||||
{ "nohash", 'd' },
|
||||
#if defined (JOB_CONTROL)
|
||||
{ "notify", 'b' },
|
||||
#endif /* JOB_CONTROL */
|
||||
{"nounset", 'u' },
|
||||
{"physical", 'P' },
|
||||
{"privileged", 'p' },
|
||||
{"verbose", 'v' },
|
||||
{"xtrace", 'x' },
|
||||
{(char *)NULL, 0},
|
||||
};
|
||||
|
||||
#define MINUS_O_FORMAT "%-15s\t%s\n"
|
||||
|
||||
void
|
||||
list_minus_o_opts ()
|
||||
{
|
||||
register int i;
|
||||
char *on = "on", *off = "off";
|
||||
|
||||
printf (MINUS_O_FORMAT, "noclobber", (noclobber == 1) ? on : off);
|
||||
|
||||
if (find_variable ("ignoreeof") || find_variable ("IGNOREEOF"))
|
||||
printf (MINUS_O_FORMAT, "ignoreeof", on);
|
||||
else
|
||||
printf (MINUS_O_FORMAT, "ignoreeof", off);
|
||||
|
||||
printf (MINUS_O_FORMAT, "interactive-comments",
|
||||
interactive_comments ? on : off);
|
||||
|
||||
printf (MINUS_O_FORMAT, "posix", posixly_correct ? on : off);
|
||||
|
||||
#if defined (READLINE)
|
||||
if (no_line_editing)
|
||||
{
|
||||
printf (MINUS_O_FORMAT, "emacs", off);
|
||||
printf (MINUS_O_FORMAT, "vi", off);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Magic. This code `knows' how readline handles rl_editing_mode. */
|
||||
printf (MINUS_O_FORMAT, "emacs", (rl_editing_mode == 1) ? on : off);
|
||||
printf (MINUS_O_FORMAT, "vi", (rl_editing_mode == 0) ? on : off);
|
||||
}
|
||||
#endif /* READLINE */
|
||||
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
{
|
||||
int *on_or_off, zero = 0;
|
||||
|
||||
on_or_off = find_flag (o_options[i].letter);
|
||||
if (on_or_off == FLAG_UNKNOWN)
|
||||
on_or_off = &zero;
|
||||
printf (MINUS_O_FORMAT, o_options[i].name, (*on_or_off == 1) ? on : off);
|
||||
}
|
||||
}
|
||||
|
||||
set_minus_o_option (on_or_off, option_name)
|
||||
int on_or_off;
|
||||
char *option_name;
|
||||
{
|
||||
int option_char = -1;
|
||||
|
||||
if (STREQ (option_name, "noclobber"))
|
||||
{
|
||||
if (on_or_off == FLAG_ON)
|
||||
bind_variable ("noclobber", "");
|
||||
else
|
||||
unbind_variable ("noclobber");
|
||||
stupidly_hack_special_variables ("noclobber");
|
||||
}
|
||||
else if (STREQ (option_name, "ignoreeof"))
|
||||
{
|
||||
unbind_variable ("ignoreeof");
|
||||
unbind_variable ("IGNOREEOF");
|
||||
if (on_or_off == FLAG_ON)
|
||||
bind_variable ("IGNOREEOF", "10");
|
||||
stupidly_hack_special_variables ("IGNOREEOF");
|
||||
}
|
||||
|
||||
#if defined (READLINE)
|
||||
else if ((STREQ (option_name, "emacs")) || (STREQ (option_name, "vi")))
|
||||
{
|
||||
if (on_or_off == FLAG_ON)
|
||||
{
|
||||
rl_variable_bind ("editing-mode", option_name);
|
||||
|
||||
if (interactive)
|
||||
with_input_from_stdin ();
|
||||
no_line_editing = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int isemacs = (rl_editing_mode == 1);
|
||||
if ((isemacs && STREQ (option_name, "emacs")) ||
|
||||
(!isemacs && STREQ (option_name, "vi")))
|
||||
{
|
||||
if (interactive)
|
||||
with_input_from_stream (stdin, "stdin");
|
||||
no_line_editing = 1;
|
||||
}
|
||||
else
|
||||
builtin_error ("not in %s editing mode", option_name);
|
||||
}
|
||||
}
|
||||
#endif /* READLINE */
|
||||
else if (STREQ (option_name, "interactive-comments"))
|
||||
interactive_comments = (on_or_off == FLAG_ON);
|
||||
else if (STREQ (option_name, "posix"))
|
||||
{
|
||||
posixly_correct = (on_or_off == FLAG_ON);
|
||||
unbind_variable ("POSIXLY_CORRECT");
|
||||
unbind_variable ("POSIX_PEDANTIC");
|
||||
if (on_or_off == FLAG_ON)
|
||||
{
|
||||
bind_variable ("POSIXLY_CORRECT", "");
|
||||
stupidly_hack_special_variables ("POSIXLY_CORRECT");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
for (i = 0; o_options[i].name; i++)
|
||||
{
|
||||
if (STREQ (option_name, o_options[i].name))
|
||||
{
|
||||
option_char = o_options[i].letter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (option_char == -1)
|
||||
{
|
||||
builtin_error ("%s: unknown option name", option_name);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
if (change_flag (option_char, on_or_off) == FLAG_ERROR)
|
||||
{
|
||||
bad_option (option_name);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
/* Set some flags from the word values in the input list. If LIST is empty,
|
||||
then print out the values of the variables instead. If LIST contains
|
||||
non-flags, then set $1 - $9 to the successive words of LIST. */
|
||||
set_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int on_or_off, flag_name, force_assignment = 0;
|
||||
|
||||
if (!list)
|
||||
{
|
||||
SHELL_VAR **vars;
|
||||
|
||||
vars = all_shell_variables ();
|
||||
if (vars)
|
||||
{
|
||||
print_var_list (vars);
|
||||
free (vars);
|
||||
}
|
||||
|
||||
vars = all_shell_functions ();
|
||||
if (vars)
|
||||
{
|
||||
print_var_list (vars);
|
||||
free (vars);
|
||||
}
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
/* Check validity of flag arguments. */
|
||||
if (*list->word->word == '-' || *list->word->word == '+')
|
||||
{
|
||||
register char *arg;
|
||||
WORD_LIST *save_list = list;
|
||||
|
||||
while (list && (arg = list->word->word))
|
||||
{
|
||||
char c;
|
||||
|
||||
if (arg[0] != '-' && arg[0] != '+')
|
||||
break;
|
||||
|
||||
/* `-' or `--' signifies end of flag arguments. */
|
||||
if (arg[0] == '-' &&
|
||||
(!arg[1] || (arg[1] == '-' && !arg[2])))
|
||||
break;
|
||||
|
||||
while (c = *++arg)
|
||||
{
|
||||
if (find_flag (c) == FLAG_UNKNOWN && c != 'o')
|
||||
{
|
||||
char s[2];
|
||||
s[0] = c; s[1] = '\0';
|
||||
bad_option (s);
|
||||
if (c == '?')
|
||||
builtin_usage ();
|
||||
return (c == '?' ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
|
||||
}
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
list = save_list;
|
||||
}
|
||||
|
||||
/* Do the set command. While the list consists of words starting with
|
||||
'-' or '+' treat them as flags, otherwise, start assigning them to
|
||||
$1 ... $n. */
|
||||
while (list)
|
||||
{
|
||||
char *string = list->word->word;
|
||||
|
||||
/* If the argument is `--' or `-' then signal the end of the list
|
||||
and remember the remaining arguments. */
|
||||
if (string[0] == '-' && (!string[1] || (string[1] == '-' && !string[2])))
|
||||
{
|
||||
list = list->next;
|
||||
|
||||
/* `set --' unsets the positional parameters. */
|
||||
if (string[1] == '-')
|
||||
force_assignment = 1;
|
||||
|
||||
/* Until told differently, the old shell behaviour of
|
||||
`set - [arg ...]' being equivalent to `set +xv [arg ...]'
|
||||
stands. Posix.2 says the behaviour is marked as obsolescent. */
|
||||
else
|
||||
{
|
||||
change_flag ('x', '+');
|
||||
change_flag ('v', '+');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((on_or_off = *string) &&
|
||||
(on_or_off == '-' || on_or_off == '+'))
|
||||
{
|
||||
int i = 1;
|
||||
while (flag_name = string[i++])
|
||||
{
|
||||
if (flag_name == '?')
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
else if (flag_name == 'o') /* -+o option-name */
|
||||
{
|
||||
char *option_name;
|
||||
WORD_LIST *opt;
|
||||
|
||||
opt = list->next;
|
||||
|
||||
if (!opt)
|
||||
{
|
||||
list_minus_o_opts ();
|
||||
continue;
|
||||
}
|
||||
|
||||
option_name = opt->word->word;
|
||||
|
||||
if (!option_name || !*option_name || (*option_name == '-'))
|
||||
{
|
||||
list_minus_o_opts ();
|
||||
continue;
|
||||
}
|
||||
list = list->next; /* Skip over option name. */
|
||||
|
||||
if (set_minus_o_option (on_or_off, option_name) != EXECUTION_SUCCESS)
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (change_flag (flag_name, on_or_off) == FLAG_ERROR)
|
||||
{
|
||||
char opt[3];
|
||||
opt[0] = on_or_off;
|
||||
opt[1] = flag_name;
|
||||
opt[2] = '\0';
|
||||
bad_option (opt);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
/* Assigning $1 ... $n */
|
||||
if (list || force_assignment)
|
||||
remember_args (list, 1);
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
$BUILTIN unset
|
||||
$FUNCTION unset_builtin
|
||||
$SHORT_DOC unset [-f] [-v] [name ...]
|
||||
For each NAME, remove the corresponding variable or function. Given
|
||||
the `-v', unset will only act on variables. Given the `-f' flag,
|
||||
unset will only act on functions. With neither flag, unset first
|
||||
tries to unset a variable, and if that fails, then tries to unset a
|
||||
function. Some variables (such as PATH and IFS) cannot be unset; also
|
||||
see readonly.
|
||||
$END
|
||||
|
||||
#define NEXT_VARIABLE() any_failed++; list = list->next; continue;
|
||||
|
||||
unset_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int unset_function, unset_variable, unset_array, opt, any_failed;
|
||||
char *name;
|
||||
|
||||
unset_function = unset_variable = unset_array = any_failed = 0;
|
||||
|
||||
reset_internal_getopt ();
|
||||
while ((opt = internal_getopt (list, "fv")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'f':
|
||||
unset_function = 1;
|
||||
break;
|
||||
case 'v':
|
||||
unset_variable = 1;
|
||||
break;
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
list = loptend;
|
||||
|
||||
if (unset_function && unset_variable)
|
||||
{
|
||||
builtin_error ("cannot simultaneously unset a function and a variable");
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
while (list)
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
int tem;
|
||||
#if defined (ARRAY_VARS)
|
||||
char *t;
|
||||
#endif
|
||||
|
||||
name = list->word->word;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (!unset_function && valid_array_reference (name))
|
||||
{
|
||||
t = strchr (name, '[');
|
||||
*t++ = '\0';
|
||||
unset_array++;
|
||||
}
|
||||
#endif
|
||||
|
||||
var = unset_function ? find_function (name) : find_variable (name);
|
||||
|
||||
if (var && !unset_function && non_unsettable_p (var))
|
||||
{
|
||||
builtin_error ("%s: cannot unset", name);
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
|
||||
/* Posix.2 says that unsetting readonly variables is an error. */
|
||||
if (var && readonly_p (var))
|
||||
{
|
||||
builtin_error ("%s: cannot unset: readonly %s",
|
||||
name, unset_function ? "function" : "variable");
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
|
||||
/* Unless the -f option is supplied, the name refers to a variable. */
|
||||
#if defined (ARRAY_VARS)
|
||||
if (var && unset_array)
|
||||
{
|
||||
if (array_p (var) == 0)
|
||||
{
|
||||
builtin_error ("%s: not an array variable", name);
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
else
|
||||
tem = unbind_array_element (var, t);
|
||||
}
|
||||
else
|
||||
#endif /* ARRAY_VARS */
|
||||
tem = makunbound (name, unset_function ? shell_functions : shell_variables);
|
||||
|
||||
/* This is what Posix.2 draft 11+ says. ``If neither -f nor -v
|
||||
is specified, the name refers to a variable; if a variable by
|
||||
that name does not exist, a function by that name, if any,
|
||||
shall be unset.'' */
|
||||
if ((tem == -1) && !unset_function && !unset_variable)
|
||||
tem = makunbound (name, shell_functions);
|
||||
|
||||
if (tem == -1)
|
||||
any_failed++;
|
||||
else if (!unset_function)
|
||||
stupidly_hack_special_variables (name);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
if (any_failed)
|
||||
return (EXECUTION_FAILURE);
|
||||
else
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* unwind_prot.h - Macros and functions for hacking unwind protection. */
|
||||
|
||||
/* Copyright (C) 1993 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_UNWIND_PROT_H)
|
||||
#define _UNWIND_PROT_H
|
||||
|
||||
/* Run a function without interrupts. */
|
||||
extern void begin_unwind_frame ();
|
||||
extern void discard_unwind_frame ();
|
||||
extern void run_unwind_frame ();
|
||||
extern void add_unwind_protect ();
|
||||
extern void remove_unwind_protect ();
|
||||
extern void run_unwind_protects ();
|
||||
extern void unwind_protect_var ();
|
||||
|
||||
/* Define for people who like their code to look a certain way. */
|
||||
#define end_unwind_frame()
|
||||
|
||||
/* How to protect an integer. */
|
||||
#define unwind_protect_int(X) unwind_protect_var (&(X), (char *)(X), sizeof (int))
|
||||
|
||||
/* How to protect a pointer to a string. */
|
||||
#define unwind_protect_string(X) \
|
||||
unwind_protect_var ((int *)&(X), (X), sizeof (char *))
|
||||
|
||||
/* How to protect any old pointer. */
|
||||
#define unwind_protect_pointer(X) unwind_protect_string (X)
|
||||
|
||||
/* How to protect the contents of a jmp_buf. */
|
||||
#define unwind_protect_jmp_buf(X) \
|
||||
unwind_protect_var ((int *)(X), (char *)(X), sizeof (procenv_t))
|
||||
|
||||
#endif /* _UNWIND_PROT_H */
|
||||
@@ -972,6 +972,8 @@ tests/getopts4.sub f
|
||||
tests/getopts5.sub f
|
||||
tests/getopts6.sub f
|
||||
tests/getopts7.sub f
|
||||
tests/getopts8.sub f
|
||||
tests/getopts9.sub f
|
||||
tests/glob.tests f
|
||||
tests/glob1.sub f
|
||||
tests/glob.right f
|
||||
|
||||
@@ -411,6 +411,8 @@ remember_args (list, destructive)
|
||||
|
||||
if (destructive)
|
||||
set_dollar_vars_changed ();
|
||||
|
||||
invalidate_cached_quoted_dollar_at ();
|
||||
}
|
||||
|
||||
static int changed_dollar_vars;
|
||||
|
||||
@@ -195,6 +195,7 @@ extern int parse_string __P((char *, const char *, int, char **));
|
||||
|
||||
/* Functions from evalfile.c */
|
||||
extern int maybe_execute_file __P((const char *, int));
|
||||
extern int force_execute_file __P((const char *, int));
|
||||
extern int source_file __P((const char *, int));
|
||||
extern int fc_execute_file __P((const char *));
|
||||
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
/* common.h -- extern declarations for functions defined in common.c. */
|
||||
|
||||
/* Copyright (C) 1993-2010 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 3 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (__COMMON_H)
|
||||
# define __COMMON_H
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
|
||||
#define ISHELP(s) (STREQ ((s), "--help"))
|
||||
|
||||
#define CHECK_HELPOPT(l) \
|
||||
do { \
|
||||
if ((l) && (l)->word && ISHELP((l)->word->word)) \
|
||||
{ \
|
||||
builtin_help (); \
|
||||
return (EX_USAGE); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CASE_HELPOPT \
|
||||
case GETOPT_HELP: \
|
||||
builtin_help (); \
|
||||
return (EX_USAGE)
|
||||
|
||||
/* Flag values for parse_and_execute () */
|
||||
#define SEVAL_NONINT 0x001
|
||||
#define SEVAL_INTERACT 0x002
|
||||
#define SEVAL_NOHIST 0x004
|
||||
#define SEVAL_NOFREE 0x008
|
||||
#define SEVAL_RESETLINE 0x010
|
||||
#define SEVAL_PARSEONLY 0x020
|
||||
#define SEVAL_NOLONGJMP 0x040
|
||||
#define SEVAL_FUNCDEF 0x080 /* only allow function definitions */
|
||||
#define SEVAL_ONECMD 0x100 /* only allow a single command */
|
||||
|
||||
/* Flags for describe_command, shared between type.def and command.def */
|
||||
#define CDESC_ALL 0x001 /* type -a */
|
||||
#define CDESC_SHORTDESC 0x002 /* command -V */
|
||||
#define CDESC_REUSABLE 0x004 /* command -v */
|
||||
#define CDESC_TYPE 0x008 /* type -t */
|
||||
#define CDESC_PATH_ONLY 0x010 /* type -p */
|
||||
#define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */
|
||||
#define CDESC_NOFUNCS 0x040 /* type -f */
|
||||
#define CDESC_ABSPATH 0x080 /* convert to absolute path, no ./ */
|
||||
|
||||
/* Flags for get_job_by_name */
|
||||
#define JM_PREFIX 0x01 /* prefix of job name */
|
||||
#define JM_SUBSTRING 0x02 /* substring of job name */
|
||||
#define JM_EXACT 0x04 /* match job name exactly */
|
||||
#define JM_STOPPED 0x08 /* match stopped jobs only */
|
||||
#define JM_FIRSTMATCH 0x10 /* return first matching job */
|
||||
|
||||
/* Flags for remember_args and value of changed_dollar_vars */
|
||||
#define ARGS_NONE 0x0
|
||||
#define ARGS_INVOC 0x01
|
||||
#define ARGS_FUNC 0x02
|
||||
#define ARGS_SETBLTIN 0x04
|
||||
|
||||
/* Functions from common.c */
|
||||
extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
|
||||
extern void builtin_warning __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
|
||||
extern void builtin_usage __P((void));
|
||||
extern void no_args __P((WORD_LIST *));
|
||||
extern int no_options __P((WORD_LIST *));
|
||||
|
||||
/* common error message functions */
|
||||
extern void sh_needarg __P((char *));
|
||||
extern void sh_neednumarg __P((char *));
|
||||
extern void sh_notfound __P((char *));
|
||||
extern void sh_invalidopt __P((char *));
|
||||
extern void sh_invalidoptname __P((char *));
|
||||
extern void sh_invalidid __P((char *));
|
||||
extern void sh_invalidnum __P((char *));
|
||||
extern void sh_invalidsig __P((char *));
|
||||
extern void sh_erange __P((char *, char *));
|
||||
extern void sh_badpid __P((char *));
|
||||
extern void sh_badjob __P((char *));
|
||||
extern void sh_readonly __P((const char *));
|
||||
extern void sh_nojobs __P((char *));
|
||||
extern void sh_restricted __P((char *));
|
||||
extern void sh_notbuiltin __P((char *));
|
||||
extern void sh_wrerror __P((void));
|
||||
extern void sh_ttyerror __P((int));
|
||||
extern int sh_chkwrite __P((int));
|
||||
|
||||
extern char **make_builtin_argv __P((WORD_LIST *, int *));
|
||||
extern void remember_args __P((WORD_LIST *, int));
|
||||
|
||||
extern int dollar_vars_changed __P((void));
|
||||
extern void set_dollar_vars_unchanged __P((void));
|
||||
extern void set_dollar_vars_changed __P((void));
|
||||
|
||||
extern int get_numeric_arg __P((WORD_LIST *, int, intmax_t *));
|
||||
extern int get_exitstat __P((WORD_LIST *));
|
||||
extern int read_octal __P((char *));
|
||||
|
||||
/* Keeps track of the current working directory. */
|
||||
extern char *the_current_working_directory;
|
||||
extern char *get_working_directory __P((char *));
|
||||
extern void set_working_directory __P((char *));
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
extern int get_job_by_name __P((const char *, int));
|
||||
extern int get_job_spec __P((WORD_LIST *));
|
||||
#endif
|
||||
extern int display_signal_list __P((WORD_LIST *, int));
|
||||
|
||||
/* It's OK to declare a function as returning a Function * without
|
||||
providing a definition of what a `Function' is. */
|
||||
extern struct builtin *builtin_address_internal __P((char *, int));
|
||||
extern sh_builtin_func_t *find_shell_builtin __P((char *));
|
||||
extern sh_builtin_func_t *builtin_address __P((char *));
|
||||
extern sh_builtin_func_t *find_special_builtin __P((char *));
|
||||
extern void initialize_shell_builtins __P((void));
|
||||
|
||||
/* Functions from exit.def */
|
||||
extern void bash_logout __P((void));
|
||||
|
||||
/* Functions from getopts.def */
|
||||
extern void getopts_reset __P((int));
|
||||
|
||||
/* Functions from help.def */
|
||||
extern void builtin_help __P((void));
|
||||
|
||||
/* Functions from read.def */
|
||||
extern void read_tty_cleanup __P((void));
|
||||
|
||||
/* Functions from set.def */
|
||||
extern int minus_o_option_value __P((char *));
|
||||
extern void list_minus_o_opts __P((int, int));
|
||||
extern char **get_minus_o_opts __P((void));
|
||||
extern int set_minus_o_option __P((int, char *));
|
||||
|
||||
extern void set_shellopts __P((void));
|
||||
extern void parse_shellopts __P((char *));
|
||||
extern void initialize_shell_options __P((int));
|
||||
|
||||
extern void reset_shell_options __P((void));
|
||||
|
||||
/* Functions from shopt.def */
|
||||
extern void reset_shopt_options __P((void));
|
||||
extern char **get_shopt_options __P((void));
|
||||
|
||||
extern int shopt_setopt __P((char *, int));
|
||||
extern int shopt_listopt __P((char *, int));
|
||||
|
||||
extern int set_login_shell __P((char *, int));
|
||||
|
||||
extern void set_bashopts __P((void));
|
||||
extern void parse_bashopts __P((char *));
|
||||
extern void initialize_bashopts __P((int));
|
||||
|
||||
extern void set_compatibility_opts __P((void));
|
||||
|
||||
/* Functions from type.def */
|
||||
extern int describe_command __P((char *, int));
|
||||
|
||||
/* Functions from setattr.def */
|
||||
extern int set_or_show_attributes __P((WORD_LIST *, int, int));
|
||||
extern int show_all_var_attributes __P((int, int));
|
||||
extern int show_var_attributes __P((SHELL_VAR *, int, int));
|
||||
extern int show_name_attributes __P((char *, int));
|
||||
extern int show_func_attributes __P((char *, int));
|
||||
extern void set_var_attribute __P((char *, int, int));
|
||||
|
||||
/* Functions from pushd.def */
|
||||
extern char *get_dirstack_from_string __P((char *));
|
||||
extern char *get_dirstack_element __P((intmax_t, int));
|
||||
extern void set_dirstack_element __P((intmax_t, int, char *));
|
||||
extern WORD_LIST *get_directory_stack __P((int));
|
||||
|
||||
/* Functions from evalstring.c */
|
||||
extern int parse_and_execute __P((char *, const char *, int));
|
||||
extern int evalstring __P((char *, const char *, int));
|
||||
extern void parse_and_execute_cleanup __P((void));
|
||||
extern int parse_string __P((char *, const char *, int, char **));
|
||||
|
||||
/* Functions from evalfile.c */
|
||||
extern int maybe_execute_file __P((const char *, int));
|
||||
extern int source_file __P((const char *, int));
|
||||
extern int fc_execute_file __P((const char *));
|
||||
|
||||
#endif /* !__COMMON_H */
|
||||
+18
-1
@@ -130,7 +130,7 @@ file_error_and_exit:
|
||||
}
|
||||
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE
|
||||
: ((errno == ENOENT) ? 0 : -1));
|
||||
: ((errno == ENOENT && (flags & FEVAL_ENOENTOK) != 0) ? 0 : -1));
|
||||
}
|
||||
|
||||
errfunc = ((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
|
||||
@@ -322,6 +322,23 @@ maybe_execute_file (fname, force_noninteractive)
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
force_execute_file (fname, force_noninteractive)
|
||||
const char *fname;
|
||||
int force_noninteractive;
|
||||
{
|
||||
char *filename;
|
||||
int result, flags;
|
||||
|
||||
filename = bash_tilde_expand (fname, 0);
|
||||
flags = 0;
|
||||
if (force_noninteractive)
|
||||
flags |= FEVAL_NONINT;
|
||||
result = _evalfile (filename, flags);
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined (HISTORY)
|
||||
int
|
||||
fc_execute_file (filename)
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
/* evalfile.c - read and evaluate commands from a file or file descriptor */
|
||||
|
||||
/* Copyright (C) 1996-2009 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 3 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../bashtypes.h"
|
||||
#include "posixstat.h"
|
||||
#include "filecntl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../bashansi.h"
|
||||
#include "../bashintl.h"
|
||||
|
||||
#include "../shell.h"
|
||||
#include "../jobs.h"
|
||||
#include "../builtins.h"
|
||||
#include "../flags.h"
|
||||
#include "../input.h"
|
||||
#include "../execute_cmd.h"
|
||||
#include "../trap.h"
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "../bashhist.h"
|
||||
#endif
|
||||
|
||||
#include <typemax.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* Flags for _evalfile() */
|
||||
#define FEVAL_ENOENTOK 0x001
|
||||
#define FEVAL_BUILTIN 0x002
|
||||
#define FEVAL_UNWINDPROT 0x004
|
||||
#define FEVAL_NONINT 0x008
|
||||
#define FEVAL_LONGJMP 0x010
|
||||
#define FEVAL_HISTORY 0x020
|
||||
#define FEVAL_CHECKBINARY 0x040
|
||||
#define FEVAL_REGFILE 0x080
|
||||
#define FEVAL_NOPUSHARGS 0x100
|
||||
|
||||
extern int posixly_correct;
|
||||
extern int indirection_level, subshell_environment;
|
||||
extern int return_catch_flag, return_catch_value;
|
||||
extern int last_command_exit_value;
|
||||
extern int executing_command_builtin;
|
||||
|
||||
/* How many `levels' of sourced files we have. */
|
||||
int sourcelevel = 0;
|
||||
|
||||
static int
|
||||
_evalfile (filename, flags)
|
||||
const char *filename;
|
||||
int flags;
|
||||
{
|
||||
volatile int old_interactive;
|
||||
procenv_t old_return_catch;
|
||||
int return_val, fd, result, pflags, i, nnull;
|
||||
ssize_t nr; /* return value from read(2) */
|
||||
char *string;
|
||||
struct stat finfo;
|
||||
size_t file_size;
|
||||
sh_vmsg_func_t *errfunc;
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
|
||||
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
|
||||
# if defined (DEBUGGER)
|
||||
SHELL_VAR *bash_argv_v, *bash_argc_v;
|
||||
ARRAY *bash_argv_a, *bash_argc_a;
|
||||
# endif
|
||||
char *t, tt[2];
|
||||
#endif
|
||||
|
||||
USE_VAR(pflags);
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
|
||||
GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a);
|
||||
GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a);
|
||||
# if defined (DEBUGGER)
|
||||
GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a);
|
||||
GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
fd = open (filename, O_RDONLY);
|
||||
|
||||
if (fd < 0 || (fstat (fd, &finfo) == -1))
|
||||
{
|
||||
i = errno;
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
errno = i;
|
||||
|
||||
file_error_and_exit:
|
||||
if (((flags & FEVAL_ENOENTOK) == 0) || errno != ENOENT)
|
||||
file_error (filename);
|
||||
|
||||
if (flags & FEVAL_LONGJMP)
|
||||
{
|
||||
last_command_exit_value = 1;
|
||||
jump_to_top_level (EXITPROG);
|
||||
}
|
||||
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE
|
||||
: ((errno == ENOENT && (flags & FEVAL_ENOENTOK) == 0) ? 0 : -1));
|
||||
}
|
||||
|
||||
errfunc = ((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
|
||||
|
||||
if (S_ISDIR (finfo.st_mode))
|
||||
{
|
||||
(*errfunc) (_("%s: is a directory"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
else if ((flags & FEVAL_REGFILE) && S_ISREG (finfo.st_mode) == 0)
|
||||
{
|
||||
(*errfunc) (_("%s: not a regular file"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
|
||||
file_size = (size_t)finfo.st_size;
|
||||
/* Check for overflow with large files. */
|
||||
if (file_size != finfo.st_size || file_size + 1 < file_size)
|
||||
{
|
||||
(*errfunc) (_("%s: file is too large"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
|
||||
if (S_ISREG (finfo.st_mode) && file_size <= SSIZE_MAX)
|
||||
{
|
||||
string = (char *)xmalloc (1 + file_size);
|
||||
nr = read (fd, string, file_size);
|
||||
if (nr >= 0)
|
||||
string[nr] = '\0';
|
||||
}
|
||||
else
|
||||
nr = zmapfd (fd, &string, 0);
|
||||
|
||||
return_val = errno;
|
||||
close (fd);
|
||||
errno = return_val;
|
||||
|
||||
if (nr < 0) /* XXX was != file_size, not < 0 */
|
||||
{
|
||||
free (string);
|
||||
goto file_error_and_exit;
|
||||
}
|
||||
|
||||
if (nr == 0)
|
||||
{
|
||||
free (string);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_SUCCESS : 1);
|
||||
}
|
||||
|
||||
if ((flags & FEVAL_CHECKBINARY) &&
|
||||
check_binary_file (string, (nr > 80) ? 80 : nr))
|
||||
{
|
||||
free (string);
|
||||
(*errfunc) (_("%s: cannot execute binary file"), filename);
|
||||
return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1);
|
||||
}
|
||||
|
||||
i = strlen (string);
|
||||
if (i < nr)
|
||||
{
|
||||
for (nnull = i = 0; i < nr; i++)
|
||||
if (string[i] == '\0')
|
||||
{
|
||||
memmove (string+i, string+i+1, nr - i);
|
||||
nr--;
|
||||
/* Even if the `check binary' flag is not set, we want to avoid
|
||||
sourcing files with more than 256 null characters -- that
|
||||
probably indicates a binary file. */
|
||||
if ((flags & FEVAL_BUILTIN) && ++nnull > 256)
|
||||
{
|
||||
free (string);
|
||||
(*errfunc) (_("%s: cannot execute binary file"), filename);
|
||||
return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & FEVAL_UNWINDPROT)
|
||||
{
|
||||
begin_unwind_frame ("_evalfile");
|
||||
|
||||
unwind_protect_int (return_catch_flag);
|
||||
unwind_protect_jmp_buf (return_catch);
|
||||
if (flags & FEVAL_NONINT)
|
||||
unwind_protect_int (interactive);
|
||||
unwind_protect_int (sourcelevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
COPY_PROCENV (return_catch, old_return_catch);
|
||||
if (flags & FEVAL_NONINT)
|
||||
old_interactive = interactive;
|
||||
}
|
||||
|
||||
if (flags & FEVAL_NONINT)
|
||||
interactive = 0;
|
||||
|
||||
return_catch_flag++;
|
||||
sourcelevel++;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
array_push (bash_source_a, (char *)filename);
|
||||
t = itos (executing_line_number ());
|
||||
array_push (bash_lineno_a, t);
|
||||
free (t);
|
||||
array_push (funcname_a, "source"); /* not exactly right */
|
||||
# if defined (DEBUGGER)
|
||||
/* Have to figure out a better way to do this when `source' is supplied
|
||||
arguments */
|
||||
if ((flags & FEVAL_NOPUSHARGS) == 0)
|
||||
{
|
||||
array_push (bash_argv_a, (char *)filename);
|
||||
tt[0] = '1'; tt[1] = '\0';
|
||||
array_push (bash_argc_a, tt);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* set the flags to be passed to parse_and_execute */
|
||||
pflags = SEVAL_RESETLINE;
|
||||
pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
|
||||
|
||||
if (flags & FEVAL_BUILTIN)
|
||||
result = EXECUTION_SUCCESS;
|
||||
|
||||
return_val = setjmp_nosigs (return_catch);
|
||||
|
||||
/* If `return' was seen outside of a function, but in the script, then
|
||||
force parse_and_execute () to clean up. */
|
||||
if (return_val)
|
||||
{
|
||||
parse_and_execute_cleanup ();
|
||||
result = return_catch_value;
|
||||
}
|
||||
else
|
||||
result = parse_and_execute (string, filename, pflags);
|
||||
|
||||
if (flags & FEVAL_UNWINDPROT)
|
||||
run_unwind_frame ("_evalfile");
|
||||
else
|
||||
{
|
||||
if (flags & FEVAL_NONINT)
|
||||
interactive = old_interactive;
|
||||
return_catch_flag--;
|
||||
sourcelevel--;
|
||||
COPY_PROCENV (old_return_catch, return_catch);
|
||||
}
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
/* These two variables cannot be unset, and cannot be affected by the
|
||||
sourced file. */
|
||||
array_pop (bash_source_a);
|
||||
array_pop (bash_lineno_a);
|
||||
|
||||
/* FUNCNAME can be unset, and so can potentially be changed by the
|
||||
sourced file. */
|
||||
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
|
||||
if (nfv == funcname_v)
|
||||
array_pop (funcname_a);
|
||||
# if defined (DEBUGGER)
|
||||
if ((flags & FEVAL_NOPUSHARGS) == 0)
|
||||
{
|
||||
array_pop (bash_argc_a);
|
||||
array_pop (bash_argv_a);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return ((flags & FEVAL_BUILTIN) ? result : 1);
|
||||
}
|
||||
|
||||
int
|
||||
maybe_execute_file (fname, force_noninteractive)
|
||||
const char *fname;
|
||||
int force_noninteractive;
|
||||
{
|
||||
char *filename;
|
||||
int result, flags;
|
||||
|
||||
filename = bash_tilde_expand (fname, 0);
|
||||
flags = FEVAL_ENOENTOK;
|
||||
if (force_noninteractive)
|
||||
flags |= FEVAL_NONINT;
|
||||
result = _evalfile (filename, flags);
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
force_execute_file (fname, force_noninteractive)
|
||||
const char *fname;
|
||||
int force_noninteractive;
|
||||
{
|
||||
char *filename;
|
||||
int result, flags;
|
||||
|
||||
filename = bash_tilde_expand (fname, 0);
|
||||
flags = 0;
|
||||
if (force_noninteractive)
|
||||
flags |= FEVAL_NONINT;
|
||||
result = _evalfile (filename, flags);
|
||||
free (filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined (HISTORY)
|
||||
int
|
||||
fc_execute_file (filename)
|
||||
const char *filename;
|
||||
{
|
||||
int flags;
|
||||
|
||||
/* We want these commands to show up in the history list if
|
||||
remember_on_history is set. */
|
||||
flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE;
|
||||
return (_evalfile (filename, flags));
|
||||
}
|
||||
#endif /* HISTORY */
|
||||
|
||||
int
|
||||
source_file (filename, sflags)
|
||||
const char *filename;
|
||||
int sflags;
|
||||
{
|
||||
int flags, rval;
|
||||
|
||||
flags = FEVAL_BUILTIN|FEVAL_UNWINDPROT|FEVAL_NONINT;
|
||||
if (sflags)
|
||||
flags |= FEVAL_NOPUSHARGS;
|
||||
/* POSIX shells exit if non-interactive and file error. */
|
||||
if (posixly_correct && interactive_shell == 0 && executing_command_builtin == 0)
|
||||
flags |= FEVAL_LONGJMP;
|
||||
rval = _evalfile (filename, flags);
|
||||
|
||||
run_return_trap ();
|
||||
return rval;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ mapfile_builtin (list)
|
||||
else
|
||||
array_name = list->word->word;
|
||||
|
||||
if (legal_identifier (array_name) == 0 && valid_array_reference (array_name) == 0)
|
||||
if (legal_identifier (array_name) == 0)
|
||||
{
|
||||
sh_invalidid (array_name);
|
||||
return (EXECUTION_FAILURE);
|
||||
|
||||
@@ -286,6 +286,14 @@ printf_builtin (list)
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
/* Allow printf -v var "" to act like var="" */
|
||||
if (vflag && list->word->word && list->word->word[0] == '\0')
|
||||
{
|
||||
bind_printf_variable (vname, "", 0);
|
||||
stupidly_hack_special_variables (vname);
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
if (list->word->word == 0 || list->word->word[0] == '\0')
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
|
||||
@@ -99,5 +99,8 @@ shift_builtin (list)
|
||||
else
|
||||
dollar_vars[9] = (char *)NULL;
|
||||
}
|
||||
|
||||
invalidate_cached_quoted_dollar_at ();
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ maybe_pop_dollar_vars ()
|
||||
if (debugging_mode)
|
||||
pop_args (); /* restore BASH_ARGC and BASH_ARGV */
|
||||
set_dollar_vars_unchanged ();
|
||||
invalidate_cached_quoted_dollar_at (); /* just invalidate to be safe */
|
||||
}
|
||||
|
||||
/* Read and execute commands from the file passed as argument. Guess what.
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests for CYGWIN32 so they don't need to be done when cross-compiling.
|
||||
|
||||
# AC_FUNC_GETPGRP should also define GETPGRP_VOID
|
||||
ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
|
||||
# AC_FUNC_SETVBUF_REVERSED should not define anything else
|
||||
ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
|
||||
# on CYGWIN32, system calls do not restart
|
||||
ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
|
||||
bash_cv_sys_restartable_syscalls=${bash_cv_sys_restartable_syscalls='no'}
|
||||
|
||||
# these may be necessary, but they are currently commented out
|
||||
#ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
|
||||
ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
|
||||
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
|
||||
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
|
||||
ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
|
||||
|
||||
bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
|
||||
bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
|
||||
bash_cv_type_rlimit=${bash_cv_type_rlimit='long'}
|
||||
bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
|
||||
bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
|
||||
bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
|
||||
bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
|
||||
bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
|
||||
bash_cv_printf_declared=${bash_cv_printf_declared='yes'}
|
||||
bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
|
||||
bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen='no'}
|
||||
bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
|
||||
bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
|
||||
bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='missing'}
|
||||
bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='missing'}
|
||||
bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
|
||||
bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
|
||||
|
||||
bash_cv_type_int32_t=${bash_cv_type_int32_t='int'}
|
||||
bash_cv_type_u_int32_t=${bash_cv_type_u_int32_t='int'}
|
||||
|
||||
ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
|
||||
|
||||
# end of cross-build/cygwin32.cache
|
||||
+1745
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -92,7 +92,9 @@ PSPDF = gs -sPAPERSIZE=${PAPERSIZE} -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -s
|
||||
MKDIRS = ${SUPPORT_SRCDIR}/mkdirs
|
||||
|
||||
# This should be a program that converts troff to an ascii-readable format
|
||||
NROFF = groff -Tascii
|
||||
# added the -P -c for benefit of Mac OS X, which insists on adding colors if
|
||||
# it's not present
|
||||
NROFF = groff -Tascii -P -c
|
||||
|
||||
# This should be a program that converts troff to postscript
|
||||
GROFF = groff
|
||||
|
||||
Binary file not shown.
+1562
-1529
File diff suppressed because it is too large
Load Diff
+66
-11
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Sat Nov 1 20:00:51 EDT 2014
|
||||
.\" Last Change: Fri Nov 21 08:07:56 EST 2014
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2014 November 1" "GNU Bash 4.3"
|
||||
.TH BASH 1 "2014 November 21" "GNU Bash 4.3"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -50,8 +50,8 @@ bash \- GNU Bourne-Again SHell
|
||||
[options]
|
||||
[command_string | file]
|
||||
.SH COPYRIGHT
|
||||
.if n Bash is Copyright (C) 1989-2013 by the Free Software Foundation, Inc.
|
||||
.if t Bash is Copyright \(co 1989-2013 by the Free Software Foundation, Inc.
|
||||
.if n Bash is Copyright (C) 1989-2014 by the Free Software Foundation, Inc.
|
||||
.if t Bash is Copyright \(co 1989-2014 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.B Bash
|
||||
is an \fBsh\fR-compatible command language interpreter that
|
||||
@@ -716,9 +716,9 @@ right of the operator is considered a pattern and matched according
|
||||
to the rules described below under \fBPattern Matching\fP,
|
||||
as if the \fBextglob\fP shell option were enabled.
|
||||
The \fB=\fP operator is equivalent to \fB==\fP.
|
||||
If the shell option
|
||||
If the
|
||||
.B nocasematch
|
||||
is enabled, the match is performed without regard to the case
|
||||
shell option is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
The return value is 0 if the string matches (\fB==\fP) or does not match
|
||||
(\fB!=\fP) the pattern, and 1 otherwise.
|
||||
@@ -734,9 +734,9 @@ The return value is 0 if the string matches
|
||||
the pattern, and 1 otherwise.
|
||||
If the regular expression is syntactically incorrect, the conditional
|
||||
expression's return value is 2.
|
||||
If the shell option
|
||||
If the
|
||||
.B nocasematch
|
||||
is enabled, the match is performed without regard to the case
|
||||
shell option is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
Any part of the pattern may be quoted to force the quoted portion
|
||||
to be matched as a string.
|
||||
@@ -869,9 +869,9 @@ command substitution, process substitution and quote removal.
|
||||
Each \fIpattern\fP examined is expanded using tilde
|
||||
expansion, parameter and variable expansion, arithmetic expansion,
|
||||
command substitution, and process substitution.
|
||||
If the shell option
|
||||
If the
|
||||
.B nocasematch
|
||||
is enabled, the match is performed without regard to the case
|
||||
shell option is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
When a match is found, the corresponding \fIlist\fP is executed.
|
||||
If the \fB;;\fP operator is used, no subsequent matches are attempted after
|
||||
@@ -3057,6 +3057,10 @@ If \fIpattern\fP begins with \fB%\fP, it must match at the end
|
||||
of the expanded value of \fIparameter\fP.
|
||||
If \fIstring\fP is null, matches of \fIpattern\fP are deleted
|
||||
and the \fB/\fP following \fIpattern\fP may be omitted.
|
||||
If the
|
||||
.B nocasematch
|
||||
shell option is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
If
|
||||
.I parameter
|
||||
is
|
||||
@@ -3349,6 +3353,10 @@ is set, each matching filename that also matches one of the patterns in
|
||||
.SM
|
||||
.B GLOBIGNORE
|
||||
is removed from the list of matches.
|
||||
If the \fBnocaseglob\fP option is set, the matching against the patterns in
|
||||
.SM
|
||||
.B GLOBIGNORE
|
||||
is performed without regard to case.
|
||||
The filenames
|
||||
.B ``.''
|
||||
and
|
||||
@@ -5317,6 +5325,12 @@ If set to \fBOn\fP, readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their readline
|
||||
equivalents.
|
||||
.TP
|
||||
.B colored\-completion\-prefix (Off)
|
||||
If set to \fBOn\fP, when listing completions, readline displays the
|
||||
common prefix of the set of possible completions using a different color.
|
||||
The color definitions are taken from the value of the \fBLS_COLORS\fP
|
||||
environment variable.
|
||||
.TP
|
||||
.B colored\-stats (Off)
|
||||
If set to \fBOn\fP, readline displays possible completions using different
|
||||
colors to indicate their file type.
|
||||
@@ -5378,6 +5392,13 @@ When set to \fBOn\fP, on operating systems that indicate they support it,
|
||||
readline echoes a character corresponding to a signal generated from the
|
||||
keyboard.
|
||||
.TP
|
||||
.B enable\-bracketed\-paste (Off)
|
||||
When set to \fBOn\fP, readline will configure the terminal in a way
|
||||
that will enable it to insert each paste into the editing buffer as a
|
||||
single string of characters, instead of treating each character as if
|
||||
it had been read from the keyboard. This can prevent pasted characters
|
||||
from being interpreted as editing commands.
|
||||
.TP
|
||||
.B enable\-keypad (Off)
|
||||
When set to \fBOn\fP, readline will try to enable the application
|
||||
keypad when it is called. Some systems need this to enable the
|
||||
@@ -5435,6 +5456,15 @@ the value of
|
||||
.B editing\-mode
|
||||
also affects the default keymap.
|
||||
.TP
|
||||
.B emacs\-mode\-string (@)
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when emacs editing mode is active. The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B keyseq\-timeout (500)
|
||||
Specifies the duration \fIreadline\fP will wait for a character when reading an
|
||||
ambiguous key sequence (one that can form a complete key sequence using
|
||||
@@ -5522,6 +5552,26 @@ does not insert characters from the completion that match characters
|
||||
after point in the word being completed, so portions of the word
|
||||
following the cursor are not duplicated.
|
||||
.TP
|
||||
.B vi\-cmd\-mode\-string ((cmd))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in command mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B vi\-ins\-mode\-string ((ins))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in insertion mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B visible\-stats (Off)
|
||||
If set to \fBOn\fP, a character denoting a file's type as reported
|
||||
by \fIstat\fP(2) is appended to the filename when listing possible
|
||||
@@ -6348,6 +6398,10 @@ is removed before attempting a match.
|
||||
Any completion that matches the pattern will be removed from the list.
|
||||
A leading \fB!\fP negates the pattern; in this case any completion
|
||||
not matching the pattern will be removed.
|
||||
If the
|
||||
.B nocasematch
|
||||
shell option is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
.PP
|
||||
Finally, any prefix and suffix specified with the \fB\-P\fP and \fB\-S\fP
|
||||
options are added to each member of the completion list, and the result is
|
||||
@@ -9555,7 +9609,8 @@ above).
|
||||
If set,
|
||||
.B bash
|
||||
matches patterns in a case\-insensitive fashion when performing matching
|
||||
while executing \fBcase\fP or \fB[[\fP conditional commands.
|
||||
while executing \fBcase\fP or \fB[[\fP conditional commands,
|
||||
or when filtering possible completions as part of programmable completion.
|
||||
.TP 8
|
||||
.B nullglob
|
||||
If set,
|
||||
|
||||
+13
-5
@@ -868,7 +868,7 @@ case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-li
|
||||
|
||||
@code{case} will selectively execute the @var{command-list} corresponding to
|
||||
the first @var{pattern} that matches @var{word}.
|
||||
If the shell option @code{nocasematch}
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
@@ -999,7 +999,7 @@ right of the operator is considered a pattern and matched according
|
||||
to the rules described below in @ref{Pattern Matching},
|
||||
as if the @code{extglob} shell option were enabled.
|
||||
The @samp{=} operator is identical to @samp{==}.
|
||||
If the shell option @code{nocasematch}
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
@@ -1016,7 +1016,7 @@ The return value is 0 if the string matches
|
||||
the pattern, and 1 otherwise.
|
||||
If the regular expression is syntactically incorrect, the conditional
|
||||
expression's return value is 2.
|
||||
If the shell option @code{nocasematch}
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
@@ -2149,6 +2149,10 @@ If @var{pattern} begins with @samp{%}, it must match at the end
|
||||
of the expanded value of @var{parameter}.
|
||||
If @var{string} is null, matches of @var{pattern} are deleted
|
||||
and the @code{/} following @var{pattern} may be omitted.
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
If @var{parameter} is @samp{@@} or @samp{*},
|
||||
the substitution operation is applied to each positional
|
||||
parameter in turn, and the expansion is the resultant list.
|
||||
@@ -2357,7 +2361,10 @@ The @env{GLOBIGNORE}
|
||||
shell variable may be used to restrict the set of filenames matching a
|
||||
pattern. If @env{GLOBIGNORE}
|
||||
is set, each matching filename that also matches one of the patterns in
|
||||
@env{GLOBIGNORE} is removed from the list of matches. The filenames
|
||||
@env{GLOBIGNORE} is removed from the list of matches.
|
||||
If the @code{nocaseglob} option is set, the matching against the patterns in
|
||||
@env{GLOBIGNORE} is performed without regard to case.
|
||||
The filenames
|
||||
@file{.} and @file{..}
|
||||
are always ignored when @env{GLOBIGNORE}
|
||||
is set and not null.
|
||||
@@ -5177,7 +5184,8 @@ performing filename expansion.
|
||||
@item nocasematch
|
||||
If set, Bash matches patterns in a case-insensitive fashion when
|
||||
performing matching while executing @code{case} or @code{[[}
|
||||
conditional commands.
|
||||
conditional commands,
|
||||
or when filtering possible completions as part of programmable completion.
|
||||
|
||||
@item nullglob
|
||||
If set, Bash allows filename patterns which match no
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Sat Nov 1 20:03:13 EDT 2014
|
||||
@set LASTCHANGE Fri Nov 21 08:07:43 EST 2014
|
||||
|
||||
@set EDITION 4.3
|
||||
@set VERSION 4.3
|
||||
|
||||
@set UPDATED 1 November 2014
|
||||
@set UPDATED 21 November 2014
|
||||
@set UPDATED-MONTH November 2014
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
#
|
||||
# Simple makefile for the sample loadable builtins
|
||||
#
|
||||
# Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
# This program 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.
|
||||
|
||||
# This program 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 this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
# Include some boilerplate Gnu makefile definitions.
|
||||
prefix = @prefix@
|
||||
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
includedir = @includedir@
|
||||
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
|
||||
@SET_MAKE@
|
||||
CC = @CC@
|
||||
RM = rm -f
|
||||
|
||||
SHELL = @MAKE_SHELL@
|
||||
|
||||
host_os = @host_os@
|
||||
host_cpu = @host_cpu@
|
||||
host_vendor = @host_vendor@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
BASHINCDIR = ${topdir}/include
|
||||
|
||||
LIBBUILD = ${BUILD_DIR}/lib
|
||||
|
||||
INTL_LIBSRC = ${topdir}/lib/intl
|
||||
INTL_BUILDDIR = ${LIBBUILD}/intl
|
||||
INTL_INC = @INTL_INC@
|
||||
LIBINTL_H = @LIBINTL_H@
|
||||
|
||||
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
#
|
||||
# These values are generated for configure by ${topdir}/support/shobj-conf.
|
||||
# If your system is not supported by that script, but includes facilities for
|
||||
# dynamic loading of shared objects, please update the script and send the
|
||||
# changes to bash-maintainers@gnu.org.
|
||||
#
|
||||
SHOBJ_CC = @SHOBJ_CC@
|
||||
SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
|
||||
SHOBJ_LD = @SHOBJ_LD@
|
||||
SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
|
||||
SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
|
||||
SHOBJ_LIBS = @SHOBJ_LIBS@
|
||||
SHOBJ_STATUS = @SHOBJ_STATUS@
|
||||
|
||||
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
|
||||
-I$(BASHINCDIR) -I$(BUILD_DIR) -I$(LIBBUILD) \
|
||||
-I$(BUILD_DIR)/builtins $(INTL_INC)
|
||||
|
||||
.c.o:
|
||||
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
|
||||
|
||||
|
||||
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
|
||||
tty pathchk tee head mkdir rmdir printenv id whoami \
|
||||
uname sync push ln unlink cut realpath getconf strftime
|
||||
OTHERPROG = necho hello cat
|
||||
|
||||
all: $(SHOBJ_STATUS)
|
||||
|
||||
supported: $(ALLPROG)
|
||||
others: $(OTHERPROG)
|
||||
|
||||
unsupported:
|
||||
@echo "Your system (${host_os}) is not supported by the"
|
||||
@echo "${topdir}/support/shobj-conf script."
|
||||
@echo "If your operating system provides facilities for dynamic"
|
||||
@echo "loading of shared objects using the dlopen(3) interface,"
|
||||
@echo "please update the script and re-run configure.
|
||||
@echo "Please send the changes you made to bash-maintainers@gnu.org"
|
||||
@echo "for inclusion in future bash releases."
|
||||
|
||||
everything: supported others
|
||||
|
||||
print: print.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ print.o $(SHOBJ_LIBS)
|
||||
|
||||
necho: necho.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ necho.o $(SHOBJ_LIBS)
|
||||
|
||||
getconf: getconf.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ getconf.o $(SHOBJ_LIBS)
|
||||
|
||||
hello: hello.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ hello.o $(SHOBJ_LIBS)
|
||||
|
||||
truefalse: truefalse.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ truefalse.o $(SHOBJ_LIBS)
|
||||
|
||||
sleep: sleep.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sleep.o $(SHOBJ_LIBS)
|
||||
|
||||
finfo: finfo.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ finfo.o $(SHOBJ_LIBS)
|
||||
|
||||
cat: cat.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cat.o $(SHOBJ_LIBS)
|
||||
|
||||
logname: logname.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ logname.o $(SHOBJ_LIBS)
|
||||
|
||||
basename: basename.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ basename.o $(SHOBJ_LIBS)
|
||||
|
||||
dirname: dirname.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ dirname.o $(SHOBJ_LIBS)
|
||||
|
||||
tty: tty.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tty.o $(SHOBJ_LIBS)
|
||||
|
||||
pathchk: pathchk.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pathchk.o $(SHOBJ_LIBS)
|
||||
|
||||
tee: tee.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ tee.o $(SHOBJ_LIBS)
|
||||
|
||||
mkdir: mkdir.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mkdir.o $(SHOBJ_LIBS)
|
||||
|
||||
rmdir: rmdir.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ rmdir.o $(SHOBJ_LIBS)
|
||||
|
||||
head: head.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ head.o $(SHOBJ_LIBS)
|
||||
|
||||
printenv: printenv.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ printenv.o $(SHOBJ_LIBS)
|
||||
|
||||
id: id.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ id.o $(SHOBJ_LIBS)
|
||||
|
||||
whoami: whoami.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ whoami.o $(SHOBJ_LIBS)
|
||||
|
||||
uname: uname.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ uname.o $(SHOBJ_LIBS)
|
||||
|
||||
sync: sync.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ sync.o $(SHOBJ_LIBS)
|
||||
|
||||
push: push.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ push.o $(SHOBJ_LIBS)
|
||||
|
||||
ln: ln.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ ln.o $(SHOBJ_LIBS)
|
||||
|
||||
unlink: unlink.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ unlink.o $(SHOBJ_LIBS)
|
||||
|
||||
cut: cut.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ cut.o $(SHOBJ_LIBS)
|
||||
|
||||
realpath: realpath.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
|
||||
|
||||
strftime: strftime.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ strftime.o $(SHOBJ_LIBS)
|
||||
|
||||
# pushd is a special case. We use the same source that the builtin version
|
||||
# uses, with special compilation options.
|
||||
#
|
||||
pushd.c: ${topdir}/builtins/pushd.def
|
||||
$(RM) $@
|
||||
${BUILD_DIR}/builtins/mkbuiltins -D ${topdir}/builtins ${topdir}/builtins/pushd.def
|
||||
|
||||
pushd.o: pushd.c
|
||||
$(RM) $@
|
||||
$(SHOBJ_CC) -DHAVE_CONFIG_H -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) -c -o $@ $<
|
||||
|
||||
pushd: pushd.o
|
||||
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pushd.o $(SHOBJ_LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(ALLPROG) $(OTHERPROG) *.o
|
||||
-( cd perl && ${MAKE} ${MFLAGS} $@ )
|
||||
|
||||
mostlyclean: clean
|
||||
-( cd perl && ${MAKE} ${MFLAGS} $@ )
|
||||
|
||||
distclean maintainer-clean: clean
|
||||
$(RM) Makefile pushd.c
|
||||
-( cd perl && ${MAKE} ${MFLAGS} $@ )
|
||||
|
||||
print.o: print.c
|
||||
truefalse.o: truefalse.c
|
||||
sleep.o: sleep.c
|
||||
finfo.o: finfo.c
|
||||
logname.o: logname.c
|
||||
basename.o: basename.c
|
||||
dirname.o: dirname.c
|
||||
tty.o: tty.c
|
||||
pathchk.o: pathchk.c
|
||||
tee.o: tee.c
|
||||
head.o: head.c
|
||||
rmdir.o: rmdir.c
|
||||
necho.o: necho.c
|
||||
getconf.o: getconf.c
|
||||
hello.o: hello.c
|
||||
cat.o: cat.c
|
||||
printenv.o: printenv.c
|
||||
id.o: id.c
|
||||
whoami.o: whoami.c
|
||||
uname.o: uname.c
|
||||
sync.o: sync.c
|
||||
push.o: push.c
|
||||
mkdir.o: mkdir.c
|
||||
realpath.o: realpath.c
|
||||
strftime.o: strftime.c
|
||||
@@ -506,11 +506,11 @@ extern void zsyncfd __P((int));
|
||||
extern int zwrite __P((int, char *, size_t));
|
||||
|
||||
/* declarations for functions defined in lib/glob/gmisc.c */
|
||||
extern int match_pattern_char __P((char *, char *));
|
||||
extern int match_pattern_char __P((char *, char *, int));
|
||||
extern int umatchlen __P((char *, size_t));
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
extern int match_pattern_wchar __P((wchar_t *, wchar_t *));
|
||||
extern int match_pattern_wchar __P((wchar_t *, wchar_t *, int));
|
||||
extern int wmatchlen __P((wchar_t *, size_t));
|
||||
#endif
|
||||
|
||||
|
||||
+27
-10
@@ -28,9 +28,14 @@
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
#include "chartypes.h"
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#ifndef FNM_CASEFOLD
|
||||
# include "strmatch.h"
|
||||
#endif
|
||||
|
||||
#ifndef LPAREN
|
||||
# define LPAREN '('
|
||||
#endif
|
||||
@@ -46,11 +51,15 @@
|
||||
extern char *glob_patscan __P((char *, char *, int));
|
||||
extern wchar_t *glob_patscan_wc __P((wchar_t *, wchar_t *, int));
|
||||
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) && iswupper (c) ? towlower (c) : (c))
|
||||
|
||||
/* Return 1 of the first character of WSTRING could match the first
|
||||
character of pattern WPAT. Wide character version. */
|
||||
character of pattern WPAT. Wide character version. FLAGS is a
|
||||
subset of strmatch flags; used to do case-insensitive matching for now. */
|
||||
int
|
||||
match_pattern_wchar (wpat, wstring)
|
||||
match_pattern_wchar (wpat, wstring, flags)
|
||||
wchar_t *wpat, *wstring;
|
||||
int flags;
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
@@ -60,9 +69,9 @@ match_pattern_wchar (wpat, wstring)
|
||||
switch (wc = *wpat++)
|
||||
{
|
||||
default:
|
||||
return (*wstring == wc);
|
||||
return (FOLD(*wstring) == FOLD(wc));
|
||||
case L'\\':
|
||||
return (*wstring == *wpat);
|
||||
return (FOLD(*wstring) == FOLD(*wpat));
|
||||
case L'?':
|
||||
return (*wpat == WLPAREN ? 1 : (*wstring != L'\0'));
|
||||
case L'*':
|
||||
@@ -70,7 +79,7 @@ match_pattern_wchar (wpat, wstring)
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
return (*wpat == WLPAREN ? 1 : (*wstring == wc));
|
||||
return (*wpat == WLPAREN ? 1 : (FOLD(*wstring) == FOLD(wc)));
|
||||
case L'[':
|
||||
return (*wstring != L'\0');
|
||||
}
|
||||
@@ -223,11 +232,19 @@ extglob_pattern_p (pat)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef FOLD
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) \
|
||||
? TOLOWER ((unsigned char)c) \
|
||||
: ((unsigned char)c))
|
||||
|
||||
/* Return 1 of the first character of STRING could match the first
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch().
|
||||
FLAGS is a subset of strmatch flags; used to do case-insensitive
|
||||
matching for now. */
|
||||
int
|
||||
match_pattern_char (pat, string)
|
||||
match_pattern_char (pat, string, flags)
|
||||
char *pat, *string;
|
||||
int flags;
|
||||
{
|
||||
char c;
|
||||
|
||||
@@ -237,9 +254,9 @@ match_pattern_char (pat, string)
|
||||
switch (c = *pat++)
|
||||
{
|
||||
default:
|
||||
return (*string == c);
|
||||
return (FOLD(*string) == FOLD(c));
|
||||
case '\\':
|
||||
return (*string == *pat);
|
||||
return (FOLD(*string) == FOLD(*pat));
|
||||
case '?':
|
||||
return (*pat == LPAREN ? 1 : (*string != '\0'));
|
||||
case '*':
|
||||
@@ -247,7 +264,7 @@ match_pattern_char (pat, string)
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
return (*pat == LPAREN ? 1 : (*string == c));
|
||||
return (*pat == LPAREN ? 1 : (FOLD(*string) == FOLD(c)));
|
||||
case '[':
|
||||
return (*string != '\0');
|
||||
}
|
||||
|
||||
@@ -1479,6 +1479,7 @@ static const struct {
|
||||
{ "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
|
||||
{ "byte-oriented", &rl_byte_oriented, 0 },
|
||||
#if defined (COLOR_SUPPORT)
|
||||
{ "colored-completion-prefix",&_rl_colored_completion_prefix, 0 },
|
||||
{ "colored-stats", &_rl_colored_stats, 0 },
|
||||
#endif
|
||||
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
|
||||
|
||||
@@ -99,11 +99,12 @@ _rl_set_normal_color (void)
|
||||
}
|
||||
|
||||
bool
|
||||
_rl_print_filename_color (void)
|
||||
_rl_print_prefix_color (void)
|
||||
{
|
||||
struct bin_str *s;
|
||||
|
||||
s = &_rl_color_indicator[C_FILE];
|
||||
/* What do we want to use for the prefix? Let's try cyan first, see colors.h */
|
||||
s = &_rl_color_indicator[C_PREFIX];
|
||||
if (s->string != NULL)
|
||||
{
|
||||
if (is_colored (C_NORM))
|
||||
|
||||
@@ -114,9 +114,12 @@ enum filetype
|
||||
arg_directory
|
||||
};
|
||||
|
||||
/* Prefix color, currently same as directory */
|
||||
#define C_PREFIX C_DIR
|
||||
|
||||
extern void _rl_put_indicator (const struct bin_str *ind);
|
||||
extern void _rl_set_normal_color (void);
|
||||
extern bool _rl_print_filename_color (void);
|
||||
extern bool _rl_print_prefix_color (void);
|
||||
extern bool _rl_print_color_indicator (char *f);
|
||||
extern void _rl_prep_non_filename_text (void);
|
||||
|
||||
|
||||
+33
-4
@@ -113,6 +113,8 @@ static int stat_char PARAMS((char *));
|
||||
#if defined (COLOR_SUPPORT)
|
||||
static int colored_stat_start PARAMS((char *));
|
||||
static void colored_stat_end PARAMS((void));
|
||||
static int colored_prefix_start PARAMS((void));
|
||||
static void colored_prefix_end PARAMS((void));
|
||||
#endif
|
||||
|
||||
static int path_isdir PARAMS((const char *));
|
||||
@@ -209,6 +211,8 @@ int rl_visible_stats = 0;
|
||||
/* Non-zero means to use colors to indicate file type when listing possible
|
||||
completions. The colors used are taken from $LS_COLORS, if set. */
|
||||
int _rl_colored_stats = 0;
|
||||
|
||||
int _rl_colored_completion_prefix = 1;
|
||||
#endif
|
||||
|
||||
/* If non-zero, when completing in the middle of a word, don't insert
|
||||
@@ -667,7 +671,7 @@ static int
|
||||
colored_prefix_start ()
|
||||
{
|
||||
_rl_set_normal_color ();
|
||||
return (_rl_print_filename_color ());
|
||||
return (_rl_print_prefix_color ());
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -778,6 +782,7 @@ fnprint (to_print, prefix_bytes)
|
||||
{
|
||||
int printed_len, w;
|
||||
const char *s;
|
||||
int common_prefix_len;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps;
|
||||
const char *end;
|
||||
@@ -789,14 +794,14 @@ fnprint (to_print, prefix_bytes)
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
printed_len = 0;
|
||||
printed_len = common_prefix_len = 0;
|
||||
|
||||
/* Don't print only the ellipsis if the common prefix is one of the
|
||||
possible completions */
|
||||
if (to_print[prefix_bytes] == '\0')
|
||||
prefix_bytes = 0;
|
||||
|
||||
if (prefix_bytes)
|
||||
if (prefix_bytes && _rl_completion_prefix_display_length > 0)
|
||||
{
|
||||
char ellipsis;
|
||||
|
||||
@@ -805,6 +810,15 @@ fnprint (to_print, prefix_bytes)
|
||||
putc (ellipsis, rl_outstream);
|
||||
printed_len = ELLIPSIS_LEN;
|
||||
}
|
||||
#if defined (COLOR_SUPPORT)
|
||||
else if (prefix_bytes && _rl_colored_completion_prefix > 0)
|
||||
{
|
||||
common_prefix_len = prefix_bytes;
|
||||
prefix_bytes = 0;
|
||||
/* XXX - print color indicator start here */
|
||||
colored_prefix_start ();
|
||||
}
|
||||
#endif
|
||||
|
||||
s = to_print + prefix_bytes;
|
||||
while (*s)
|
||||
@@ -855,6 +869,13 @@ fnprint (to_print, prefix_bytes)
|
||||
printed_len++;
|
||||
#endif
|
||||
}
|
||||
if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
|
||||
{
|
||||
/* printed bytes = s - to_print */
|
||||
/* printed bytes should never be > but check for paranoia's sake */
|
||||
colored_prefix_end ();
|
||||
common_prefix_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return printed_len;
|
||||
@@ -1515,7 +1536,7 @@ rl_display_match_list (matches, len, max)
|
||||
if (_rl_completion_prefix_display_length > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
temp = strrchr (t, '/');
|
||||
temp = strrchr (t, '/'); /* XXX - why check again? */
|
||||
common_length = temp ? fnwidth (temp) : fnwidth (t);
|
||||
sind = temp ? strlen (temp) : strlen (t);
|
||||
|
||||
@@ -1524,6 +1545,14 @@ rl_display_match_list (matches, len, max)
|
||||
else
|
||||
common_length = sind = 0;
|
||||
}
|
||||
#if defined (COLOR_SUPPORT)
|
||||
else if (_rl_colored_completion_prefix > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
common_length = fnwidth (t);
|
||||
sind = RL_STRLEN (t);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* How many items of MAX length can we fit in the screen window? */
|
||||
cols = complete_get_screenwidth ();
|
||||
|
||||
@@ -2018,6 +2018,7 @@ void
|
||||
rl_redraw_prompt_last_line ()
|
||||
{
|
||||
char *t;
|
||||
|
||||
t = strrchr (rl_display_prompt, '\n');
|
||||
if (t)
|
||||
redraw_prompt (++t);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# This makefile for Readline library documentation is in -*- text -*- mode.
|
||||
# Emacs likes it that way.
|
||||
RM = rm -f
|
||||
|
||||
MAKEINFO = makeinfo
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXI2HTML = texi2html
|
||||
QUIETPS = #set this to -q to shut up dvips
|
||||
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
|
||||
|
||||
INSTALL_DATA = cp
|
||||
infodir = /usr/local/info
|
||||
|
||||
RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
|
||||
HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
|
||||
|
||||
DVIOBJ = readline.dvi history.dvi
|
||||
INFOOBJ = readline.info history.info
|
||||
PSOBJ = readline.ps history.ps
|
||||
HTMLOBJ = readline.html history.html
|
||||
|
||||
all: info dvi html ps
|
||||
nodvi: info html
|
||||
|
||||
readline.dvi: $(RLSRC)
|
||||
$(TEXI2DVI) rlman.texinfo
|
||||
mv rlman.dvi readline.dvi
|
||||
|
||||
readline.info: $(RLSRC)
|
||||
$(MAKEINFO) --no-split -o $@ rlman.texinfo
|
||||
|
||||
history.dvi: ${HISTSRC}
|
||||
$(TEXI2DVI) hist.texinfo
|
||||
mv hist.dvi history.dvi
|
||||
|
||||
history.info: ${HISTSRC}
|
||||
$(MAKEINFO) --no-split -o $@ hist.texinfo
|
||||
|
||||
readline.ps: readline.dvi
|
||||
$(RM) $@
|
||||
$(DVIPS) readline.dvi
|
||||
|
||||
history.ps: history.dvi
|
||||
$(RM) $@
|
||||
$(DVIPS) history.dvi
|
||||
|
||||
readline.html: ${RLSRC}
|
||||
$(TEXI2HTML) rlman.texinfo
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
|
||||
$(RM) rlman.html rlman_toc.html
|
||||
|
||||
history.html: ${HISTSRC}
|
||||
$(TEXI2HTML) hist.texinfo
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
|
||||
$(RM) hist.html hist_toc.html
|
||||
|
||||
info: $(INFOOBJ)
|
||||
dvi: $(DVIOBJ)
|
||||
ps: $(PSOBJ)
|
||||
html: $(HTMLOBJ)
|
||||
|
||||
clean:
|
||||
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
|
||||
*.fns *.kys *.tps *.vrs *.o core
|
||||
|
||||
distclean: clean
|
||||
mostlyclean: clean
|
||||
|
||||
maintainer-clean: clean
|
||||
$(RM) *.dvi *.info *.info-* *.ps *.html
|
||||
|
||||
install: info
|
||||
${INSTALL_DATA} readline.info $(infodir)/readline.info
|
||||
${INSTALL_DATA} history.info $(infodir)/history.info
|
||||
@@ -40,8 +40,8 @@
|
||||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2011 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2011 by the Free Software Foundation, Inc.
|
||||
.if t The GNU History Library is Copyright \(co 1989-2014 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2014 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
Many programs read input from the user a line at a time. The GNU
|
||||
History library is able to keep track of those lines, associate arbitrary
|
||||
@@ -134,7 +134,7 @@ The entire command line typed so far.
|
||||
.SS Word Designators
|
||||
.PP
|
||||
Word designators are used to select desired words from the event.
|
||||
A
|
||||
A
|
||||
.B :
|
||||
separates the event specification from the word designator.
|
||||
It may be omitted if the word designator begins with a
|
||||
|
||||
+56
-21
@@ -6,10 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Fri May 16 09:35:15 EDT 2014
|
||||
|
||||
.\" Last Change: Wed Nov 19 18:32:58 EST 2014
|
||||
.\"
|
||||
.TH READLINE 3 "2014 May 16" "GNU Readline 6.3"
|
||||
.TH READLINE 3 "2014 November 19" "GNU Readline 6.3"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -35,8 +34,8 @@ readline \- get a line from a user with editing
|
||||
\fBreadline\fP (\fIconst char *prompt\fP);
|
||||
.fi
|
||||
.SH COPYRIGHT
|
||||
.if n Readline is Copyright (C) 1989\-2011 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2011 Free Software Foundation, Inc.
|
||||
.if n Readline is Copyright (C) 1989\-2014 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
.B readline
|
||||
@@ -79,10 +78,10 @@ treated as a newline.
|
||||
.LP
|
||||
An Emacs-style notation is used to denote
|
||||
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
|
||||
means Control\-N. Similarly,
|
||||
means Control\-N. Similarly,
|
||||
.I meta
|
||||
keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X. (On keyboards
|
||||
without a
|
||||
without a
|
||||
.I meta
|
||||
key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key
|
||||
then the
|
||||
@@ -99,14 +98,15 @@ Readline commands may be given numeric
|
||||
which normally act as a repeat count. Sometimes, however, it is the
|
||||
sign of the argument that is significant. Passing a negative argument
|
||||
to a command that acts in the forward direction (e.g., \fBkill\-line\fP)
|
||||
causes that command to act in a backward direction. Commands whose
|
||||
behavior with arguments deviates from this are noted.
|
||||
causes that command to act in a backward direction.
|
||||
Commands whose behavior with arguments deviates from this are noted
|
||||
below.
|
||||
.PP
|
||||
When a command is described as \fIkilling\fP text, the text
|
||||
deleted is saved for possible future retrieval
|
||||
(\fIyanking\fP). The killed text is saved in a
|
||||
\fIkill ring\fP. Consecutive kills cause the text to be
|
||||
accumulated into one unit, which can be yanked all at once.
|
||||
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.
|
||||
.SH INITIALIZATION FILE
|
||||
@@ -139,7 +139,7 @@ or
|
||||
C\-Meta\-u: universal\-argument
|
||||
.RE
|
||||
.sp
|
||||
into the
|
||||
into the
|
||||
.I inputrc
|
||||
would make M\-C\-u execute the readline command
|
||||
.IR universal\-argument .
|
||||
@@ -168,7 +168,7 @@ The syntax for controlling key bindings in the
|
||||
.I inputrc
|
||||
file is simple. All that is required is the name of the
|
||||
command or the text of a macro and a key sequence to which
|
||||
it should be bound. The name may be specified in one of two ways:
|
||||
it should be bound. The name may be specified in one of two ways:
|
||||
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
|
||||
prefixes, or as a key sequence.
|
||||
The name and key sequence are separated by a colon. There can be no
|
||||
@@ -226,7 +226,7 @@ is again bound to the function
|
||||
.I "C-x C-r"
|
||||
is bound to the function
|
||||
.BR re\-read\-init\-file ,
|
||||
and
|
||||
and
|
||||
.I "ESC [ 1 1 ~"
|
||||
is bound to insert the text
|
||||
.if t \f(CWFunction Key 1\fP.
|
||||
@@ -356,9 +356,15 @@ readline equivalents.
|
||||
If set to \fBOn\fP, readline attempts to briefly move the cursor to an
|
||||
opening parenthesis when a closing parenthsis is inserted.
|
||||
.TP
|
||||
.B colored\-completion\-prefix (Off)
|
||||
If set to \fBOn\fP, when listing completions, readline displays the
|
||||
common prefix of the set of possible completions using a different color.
|
||||
The color definitions are taken from the value of the \fBLS_COLORS\fP
|
||||
environment variable.
|
||||
.TP
|
||||
.B colored\-stats (Off)
|
||||
If set to \fBOn\fP, readline displays possible completions using different
|
||||
colors to indicate their file type.
|
||||
colors to indicate their file type.
|
||||
The color definitions are taken from the value of the \fBLS_COLORS\fP
|
||||
environment variable.
|
||||
.TP
|
||||
@@ -494,6 +500,15 @@ The value of
|
||||
.B editing\-mode
|
||||
also affects the default keymap.
|
||||
.TP
|
||||
.B emacs\-mode\-string (@)
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when emacs editing mode is active. The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B keyseq\-timeout (500)
|
||||
Specifies the duration \fIreadline\fP will wait for a character when reading an
|
||||
ambiguous key sequence (one that can form a complete key sequence using
|
||||
@@ -522,7 +537,7 @@ have a slash appended (subject to the value of
|
||||
.TP
|
||||
.B match\-hidden\-files (On)
|
||||
This variable, when set to \fBOn\fP, causes readline to match files whose
|
||||
names begin with a `.' (hidden files) when performing filename
|
||||
names begin with a `.' (hidden files) when performing filename
|
||||
completion.
|
||||
If set to \fBOff\fP, the leading `.' must be
|
||||
supplied by the user in the filename to be completed.
|
||||
@@ -570,8 +585,8 @@ of ringing the bell.
|
||||
.TP
|
||||
.B show\-mode\-in\-prompt (Off)
|
||||
If set to \fBOn\fP, add a character to the beginning of the prompt
|
||||
indicating the editing mode: emacs (@), vi command (:) or vi
|
||||
insertion (+).
|
||||
indicating the editing mode: emacs, vi command, or vi insertion.
|
||||
The mode strings are user-settable.
|
||||
.TP
|
||||
.B skip\-completed\-text (Off)
|
||||
If set to \fBOn\fP, this alters the default completion behavior when
|
||||
@@ -581,6 +596,26 @@ does not insert characters from the completion that match characters
|
||||
after point in the word being completed, so portions of the word
|
||||
following the cursor are not duplicated.
|
||||
.TP
|
||||
.B vi\-cmd\-mode\-string ((cmd))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in command mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B vi\-ins\-mode\-string ((ins))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in insertion mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B visible\-stats (Off)
|
||||
If set to \fBOn\fP, a character denoting a file's type as reported
|
||||
by \fIstat\fP(2) is appended to the filename when listing possible
|
||||
@@ -593,7 +628,7 @@ compilation features of the C preprocessor which allows key
|
||||
bindings and variable settings to be performed as the result
|
||||
of tests. There are four parser directives used.
|
||||
.IP \fB$if\fP
|
||||
The
|
||||
The
|
||||
.B $if
|
||||
construct allows bindings to be made based on the
|
||||
editing mode, the terminal being used, or the application using
|
||||
@@ -899,7 +934,7 @@ switches to overwrite mode. With an explicit non-positive numeric
|
||||
argument, switches to insert mode. This command affects only
|
||||
\fBemacs\fP mode; \fBvi\fP mode does overwrite differently.
|
||||
Each call to \fIreadline()\fP starts in insert mode.
|
||||
In overwrite mode, characters bound to \fBself\-insert\fP replace
|
||||
In overwrite mode, characters bound to \fBself\-insert\fP replace
|
||||
the text at point rather than pushing the text to the right.
|
||||
Characters bound to \fBbackward\-delete\-char\fP replace the character
|
||||
before point with a space. By default, this command is unbound.
|
||||
@@ -922,7 +957,7 @@ The killed text is saved on the kill-ring.
|
||||
.B kill\-whole\-line
|
||||
Kill all characters on the current line, no matter where point is.
|
||||
.TP
|
||||
.B kill\-word (M\-d)
|
||||
.B kill\-word (M\-d)
|
||||
Kill from point the end of the current word, or if between
|
||||
words, to the end of the next word. Word boundaries are the same as
|
||||
those used by \fBforward\-word\fP.
|
||||
@@ -1129,7 +1164,7 @@ but usually bound to ESC\-[.
|
||||
Without a numeric argument, the value of the readline
|
||||
.B comment\-begin
|
||||
variable is inserted at the beginning of the current line.
|
||||
If a numeric argument is supplied, this command acts as a toggle: if
|
||||
If a numeric argument is supplied, this command acts as a toggle: if
|
||||
the characters at the beginning of the line do not match the value
|
||||
of \fBcomment\-begin\fP, the value is inserted, otherwise
|
||||
the characters in \fBcomment-begin\fP are deleted from the beginning of
|
||||
|
||||
@@ -1328,7 +1328,7 @@ the terminal settings are modified for Readline's use again.
|
||||
|
||||
@deftypefun void rl_callback_handler_remove (void)
|
||||
Restore the terminal to its initial state and remove the line handler.
|
||||
This may be called from within a callback as well as independently.
|
||||
You may call this function from within a callback as well as independently.
|
||||
If the @var{lhandler} installed by @code{rl_callback_handler_install}
|
||||
does not exit the program, either this function or the function referred
|
||||
to by the value of @code{rl_deprep_term_function} should be called before
|
||||
@@ -1942,8 +1942,8 @@ where @var{matches} is the array of matching strings,
|
||||
@var{num_matches} is the number of strings in that array, and
|
||||
@var{max_length} is the length of the longest string in that array.
|
||||
Readline provides a convenience function, @code{rl_display_match_list},
|
||||
that takes care of doing the display to Readline's output stream. That
|
||||
function may be called from this hook.
|
||||
that takes care of doing the display to Readline's output stream.
|
||||
You may call that function from this hook.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {const char *} rl_basic_word_break_characters
|
||||
|
||||
@@ -433,6 +433,14 @@ If set to @samp{on}, Readline attempts to briefly move the cursor to an
|
||||
opening parenthesis when a closing parenthsis is inserted. The default
|
||||
is @samp{off}.
|
||||
|
||||
@item colored-completion-prefix
|
||||
@vindex colored-completion-prefix
|
||||
If set to @samp{on}, when listing completions, Readline displays the
|
||||
common prefix of the set of possible completions using a different color.
|
||||
The color definitions are taken from the value of the @env{LS_COLORS}
|
||||
environment variable.
|
||||
The default is @samp{off}.
|
||||
|
||||
@item colored-stats
|
||||
@vindex colored-stats
|
||||
If set to @samp{on}, Readline displays possible completions using different
|
||||
@@ -511,7 +519,7 @@ set to either @samp{emacs} or @samp{vi}.
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when emacs editing mode is active. The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available (@pxref{Key Bindings}).
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
@@ -699,8 +707,8 @@ The default value is @samp{off}.
|
||||
@item show-mode-in-prompt
|
||||
@vindex show-mode-in-prompt
|
||||
If set to @samp{on}, add a character to the beginning of the prompt
|
||||
indicating the editing mode: emacs (@samp{@@}), vi command (@samp{:}),
|
||||
or vi insertion (@samp{+}).
|
||||
indicating the editing mode: emacs, vi command, or vi insertion.
|
||||
The mode strings are user-settable.
|
||||
The default value is @samp{off}.
|
||||
|
||||
@item skip-completed-text
|
||||
@@ -723,7 +731,7 @@ This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in command mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available (@pxref{Key Bindings}).
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
@@ -735,7 +743,7 @@ This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in insertion mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available (@pxref{Key Bindings}).
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
@@ -1848,6 +1856,10 @@ is removed before attempting a match.
|
||||
Any completion that matches the pattern will be removed from the list.
|
||||
A leading @samp{!} negates the pattern; in this case any completion
|
||||
not matching the pattern will be removed.
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
|
||||
Finally, any prefix and suffix specified with the @option{-P} and @option{-S}
|
||||
options are added to each member of the completion list, and the result is
|
||||
|
||||
@@ -4,7 +4,7 @@ Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||
|
||||
@set EDITION 6.3
|
||||
@set VERSION 6.3
|
||||
@set UPDATED 15 November 2014
|
||||
@set UPDATED 21 November 2014
|
||||
@set UPDATED-MONTH November 2014
|
||||
|
||||
@set LASTCHANGE Sat Nov 15 19:56:51 EST 2014
|
||||
@set LASTCHANGE Fri Nov 21 08:07:14 EST 2014
|
||||
|
||||
@@ -288,7 +288,7 @@ add_history (string)
|
||||
for (i = 0; i < history_length; i++)
|
||||
the_history[i] = the_history[i + 1];
|
||||
#else
|
||||
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY));
|
||||
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
|
||||
#endif
|
||||
|
||||
history_base++;
|
||||
|
||||
@@ -1196,7 +1196,7 @@ readline_initialize_everything ()
|
||||
rl_completer_word_break_characters = (char *)rl_basic_word_break_characters;
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
if (_rl_colored_stats)
|
||||
if (_rl_colored_stats || _rl_colored_completion_prefix)
|
||||
_rl_parse_colors ();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ extern int rl_visible_stats;
|
||||
#endif /* VISIBLE_STATS */
|
||||
#if defined (COLOR_SUPPORT)
|
||||
extern int _rl_colored_stats;
|
||||
extern int _rl_colored_completion_prefix;
|
||||
#endif
|
||||
|
||||
/* readline.c */
|
||||
|
||||
@@ -461,7 +461,7 @@ glob_name_is_acceptable (name)
|
||||
if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
|
||||
return (0);
|
||||
|
||||
flags = FNM_PATHNAME | FNMATCH_EXTFLAG;
|
||||
flags = FNM_PATHNAME | FNMATCH_EXTFLAG | FNMATCH_NOCASEGLOB;
|
||||
for (p = globignore.ignores; p->val; p++)
|
||||
{
|
||||
if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH)
|
||||
|
||||
@@ -43,6 +43,7 @@ extern char *glob_error_return;
|
||||
#endif /* !EXTENDED_GLOB */
|
||||
|
||||
#define FNMATCH_IGNCASE (match_ignore_case ? FNM_CASEFOLD : 0)
|
||||
#define FNMATCH_NOCASEGLOB (glob_ignore_case ? FNM_CASEFOLD : 0)
|
||||
|
||||
extern int glob_dot_filenames;
|
||||
extern int extended_glob;
|
||||
|
||||
+1
-1
@@ -310,7 +310,7 @@ filter_stringlist (sl, filterpat, text)
|
||||
ret = strlist_create (sl->list_size);
|
||||
for (i = 0; i < sl->list_len; i++)
|
||||
{
|
||||
m = strmatch (t, sl->list[i], FNMATCH_EXTFLAG);
|
||||
m = strmatch (t, sl->list[i], FNMATCH_EXTFLAG | FNMATCH_IGNCASE);
|
||||
if ((not && m == FNM_NOMATCH) || (not == 0 && m != FNM_NOMATCH))
|
||||
free (sl->list[i]);
|
||||
else
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -722,7 +722,7 @@ main (argc, argv, env)
|
||||
/* Bind remaining args to $1 ... $n */
|
||||
arg_index = bind_args (argv, arg_index, argc, 1);
|
||||
|
||||
if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && dollar_vars[1])
|
||||
if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && (dollar_vars[1] || interactive_shell == 0))
|
||||
start_debugger ();
|
||||
|
||||
/* Do the things that should be done only for interactive shells. */
|
||||
@@ -1408,12 +1408,19 @@ start_debugger ()
|
||||
{
|
||||
#if defined (DEBUGGER) && defined (DEBUGGER_START_FILE)
|
||||
int old_errexit;
|
||||
int r;
|
||||
|
||||
old_errexit = exit_immediately_on_error;
|
||||
exit_immediately_on_error = 0;
|
||||
|
||||
maybe_execute_file (DEBUGGER_START_FILE, 1);
|
||||
function_trace_mode = 1;
|
||||
r = force_execute_file (DEBUGGER_START_FILE, 1);
|
||||
if (r < 0)
|
||||
{
|
||||
internal_warning ("cannot start debugger; debugging mode disabled");
|
||||
debugging_mode = function_trace_mode = 0;
|
||||
}
|
||||
else
|
||||
function_trace_mode = 1;
|
||||
|
||||
exit_immediately_on_error += old_errexit;
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* ``Have a little faith, there's magic in the night. You ain't a
|
||||
beauty, but, hey, you're alright.'' */
|
||||
|
||||
/* Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2014 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -191,6 +191,8 @@ char *glob_argv_flags;
|
||||
static int glob_argv_flags_size;
|
||||
#endif
|
||||
|
||||
static WORD_LIST *cached_quoted_dollar_at = 0;
|
||||
|
||||
static WORD_LIST expand_word_error, expand_word_fatal;
|
||||
static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
|
||||
static char expand_param_error, expand_param_fatal;
|
||||
@@ -4174,7 +4176,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
}
|
||||
else
|
||||
npat = pat;
|
||||
c = strmatch (npat, string, FNMATCH_EXTFLAG);
|
||||
c = strmatch (npat, string, FNMATCH_EXTFLAG | FNMATCH_IGNCASE);
|
||||
if (npat != pat)
|
||||
free (npat);
|
||||
if (c == FNM_NOMATCH)
|
||||
@@ -4190,7 +4192,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
case MATCH_ANY:
|
||||
for (p = string; p <= end; p++)
|
||||
{
|
||||
if (match_pattern_char (pat, p))
|
||||
if (match_pattern_char (pat, p, FNMATCH_IGNCASE))
|
||||
{
|
||||
p1 = (mlen == -1) ? end : p + mlen;
|
||||
/* p1 - p = length of portion of string to be considered
|
||||
@@ -4206,7 +4208,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
for ( ; p1 >= p; p1--)
|
||||
{
|
||||
c = *p1; *p1 = '\0';
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
*p1 = c;
|
||||
*sp = p;
|
||||
@@ -4226,13 +4228,13 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
return (0);
|
||||
|
||||
case MATCH_BEG:
|
||||
if (match_pattern_char (pat, string) == 0)
|
||||
if (match_pattern_char (pat, string, FNMATCH_IGNCASE) == 0)
|
||||
return (0);
|
||||
|
||||
for (p = (mlen == -1) ? end : string + mlen; p >= string; p--)
|
||||
{
|
||||
c = *p; *p = '\0';
|
||||
if (strmatch (pat, string, FNMATCH_EXTFLAG) == 0)
|
||||
if (strmatch (pat, string, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
*p = c;
|
||||
*sp = string;
|
||||
@@ -4250,7 +4252,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
case MATCH_END:
|
||||
for (p = end - ((mlen == -1) ? len : mlen); p <= end; p++)
|
||||
{
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
*sp = p;
|
||||
*ep = end;
|
||||
@@ -4268,6 +4270,9 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
||||
#define WFOLD(c) (match_ignore_case && iswupper (c) ? towlower (c) : (c))
|
||||
|
||||
/* Match WPAT anywhere in WSTRING and return the match boundaries.
|
||||
This returns 1 in case of a successful match, 0 otherwise. Wide
|
||||
character version. */
|
||||
@@ -4312,7 +4317,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
}
|
||||
else
|
||||
nwpat = wpat;
|
||||
len = wcsmatch (nwpat, wstring, FNMATCH_EXTFLAG);
|
||||
len = wcsmatch (nwpat, wstring, FNMATCH_EXTFLAG | FNMATCH_IGNCASE);
|
||||
if (nwpat != wpat)
|
||||
free (nwpat);
|
||||
if (len == FNM_NOMATCH)
|
||||
@@ -4326,7 +4331,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
case MATCH_ANY:
|
||||
for (n = 0; n <= wstrlen; n++)
|
||||
{
|
||||
n2 = simple ? (*wpat == wstring[n]) : match_pattern_wchar (wpat, wstring + n);
|
||||
n2 = simple ? (WFOLD(*wpat) == WFOLD(wstring[n])) : match_pattern_wchar (wpat, wstring + n, FNMATCH_IGNCASE);
|
||||
if (n2)
|
||||
{
|
||||
n1 = (mlen == -1) ? wstrlen : n + mlen;
|
||||
@@ -4336,7 +4341,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
for ( ; n1 >= n; n1--)
|
||||
{
|
||||
wc = wstring[n1]; wstring[n1] = L'\0';
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
wstring[n1] = wc;
|
||||
*sp = indices[n];
|
||||
@@ -4354,13 +4359,13 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
return (0);
|
||||
|
||||
case MATCH_BEG:
|
||||
if (match_pattern_wchar (wpat, wstring) == 0)
|
||||
if (match_pattern_wchar (wpat, wstring, FNMATCH_IGNCASE) == 0)
|
||||
return (0);
|
||||
|
||||
for (n = (mlen == -1) ? wstrlen : mlen; n >= 0; n--)
|
||||
{
|
||||
wc = wstring[n]; wstring[n] = L'\0';
|
||||
if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG) == 0)
|
||||
if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
wstring[n] = wc;
|
||||
*sp = indices[0];
|
||||
@@ -4378,7 +4383,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
case MATCH_END:
|
||||
for (n = wstrlen - ((mlen == -1) ? wstrlen : mlen); n <= wstrlen; n++)
|
||||
{
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG | FNMATCH_IGNCASE) == 0)
|
||||
{
|
||||
*sp = indices[n];
|
||||
*ep = indices[wstrlen];
|
||||
@@ -4394,6 +4399,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
|
||||
return (0);
|
||||
}
|
||||
#undef WFOLD
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
||||
static int
|
||||
@@ -8197,6 +8203,13 @@ return0:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
invalidate_cached_quoted_dollar_at ()
|
||||
{
|
||||
dispose_words (cached_quoted_dollar_at);
|
||||
cached_quoted_dollar_at = 0;
|
||||
}
|
||||
|
||||
/* Make a word list which is the result of parameter and variable
|
||||
expansion, command substitution, arithmetic substitution, and
|
||||
quote removal of WORD. Return a pointer to a WORD_LIST which is
|
||||
@@ -8278,6 +8291,23 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
/* OK, let's see if we can optimize a common idiom: "$@" */
|
||||
if (STREQ (word->word, "\"$@\"") &&
|
||||
(word->flags == (W_HASDOLLAR|W_QUOTED)) &&
|
||||
dollar_vars[1]) /* XXX - check IFS here as well? */
|
||||
{
|
||||
if (contains_dollar_at)
|
||||
*contains_dollar_at = 1;
|
||||
if (expanded_something)
|
||||
*expanded_something = 1;
|
||||
if (cached_quoted_dollar_at)
|
||||
return (copy_word_list (cached_quoted_dollar_at));
|
||||
list = list_rest_of_args ();
|
||||
list = quote_list (list);
|
||||
cached_quoted_dollar_at = copy_word_list (list);
|
||||
return (list);
|
||||
}
|
||||
|
||||
istring = (char *)xmalloc (istring_size = DEFAULT_INITIAL_ARRAY_SIZE);
|
||||
istring[istring_index = 0] = '\0';
|
||||
quoted_dollar_at = had_quoted_null = has_dollar_at = 0;
|
||||
|
||||
@@ -319,4 +319,6 @@ extern unsigned char ifs_firstc;
|
||||
/* Is the first character of STRING a quoted NULL character? */
|
||||
#define QUOTED_NULL(string) ((string)[0] == CTLNUL && (string)[1] == '\0')
|
||||
|
||||
extern void invalidate_cached_quoted_dollar_at __P((void));
|
||||
|
||||
#endif /* !_SUBST_H_ */
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
@@ -54,3 +54,10 @@ remaining args:
|
||||
0
|
||||
./getopts7.sub: line 4: getopts: `opt-var': not a valid identifier
|
||||
remaining args:
|
||||
opt: x
|
||||
opt: y
|
||||
opt: a
|
||||
opt: b
|
||||
opt: c
|
||||
opt: z
|
||||
$1 = a
|
||||
|
||||
@@ -36,3 +36,6 @@ ${THIS_SH} ./getopts6.sub -ac
|
||||
echo $? # this should be 2
|
||||
|
||||
${THIS_SH} ./getopts7.sub -a
|
||||
|
||||
${THIS_SH} ./getopts8.sub
|
||||
${THIS_SH} ./getopts9.sub
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# getopts tests
|
||||
# this should fail
|
||||
getopts
|
||||
echo $?
|
||||
getopts opts
|
||||
echo $?
|
||||
|
||||
# maybe someday we will have a ksh93-like -a argument to set the name
|
||||
# used in error messages, but not yet
|
||||
getopts -a opts name
|
||||
|
||||
${THIS_SH} ./getopts1.sub -a -b bval one two three
|
||||
# make sure getopts works when there are more than 9 positional parameters
|
||||
${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
|
||||
${THIS_SH} ./getopts1.sub -a -b
|
||||
|
||||
${THIS_SH} ./getopts2.sub -ad -c cval three four five
|
||||
|
||||
${THIS_SH} ./getopts3.sub
|
||||
|
||||
# make sure that `-b bval' and `-bbval' are equivalent
|
||||
${THIS_SH} ./getopts4.sub -a -b bval one two three
|
||||
${THIS_SH} ./getopts4.sub -a -bbval one two three
|
||||
# this tests `silent' error reporting
|
||||
${THIS_SH} ./getopts4.sub -a -b
|
||||
${THIS_SH} ./getopts4.sub -a -c
|
||||
|
||||
# make sure that `--' can be used to end the list of options
|
||||
${THIS_SH} ./getopts4.sub -a -- -b bval one two three
|
||||
|
||||
${THIS_SH} ./getopts5.sub -a -c
|
||||
|
||||
${THIS_SH} ./getopts6.sub -a
|
||||
${THIS_SH} ./getopts6.sub -a -c
|
||||
${THIS_SH} ./getopts6.sub -ac
|
||||
echo $? # this should be 2
|
||||
|
||||
${THIS_SH} ./getopts7.sub -a
|
||||
@@ -0,0 +1,13 @@
|
||||
f()
|
||||
{
|
||||
typeset OPTIND=1
|
||||
typeset opt
|
||||
|
||||
while getopts ":abcxyz" opt
|
||||
do
|
||||
echo opt: "$opt"
|
||||
if [[ $opt = y ]]; then f -abc ; fi
|
||||
done
|
||||
}
|
||||
|
||||
f -xyz
|
||||
@@ -0,0 +1,16 @@
|
||||
f()
|
||||
{
|
||||
OPTIND=4
|
||||
|
||||
echo \$1 = $1
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
while getopts abcdefg opt
|
||||
do
|
||||
f $opt
|
||||
done
|
||||
}
|
||||
|
||||
main -abc
|
||||
@@ -0,0 +1,50 @@
|
||||
:; ./shx
|
||||
|
||||
sh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:00 EDT 1992
|
||||
bang geoff
|
||||
quote 712824302
|
||||
setbq defmsgid=<1992Aug3.024502.6176@host>
|
||||
bgwait sleep done... wait 6187
|
||||
|
||||
|
||||
bash:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:09 EDT 1992
|
||||
bang geoff
|
||||
quote 712824311
|
||||
setbq defmsgid=<1992Aug3.024512.6212@host>
|
||||
bgwait sleep done... wait 6223
|
||||
|
||||
|
||||
ash:
|
||||
<&$fd shx1: 4: Syntax error: Bad fd number
|
||||
nlbq Mon Aug 3 02:45:19 EDT 1992
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.` echo 024521
|
||||
bgwait sleep done... wait 6241
|
||||
|
||||
|
||||
ksh:
|
||||
<&$fd ok
|
||||
nlbq ./shx: 6248 Memory fault - core dumped
|
||||
bang geoff
|
||||
quote getdate: `"now"' not a valid date
|
||||
|
||||
setbq defmsgid=<1992Aug3.024530.6257@host>
|
||||
bgwait no such job: 6265
|
||||
wait 6265
|
||||
sleep done...
|
||||
|
||||
zsh:
|
||||
<&$fd ok
|
||||
nlbq Mon Aug 3 02:45:36 EDT 1992
|
||||
bang shx3: event not found: /s/ [4]
|
||||
quote 712824337
|
||||
setbq defmsgid=<..6290@host>
|
||||
bgwait shx7: unmatched " [9]
|
||||
sleep done...
|
||||
:;
|
||||
@@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
for cmd in sh bash ash ksh zsh
|
||||
do
|
||||
echo
|
||||
echo $cmd:
|
||||
for demo in shx?
|
||||
do
|
||||
$cmd $demo
|
||||
done
|
||||
done
|
||||
+1
-2
@@ -4564,8 +4564,7 @@ static WORD_LIST **dollar_arg_stack = (WORD_LIST **)NULL;
|
||||
static int dollar_arg_stack_slots;
|
||||
static int dollar_arg_stack_index;
|
||||
|
||||
/* XXX - we might want to consider pushing and popping the `getopts' state
|
||||
when we modify the positional parameters. */
|
||||
/* XXX - should always be followed by remember_args () */
|
||||
void
|
||||
push_context (name, is_subshell, tempvars)
|
||||
char *name; /* function name */
|
||||
|
||||
Reference in New Issue
Block a user