mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
commit bash-20100728 snapshot
This commit is contained in:
+112
-1
@@ -10206,7 +10206,8 @@ execute_cmd.c
|
||||
subst.c
|
||||
- when performing pattern substitution word expansions, a `&' in the
|
||||
replacement string is replaced by the text matched by the pattern.
|
||||
The `&' can be quoted with a backslash to inhibit the expansion
|
||||
The `&' can be quoted with a backslash to inhibit the expansion.
|
||||
CURRENTLY DISABLED
|
||||
|
||||
7/13
|
||||
----
|
||||
@@ -10248,3 +10249,113 @@ lib/readline/terminal.c
|
||||
----
|
||||
lib/readline/xfree.c
|
||||
- new file, contains definition of xfree moved from xmalloc.c
|
||||
|
||||
7/28
|
||||
----
|
||||
variables.c
|
||||
- check suspect return values from bind_variable before trying to use
|
||||
the returned SHELL_VAR *. Changes to: initialize_shell_variables,
|
||||
bind_int_variable, FIND_OR_MAKE_VARIABLE. Fixes bug reported by
|
||||
Roman Rakus <rrakus@redhat.com>
|
||||
|
||||
7/31
|
||||
----
|
||||
lib/readline/rltty.c
|
||||
- fix rl_prep_terminal and rl_deprep_terminal to use fileno(stdout)
|
||||
if rl_instream is NULL. Fixes bug reported by Otto Allmendinger
|
||||
otto.allmendinger@googlemail.com
|
||||
|
||||
8/2
|
||||
---
|
||||
lib/sh/casemod.c
|
||||
- if the passed string is NULL or empty, return it immediately. Fixes
|
||||
bug reported by Dennis Williamson <dennistwilliamson@gmail.com>
|
||||
|
||||
subst.c
|
||||
- fix pat_subst to cope with the passed string being NULL
|
||||
|
||||
arrayfunc.h
|
||||
- added flag values for array_value_internal and its callers; converted
|
||||
array_value_internal `allow_all' parameter into a general flags word
|
||||
- get_array_value now takes a flags value
|
||||
- changed array_value internal to use *indp as an index to use if the
|
||||
AV_USEIND flag is set, rather than recomputing it
|
||||
|
||||
subst.c
|
||||
- get_var_and_type takes two new parameters: a flags word and an index
|
||||
that represents an already-computed index for an array reference
|
||||
(just indexed arrays so far). Index is used and passed to array_value
|
||||
if flags includes AV_USEIND
|
||||
- parameter_brace_expand_word takes a new argument: the already-
|
||||
computed index; returns W_ARRAYIND if word expanded is being used
|
||||
as an array index
|
||||
- changed parameter_brace_casemod, parameter_brace_patsub,
|
||||
parameter_brace_substring, parameter_brace_remove_pattern to take new
|
||||
flags and index arguments from parameter_brace_expand_word. They
|
||||
pass the new parameters along to get_var_and_type to use an
|
||||
already-computed array index if necessary. Fixes bug where array
|
||||
indexes are computed twice reported by Andrew Benton
|
||||
<b3nton@gmail.com>
|
||||
|
||||
doc/bash.1,lib/readline/doc/{history.3,hsuser.texi}
|
||||
- modified description of history event designators to clarify that
|
||||
all non-absolute event designators are relative to the current
|
||||
position in the history list. Question raised by Frank
|
||||
Heckenbach <f.heckenbach@fh-soft.de> as debian bash bug 590012
|
||||
|
||||
8/5
|
||||
---
|
||||
subst.c
|
||||
- remove code that does not add a quoted null when the input string
|
||||
is partially quoted; subsequent word splitting may require it.
|
||||
Fixes bug reported by Eric Blake <eblake@redhat.com>
|
||||
|
||||
8/12
|
||||
----
|
||||
lib/glob/gmisc.c
|
||||
- move match_pattern_wchar and match_pattern_char to new file in
|
||||
glob library
|
||||
- new functions: wmatchlen(pat, max) and umatchlen(pat, max), computes
|
||||
number of characters PAT will match. Returns the number of chars
|
||||
that will be matched or -1 if the match length is indeterminate
|
||||
(i.e., contains a `*')
|
||||
|
||||
subst.c
|
||||
- use umatchlen/wmatchlen in match_upattern/match_wpattern to bound
|
||||
the number of match attempts in large strings to (usually) one,
|
||||
depending on match length. Fixes performance problems with
|
||||
pattern substitution in large strings noted by Yi Yan
|
||||
<yiyan97@hotmail.com>. Can be applied to remove_[uw]pattern also
|
||||
|
||||
8/13
|
||||
----
|
||||
bashhist.c
|
||||
- in maybe_append_history, change check for history_lines_this_session
|
||||
so that we append the lines to the file if it's equal to the value
|
||||
returned by where_history(). This means that without this change,
|
||||
the history won't be appended if all the lines in the history list
|
||||
were added in the current session since the last time the history
|
||||
file was read or written. Fixes bug reported by Bruce Korb
|
||||
<bruce.korb@gmail.com>
|
||||
|
||||
shell.h,parse.y
|
||||
- add prompt_string_pointer to the parser_state struct saved and
|
||||
restored by {save,restore}_parser_state. Fixes both bugs exposed
|
||||
by bash_completion and completion of open backquotes reported by
|
||||
Egmont Koblinger <egmont@gmail.com>
|
||||
|
||||
subst.h
|
||||
- new flag for skip_to_delim: SD_EXTGLOB. Skip extended globbing
|
||||
patterns while looking for ending delimiter
|
||||
|
||||
subst.c
|
||||
- when passed the SD_EXTGLOB flag, skip_to_delim skips over extended
|
||||
globbing patterns (when extended_glob is set) while looking for a
|
||||
character in the delimiter set
|
||||
|
||||
pathexp.c
|
||||
- split_ignorespec: new function to replace calls to extract_colon_unit
|
||||
in setup_ignore_patterns. uses skip_to_delim with the SD_EXTGLOB
|
||||
flag to skip over extended globbing patterns in variables like
|
||||
HISTIGNORE and GLOBIGNORE. Fixes bug reported by Dimitar DIMITROV
|
||||
<mitkofr@yahoo.fr> and Greg Wooledge <wooledg@eeg.ccf.org>
|
||||
|
||||
+117
-1
@@ -10206,7 +10206,8 @@ execute_cmd.c
|
||||
subst.c
|
||||
- when performing pattern substitution word expansions, a `&' in the
|
||||
replacement string is replaced by the text matched by the pattern.
|
||||
The `&' can be quoted with a backslash to inhibit the expansion
|
||||
The `&' can be quoted with a backslash to inhibit the expansion.
|
||||
CURRENTLY DISABLED
|
||||
|
||||
7/13
|
||||
----
|
||||
@@ -10243,3 +10244,118 @@ lib/readline/terminal.c
|
||||
- change rl_resize_terminal to always fetch the new terminal size and
|
||||
only force the redisplay if _rl_echoing_p is non-zero. Fixes bug
|
||||
reported by Balazs Kezes <rlblaster@gmail.com>
|
||||
|
||||
7/25
|
||||
----
|
||||
lib/readline/xfree.c
|
||||
- new file, contains definition of xfree moved from xmalloc.c
|
||||
|
||||
7/28
|
||||
----
|
||||
variables.c
|
||||
- check suspect return values from bind_variable before trying to use
|
||||
the returned SHELL_VAR *. Changes to: initialize_shell_variables,
|
||||
bind_int_variable, FIND_OR_MAKE_VARIABLE. Fixes bug reported by
|
||||
Roman Rakus <rrakus@redhat.com>
|
||||
|
||||
7/31
|
||||
----
|
||||
lib/readline/rltty.c
|
||||
- fix rl_prep_terminal and rl_deprep_terminal to use fileno(stdout)
|
||||
if rl_instream is NULL. Fixes bug reported by Otto Allmendinger
|
||||
otto.allmendinger@googlemail.com
|
||||
|
||||
8/2
|
||||
---
|
||||
lib/sh/casemod.c
|
||||
- if the passed string is NULL or empty, return it immediately. Fixes
|
||||
bug reported by Dennis Williamson <dennistwilliamson@gmail.com>
|
||||
|
||||
subst.c
|
||||
- fix pat_subst to cope with the passed string being NULL
|
||||
|
||||
arrayfunc.h
|
||||
- added flag values for array_value_internal and its callers; converted
|
||||
array_value_internal `allow_all' parameter into a general flags word
|
||||
- get_array_value now takes a flags value
|
||||
- changed array_value internal to use *indp as an index to use if the
|
||||
AV_USEIND flag is set, rather than recomputing it
|
||||
|
||||
subst.c
|
||||
- get_var_and_type takes two new parameters: a flags word and an index
|
||||
that represents an already-computed index for an array reference
|
||||
(just indexed arrays so far). Index is used and passed to array_value
|
||||
if flags includes AV_USEIND
|
||||
- parameter_brace_expand_word takes a new argument: the already-
|
||||
computed index; returns W_ARRAYIND if word expanded is being used
|
||||
as an array index
|
||||
- changed parameter_brace_casemod, parameter_brace_patsub,
|
||||
parameter_brace_substring, parameter_brace_remove_pattern to take new
|
||||
flags and index arguments from parameter_brace_expand_word. They
|
||||
pass the new parameters along to get_var_and_type to use an
|
||||
already-computed array index if necessary. Fixes bug where array
|
||||
indexes are computed twice reported by Andrew Benton
|
||||
<b3nton@gmail.com>
|
||||
|
||||
doc/bash.1,lib/readline/doc/{history.3,hsuser.texi}
|
||||
- modified description of history event designators to clarify that
|
||||
all non-absolute event designators are relative to the current
|
||||
position in the history list. Question raised by Frank
|
||||
Heckenbach <f.heckenbach@fh-soft.de> as debian bash bug 590012
|
||||
|
||||
8/5
|
||||
---
|
||||
subst.c
|
||||
- remove code that does not add a quoted null when the input string
|
||||
is partially quoted; subsequent word splitting may require it.
|
||||
Fixes bug reported by Eric Blake <eblake@redhat.com>
|
||||
|
||||
8/12
|
||||
----
|
||||
lib/glob/gmisc.c
|
||||
- move match_pattern_wchar and match_pattern_char to new file in
|
||||
glob library
|
||||
- new functions: wmatchlen(pat, max) and umatchlen(pat, max), computes
|
||||
number of characters PAT will match. Returns the number of chars
|
||||
that will be matched or -1 if the match length is indeterminate
|
||||
(i.e., contains a `*')
|
||||
|
||||
subst.c
|
||||
- use umatchlen/wmatchlen in match_upattern/match_wpattern to bound
|
||||
the number of match attempts in large strings to (usually) one,
|
||||
depending on match length. Fixes performance problems with
|
||||
pattern substitution in large strings noted by Yi Yan
|
||||
<yiyan97@hotmail.com>. Can be applied to remove_[uw]pattern also
|
||||
|
||||
8/13
|
||||
----
|
||||
bashhist.c
|
||||
- in maybe_append_history, change check for history_lines_this_session
|
||||
so that we append the lines to the file if it's equal to the value
|
||||
returned by where_history(). This means that without this change,
|
||||
the history won't be appended if all the lines in the history list
|
||||
were added in the current session since the last time the history
|
||||
file was read or written. Fixes bug reported by Bruce Korb
|
||||
<bruce.korb@gmail.com>
|
||||
|
||||
shell.h,parse.y
|
||||
- add prompt_string_pointer to the parser_state struct saved and
|
||||
restored by {save,restore}_parser_state. Fixes part of bug exposed
|
||||
by bash_completion and completion of open backquotes reported by
|
||||
Egmont Koblinger <egmont@gmail.com>
|
||||
|
||||
subst.h
|
||||
- new flag for skip_to_delim: SD_EXTGLOB. Skip extended globbing
|
||||
patterns while looking for ending delimiter
|
||||
|
||||
subst.c
|
||||
- when passed the SD_EXTGLOB flag, skip_to_delim skips over extended
|
||||
globbing patterns (when extended_glob is set) while looking for a
|
||||
character in the delimiter set
|
||||
|
||||
pathexp.c
|
||||
- split_ignorespec: new function to replace calls to extract_colon_unit
|
||||
in setup_ignore_patterns. uses skip_to_delim with the SD_EXTGLOB
|
||||
flag to skip over extended globbing patterns in variables like
|
||||
HISTIGNORE and GLOBIGNORE. Fixes bug reported by Dimitar DIMITROV
|
||||
<mitkofr@yahoo.fr> and Greg Wooledge <wooledg@eeg.ccf.org>
|
||||
|
||||
@@ -234,6 +234,7 @@ lib/glob/strmatch.h f
|
||||
lib/glob/glob.c f
|
||||
lib/glob/glob.h f
|
||||
lib/glob/glob_loop.c f
|
||||
lib/glob/gmisc.c f
|
||||
lib/glob/xmbsrtowcs.c f
|
||||
lib/glob/collsyms.h f
|
||||
lib/glob/doc/Makefile f
|
||||
@@ -763,6 +764,7 @@ tests/array6.sub f
|
||||
tests/array7.sub f
|
||||
tests/array8.sub f
|
||||
tests/array9.sub f
|
||||
tests/array10.sub f
|
||||
tests/array-at-star f
|
||||
tests/array2.right f
|
||||
tests/assoc.tests f
|
||||
@@ -927,6 +929,7 @@ tests/new-exp4.sub f
|
||||
tests/new-exp5.sub f
|
||||
tests/new-exp6.sub f
|
||||
tests/new-exp7.sub f
|
||||
tests/new-exp8.sub f
|
||||
tests/new-exp.right f
|
||||
tests/nquote.tests f
|
||||
tests/nquote.right f
|
||||
|
||||
@@ -234,6 +234,7 @@ lib/glob/strmatch.h f
|
||||
lib/glob/glob.c f
|
||||
lib/glob/glob.h f
|
||||
lib/glob/glob_loop.c f
|
||||
lib/glob/gmisc.c f
|
||||
lib/glob/xmbsrtowcs.c f
|
||||
lib/glob/collsyms.h f
|
||||
lib/glob/doc/Makefile f
|
||||
@@ -315,6 +316,7 @@ lib/readline/funmap.c f
|
||||
lib/readline/keymaps.c f
|
||||
lib/readline/util.c f
|
||||
lib/readline/terminal.c f
|
||||
lib/readline/xfree.c f
|
||||
lib/readline/xmalloc.c f
|
||||
lib/readline/search.c f
|
||||
lib/readline/isearch.c f
|
||||
@@ -762,6 +764,7 @@ tests/array6.sub f
|
||||
tests/array7.sub f
|
||||
tests/array8.sub f
|
||||
tests/array9.sub f
|
||||
tests/array10.sub f
|
||||
tests/array-at-star f
|
||||
tests/array2.right f
|
||||
tests/assoc.tests f
|
||||
|
||||
+3
-1
@@ -319,9 +319,11 @@ GLOB_DEP = $(GLOB_LIBRARY)
|
||||
GLOB_SOURCE = $(GLOB_LIBSRC)/glob.c $(GLOB_LIBSRC)/strmatch.c \
|
||||
$(GLOB_LIBSRC)/smatch.c $(GLOB_LIBSRC)/xmbsrtowcs.c \
|
||||
$(GLOB_LIBSRC)/glob_loop.c $(GLOB_LIBSRC)/sm_loop.c \
|
||||
$(GLOB_LIBSRC)/gmisc.c \
|
||||
$(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/strmatch.h
|
||||
GLOB_OBJ = $(GLOB_LIBDIR)/glob.o $(GLOB_LIBDIR)/strmatch.o \
|
||||
$(GLOB_LIBDIR)/smatch.o $(GLOB_LIBDIR)/xmbsrtowcs.o
|
||||
$(GLOB_LIBDIR)/smatch.o $(GLOB_LIBDIR)/xmbsrtowcs.o \
|
||||
$(GLOB_LIBDIR)/gmisc.o
|
||||
|
||||
# The source, object and documentation for the GNU Tilde library.
|
||||
TILDE_LIBSRC = $(LIBSRC)/tilde
|
||||
|
||||
+1
-1
@@ -565,7 +565,7 @@ strip: $(Program) .made
|
||||
lint:
|
||||
${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
|
||||
|
||||
version.h: $(SOURCES) config.h Makefile
|
||||
version.h: $(SOURCES) config.h Makefile patchlevel.h
|
||||
$(SHELL) $(SUPPORT_SRC)mkversion.sh -b -S ${topdir} -s $(RELSTATUS) -d $(Version) -o newversion.h \
|
||||
&& mv newversion.h version.h
|
||||
|
||||
|
||||
+25
-20
@@ -864,9 +864,9 @@ array_variable_part (s, subp, lenp)
|
||||
is non-null it gets 1 if the array reference is name[*], 2 if the
|
||||
reference is name[@], and 0 otherwise. */
|
||||
static char *
|
||||
array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
array_value_internal (s, quoted, flags, rtype, indp)
|
||||
char *s;
|
||||
int quoted, allow_all, *rtype;
|
||||
int quoted, flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
int len;
|
||||
@@ -893,7 +893,7 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
{
|
||||
if (rtype)
|
||||
*rtype = (t[0] == '*') ? 1 : 2;
|
||||
if (allow_all == 0)
|
||||
if ((flags & AV_ALLOWALL) == 0)
|
||||
{
|
||||
err_badarraysub (s);
|
||||
return ((char *)NULL);
|
||||
@@ -932,17 +932,22 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
*rtype = 0;
|
||||
if (var == 0 || array_p (var) || assoc_p (var) == 0)
|
||||
{
|
||||
ind = array_expand_index (t, len);
|
||||
if (ind < 0)
|
||||
if ((flags & AV_USEIND) == 0 || indp == 0)
|
||||
{
|
||||
/* negative subscripts to indexed arrays count back from end */
|
||||
if (var && array_p (var))
|
||||
ind = array_max_index (array_cell (var)) + 1 + ind;
|
||||
ind = array_expand_index (t, len);
|
||||
if (ind < 0)
|
||||
INDEX_ERROR();
|
||||
{
|
||||
/* negative subscripts to indexed arrays count back from end */
|
||||
if (var && array_p (var))
|
||||
ind = array_max_index (array_cell (var)) + 1 + ind;
|
||||
if (ind < 0)
|
||||
INDEX_ERROR();
|
||||
}
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
}
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
else if (indp)
|
||||
ind = *indp;
|
||||
}
|
||||
else if (assoc_p (var))
|
||||
{
|
||||
@@ -972,25 +977,25 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
/* Return a string containing the elements described by the array and
|
||||
subscript contained in S, obeying quoting for subscripts * and @. */
|
||||
char *
|
||||
array_value (s, quoted, rtype, indp)
|
||||
array_value (s, quoted, flags, rtype, indp)
|
||||
char *s;
|
||||
int quoted, *rtype;
|
||||
int quoted, flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
return (array_value_internal (s, quoted, 1, rtype, indp));
|
||||
return (array_value_internal (s, quoted, flags|AV_ALLOWALL, rtype, indp));
|
||||
}
|
||||
|
||||
/* Return the value of the array indexing expression S as a single string.
|
||||
If ALLOW_ALL is 0, do not allow `@' and `*' subscripts. This is used
|
||||
by other parts of the shell such as the arithmetic expression evaluator
|
||||
in expr.c. */
|
||||
If (FLAGS & AV_ALLOWALL) is 0, do not allow `@' and `*' subscripts. This
|
||||
is used by other parts of the shell such as the arithmetic expression
|
||||
evaluator in expr.c. */
|
||||
char *
|
||||
get_array_value (s, allow_all, rtype, indp)
|
||||
get_array_value (s, flags, rtype, indp)
|
||||
char *s;
|
||||
int allow_all, *rtype;
|
||||
int flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
return (array_value_internal (s, 0, allow_all, rtype, indp));
|
||||
return (array_value_internal (s, 0, flags, rtype, indp));
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
+25
-19
@@ -864,9 +864,9 @@ array_variable_part (s, subp, lenp)
|
||||
is non-null it gets 1 if the array reference is name[*], 2 if the
|
||||
reference is name[@], and 0 otherwise. */
|
||||
static char *
|
||||
array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
array_value_internal (s, quoted, flags, rtype, indp)
|
||||
char *s;
|
||||
int quoted, allow_all, *rtype;
|
||||
int quoted, flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
int len;
|
||||
@@ -893,7 +893,7 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
{
|
||||
if (rtype)
|
||||
*rtype = (t[0] == '*') ? 1 : 2;
|
||||
if (allow_all == 0)
|
||||
if ((flags & AV_ALLOWALL) == 0)
|
||||
{
|
||||
err_badarraysub (s);
|
||||
return ((char *)NULL);
|
||||
@@ -932,16 +932,22 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
*rtype = 0;
|
||||
if (var == 0 || array_p (var) || assoc_p (var) == 0)
|
||||
{
|
||||
ind = array_expand_index (t, len);
|
||||
if (ind < 0)
|
||||
if ((flags & AV_USEIND) == 0)
|
||||
{
|
||||
if (var && array_p (var))
|
||||
ind = array_max_index (array_cell (var)) + 1 + ind;
|
||||
ind = array_expand_index (t, len);
|
||||
if (ind < 0)
|
||||
INDEX_ERROR();
|
||||
{
|
||||
/* negative subscripts to indexed arrays count back from end */
|
||||
if (var && array_p (var))
|
||||
ind = array_max_index (array_cell (var)) + 1 + ind;
|
||||
if (ind < 0)
|
||||
INDEX_ERROR();
|
||||
}
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
}
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
else if (indp)
|
||||
ind = *indp;
|
||||
}
|
||||
else if (assoc_p (var))
|
||||
{
|
||||
@@ -971,25 +977,25 @@ array_value_internal (s, quoted, allow_all, rtype, indp)
|
||||
/* Return a string containing the elements described by the array and
|
||||
subscript contained in S, obeying quoting for subscripts * and @. */
|
||||
char *
|
||||
array_value (s, quoted, rtype, indp)
|
||||
array_value (s, quoted, flags, rtype, indp)
|
||||
char *s;
|
||||
int quoted, *rtype;
|
||||
int quoted, flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
return (array_value_internal (s, quoted, 1, rtype, indp));
|
||||
return (array_value_internal (s, quoted, flags|AV_ALLOWALL, rtype, indp));
|
||||
}
|
||||
|
||||
/* Return the value of the array indexing expression S as a single string.
|
||||
If ALLOW_ALL is 0, do not allow `@' and `*' subscripts. This is used
|
||||
by other parts of the shell such as the arithmetic expression evaluator
|
||||
in expr.c. */
|
||||
If (FLAGS & AV_ALLOWALL) is 0, do not allow `@' and `*' subscripts. This
|
||||
is used by other parts of the shell such as the arithmetic expression
|
||||
evaluator in expr.c. */
|
||||
char *
|
||||
get_array_value (s, allow_all, rtype, indp)
|
||||
get_array_value (s, flags, rtype, indp)
|
||||
char *s;
|
||||
int allow_all, *rtype;
|
||||
int flags, *rtype;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
return (array_value_internal (s, 0, allow_all, rtype, indp));
|
||||
return (array_value_internal (s, 0, flags, rtype, indp));
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
+6
-1
@@ -25,6 +25,11 @@
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
|
||||
/* Flags for array_value_internal and callers array_value/get_array_value */
|
||||
#define AV_ALLOWALL 0x001
|
||||
#define AV_QUOTED 0x002
|
||||
#define AV_USEIND 0x004
|
||||
|
||||
extern SHELL_VAR *convert_var_to_array __P((SHELL_VAR *));
|
||||
extern SHELL_VAR *convert_var_to_assoc __P((SHELL_VAR *));
|
||||
|
||||
@@ -51,7 +56,7 @@ extern void print_assoc_assignment __P((SHELL_VAR *, int));
|
||||
|
||||
extern arrayind_t array_expand_index __P((char *, int));
|
||||
extern int valid_array_reference __P((char *));
|
||||
extern char *array_value __P((char *, int, int *, arrayind_t *));
|
||||
extern char *array_value __P((char *, int, int, int *, arrayind_t *));
|
||||
extern char *get_array_value __P((char *, int, int *, arrayind_t *));
|
||||
|
||||
extern char *array_keys __P((char *, int));
|
||||
|
||||
+6
-1
@@ -1,6 +1,6 @@
|
||||
/* arrayfunc.h -- declarations for miscellaneous array functions in arrayfunc.c */
|
||||
|
||||
/* Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2001-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
|
||||
/* Flags for array_value_internal and callers */
|
||||
#define AV_ALLOWALL 0x001
|
||||
#define AV_QUOTED 0x002
|
||||
#define AV_USEIND 0x004
|
||||
|
||||
extern SHELL_VAR *convert_var_to_array __P((SHELL_VAR *));
|
||||
extern SHELL_VAR *convert_var_to_assoc __P((SHELL_VAR *));
|
||||
|
||||
|
||||
@@ -27176,6 +27176,366 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:$LINENO: checking size of intmax_t" >&5
|
||||
$as_echo_n "checking size of intmax_t... " >&6; }
|
||||
if test "${ac_cv_sizeof_intmax_t+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then
|
||||
# Depending upon the size, compute the lo and hi bounds.
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array @<:@1 - 2 * !(((long int) (sizeof (intmax_t))) >= 0)@:>@;
|
||||
test_array @<:@0@:>@ = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_lo=0 ac_mid=0
|
||||
while :; do
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array @<:@1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)@:>@;
|
||||
test_array @<:@0@:>@ = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=$ac_mid; break
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo=`expr $ac_mid + 1`
|
||||
if test $ac_lo -le $ac_mid; then
|
||||
ac_lo= ac_hi=
|
||||
break
|
||||
fi
|
||||
ac_mid=`expr 2 '*' $ac_mid + 1`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array @<:@1 - 2 * !(((long int) (sizeof (intmax_t))) < 0)@:>@;
|
||||
test_array @<:@0@:>@ = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=-1 ac_mid=-1
|
||||
while :; do
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array @<:@1 - 2 * !(((long int) (sizeof (intmax_t))) >= $ac_mid)@:>@;
|
||||
test_array @<:@0@:>@ = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_lo=$ac_mid; break
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_hi=`expr '(' $ac_mid ')' - 1`
|
||||
if test $ac_mid -le $ac_hi; then
|
||||
ac_lo= ac_hi=
|
||||
break
|
||||
fi
|
||||
ac_mid=`expr 2 '*' $ac_mid`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo= ac_hi=
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
# Binary search between lo and hi bounds.
|
||||
while test "x$ac_lo" != "x$ac_hi"; do
|
||||
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array @<:@1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)@:>@;
|
||||
test_array @<:@0@:>@ = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=$ac_mid
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo=`expr '(' $ac_mid ')' + 1`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
case $ac_lo in
|
||||
?*) ac_cv_sizeof_intmax_t=$ac_lo;;
|
||||
'') if test "$ac_cv_type_intmax_t" = yes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&5
|
||||
$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 77); exit 77; }; }; }
|
||||
else
|
||||
ac_cv_sizeof_intmax_t=0
|
||||
fi ;;
|
||||
esac
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
static long int longval () { return (long int) (sizeof (intmax_t)); }
|
||||
static unsigned long int ulongval () { return (long int) (sizeof (intmax_t)); }
|
||||
@%:@include <stdio.h>
|
||||
@%:@include <stdlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
FILE *f = fopen ("conftest.val", "w");
|
||||
if (! f)
|
||||
return 1;
|
||||
if (((long int) (sizeof (intmax_t))) < 0)
|
||||
{
|
||||
long int i = longval ();
|
||||
if (i != ((long int) (sizeof (intmax_t))))
|
||||
return 1;
|
||||
fprintf (f, "%ld", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long int i = ulongval ();
|
||||
if (i != ((long int) (sizeof (intmax_t))))
|
||||
return 1;
|
||||
fprintf (f, "%lu", i);
|
||||
}
|
||||
/* Do not output a trailing newline, as this causes \r\n confusion
|
||||
on some platforms. */
|
||||
return ferror (f) || fclose (f) != 0;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_sizeof_intmax_t=`cat conftest.val`
|
||||
else
|
||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
if test "$ac_cv_type_intmax_t" = yes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&5
|
||||
$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 77); exit 77; }; }; }
|
||||
else
|
||||
ac_cv_sizeof_intmax_t=0
|
||||
fi
|
||||
fi
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
rm -f conftest.val
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_intmax_t" >&5
|
||||
$as_echo "$ac_cv_sizeof_intmax_t" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@%:@define SIZEOF_INTMAX_T $ac_cv_sizeof_intmax_t
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for struct termios.c_line" >&5
|
||||
$as_echo_n "checking for struct termios.c_line... " >&6; }
|
||||
|
||||
+11
-11
@@ -15,25 +15,25 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'_m4_warn' => 1,
|
||||
@@ -49,13 +49,13 @@
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'm4_include' => 1,
|
||||
|
||||
+311
-307
@@ -2149,41 +2149,45 @@ m4trace:configure.in:906: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE])
|
||||
m4trace:configure.in:906: -1- m4_pattern_allow([^RLIMTYPE$])
|
||||
m4trace:configure.in:906: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE])
|
||||
m4trace:configure.in:906: -1- m4_pattern_allow([^RLIMTYPE$])
|
||||
m4trace:configure.in:909: -2- AC_DEFINE_TRACE_LITERAL([TERMIOS_LDISC])
|
||||
m4trace:configure.in:909: -2- m4_pattern_allow([^TERMIOS_LDISC$])
|
||||
m4trace:configure.in:910: -2- AC_DEFINE_TRACE_LITERAL([TERMIO_LDISC])
|
||||
m4trace:configure.in:910: -2- m4_pattern_allow([^TERMIO_LDISC$])
|
||||
m4trace:configure.in:911: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1042: BASH_STRUCT_DIRENT_D_INO is expanded from...
|
||||
configure.in:911: the top level])
|
||||
m4trace:configure.in:911: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_INO])
|
||||
m4trace:configure.in:911: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_INO$])
|
||||
m4trace:configure.in:912: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1075: BASH_STRUCT_DIRENT_D_FILENO is expanded from...
|
||||
configure.in:912: the top level])
|
||||
m4trace:configure.in:912: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_FILENO])
|
||||
m4trace:configure.in:912: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_FILENO$])
|
||||
m4trace:configure.in:908: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_INTMAX_T])
|
||||
m4trace:configure.in:908: -1- m4_pattern_allow([^SIZEOF_INTMAX_T$])
|
||||
m4trace:configure.in:908: -1- AH_OUTPUT([SIZEOF_INTMAX_T], [/* The size of `intmax_t\', as computed by sizeof. */
|
||||
#undef SIZEOF_INTMAX_T])
|
||||
m4trace:configure.in:911: -2- AC_DEFINE_TRACE_LITERAL([TERMIOS_LDISC])
|
||||
m4trace:configure.in:911: -2- m4_pattern_allow([^TERMIOS_LDISC$])
|
||||
m4trace:configure.in:912: -2- AC_DEFINE_TRACE_LITERAL([TERMIO_LDISC])
|
||||
m4trace:configure.in:912: -2- m4_pattern_allow([^TERMIO_LDISC$])
|
||||
m4trace:configure.in:913: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1108: BASH_STRUCT_DIRENT_D_NAMLEN is expanded from...
|
||||
aclocal.m4:1042: BASH_STRUCT_DIRENT_D_INO is expanded from...
|
||||
configure.in:913: the top level])
|
||||
m4trace:configure.in:913: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_NAMLEN])
|
||||
m4trace:configure.in:913: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_NAMLEN$])
|
||||
m4trace:configure.in:913: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_INO])
|
||||
m4trace:configure.in:913: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_INO$])
|
||||
m4trace:configure.in:914: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1173: BASH_STRUCT_WINSIZE is expanded from...
|
||||
aclocal.m4:1075: BASH_STRUCT_DIRENT_D_FILENO is expanded from...
|
||||
configure.in:914: the top level])
|
||||
m4trace:configure.in:914: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
m4trace:configure.in:914: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_FILENO])
|
||||
m4trace:configure.in:914: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_FILENO$])
|
||||
m4trace:configure.in:915: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1108: BASH_STRUCT_DIRENT_D_NAMLEN is expanded from...
|
||||
configure.in:915: the top level])
|
||||
m4trace:configure.in:915: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_NAMLEN])
|
||||
m4trace:configure.in:915: -1- m4_pattern_allow([^HAVE_STRUCT_DIRENT_D_NAMLEN$])
|
||||
m4trace:configure.in:916: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1173: BASH_STRUCT_WINSIZE is expanded from...
|
||||
configure.in:916: the top level])
|
||||
m4trace:configure.in:916: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:2462: AC_COMPILE_IFELSE is expanded from...
|
||||
@@ -2191,255 +2195,255 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1173: BASH_STRUCT_WINSIZE is expanded from...
|
||||
configure.in:914: the top level])
|
||||
m4trace:configure.in:914: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:914: -1- m4_pattern_allow([^STRUCT_WINSIZE_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:914: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_TERMIOS])
|
||||
m4trace:configure.in:914: -1- m4_pattern_allow([^STRUCT_WINSIZE_IN_TERMIOS$])
|
||||
m4trace:configure.in:915: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TIMEVAL])
|
||||
m4trace:configure.in:915: -1- m4_pattern_allow([^HAVE_TIMEVAL$])
|
||||
m4trace:configure.in:916: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_STAT_ST_BLOCKS])
|
||||
m4trace:configure.in:916: -1- m4_pattern_allow([^HAVE_STRUCT_STAT_ST_BLOCKS$])
|
||||
m4trace:configure.in:916: -1- AH_OUTPUT([HAVE_STRUCT_STAT_ST_BLOCKS], [/* Define to 1 if `st_blocks\' is member of `struct stat\'. */
|
||||
configure.in:916: the top level])
|
||||
m4trace:configure.in:916: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:916: -1- m4_pattern_allow([^STRUCT_WINSIZE_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:916: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_TERMIOS])
|
||||
m4trace:configure.in:916: -1- m4_pattern_allow([^STRUCT_WINSIZE_IN_TERMIOS$])
|
||||
m4trace:configure.in:917: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TIMEVAL])
|
||||
m4trace:configure.in:917: -1- m4_pattern_allow([^HAVE_TIMEVAL$])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_STAT_ST_BLOCKS])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_STRUCT_STAT_ST_BLOCKS$])
|
||||
m4trace:configure.in:918: -1- AH_OUTPUT([HAVE_STRUCT_STAT_ST_BLOCKS], [/* Define to 1 if `st_blocks\' is member of `struct stat\'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BLOCKS])
|
||||
m4trace:configure.in:917: -1- AC_DEFINE_TRACE_LITERAL([TM_IN_SYS_TIME])
|
||||
m4trace:configure.in:917: -1- m4_pattern_allow([^TM_IN_SYS_TIME$])
|
||||
m4trace:configure.in:917: -1- AH_OUTPUT([TM_IN_SYS_TIME], [/* Define to 1 if your <sys/time.h> declares `struct tm\'. */
|
||||
m4trace:configure.in:919: -1- AC_DEFINE_TRACE_LITERAL([TM_IN_SYS_TIME])
|
||||
m4trace:configure.in:919: -1- m4_pattern_allow([^TM_IN_SYS_TIME$])
|
||||
m4trace:configure.in:919: -1- AH_OUTPUT([TM_IN_SYS_TIME], [/* Define to 1 if your <sys/time.h> declares `struct tm\'. */
|
||||
#undef TM_IN_SYS_TIME])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TM_TM_ZONE])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_STRUCT_TM_TM_ZONE$])
|
||||
m4trace:configure.in:918: -1- AH_OUTPUT([HAVE_STRUCT_TM_TM_ZONE], [/* Define to 1 if `tm_zone\' is member of `struct tm\'. */
|
||||
m4trace:configure.in:920: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TM_TM_ZONE])
|
||||
m4trace:configure.in:920: -1- m4_pattern_allow([^HAVE_STRUCT_TM_TM_ZONE$])
|
||||
m4trace:configure.in:920: -1- AH_OUTPUT([HAVE_STRUCT_TM_TM_ZONE], [/* Define to 1 if `tm_zone\' is member of `struct tm\'. */
|
||||
#undef HAVE_STRUCT_TM_TM_ZONE])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TM_ZONE])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_TM_ZONE$])
|
||||
m4trace:configure.in:918: -1- AH_OUTPUT([HAVE_TM_ZONE], [/* Define to 1 if your `struct tm\' has `tm_zone\'. Deprecated, use
|
||||
m4trace:configure.in:920: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TM_ZONE])
|
||||
m4trace:configure.in:920: -1- m4_pattern_allow([^HAVE_TM_ZONE$])
|
||||
m4trace:configure.in:920: -1- AH_OUTPUT([HAVE_TM_ZONE], [/* Define to 1 if your `struct tm\' has `tm_zone\'. Deprecated, use
|
||||
`HAVE_STRUCT_TM_TM_ZONE\' instead. */
|
||||
#undef HAVE_TM_ZONE])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_TZNAME])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_DECL_TZNAME$])
|
||||
m4trace:configure.in:918: -1- AH_OUTPUT([HAVE_DECL_TZNAME], [/* Define to 1 if you have the declaration of `tzname\', and to 0 if you don\'t.
|
||||
m4trace:configure.in:920: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_TZNAME])
|
||||
m4trace:configure.in:920: -1- m4_pattern_allow([^HAVE_DECL_TZNAME$])
|
||||
m4trace:configure.in:920: -1- AH_OUTPUT([HAVE_DECL_TZNAME], [/* Define to 1 if you have the declaration of `tzname\', and to 0 if you don\'t.
|
||||
*/
|
||||
#undef HAVE_DECL_TZNAME])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_TZNAME])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_DECL_TZNAME$])
|
||||
m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TZNAME])
|
||||
m4trace:configure.in:918: -1- m4_pattern_allow([^HAVE_TZNAME$])
|
||||
m4trace:configure.in:918: -1- AH_OUTPUT([HAVE_TZNAME], [/* Define to 1 if you don\'t have `tm_zone\' but do have the external array
|
||||
m4trace:configure.in:920: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_TZNAME])
|
||||
m4trace:configure.in:920: -1- m4_pattern_allow([^HAVE_DECL_TZNAME$])
|
||||
m4trace:configure.in:920: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TZNAME])
|
||||
m4trace:configure.in:920: -1- m4_pattern_allow([^HAVE_TZNAME$])
|
||||
m4trace:configure.in:920: -1- AH_OUTPUT([HAVE_TZNAME], [/* Define to 1 if you don\'t have `tm_zone\' but do have the external array
|
||||
`tzname\'. */
|
||||
#undef HAVE_TZNAME])
|
||||
m4trace:configure.in:919: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TIMEZONE])
|
||||
m4trace:configure.in:919: -1- m4_pattern_allow([^HAVE_STRUCT_TIMEZONE$])
|
||||
m4trace:configure.in:921: -1- AC_DEFINE_TRACE_LITERAL([WEXITSTATUS_OFFSET])
|
||||
m4trace:configure.in:921: -1- m4_pattern_allow([^WEXITSTATUS_OFFSET$])
|
||||
m4trace:configure.in:921: -1- AH_OUTPUT([WEXITSTATUS_OFFSET], [/* Offset of exit status in wait status word */
|
||||
m4trace:configure.in:921: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TIMEZONE])
|
||||
m4trace:configure.in:921: -1- m4_pattern_allow([^HAVE_STRUCT_TIMEZONE$])
|
||||
m4trace:configure.in:923: -1- AC_DEFINE_TRACE_LITERAL([WEXITSTATUS_OFFSET])
|
||||
m4trace:configure.in:923: -1- m4_pattern_allow([^WEXITSTATUS_OFFSET$])
|
||||
m4trace:configure.in:923: -1- AH_OUTPUT([WEXITSTATUS_OFFSET], [/* Offset of exit status in wait status word */
|
||||
#undef WEXITSTATUS_OFFSET])
|
||||
m4trace:configure.in:924: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
m4trace:configure.in:926: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2527: AC_TRY_LINK is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:299: BASH_FUNC_STRSIGNAL is expanded from...
|
||||
configure.in:924: the top level])
|
||||
m4trace:configure.in:924: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRSIGNAL])
|
||||
m4trace:configure.in:924: -1- m4_pattern_allow([^HAVE_STRSIGNAL$])
|
||||
m4trace:configure.in:925: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
configure.in:926: the top level])
|
||||
m4trace:configure.in:926: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRSIGNAL])
|
||||
m4trace:configure.in:926: -1- m4_pattern_allow([^HAVE_STRSIGNAL$])
|
||||
m4trace:configure.in:927: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:313: BASH_FUNC_OPENDIR_CHECK is expanded from...
|
||||
configure.in:925: the top level])
|
||||
m4trace:configure.in:925: -1- AC_DEFINE_TRACE_LITERAL([OPENDIR_NOT_ROBUST])
|
||||
m4trace:configure.in:925: -1- m4_pattern_allow([^OPENDIR_NOT_ROBUST$])
|
||||
m4trace:configure.in:926: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:683: BASH_FUNC_ULIMIT_MAXFDS is expanded from...
|
||||
configure.in:926: the top level])
|
||||
m4trace:configure.in:926: -1- AC_DEFINE_TRACE_LITERAL([ULIMIT_MAXFDS])
|
||||
m4trace:configure.in:926: -1- m4_pattern_allow([^ULIMIT_MAXFDS$])
|
||||
m4trace:configure.in:927: -1- AH_OUTPUT([HAVE_FPURGE], [/* Define to 1 if you have the `fpurge\' function. */
|
||||
#undef HAVE_FPURGE])
|
||||
m4trace:configure.in:927: -1- AH_OUTPUT([HAVE___FPURGE], [/* Define to 1 if you have the `__fpurge\' function. */
|
||||
#undef HAVE___FPURGE])
|
||||
m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:927: -1- m4_pattern_allow([^HAVE_DECL_FPURGE$])
|
||||
m4trace:configure.in:927: -1- AH_OUTPUT([HAVE_DECL_FPURGE], [/* Define to 1 if you have the declaration of `fpurge\', and to 0 if you don\'t.
|
||||
*/
|
||||
#undef HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:927: -1- m4_pattern_allow([^HAVE_DECL_FPURGE$])
|
||||
configure.in:927: the top level])
|
||||
m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([OPENDIR_NOT_ROBUST])
|
||||
m4trace:configure.in:927: -1- m4_pattern_allow([^OPENDIR_NOT_ROBUST$])
|
||||
m4trace:configure.in:928: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:579: BASH_FUNC_GETENV is expanded from...
|
||||
aclocal.m4:683: BASH_FUNC_ULIMIT_MAXFDS is expanded from...
|
||||
configure.in:928: the top level])
|
||||
m4trace:configure.in:928: -1- AC_DEFINE_TRACE_LITERAL([CAN_REDEFINE_GETENV])
|
||||
m4trace:configure.in:928: -1- m4_pattern_allow([^CAN_REDEFINE_GETENV$])
|
||||
m4trace:configure.in:928: -1- AC_DEFINE_TRACE_LITERAL([ULIMIT_MAXFDS])
|
||||
m4trace:configure.in:928: -1- m4_pattern_allow([^ULIMIT_MAXFDS$])
|
||||
m4trace:configure.in:929: -1- AH_OUTPUT([HAVE_FPURGE], [/* Define to 1 if you have the `fpurge\' function. */
|
||||
#undef HAVE_FPURGE])
|
||||
m4trace:configure.in:929: -1- AH_OUTPUT([HAVE___FPURGE], [/* Define to 1 if you have the `__fpurge\' function. */
|
||||
#undef HAVE___FPURGE])
|
||||
m4trace:configure.in:929: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:929: -1- m4_pattern_allow([^HAVE_DECL_FPURGE$])
|
||||
m4trace:configure.in:929: -1- AH_OUTPUT([HAVE_DECL_FPURGE], [/* Define to 1 if you have the declaration of `fpurge\', and to 0 if you don\'t.
|
||||
*/
|
||||
#undef HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:929: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_FPURGE])
|
||||
m4trace:configure.in:929: -1- m4_pattern_allow([^HAVE_DECL_FPURGE$])
|
||||
m4trace:configure.in:930: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:702: BASH_FUNC_GETCWD is expanded from...
|
||||
aclocal.m4:579: BASH_FUNC_GETENV is expanded from...
|
||||
configure.in:930: the top level])
|
||||
m4trace:configure.in:930: -1- AC_DEFINE_TRACE_LITERAL([GETCWD_BROKEN])
|
||||
m4trace:configure.in:930: -1- m4_pattern_allow([^GETCWD_BROKEN$])
|
||||
m4trace:configure.in:930: -1- AC_LIBSOURCE([getcwd.c])
|
||||
m4trace:configure.in:930: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS getcwd.$ac_objext"])
|
||||
m4trace:configure.in:930: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.in:930: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.in:930: -1- AC_DEFINE_TRACE_LITERAL([CAN_REDEFINE_GETENV])
|
||||
m4trace:configure.in:930: -1- m4_pattern_allow([^CAN_REDEFINE_GETENV$])
|
||||
m4trace:configure.in:932: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:778: BASH_FUNC_POSIX_SETJMP is expanded from...
|
||||
aclocal.m4:702: BASH_FUNC_GETCWD is expanded from...
|
||||
configure.in:932: the top level])
|
||||
m4trace:configure.in:932: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGSETJMP])
|
||||
m4trace:configure.in:932: -1- m4_pattern_allow([^HAVE_POSIX_SIGSETJMP$])
|
||||
m4trace:configure.in:933: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
m4trace:configure.in:932: -1- AC_DEFINE_TRACE_LITERAL([GETCWD_BROKEN])
|
||||
m4trace:configure.in:932: -1- m4_pattern_allow([^GETCWD_BROKEN$])
|
||||
m4trace:configure.in:932: -1- AC_LIBSOURCE([getcwd.c])
|
||||
m4trace:configure.in:932: -1- AC_SUBST([LIB@&t@OBJS], ["$LIB@&t@OBJS getcwd.$ac_objext"])
|
||||
m4trace:configure.in:932: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.in:932: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.in:934: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:778: BASH_FUNC_POSIX_SETJMP is expanded from...
|
||||
configure.in:934: the top level])
|
||||
m4trace:configure.in:934: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGSETJMP])
|
||||
m4trace:configure.in:934: -1- m4_pattern_allow([^HAVE_POSIX_SIGSETJMP$])
|
||||
m4trace:configure.in:935: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:829: BASH_FUNC_STRCOLL is expanded from...
|
||||
configure.in:933: the top level])
|
||||
m4trace:configure.in:933: -1- AC_DEFINE_TRACE_LITERAL([STRCOLL_BROKEN])
|
||||
m4trace:configure.in:933: -1- m4_pattern_allow([^STRCOLL_BROKEN$])
|
||||
m4trace:configure.in:934: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define to 1 if you have the `snprintf\' function. */
|
||||
configure.in:935: the top level])
|
||||
m4trace:configure.in:935: -1- AC_DEFINE_TRACE_LITERAL([STRCOLL_BROKEN])
|
||||
m4trace:configure.in:935: -1- m4_pattern_allow([^STRCOLL_BROKEN$])
|
||||
m4trace:configure.in:936: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define to 1 if you have the `snprintf\' function. */
|
||||
#undef HAVE_SNPRINTF])
|
||||
m4trace:configure.in:934: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
m4trace:configure.in:936: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
|
||||
aclocal.m4:4039: BASH_FUNC_SNPRINTF is expanded from...
|
||||
configure.in:934: the top level])
|
||||
m4trace:configure.in:934: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SNPRINTF])
|
||||
m4trace:configure.in:934: -1- m4_pattern_allow([^HAVE_SNPRINTF$])
|
||||
m4trace:configure.in:934: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define if you have a standard-conformant snprintf function. */
|
||||
configure.in:936: the top level])
|
||||
m4trace:configure.in:936: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SNPRINTF])
|
||||
m4trace:configure.in:936: -1- m4_pattern_allow([^HAVE_SNPRINTF$])
|
||||
m4trace:configure.in:936: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define if you have a standard-conformant snprintf function. */
|
||||
#undef HAVE_SNPRINTF])
|
||||
m4trace:configure.in:935: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define to 1 if you have the `vsnprintf\' function. */
|
||||
m4trace:configure.in:937: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define to 1 if you have the `vsnprintf\' function. */
|
||||
#undef HAVE_VSNPRINTF])
|
||||
m4trace:configure.in:935: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
m4trace:configure.in:937: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
|
||||
aclocal.m4:4067: BASH_FUNC_VSNPRINTF is expanded from...
|
||||
configure.in:935: the top level])
|
||||
m4trace:configure.in:935: -1- AC_DEFINE_TRACE_LITERAL([HAVE_VSNPRINTF])
|
||||
m4trace:configure.in:935: -1- m4_pattern_allow([^HAVE_VSNPRINTF$])
|
||||
m4trace:configure.in:935: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define if you have a standard-conformant vsnprintf function. */
|
||||
configure.in:937: the top level])
|
||||
m4trace:configure.in:937: -1- AC_DEFINE_TRACE_LITERAL([HAVE_VSNPRINTF])
|
||||
m4trace:configure.in:937: -1- m4_pattern_allow([^HAVE_VSNPRINTF$])
|
||||
m4trace:configure.in:937: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define if you have a standard-conformant vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF])
|
||||
m4trace:configure.in:941: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
m4trace:configure.in:943: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2527: AC_TRY_LINK is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
|
||||
aclocal.m4:624: BASH_FUNC_STD_PUTENV is expanded from...
|
||||
configure.in:941: the top level])
|
||||
m4trace:configure.in:941: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV])
|
||||
m4trace:configure.in:941: -1- m4_pattern_allow([^HAVE_STD_PUTENV$])
|
||||
configure.in:943: the top level])
|
||||
m4trace:configure.in:943: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV])
|
||||
m4trace:configure.in:943: -1- m4_pattern_allow([^HAVE_STD_PUTENV$])
|
||||
m4trace:configure.in:946: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
m4trace:configure.in:945: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV])
|
||||
m4trace:configure.in:945: -1- m4_pattern_allow([^HAVE_STD_PUTENV$])
|
||||
m4trace:configure.in:948: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2527: AC_TRY_LINK is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
|
||||
aclocal.m4:654: BASH_FUNC_STD_UNSETENV is expanded from...
|
||||
configure.in:946: the top level])
|
||||
m4trace:configure.in:946: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV])
|
||||
m4trace:configure.in:946: -1- m4_pattern_allow([^HAVE_STD_UNSETENV$])
|
||||
configure.in:948: the top level])
|
||||
m4trace:configure.in:948: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV])
|
||||
m4trace:configure.in:948: -1- m4_pattern_allow([^HAVE_STD_UNSETENV$])
|
||||
m4trace:configure.in:951: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
m4trace:configure.in:950: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV])
|
||||
m4trace:configure.in:950: -1- m4_pattern_allow([^HAVE_STD_UNSETENV$])
|
||||
m4trace:configure.in:953: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:878: BASH_FUNC_PRINTF_A_FORMAT is expanded from...
|
||||
configure.in:951: the top level])
|
||||
m4trace:configure.in:951: -1- AC_DEFINE_TRACE_LITERAL([HAVE_PRINTF_A_FORMAT])
|
||||
m4trace:configure.in:951: -1- m4_pattern_allow([^HAVE_PRINTF_A_FORMAT$])
|
||||
m4trace:configure.in:954: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1297: BASH_SYS_REINSTALL_SIGHANDLERS is expanded from...
|
||||
configure.in:954: the top level])
|
||||
m4trace:configure.in:954: -1- AC_DEFINE_TRACE_LITERAL([MUST_REINSTALL_SIGHANDLERS])
|
||||
m4trace:configure.in:954: -1- m4_pattern_allow([^MUST_REINSTALL_SIGHANDLERS$])
|
||||
m4trace:configure.in:955: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1356: BASH_SYS_JOB_CONTROL_MISSING is expanded from...
|
||||
configure.in:955: the top level])
|
||||
m4trace:configure.in:955: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL_MISSING])
|
||||
m4trace:configure.in:955: -1- m4_pattern_allow([^JOB_CONTROL_MISSING$])
|
||||
configure.in:953: the top level])
|
||||
m4trace:configure.in:953: -1- AC_DEFINE_TRACE_LITERAL([HAVE_PRINTF_A_FORMAT])
|
||||
m4trace:configure.in:953: -1- m4_pattern_allow([^HAVE_PRINTF_A_FORMAT$])
|
||||
m4trace:configure.in:956: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1415: BASH_SYS_NAMED_PIPES is expanded from...
|
||||
aclocal.m4:1297: BASH_SYS_REINSTALL_SIGHANDLERS is expanded from...
|
||||
configure.in:956: the top level])
|
||||
m4trace:configure.in:956: -1- AC_DEFINE_TRACE_LITERAL([NAMED_PIPES_MISSING])
|
||||
m4trace:configure.in:956: -1- m4_pattern_allow([^NAMED_PIPES_MISSING$])
|
||||
m4trace:configure.in:959: -1- AC_DEFINE_TRACE_LITERAL([GWINSZ_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:959: -1- m4_pattern_allow([^GWINSZ_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:959: -1- AH_OUTPUT([GWINSZ_IN_SYS_IOCTL], [/* Define to 1 if `TIOCGWINSZ\' requires <sys/ioctl.h>. */
|
||||
m4trace:configure.in:956: -1- AC_DEFINE_TRACE_LITERAL([MUST_REINSTALL_SIGHANDLERS])
|
||||
m4trace:configure.in:956: -1- m4_pattern_allow([^MUST_REINSTALL_SIGHANDLERS$])
|
||||
m4trace:configure.in:957: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1356: BASH_SYS_JOB_CONTROL_MISSING is expanded from...
|
||||
configure.in:957: the top level])
|
||||
m4trace:configure.in:957: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL_MISSING])
|
||||
m4trace:configure.in:957: -1- m4_pattern_allow([^JOB_CONTROL_MISSING$])
|
||||
m4trace:configure.in:958: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1415: BASH_SYS_NAMED_PIPES is expanded from...
|
||||
configure.in:958: the top level])
|
||||
m4trace:configure.in:958: -1- AC_DEFINE_TRACE_LITERAL([NAMED_PIPES_MISSING])
|
||||
m4trace:configure.in:958: -1- m4_pattern_allow([^NAMED_PIPES_MISSING$])
|
||||
m4trace:configure.in:961: -1- AC_DEFINE_TRACE_LITERAL([GWINSZ_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:961: -1- m4_pattern_allow([^GWINSZ_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:961: -1- AH_OUTPUT([GWINSZ_IN_SYS_IOCTL], [/* Define to 1 if `TIOCGWINSZ\' requires <sys/ioctl.h>. */
|
||||
#undef GWINSZ_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:960: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
m4trace:configure.in:962: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1496: BASH_HAVE_TIOCSTAT is expanded from...
|
||||
configure.in:960: the top level])
|
||||
m4trace:configure.in:960: -1- AC_DEFINE_TRACE_LITERAL([TIOCSTAT_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:960: -1- m4_pattern_allow([^TIOCSTAT_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:961: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
configure.in:962: the top level])
|
||||
m4trace:configure.in:962: -1- AC_DEFINE_TRACE_LITERAL([TIOCSTAT_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:962: -1- m4_pattern_allow([^TIOCSTAT_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:963: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1508: BASH_HAVE_FIONREAD is expanded from...
|
||||
configure.in:961: the top level])
|
||||
m4trace:configure.in:961: -1- AC_DEFINE_TRACE_LITERAL([FIONREAD_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:961: -1- m4_pattern_allow([^FIONREAD_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:963: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
configure.in:963: the top level])
|
||||
m4trace:configure.in:963: -1- AC_DEFINE_TRACE_LITERAL([FIONREAD_IN_SYS_IOCTL])
|
||||
m4trace:configure.in:963: -1- m4_pattern_allow([^FIONREAD_IN_SYS_IOCTL$])
|
||||
m4trace:configure.in:965: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1938: BASH_CHECK_WCONTINUED is expanded from...
|
||||
configure.in:963: the top level])
|
||||
m4trace:configure.in:963: -1- AC_DEFINE_TRACE_LITERAL([WCONTINUED_BROKEN])
|
||||
m4trace:configure.in:963: -1- m4_pattern_allow([^WCONTINUED_BROKEN$])
|
||||
m4trace:configure.in:966: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
configure.in:965: the top level])
|
||||
m4trace:configure.in:965: -1- AC_DEFINE_TRACE_LITERAL([WCONTINUED_BROKEN])
|
||||
m4trace:configure.in:965: -1- m4_pattern_allow([^WCONTINUED_BROKEN$])
|
||||
m4trace:configure.in:968: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1526: BASH_CHECK_SPEED_T is expanded from...
|
||||
configure.in:966: the top level])
|
||||
m4trace:configure.in:966: -1- AC_DEFINE_TRACE_LITERAL([SPEED_T_IN_SYS_TYPES])
|
||||
m4trace:configure.in:966: -1- m4_pattern_allow([^SPEED_T_IN_SYS_TYPES$])
|
||||
m4trace:configure.in:967: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_DECLS])
|
||||
m4trace:configure.in:967: -1- m4_pattern_allow([^HAVE_GETPW_DECLS$])
|
||||
m4trace:configure.in:968: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
configure.in:968: the top level])
|
||||
m4trace:configure.in:968: -1- AC_DEFINE_TRACE_LITERAL([SPEED_T_IN_SYS_TYPES])
|
||||
m4trace:configure.in:968: -1- m4_pattern_allow([^SPEED_T_IN_SYS_TYPES$])
|
||||
m4trace:configure.in:969: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_DECLS])
|
||||
m4trace:configure.in:969: -1- m4_pattern_allow([^HAVE_GETPW_DECLS$])
|
||||
m4trace:configure.in:970: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2592: AC_TRY_RUN is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1653: BASH_CHECK_RTSIGS is expanded from...
|
||||
configure.in:968: the top level])
|
||||
m4trace:configure.in:968: -1- AC_DEFINE_TRACE_LITERAL([UNUSABLE_RT_SIGNALS])
|
||||
m4trace:configure.in:968: -1- m4_pattern_allow([^UNUSABLE_RT_SIGNALS$])
|
||||
m4trace:configure.in:969: -1- AC_SUBST([SIGLIST_O])
|
||||
m4trace:configure.in:969: -1- AC_SUBST_TRACE([SIGLIST_O])
|
||||
m4trace:configure.in:969: -1- m4_pattern_allow([^SIGLIST_O$])
|
||||
m4trace:configure.in:973: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
configure.in:970: the top level])
|
||||
m4trace:configure.in:970: -1- AC_DEFINE_TRACE_LITERAL([UNUSABLE_RT_SIGNALS])
|
||||
m4trace:configure.in:970: -1- m4_pattern_allow([^UNUSABLE_RT_SIGNALS$])
|
||||
m4trace:configure.in:971: -1- AC_SUBST([SIGLIST_O])
|
||||
m4trace:configure.in:971: -1- AC_SUBST_TRACE([SIGLIST_O])
|
||||
m4trace:configure.in:971: -1- m4_pattern_allow([^SIGLIST_O$])
|
||||
m4trace:configure.in:975: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1605: BASH_CHECK_KERNEL_RLIMIT is expanded from...
|
||||
configure.in:973: the top level])
|
||||
m4trace:configure.in:973: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
configure.in:975: the top level])
|
||||
m4trace:configure.in:975: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE is expanded from...
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:2462: AC_COMPILE_IFELSE is expanded from...
|
||||
@@ -2447,140 +2451,140 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2470: AC_TRY_COMPILE
|
||||
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
|
||||
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
|
||||
aclocal.m4:1605: BASH_CHECK_KERNEL_RLIMIT is expanded from...
|
||||
configure.in:973: the top level])
|
||||
m4trace:configure.in:973: -1- AC_DEFINE_TRACE_LITERAL([RLIMIT_NEEDS_KERNEL])
|
||||
m4trace:configure.in:973: -1- m4_pattern_allow([^RLIMIT_NEEDS_KERNEL$])
|
||||
m4trace:configure.in:983: -1- AC_SUBST([TERMCAP_LIB])
|
||||
m4trace:configure.in:983: -1- AC_SUBST_TRACE([TERMCAP_LIB])
|
||||
m4trace:configure.in:983: -1- m4_pattern_allow([^TERMCAP_LIB$])
|
||||
m4trace:configure.in:984: -1- AC_SUBST([TERMCAP_DEP])
|
||||
m4trace:configure.in:984: -1- AC_SUBST_TRACE([TERMCAP_DEP])
|
||||
m4trace:configure.in:984: -1- m4_pattern_allow([^TERMCAP_DEP$])
|
||||
m4trace:configure.in:986: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD])
|
||||
m4trace:configure.in:986: -1- m4_pattern_allow([^HAVE_DEV_FD$])
|
||||
m4trace:configure.in:986: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX])
|
||||
m4trace:configure.in:986: -1- m4_pattern_allow([^DEV_FD_PREFIX$])
|
||||
m4trace:configure.in:986: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD])
|
||||
m4trace:configure.in:986: -1- m4_pattern_allow([^HAVE_DEV_FD$])
|
||||
m4trace:configure.in:986: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX])
|
||||
m4trace:configure.in:986: -1- m4_pattern_allow([^DEV_FD_PREFIX$])
|
||||
m4trace:configure.in:987: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_STDIN])
|
||||
m4trace:configure.in:987: -1- m4_pattern_allow([^HAVE_DEV_STDIN$])
|
||||
m4trace:configure.in:988: -1- AC_DEFINE_TRACE_LITERAL([DEFAULT_MAIL_DIRECTORY])
|
||||
m4trace:configure.in:988: -1- m4_pattern_allow([^DEFAULT_MAIL_DIRECTORY$])
|
||||
m4trace:configure.in:995: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL])
|
||||
m4trace:configure.in:995: -1- m4_pattern_allow([^JOB_CONTROL$])
|
||||
m4trace:configure.in:1001: -1- AC_SUBST([JOBS_O])
|
||||
m4trace:configure.in:1001: -1- AC_SUBST_TRACE([JOBS_O])
|
||||
m4trace:configure.in:1001: -1- m4_pattern_allow([^JOBS_O$])
|
||||
m4trace:configure.in:1014: -1- AC_DEFINE_TRACE_LITERAL([SVR4_2])
|
||||
m4trace:configure.in:1014: -1- m4_pattern_allow([^SVR4_2$])
|
||||
m4trace:configure.in:1015: -1- AC_DEFINE_TRACE_LITERAL([SVR4])
|
||||
m4trace:configure.in:1015: -1- m4_pattern_allow([^SVR4$])
|
||||
m4trace:configure.in:1016: -1- AC_DEFINE_TRACE_LITERAL([SVR4])
|
||||
m4trace:configure.in:1016: -1- m4_pattern_allow([^SVR4$])
|
||||
m4trace:configure.in:1017: -1- AC_DEFINE_TRACE_LITERAL([SVR5])
|
||||
m4trace:configure.in:1017: -1- m4_pattern_allow([^SVR5$])
|
||||
m4trace:configure.in:1036: -1- AC_DEFINE_TRACE_LITERAL([PGRP_PIPE])
|
||||
m4trace:configure.in:1036: -1- m4_pattern_allow([^PGRP_PIPE$])
|
||||
m4trace:configure.in:1083: -1- AC_SUBST([SHOBJ_CC])
|
||||
m4trace:configure.in:1083: -1- AC_SUBST_TRACE([SHOBJ_CC])
|
||||
m4trace:configure.in:1083: -1- m4_pattern_allow([^SHOBJ_CC$])
|
||||
m4trace:configure.in:1084: -1- AC_SUBST([SHOBJ_CFLAGS])
|
||||
m4trace:configure.in:1084: -1- AC_SUBST_TRACE([SHOBJ_CFLAGS])
|
||||
m4trace:configure.in:1084: -1- m4_pattern_allow([^SHOBJ_CFLAGS$])
|
||||
m4trace:configure.in:1085: -1- AC_SUBST([SHOBJ_LD])
|
||||
m4trace:configure.in:1085: -1- AC_SUBST_TRACE([SHOBJ_LD])
|
||||
m4trace:configure.in:1085: -1- m4_pattern_allow([^SHOBJ_LD$])
|
||||
m4trace:configure.in:1086: -1- AC_SUBST([SHOBJ_LDFLAGS])
|
||||
m4trace:configure.in:1086: -1- AC_SUBST_TRACE([SHOBJ_LDFLAGS])
|
||||
m4trace:configure.in:1086: -1- m4_pattern_allow([^SHOBJ_LDFLAGS$])
|
||||
m4trace:configure.in:1087: -1- AC_SUBST([SHOBJ_XLDFLAGS])
|
||||
m4trace:configure.in:1087: -1- AC_SUBST_TRACE([SHOBJ_XLDFLAGS])
|
||||
m4trace:configure.in:1087: -1- m4_pattern_allow([^SHOBJ_XLDFLAGS$])
|
||||
m4trace:configure.in:1088: -1- AC_SUBST([SHOBJ_LIBS])
|
||||
m4trace:configure.in:1088: -1- AC_SUBST_TRACE([SHOBJ_LIBS])
|
||||
m4trace:configure.in:1088: -1- m4_pattern_allow([^SHOBJ_LIBS$])
|
||||
m4trace:configure.in:1089: -1- AC_SUBST([SHOBJ_STATUS])
|
||||
m4trace:configure.in:1089: -1- AC_SUBST_TRACE([SHOBJ_STATUS])
|
||||
m4trace:configure.in:1089: -1- m4_pattern_allow([^SHOBJ_STATUS$])
|
||||
m4trace:configure.in:1121: -1- AC_SUBST([PROFILE_FLAGS])
|
||||
m4trace:configure.in:1121: -1- AC_SUBST_TRACE([PROFILE_FLAGS])
|
||||
m4trace:configure.in:1121: -1- m4_pattern_allow([^PROFILE_FLAGS$])
|
||||
m4trace:configure.in:1123: -1- AC_SUBST([incdir])
|
||||
m4trace:configure.in:1123: -1- AC_SUBST_TRACE([incdir])
|
||||
m4trace:configure.in:1123: -1- m4_pattern_allow([^incdir$])
|
||||
m4trace:configure.in:1124: -1- AC_SUBST([BUILD_DIR])
|
||||
m4trace:configure.in:1124: -1- AC_SUBST_TRACE([BUILD_DIR])
|
||||
m4trace:configure.in:1124: -1- m4_pattern_allow([^BUILD_DIR$])
|
||||
m4trace:configure.in:1127: -1- AC_SUBST([datarootdir])
|
||||
m4trace:configure.in:1127: -1- AC_SUBST_TRACE([datarootdir])
|
||||
m4trace:configure.in:1127: -1- m4_pattern_allow([^datarootdir$])
|
||||
m4trace:configure.in:1128: -1- AC_SUBST([localedir])
|
||||
m4trace:configure.in:1128: -1- AC_SUBST_TRACE([localedir])
|
||||
m4trace:configure.in:1128: -1- m4_pattern_allow([^localedir$])
|
||||
m4trace:configure.in:1130: -1- AC_SUBST([YACC])
|
||||
m4trace:configure.in:1130: -1- AC_SUBST_TRACE([YACC])
|
||||
m4trace:configure.in:1130: -1- m4_pattern_allow([^YACC$])
|
||||
m4trace:configure.in:1131: -1- AC_SUBST([AR])
|
||||
m4trace:configure.in:1131: -1- AC_SUBST_TRACE([AR])
|
||||
m4trace:configure.in:1131: -1- m4_pattern_allow([^AR$])
|
||||
m4trace:configure.in:1132: -1- AC_SUBST([ARFLAGS])
|
||||
m4trace:configure.in:1132: -1- AC_SUBST_TRACE([ARFLAGS])
|
||||
m4trace:configure.in:1132: -1- m4_pattern_allow([^ARFLAGS$])
|
||||
m4trace:configure.in:1134: -1- AC_SUBST([BASHVERS])
|
||||
m4trace:configure.in:1134: -1- AC_SUBST_TRACE([BASHVERS])
|
||||
m4trace:configure.in:1134: -1- m4_pattern_allow([^BASHVERS$])
|
||||
m4trace:configure.in:1135: -1- AC_SUBST([RELSTATUS])
|
||||
m4trace:configure.in:1135: -1- AC_SUBST_TRACE([RELSTATUS])
|
||||
m4trace:configure.in:1135: -1- m4_pattern_allow([^RELSTATUS$])
|
||||
m4trace:configure.in:1136: -1- AC_SUBST([DEBUG])
|
||||
m4trace:configure.in:1136: -1- AC_SUBST_TRACE([DEBUG])
|
||||
m4trace:configure.in:1136: -1- m4_pattern_allow([^DEBUG$])
|
||||
m4trace:configure.in:1137: -1- AC_SUBST([MALLOC_DEBUG])
|
||||
m4trace:configure.in:1137: -1- AC_SUBST_TRACE([MALLOC_DEBUG])
|
||||
m4trace:configure.in:1137: -1- m4_pattern_allow([^MALLOC_DEBUG$])
|
||||
m4trace:configure.in:1139: -1- AC_SUBST([host_cpu])
|
||||
m4trace:configure.in:1139: -1- AC_SUBST_TRACE([host_cpu])
|
||||
m4trace:configure.in:1139: -1- m4_pattern_allow([^host_cpu$])
|
||||
m4trace:configure.in:1140: -1- AC_SUBST([host_vendor])
|
||||
m4trace:configure.in:1140: -1- AC_SUBST_TRACE([host_vendor])
|
||||
m4trace:configure.in:1140: -1- m4_pattern_allow([^host_vendor$])
|
||||
m4trace:configure.in:1141: -1- AC_SUBST([host_os])
|
||||
m4trace:configure.in:1141: -1- AC_SUBST_TRACE([host_os])
|
||||
m4trace:configure.in:1141: -1- m4_pattern_allow([^host_os$])
|
||||
m4trace:configure.in:1143: -1- AC_SUBST([LOCAL_LIBS])
|
||||
m4trace:configure.in:1143: -1- AC_SUBST_TRACE([LOCAL_LIBS])
|
||||
m4trace:configure.in:1143: -1- m4_pattern_allow([^LOCAL_LIBS$])
|
||||
m4trace:configure.in:1144: -1- AC_SUBST([LOCAL_CFLAGS])
|
||||
m4trace:configure.in:1144: -1- AC_SUBST_TRACE([LOCAL_CFLAGS])
|
||||
m4trace:configure.in:1144: -1- m4_pattern_allow([^LOCAL_CFLAGS$])
|
||||
m4trace:configure.in:1145: -1- AC_SUBST([LOCAL_LDFLAGS])
|
||||
m4trace:configure.in:1145: -1- AC_SUBST_TRACE([LOCAL_LDFLAGS])
|
||||
m4trace:configure.in:1145: -1- m4_pattern_allow([^LOCAL_LDFLAGS$])
|
||||
m4trace:configure.in:1146: -1- AC_SUBST([LOCAL_DEFS])
|
||||
m4trace:configure.in:1146: -1- AC_SUBST_TRACE([LOCAL_DEFS])
|
||||
m4trace:configure.in:1146: -1- m4_pattern_allow([^LOCAL_DEFS$])
|
||||
m4trace:configure.in:1151: -1- AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
|
||||
configure.in:975: the top level])
|
||||
m4trace:configure.in:975: -1- AC_DEFINE_TRACE_LITERAL([RLIMIT_NEEDS_KERNEL])
|
||||
m4trace:configure.in:975: -1- m4_pattern_allow([^RLIMIT_NEEDS_KERNEL$])
|
||||
m4trace:configure.in:985: -1- AC_SUBST([TERMCAP_LIB])
|
||||
m4trace:configure.in:985: -1- AC_SUBST_TRACE([TERMCAP_LIB])
|
||||
m4trace:configure.in:985: -1- m4_pattern_allow([^TERMCAP_LIB$])
|
||||
m4trace:configure.in:986: -1- AC_SUBST([TERMCAP_DEP])
|
||||
m4trace:configure.in:986: -1- AC_SUBST_TRACE([TERMCAP_DEP])
|
||||
m4trace:configure.in:986: -1- m4_pattern_allow([^TERMCAP_DEP$])
|
||||
m4trace:configure.in:988: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD])
|
||||
m4trace:configure.in:988: -1- m4_pattern_allow([^HAVE_DEV_FD$])
|
||||
m4trace:configure.in:988: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX])
|
||||
m4trace:configure.in:988: -1- m4_pattern_allow([^DEV_FD_PREFIX$])
|
||||
m4trace:configure.in:988: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD])
|
||||
m4trace:configure.in:988: -1- m4_pattern_allow([^HAVE_DEV_FD$])
|
||||
m4trace:configure.in:988: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX])
|
||||
m4trace:configure.in:988: -1- m4_pattern_allow([^DEV_FD_PREFIX$])
|
||||
m4trace:configure.in:989: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_STDIN])
|
||||
m4trace:configure.in:989: -1- m4_pattern_allow([^HAVE_DEV_STDIN$])
|
||||
m4trace:configure.in:990: -1- AC_DEFINE_TRACE_LITERAL([DEFAULT_MAIL_DIRECTORY])
|
||||
m4trace:configure.in:990: -1- m4_pattern_allow([^DEFAULT_MAIL_DIRECTORY$])
|
||||
m4trace:configure.in:997: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL])
|
||||
m4trace:configure.in:997: -1- m4_pattern_allow([^JOB_CONTROL$])
|
||||
m4trace:configure.in:1003: -1- AC_SUBST([JOBS_O])
|
||||
m4trace:configure.in:1003: -1- AC_SUBST_TRACE([JOBS_O])
|
||||
m4trace:configure.in:1003: -1- m4_pattern_allow([^JOBS_O$])
|
||||
m4trace:configure.in:1016: -1- AC_DEFINE_TRACE_LITERAL([SVR4_2])
|
||||
m4trace:configure.in:1016: -1- m4_pattern_allow([^SVR4_2$])
|
||||
m4trace:configure.in:1017: -1- AC_DEFINE_TRACE_LITERAL([SVR4])
|
||||
m4trace:configure.in:1017: -1- m4_pattern_allow([^SVR4$])
|
||||
m4trace:configure.in:1018: -1- AC_DEFINE_TRACE_LITERAL([SVR4])
|
||||
m4trace:configure.in:1018: -1- m4_pattern_allow([^SVR4$])
|
||||
m4trace:configure.in:1019: -1- AC_DEFINE_TRACE_LITERAL([SVR5])
|
||||
m4trace:configure.in:1019: -1- m4_pattern_allow([^SVR5$])
|
||||
m4trace:configure.in:1038: -1- AC_DEFINE_TRACE_LITERAL([PGRP_PIPE])
|
||||
m4trace:configure.in:1038: -1- m4_pattern_allow([^PGRP_PIPE$])
|
||||
m4trace:configure.in:1085: -1- AC_SUBST([SHOBJ_CC])
|
||||
m4trace:configure.in:1085: -1- AC_SUBST_TRACE([SHOBJ_CC])
|
||||
m4trace:configure.in:1085: -1- m4_pattern_allow([^SHOBJ_CC$])
|
||||
m4trace:configure.in:1086: -1- AC_SUBST([SHOBJ_CFLAGS])
|
||||
m4trace:configure.in:1086: -1- AC_SUBST_TRACE([SHOBJ_CFLAGS])
|
||||
m4trace:configure.in:1086: -1- m4_pattern_allow([^SHOBJ_CFLAGS$])
|
||||
m4trace:configure.in:1087: -1- AC_SUBST([SHOBJ_LD])
|
||||
m4trace:configure.in:1087: -1- AC_SUBST_TRACE([SHOBJ_LD])
|
||||
m4trace:configure.in:1087: -1- m4_pattern_allow([^SHOBJ_LD$])
|
||||
m4trace:configure.in:1088: -1- AC_SUBST([SHOBJ_LDFLAGS])
|
||||
m4trace:configure.in:1088: -1- AC_SUBST_TRACE([SHOBJ_LDFLAGS])
|
||||
m4trace:configure.in:1088: -1- m4_pattern_allow([^SHOBJ_LDFLAGS$])
|
||||
m4trace:configure.in:1089: -1- AC_SUBST([SHOBJ_XLDFLAGS])
|
||||
m4trace:configure.in:1089: -1- AC_SUBST_TRACE([SHOBJ_XLDFLAGS])
|
||||
m4trace:configure.in:1089: -1- m4_pattern_allow([^SHOBJ_XLDFLAGS$])
|
||||
m4trace:configure.in:1090: -1- AC_SUBST([SHOBJ_LIBS])
|
||||
m4trace:configure.in:1090: -1- AC_SUBST_TRACE([SHOBJ_LIBS])
|
||||
m4trace:configure.in:1090: -1- m4_pattern_allow([^SHOBJ_LIBS$])
|
||||
m4trace:configure.in:1091: -1- AC_SUBST([SHOBJ_STATUS])
|
||||
m4trace:configure.in:1091: -1- AC_SUBST_TRACE([SHOBJ_STATUS])
|
||||
m4trace:configure.in:1091: -1- m4_pattern_allow([^SHOBJ_STATUS$])
|
||||
m4trace:configure.in:1123: -1- AC_SUBST([PROFILE_FLAGS])
|
||||
m4trace:configure.in:1123: -1- AC_SUBST_TRACE([PROFILE_FLAGS])
|
||||
m4trace:configure.in:1123: -1- m4_pattern_allow([^PROFILE_FLAGS$])
|
||||
m4trace:configure.in:1125: -1- AC_SUBST([incdir])
|
||||
m4trace:configure.in:1125: -1- AC_SUBST_TRACE([incdir])
|
||||
m4trace:configure.in:1125: -1- m4_pattern_allow([^incdir$])
|
||||
m4trace:configure.in:1126: -1- AC_SUBST([BUILD_DIR])
|
||||
m4trace:configure.in:1126: -1- AC_SUBST_TRACE([BUILD_DIR])
|
||||
m4trace:configure.in:1126: -1- m4_pattern_allow([^BUILD_DIR$])
|
||||
m4trace:configure.in:1129: -1- AC_SUBST([datarootdir])
|
||||
m4trace:configure.in:1129: -1- AC_SUBST_TRACE([datarootdir])
|
||||
m4trace:configure.in:1129: -1- m4_pattern_allow([^datarootdir$])
|
||||
m4trace:configure.in:1130: -1- AC_SUBST([localedir])
|
||||
m4trace:configure.in:1130: -1- AC_SUBST_TRACE([localedir])
|
||||
m4trace:configure.in:1130: -1- m4_pattern_allow([^localedir$])
|
||||
m4trace:configure.in:1132: -1- AC_SUBST([YACC])
|
||||
m4trace:configure.in:1132: -1- AC_SUBST_TRACE([YACC])
|
||||
m4trace:configure.in:1132: -1- m4_pattern_allow([^YACC$])
|
||||
m4trace:configure.in:1133: -1- AC_SUBST([AR])
|
||||
m4trace:configure.in:1133: -1- AC_SUBST_TRACE([AR])
|
||||
m4trace:configure.in:1133: -1- m4_pattern_allow([^AR$])
|
||||
m4trace:configure.in:1134: -1- AC_SUBST([ARFLAGS])
|
||||
m4trace:configure.in:1134: -1- AC_SUBST_TRACE([ARFLAGS])
|
||||
m4trace:configure.in:1134: -1- m4_pattern_allow([^ARFLAGS$])
|
||||
m4trace:configure.in:1136: -1- AC_SUBST([BASHVERS])
|
||||
m4trace:configure.in:1136: -1- AC_SUBST_TRACE([BASHVERS])
|
||||
m4trace:configure.in:1136: -1- m4_pattern_allow([^BASHVERS$])
|
||||
m4trace:configure.in:1137: -1- AC_SUBST([RELSTATUS])
|
||||
m4trace:configure.in:1137: -1- AC_SUBST_TRACE([RELSTATUS])
|
||||
m4trace:configure.in:1137: -1- m4_pattern_allow([^RELSTATUS$])
|
||||
m4trace:configure.in:1138: -1- AC_SUBST([DEBUG])
|
||||
m4trace:configure.in:1138: -1- AC_SUBST_TRACE([DEBUG])
|
||||
m4trace:configure.in:1138: -1- m4_pattern_allow([^DEBUG$])
|
||||
m4trace:configure.in:1139: -1- AC_SUBST([MALLOC_DEBUG])
|
||||
m4trace:configure.in:1139: -1- AC_SUBST_TRACE([MALLOC_DEBUG])
|
||||
m4trace:configure.in:1139: -1- m4_pattern_allow([^MALLOC_DEBUG$])
|
||||
m4trace:configure.in:1141: -1- AC_SUBST([host_cpu])
|
||||
m4trace:configure.in:1141: -1- AC_SUBST_TRACE([host_cpu])
|
||||
m4trace:configure.in:1141: -1- m4_pattern_allow([^host_cpu$])
|
||||
m4trace:configure.in:1142: -1- AC_SUBST([host_vendor])
|
||||
m4trace:configure.in:1142: -1- AC_SUBST_TRACE([host_vendor])
|
||||
m4trace:configure.in:1142: -1- m4_pattern_allow([^host_vendor$])
|
||||
m4trace:configure.in:1143: -1- AC_SUBST([host_os])
|
||||
m4trace:configure.in:1143: -1- AC_SUBST_TRACE([host_os])
|
||||
m4trace:configure.in:1143: -1- m4_pattern_allow([^host_os$])
|
||||
m4trace:configure.in:1145: -1- AC_SUBST([LOCAL_LIBS])
|
||||
m4trace:configure.in:1145: -1- AC_SUBST_TRACE([LOCAL_LIBS])
|
||||
m4trace:configure.in:1145: -1- m4_pattern_allow([^LOCAL_LIBS$])
|
||||
m4trace:configure.in:1146: -1- AC_SUBST([LOCAL_CFLAGS])
|
||||
m4trace:configure.in:1146: -1- AC_SUBST_TRACE([LOCAL_CFLAGS])
|
||||
m4trace:configure.in:1146: -1- m4_pattern_allow([^LOCAL_CFLAGS$])
|
||||
m4trace:configure.in:1147: -1- AC_SUBST([LOCAL_LDFLAGS])
|
||||
m4trace:configure.in:1147: -1- AC_SUBST_TRACE([LOCAL_LDFLAGS])
|
||||
m4trace:configure.in:1147: -1- m4_pattern_allow([^LOCAL_LDFLAGS$])
|
||||
m4trace:configure.in:1148: -1- AC_SUBST([LOCAL_DEFS])
|
||||
m4trace:configure.in:1148: -1- AC_SUBST_TRACE([LOCAL_DEFS])
|
||||
m4trace:configure.in:1148: -1- m4_pattern_allow([^LOCAL_DEFS$])
|
||||
m4trace:configure.in:1153: -1- AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
|
||||
lib/intl/Makefile \
|
||||
lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
|
||||
lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
|
||||
examples/loadables/Makefile examples/loadables/perl/Makefile])
|
||||
m4trace:configure.in:1151: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments.
|
||||
m4trace:configure.in:1153: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments.
|
||||
You should run autoupdate.], [])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.in:1151: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([LTLIBOBJS])
|
||||
m4trace:configure.in:1151: -1- m4_pattern_allow([^LTLIBOBJS$])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([top_builddir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([top_build_prefix])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([srcdir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([abs_srcdir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([top_srcdir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([abs_top_srcdir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([builddir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([abs_builddir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([abs_top_builddir])
|
||||
m4trace:configure.in:1151: -1- AC_SUBST_TRACE([INSTALL])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.in:1153: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([LTLIBOBJS])
|
||||
m4trace:configure.in:1153: -1- m4_pattern_allow([^LTLIBOBJS$])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([top_builddir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([top_build_prefix])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([srcdir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([abs_srcdir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([top_srcdir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([abs_top_srcdir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([builddir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([abs_builddir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([abs_top_builddir])
|
||||
m4trace:configure.in:1153: -1- AC_SUBST_TRACE([INSTALL])
|
||||
|
||||
+2
-2
@@ -359,7 +359,7 @@ save_history ()
|
||||
the history file. */
|
||||
using_history ();
|
||||
|
||||
if (history_lines_this_session < where_history () || force_append_history)
|
||||
if (history_lines_this_session <= where_history () || force_append_history)
|
||||
append_history (history_lines_this_session, hf);
|
||||
else
|
||||
write_history (hf);
|
||||
@@ -376,7 +376,7 @@ maybe_append_history (filename)
|
||||
struct stat buf;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (history_lines_this_session && (history_lines_this_session < where_history ()))
|
||||
if (history_lines_this_session && (history_lines_this_session <= where_history ()))
|
||||
{
|
||||
/* If the filename was supplied, then create it if necessary. */
|
||||
if (stat (filename, &buf) == -1 && errno == ENOENT)
|
||||
|
||||
+6
-2
@@ -213,6 +213,9 @@ bash_history_inhibit_expansion (string, i)
|
||||
else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
|
||||
member ('}', string + i + 1))
|
||||
return (1);
|
||||
/* The shell uses $! as a defined parameter expansion. */
|
||||
else if (i > 1 && string[i - 1] == '$' && string[i] == '!')
|
||||
return (1);
|
||||
#if defined (EXTENDED_GLOB)
|
||||
else if (extended_glob && i > 1 && string[i+1] == '(' && member (')', string + i + 2))
|
||||
return (1);
|
||||
@@ -356,7 +359,7 @@ save_history ()
|
||||
the history file. */
|
||||
using_history ();
|
||||
|
||||
if (history_lines_this_session < where_history () || force_append_history)
|
||||
if (history_lines_this_session <= where_history () || force_append_history)
|
||||
append_history (history_lines_this_session, hf);
|
||||
else
|
||||
write_history (hf);
|
||||
@@ -373,7 +376,8 @@ maybe_append_history (filename)
|
||||
struct stat buf;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (history_lines_this_session && (history_lines_this_session < where_history ()))
|
||||
/* XXX - why isn't this <= where_history() ? */
|
||||
if (history_lines_this_session && (history_lines_this_session <= where_history ()))
|
||||
{
|
||||
/* If the filename was supplied, then create it if necessary. */
|
||||
if (stat (filename, &buf) == -1 && errno == ENOENT)
|
||||
|
||||
@@ -96,6 +96,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||
#define W_NOPROCSUB 0x100000 /* don't perform process substitution */
|
||||
#define W_HASCTLESC 0x200000 /* word contains literal CTLESC characters */
|
||||
#define W_ASSIGNASSOC 0x400000 /* word looks like associative array assignment */
|
||||
#define W_ARRAYIND 0x800000 /* word is an array index being expanded */
|
||||
|
||||
/* Possible values for subshell_environment */
|
||||
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ typedef struct element {
|
||||
#define CMD_STDIN_REDIR 0x400 /* async command needs implicit </dev/null */
|
||||
#define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */
|
||||
#define CMD_COPROC_SUBSHELL 0x1000
|
||||
#defien CMD_LASTPIPE 0x2000
|
||||
#define CMD_LASTPIPE 0x2000
|
||||
|
||||
/* What a command looks like. */
|
||||
typedef struct command {
|
||||
|
||||
@@ -215,6 +215,9 @@
|
||||
/* The number of bytes in a double (hopefully 8). */
|
||||
#undef SIZEOF_DOUBLE
|
||||
|
||||
/* The number of bytes in an `intmax_t'. */
|
||||
#undef SIZEOF_INTMAX_T
|
||||
|
||||
/* The number of bytes in a `long long', if we have one. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
|
||||
@@ -415,6 +415,8 @@
|
||||
|
||||
#undef HAVE_STRUCT_TIMEZONE
|
||||
|
||||
#undef WEXITSTATUS_OFFSET
|
||||
|
||||
/* Characteristics of definitions in the system header files. */
|
||||
|
||||
#undef HAVE_GETPW_DECLS
|
||||
|
||||
@@ -27176,6 +27176,366 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:$LINENO: checking size of intmax_t" >&5
|
||||
$as_echo_n "checking size of intmax_t... " >&6; }
|
||||
if test "${ac_cv_sizeof_intmax_t+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then
|
||||
# Depending upon the size, compute the lo and hi bounds.
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) >= 0)];
|
||||
test_array [0] = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_lo=0 ac_mid=0
|
||||
while :; do
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)];
|
||||
test_array [0] = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=$ac_mid; break
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo=`expr $ac_mid + 1`
|
||||
if test $ac_lo -le $ac_mid; then
|
||||
ac_lo= ac_hi=
|
||||
break
|
||||
fi
|
||||
ac_mid=`expr 2 '*' $ac_mid + 1`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) < 0)];
|
||||
test_array [0] = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=-1 ac_mid=-1
|
||||
while :; do
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) >= $ac_mid)];
|
||||
test_array [0] = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_lo=$ac_mid; break
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_hi=`expr '(' $ac_mid ')' - 1`
|
||||
if test $ac_mid -le $ac_hi; then
|
||||
ac_lo= ac_hi=
|
||||
break
|
||||
fi
|
||||
ac_mid=`expr 2 '*' $ac_mid`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo= ac_hi=
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
# Binary search between lo and hi bounds.
|
||||
while test "x$ac_lo" != "x$ac_hi"; do
|
||||
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)];
|
||||
test_array [0] = 0
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_hi=$ac_mid
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_lo=`expr '(' $ac_mid ')' + 1`
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
case $ac_lo in
|
||||
?*) ac_cv_sizeof_intmax_t=$ac_lo;;
|
||||
'') if test "$ac_cv_type_intmax_t" = yes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&5
|
||||
$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 77); exit 77; }; }; }
|
||||
else
|
||||
ac_cv_sizeof_intmax_t=0
|
||||
fi ;;
|
||||
esac
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
static long int longval () { return (long int) (sizeof (intmax_t)); }
|
||||
static unsigned long int ulongval () { return (long int) (sizeof (intmax_t)); }
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
FILE *f = fopen ("conftest.val", "w");
|
||||
if (! f)
|
||||
return 1;
|
||||
if (((long int) (sizeof (intmax_t))) < 0)
|
||||
{
|
||||
long int i = longval ();
|
||||
if (i != ((long int) (sizeof (intmax_t))))
|
||||
return 1;
|
||||
fprintf (f, "%ld", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long int i = ulongval ();
|
||||
if (i != ((long int) (sizeof (intmax_t))))
|
||||
return 1;
|
||||
fprintf (f, "%lu", i);
|
||||
}
|
||||
/* Do not output a trailing newline, as this causes \r\n confusion
|
||||
on some platforms. */
|
||||
return ferror (f) || fclose (f) != 0;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_sizeof_intmax_t=`cat conftest.val`
|
||||
else
|
||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
if test "$ac_cv_type_intmax_t" = yes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&5
|
||||
$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 77); exit 77; }; }; }
|
||||
else
|
||||
ac_cv_sizeof_intmax_t=0
|
||||
fi
|
||||
fi
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
rm -f conftest.val
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_intmax_t" >&5
|
||||
$as_echo "$ac_cv_sizeof_intmax_t" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_INTMAX_T $ac_cv_sizeof_intmax_t
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for struct termios.c_line" >&5
|
||||
$as_echo_n "checking for struct termios.c_line... " >&6; }
|
||||
|
||||
@@ -905,6 +905,8 @@ BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
|
||||
fi
|
||||
BASH_TYPE_RLIMIT
|
||||
|
||||
AC_CHECK_SIZEOF(intmax_t, 8)
|
||||
|
||||
dnl presence and contents of structures used by system calls
|
||||
BASH_STRUCT_TERMIOS_LDISC
|
||||
BASH_STRUCT_TERMIO_LDISC
|
||||
|
||||
+3
-1
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 4.2, version 4.031])dnl
|
||||
AC_REVISION([for Bash 4.2, version 4.032])dnl
|
||||
|
||||
define(bashvers, 4.2)
|
||||
define(relstatus, devel)
|
||||
@@ -918,6 +918,8 @@ AC_STRUCT_TM
|
||||
AC_STRUCT_TIMEZONE
|
||||
BASH_STRUCT_TIMEZONE
|
||||
|
||||
BASH_STRUCT_WEXITSTATUS_OFFSET
|
||||
|
||||
dnl presence and behavior of C library functions
|
||||
BASH_FUNC_STRSIGNAL
|
||||
BASH_FUNC_OPENDIR_CHECK
|
||||
|
||||
+14
-10
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Wed Jul 21 08:47:30 EDT 2010
|
||||
.\" Last Change: Tue Aug 3 15:24:33 EDT 2010
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2010 July 21" "GNU Bash-4.2"
|
||||
.TH BASH 1 "2010 August 3" "GNU Bash-4.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -408,7 +408,7 @@ No other startup files are read.
|
||||
.PP
|
||||
.B Bash
|
||||
attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell
|
||||
connected to a network connection, as if by the remote shell
|
||||
daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
|
||||
If
|
||||
.B bash
|
||||
@@ -1883,7 +1883,7 @@ If \fBbash\fP finds this variable in the environment when the shell starts
|
||||
with value
|
||||
.if t \f(CWt\fP,
|
||||
.if n "t",
|
||||
it assumes that the shell is running in an emacs shell buffer and disables
|
||||
it assumes that the shell is running in an Emacs shell buffer and disables
|
||||
line editing.
|
||||
.TP
|
||||
.B ENV
|
||||
@@ -2300,8 +2300,8 @@ terminates after waiting for that number of seconds if input does
|
||||
not arrive.
|
||||
.TP
|
||||
.B TMPDIR
|
||||
If set, \fBBash\fP uses its value as the name of a directory in which
|
||||
\fBBash\fP creates temporary files for the shell's use.
|
||||
If set, \fBbash\fP uses its value as the name of a directory in which
|
||||
\fBbash\fP creates temporary files for the shell's use.
|
||||
.TP
|
||||
.B auto_resume
|
||||
This variable controls how the shell interacts with the user and
|
||||
@@ -6357,6 +6357,8 @@ writing the history file.
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
@@ -6372,25 +6374,27 @@ Refer to command line
|
||||
.IR n .
|
||||
.TP
|
||||
.B !\-\fIn\fR
|
||||
Refer to the current command line minus
|
||||
Refer to the current command minus
|
||||
.IR n .
|
||||
.TP
|
||||
.B !!
|
||||
Refer to the previous command. This is a synonym for `!\-1'.
|
||||
.TP
|
||||
.B !\fIstring\fR
|
||||
Refer to the most recent command starting with
|
||||
Refer to the most recent command preceding the current position in the
|
||||
history list starting with
|
||||
.IR string .
|
||||
.TP
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
Refer to the most recent command containing
|
||||
Refer to the most recent command preceding the current postition in the
|
||||
history list containing
|
||||
.IR string .
|
||||
The trailing \fB?\fP may be omitted if
|
||||
.I string
|
||||
is followed immediately by a newline.
|
||||
.TP
|
||||
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
|
||||
Quick substitution. Repeat the last command, replacing
|
||||
Quick substitution. Repeat the previous command, replacing
|
||||
.I string1
|
||||
with
|
||||
.IR string2 .
|
||||
|
||||
+24
-13
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Jul 2 17:31:49 EDT 2010
|
||||
.\" Last Change: Tue Aug 3 15:24:33 EDT 2010
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2010 July 2" "GNU Bash-4.2"
|
||||
.TH BASH 1 "2010 August 3" "GNU Bash-4.2"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -408,7 +408,7 @@ No other startup files are read.
|
||||
.PP
|
||||
.B Bash
|
||||
attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell
|
||||
connected to a network connection, as if by the remote shell
|
||||
daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP.
|
||||
If
|
||||
.B bash
|
||||
@@ -950,7 +950,11 @@ A shell function is an object that is called like a simple command and
|
||||
executes a compound command with a new set of positional parameters.
|
||||
Shell functions are declared as follows:
|
||||
.TP
|
||||
[ \fBfunction\fP ] \fIname\fP () \fIcompound\-command\fP [\fIredirection\fP]
|
||||
\fIname\fP () \fIcompound\-command\fP [\fIredirection\fP]
|
||||
.PD 0
|
||||
.TP
|
||||
\fBfunction\fP \fIname\fP [()] \fIcompound\-command\fP [\fIredirection\fP]
|
||||
.PD
|
||||
This defines a function named \fIname\fP.
|
||||
The reserved word \fBfunction\fP is optional.
|
||||
If the \fBfunction\fP reserved word is supplied, the parentheses are optional.
|
||||
@@ -1879,7 +1883,7 @@ If \fBbash\fP finds this variable in the environment when the shell starts
|
||||
with value
|
||||
.if t \f(CWt\fP,
|
||||
.if n "t",
|
||||
it assumes that the shell is running in an emacs shell buffer and disables
|
||||
it assumes that the shell is running in an Emacs shell buffer and disables
|
||||
line editing.
|
||||
.TP
|
||||
.B ENV
|
||||
@@ -2102,12 +2106,13 @@ for printing selection lists. Automatically set upon receipt of a
|
||||
.BR SIGWINCH .
|
||||
.TP
|
||||
.B MAIL
|
||||
If this parameter is set to a file name and the
|
||||
If this parameter is set to a file or directory name and the
|
||||
.SM
|
||||
.B MAILPATH
|
||||
variable is not set,
|
||||
.B bash
|
||||
informs the user of the arrival of mail in the specified file.
|
||||
informs the user of the arrival of mail in the specified file or
|
||||
Maildir-format directory.
|
||||
.TP
|
||||
.B MAILCHECK
|
||||
Specifies how
|
||||
@@ -2295,8 +2300,8 @@ terminates after waiting for that number of seconds if input does
|
||||
not arrive.
|
||||
.TP
|
||||
.B TMPDIR
|
||||
If set, \fBBash\fP uses its value as the name of a directory in which
|
||||
\fBBash\fP creates temporary files for the shell's use.
|
||||
If set, \fBbash\fP uses its value as the name of a directory in which
|
||||
\fBbash\fP creates temporary files for the shell's use.
|
||||
.TP
|
||||
.B auto_resume
|
||||
This variable controls how the shell interacts with the user and
|
||||
@@ -6352,6 +6357,8 @@ writing the history file.
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
@@ -6367,25 +6374,27 @@ Refer to command line
|
||||
.IR n .
|
||||
.TP
|
||||
.B !\-\fIn\fR
|
||||
Refer to the current command line minus
|
||||
Refer to the current command minus
|
||||
.IR n .
|
||||
.TP
|
||||
.B !!
|
||||
Refer to the previous command. This is a synonym for `!\-1'.
|
||||
.TP
|
||||
.B !\fIstring\fR
|
||||
Refer to the most recent command starting with
|
||||
Refer to the most recent command preceding the current position in the
|
||||
history list starting with
|
||||
.IR string .
|
||||
.TP
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
Refer to the most recent command containing
|
||||
Refer to the most recent command preceding the current postition in the
|
||||
history list containing
|
||||
.IR string .
|
||||
The trailing \fB?\fP may be omitted if
|
||||
.I string
|
||||
is followed immediately by a newline.
|
||||
.TP
|
||||
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
|
||||
Quick substitution. Repeat the last command, replacing
|
||||
Quick substitution. Repeat the previous command, replacing
|
||||
.I string1
|
||||
with
|
||||
.IR string2 .
|
||||
@@ -7338,6 +7347,8 @@ backspace
|
||||
suppress further output
|
||||
.TP
|
||||
.B \ee
|
||||
.TP
|
||||
.B \eE
|
||||
an escape character
|
||||
.TP
|
||||
.B \ef
|
||||
|
||||
+2
-2
@@ -5058,7 +5058,7 @@ it is subsequently reset.
|
||||
@item EMACS
|
||||
If Bash finds this variable in the environment when the shell
|
||||
starts with value @samp{t}, it assumes that the shell is running in an
|
||||
emacs shell buffer and disables line editing.
|
||||
Emacs shell buffer and disables line editing.
|
||||
|
||||
@item ENV
|
||||
Similar to @code{BASH_ENV}; used when the shell is invoked in
|
||||
@@ -5728,7 +5728,7 @@ No other startup files are read.
|
||||
@subsubheading Invoked by remote shell daemon
|
||||
|
||||
Bash attempts to determine when it is being run with its standard input
|
||||
connected to a a network connection, as if by the remote shell
|
||||
connected to a network connection, as if by the remote shell
|
||||
daemon, usually @code{rshd}, or the secure shell daemon @code{sshd}.
|
||||
If Bash determines it is being run in
|
||||
this fashion, it reads and executes commands from @file{~/.bashrc}, if that
|
||||
|
||||
+7
-4
@@ -820,7 +820,7 @@ until it evaluates to zero.
|
||||
Each time @var{expr2} evaluates to a non-zero value, @var{commands} are
|
||||
executed and the arithmetic expression @var{expr3} is evaluated.
|
||||
If any expression is omitted, it behaves as if it evaluates to 1.
|
||||
The return value is the exit status of the last command in @var{list}
|
||||
The return value is the exit status of the last command in @var{commands}
|
||||
that is executed, or false if any of the expressions is invalid.
|
||||
|
||||
@end table
|
||||
@@ -1233,7 +1233,8 @@ shell context; no new process is created to interpret them.
|
||||
Functions are declared using this syntax:
|
||||
@rwindex function
|
||||
@example
|
||||
[ @code{function} ] @var{name} () @var{compound-command} [ @var{redirections} ]
|
||||
@var{name} () @var{compound-command} [ @var{redirections} ]@*or@*
|
||||
@code{function} @var{name} [()] @var{compound-command} [ @var{redirections} ]
|
||||
@end example
|
||||
|
||||
This defines a shell function named @var{name}. The reserved
|
||||
@@ -3650,6 +3651,7 @@ backspace
|
||||
@item \c
|
||||
suppress further output
|
||||
@item \e
|
||||
@itemx \E
|
||||
escape
|
||||
@item \f
|
||||
form feed
|
||||
@@ -4783,9 +4785,10 @@ A list of characters that separate fields; used when the shell splits
|
||||
words as part of expansion.
|
||||
|
||||
@item MAIL
|
||||
If this parameter is set to a filename and the @env{MAILPATH} variable
|
||||
If this parameter is set to a filename or directory name
|
||||
and the @env{MAILPATH} variable
|
||||
is not set, Bash informs the user of the arrival of mail in
|
||||
the specified file.
|
||||
the specified file or Maildir-format directory.
|
||||
|
||||
@item MAILPATH
|
||||
A colon-separated list of filenames which the shell periodically checks
|
||||
|
||||
+2
-5
@@ -2212,17 +2212,13 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
|
||||
lastpipe_flag = 1;
|
||||
freeze_jobs_list ();
|
||||
lastpipe_jid = stop_pipeline (0, (COMMAND *)NULL); /* XXX */
|
||||
add_unwind_protect (lastpipe_cleanup, lastpipe_flag);
|
||||
add_unwind_protect (lastpipe_cleanup, lastpipe_jid);
|
||||
}
|
||||
cmd->flags |= CMD_LASTPIPE;
|
||||
}
|
||||
if (prev >= 0)
|
||||
add_unwind_protect (close, prev);
|
||||
|
||||
/* XXX - might need to temporarily put shell process in pgrp of the pipeline,
|
||||
so after we give the terminal to that process group in stop_pipeline, the
|
||||
shell can still access it. Would need to give it to
|
||||
jobs[lastpipe_jid]->pgrp */
|
||||
exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
|
||||
|
||||
if (lstdin > 0)
|
||||
@@ -4333,6 +4329,7 @@ execute_shell_function (var, words)
|
||||
int ret;
|
||||
struct fd_bitmap *bitmap;
|
||||
|
||||
itrace("execute_shell_function: %s", var->name);
|
||||
bitmap = new_fd_bitmap (FD_BITMAP_DEFAULT_SIZE);
|
||||
begin_unwind_frame ("execute-shell-function");
|
||||
add_unwind_protect (dispose_fd_bitmap, (char *)bitmap);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* expr.c -- arithmetic expression evaluation. */
|
||||
|
||||
/* Copyright (C) 1990-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1990-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -309,6 +309,7 @@ static void
|
||||
expr_bind_variable (lhs, rhs)
|
||||
char *lhs, *rhs;
|
||||
{
|
||||
itrace("expr_bind_variable: %s = %s", lhs, rhs);
|
||||
(void)bind_int_variable (lhs, rhs);
|
||||
stupidly_hack_special_variables (lhs);
|
||||
}
|
||||
@@ -1000,6 +1001,7 @@ expr_streval (tok, e, lvalue)
|
||||
arrayind_t ind;
|
||||
#endif
|
||||
|
||||
itrace("expr_streval: %s", tok);
|
||||
/* [[[[[ */
|
||||
#if defined (ARRAY_VARS)
|
||||
v = (e == ']') ? array_variable_part (tok, (char **)0, (int *)0) : find_variable (tok);
|
||||
|
||||
@@ -482,4 +482,13 @@ extern void zsyncfd __P((int));
|
||||
/* declarations for functions defined in lib/sh/zwrite.c */
|
||||
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 umatchlen __P((char *, size_t));
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
extern int match_pattern_wchar __P((wchar_t *, wchar_t *));
|
||||
extern int wmatchlen __P((wchar_t *, size_t));
|
||||
#endif
|
||||
|
||||
#endif /* _EXTERNS_H_ */
|
||||
|
||||
+10
-1
@@ -1,7 +1,7 @@
|
||||
/* externs.h -- extern function declarations which do not appear in their
|
||||
own header file. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -482,4 +482,13 @@ extern void zsyncfd __P((int));
|
||||
/* declarations for functions defined in lib/sh/zwrite.c */
|
||||
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 size_t umatchlen __P((char *, size_t));
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
extern int match_pattern_wchar __P((wchar_t *, wchar_t *));
|
||||
extern size_t wmatchlen __P((wchar_t *, size_t));
|
||||
#endif
|
||||
|
||||
#endif /* _EXTERNS_H_ */
|
||||
|
||||
@@ -77,6 +77,17 @@ static const unsigned long long int maxquad = ULLONG_MAX;
|
||||
# define ULLONG_MAX maxquad
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INTMAX_T == SIZEOF_LONG_LONG
|
||||
# define INTMAX_MAX LLONG_MAX
|
||||
# define INTMAX_MIN LLONG_MIN
|
||||
#elif SIZEOF_INTMAX_T == SIZEOF_LONG
|
||||
# define INTMAX_MAX LONG_MAX
|
||||
# define INTMAX_MIN LONG_MIN
|
||||
#else
|
||||
# define INTMAX_MAX INT_MAX
|
||||
# define INTMAX_MIN INT_MIN
|
||||
#endif
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX 32767 /* POSIX minimum max */
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/* typemax.h -- encapsulate max values for long, long long, etc. */
|
||||
|
||||
/* Copyright (C) 2001 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: This should be included after config.h, limits.h, stdint.h, and
|
||||
* inttypes.h
|
||||
*/
|
||||
|
||||
#ifndef _SH_TYPEMAX_H
|
||||
#define _SH_TYPEMAX_H
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Nonzero if the integer type T is signed. */
|
||||
#ifndef TYPE_SIGNED
|
||||
# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
#endif
|
||||
|
||||
#ifndef TYPE_MINIMUM
|
||||
# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
|
||||
: (t) 0))
|
||||
#endif
|
||||
|
||||
#ifndef TYPE_MAXIMUM
|
||||
# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
# ifndef LLONG_MAX
|
||||
# define LLONG_MAX TYPE_MAXIMUM(long long int)
|
||||
# define LLONG_MIN TYPE_MINIMUM(long long int)
|
||||
# endif
|
||||
# ifndef ULLONG_MAX
|
||||
# define ULLONG_MAX TYPE_MAXIMUM(unsigned long long int)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
|
||||
# define LONG_MIN ((long int) (-LONG_MAX - 1L))
|
||||
#endif
|
||||
|
||||
#ifndef INT_MAX /* ouch */
|
||||
# define INT_MAX TYPE_MAXIMUM(int)
|
||||
# define INT_MIN TYPE_MINIMUM(int)
|
||||
# define UINT_MAX ((unsigned int) ~(unsigned int)0)
|
||||
#endif
|
||||
|
||||
/* workaround for gcc bug in versions < 2.7 */
|
||||
#if defined (HAVE_LONG_LONG) && __GNUC__ == 2 && __GNUC_MINOR__ < 7
|
||||
static const unsigned long long int maxquad = ULLONG_MAX;
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX maxquad
|
||||
#endif
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX 32767 /* POSIX minimum max */
|
||||
#endif
|
||||
|
||||
#endif /* _SH_TYPEMAX_H */
|
||||
@@ -71,7 +71,7 @@ CSOURCES = $(srcdir)/glob.c $(srcdir)/strmatch.c $(srcdir)/smatch.c \
|
||||
# The header files for this library.
|
||||
HSOURCES = $(srcdir)/strmatch.h
|
||||
|
||||
OBJECTS = glob.o strmatch.o smatch.o xmbsrtowcs.o
|
||||
OBJECTS = glob.o strmatch.o smatch.o xmbsrtowcs.o gmisc.o
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/glob.texi
|
||||
@@ -147,12 +147,17 @@ glob.o: strmatch.h glob.h
|
||||
glob.o: $(BASHINCDIR)/shmbutil.h
|
||||
glob.o: $(topdir)/xmalloc.h
|
||||
|
||||
gmisc.o: $(BUILD_DIR)/config.h
|
||||
gmisc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
|
||||
gmisc.o: $(BASHINCDIR)/shmbutil.h
|
||||
|
||||
xmbsrtowcs.o: ${BUILD_DIR}/config.h
|
||||
xmbsrtowcs.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
xmbsrtowcs.o: ${BASHINCDIR}/shmbutil.h
|
||||
|
||||
# Rules for deficient makes, like SunOS and Solaris
|
||||
glob.o: glob.c
|
||||
gmisc.o: gmisc.c
|
||||
strmatch.o: strmatch.c
|
||||
smatch.o: smatch.c
|
||||
xmbsrtowcs.o: xmbsrtowcs.c
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Glob Library. #
|
||||
# #
|
||||
####################################################################
|
||||
#
|
||||
# Copyright (C) 1996-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
SHELL = @MAKE_SHELL@
|
||||
|
||||
PROFILE_FLAGS = @PROFILE_FLAGS@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
|
||||
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
BASHINCDIR = ${topdir}/include
|
||||
|
||||
INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib
|
||||
|
||||
CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \
|
||||
$(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(RM) $@
|
||||
$(CC) -c $(CCFLAGS) $<
|
||||
|
||||
# The name of the library target.
|
||||
LIBRARY_NAME = libglob.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)/glob.c $(srcdir)/strmatch.c $(srcdir)/smatch.c \
|
||||
$(srcdir)/xmbsrtowcs.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = $(srcdir)/strmatch.h
|
||||
|
||||
OBJECTS = glob.o strmatch.o smatch.o xmbsrtowcs.o
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/glob.texi
|
||||
DOCOBJECT = doc/glob.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
|
||||
######################################################################
|
||||
|
||||
all: $(LIBRARY_NAME)
|
||||
|
||||
$(LIBRARY_NAME): $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
what-tar:
|
||||
@for file in $(THINGS_TO_TAR); do \
|
||||
echo $(selfdir)$$file; \
|
||||
done
|
||||
|
||||
documentation: force
|
||||
-(cd doc; $(MAKE) $(MFLAGS))
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install:
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(LIBRARY_NAME)
|
||||
-(cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
realclean distclean maintainer-clean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
$(RM) -f Makefile
|
||||
|
||||
mostlyclean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
|
||||
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h )
|
||||
|
||||
######################################################################
|
||||
# #
|
||||
# Dependencies for the object files which make up this library. #
|
||||
# #
|
||||
######################################################################
|
||||
|
||||
smatch.o: strmatch.h
|
||||
smatch.o: $(BUILD_DIR)/config.h
|
||||
smatch.o: $(BASHINCDIR)/chartypes.h
|
||||
smatch.o: $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
|
||||
smatch.o: $(BASHINCDIR)/shmbutil.h
|
||||
smatch.o: $(topdir)/xmalloc.h
|
||||
|
||||
strmatch.o: strmatch.h
|
||||
strmatch.o: $(BUILD_DIR)/config.h
|
||||
strmatch.o: $(BASHINCDIR)/stdc.h
|
||||
|
||||
glob.o: $(BUILD_DIR)/config.h
|
||||
glob.o: $(topdir)/shell.h $(BUILD_DIR)/pathnames.h
|
||||
glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
|
||||
glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h
|
||||
glob.o: strmatch.h glob.h
|
||||
glob.o: $(BASHINCDIR)/shmbutil.h
|
||||
glob.o: $(topdir)/xmalloc.h
|
||||
|
||||
xmbsrtowcs.o: ${BUILD_DIR}/config.h
|
||||
xmbsrtowcs.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
xmbsrtowcs.o: ${BASHINCDIR}/shmbutil.h
|
||||
|
||||
# Rules for deficient makes, like SunOS and Solaris
|
||||
glob.o: glob.c
|
||||
strmatch.o: strmatch.c
|
||||
smatch.o: smatch.c
|
||||
xmbsrtowcs.o: xmbsrtowcs.c
|
||||
|
||||
# dependencies for C files that include other C files
|
||||
glob.o: glob_loop.c
|
||||
smatch.o: sm_loop.c
|
||||
@@ -0,0 +1,311 @@
|
||||
/* gmisc.c -- miscellaneous pattern matching utility functions for Bash.
|
||||
|
||||
Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "bashtypes.h"
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#ifndef RPAREN
|
||||
# define RPAREN '('
|
||||
#endif
|
||||
#ifndef LPAREN
|
||||
# define LPAREN ')'
|
||||
#endif
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Return 1 of the first character of WSTRING could match the first
|
||||
character of pattern WPAT. Wide character version. */
|
||||
int
|
||||
match_pattern_wchar (wpat, wstring)
|
||||
wchar_t *wpat, *wstring;
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
if (*wstring == 0)
|
||||
return (0);
|
||||
|
||||
switch (wc = *wpat++)
|
||||
{
|
||||
default:
|
||||
return (*wstring == wc);
|
||||
case L'\\':
|
||||
return (*wstring == *wpat);
|
||||
case L'?':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring != L'\0'));
|
||||
case L'*':
|
||||
return (1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring == wc));
|
||||
case L'[':
|
||||
return (*wstring != L'\0');
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
wmatchlen (wpat, wmax)
|
||||
wchar_t *wpat;
|
||||
size_t wmax;
|
||||
{
|
||||
wchar_t wc, *wbrack;
|
||||
int matlen, t, in_cclass, in_collsym, in_equiv;
|
||||
|
||||
if (*wpat == 0)
|
||||
return (0);
|
||||
|
||||
matlen = 0;
|
||||
while (wc = *wpat++)
|
||||
{
|
||||
switch (wc)
|
||||
{
|
||||
default:
|
||||
matlen++;
|
||||
break;
|
||||
case L'\\':
|
||||
if (*wpat == 0)
|
||||
return ++matlen;
|
||||
else
|
||||
{
|
||||
matlen++;
|
||||
wpat++;
|
||||
}
|
||||
break;
|
||||
case L'?':
|
||||
if (*wpat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'*':
|
||||
return (matlen = -1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
if (*wpat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'[':
|
||||
/* scan for ending `]', skipping over embedded [:...:] */
|
||||
wbrack = wpat;
|
||||
wc = *wpat++;
|
||||
do
|
||||
{
|
||||
if (wc == 0)
|
||||
{
|
||||
matlen += wpat - wbrack - 1; /* incremented below */
|
||||
break;
|
||||
}
|
||||
else if (wc == L'\\')
|
||||
{
|
||||
wc = *wpat++;
|
||||
if (*wpat == 0)
|
||||
break;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L':') /* character class */
|
||||
{
|
||||
wpat++;
|
||||
in_cclass = 1;
|
||||
}
|
||||
else if (in_cclass && wc == L':' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_cclass = 0;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L'.') /* collating symbol */
|
||||
{
|
||||
wpat++;
|
||||
if (*wpat == L']') /* right bracket can appear as collating symbol */
|
||||
wpat++;
|
||||
in_collsym = 1;
|
||||
}
|
||||
else if (in_collsym && wc == L'.' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_collsym = 0;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L'=') /* equivalence class */
|
||||
{
|
||||
wpat++;
|
||||
if (*wpat == L']') /* right bracket can appear as equivalence class */
|
||||
wpat++;
|
||||
in_equiv = 1;
|
||||
}
|
||||
else if (in_equiv && wc == L'=' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_equiv = 0;
|
||||
}
|
||||
}
|
||||
while ((wc = *wpat++) != L']');
|
||||
matlen++; /* bracket expression can only match one char */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matlen;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return 1 of the first character of STRING could match the first
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
|
||||
int
|
||||
match_pattern_char (pat, string)
|
||||
char *pat, *string;
|
||||
{
|
||||
char c;
|
||||
|
||||
if (*string == 0)
|
||||
return (0);
|
||||
|
||||
switch (c = *pat++)
|
||||
{
|
||||
default:
|
||||
return (*string == c);
|
||||
case '\\':
|
||||
return (*string == *pat);
|
||||
case '?':
|
||||
return (*pat == LPAREN ? 1 : (*string != '\0'));
|
||||
case '*':
|
||||
return (1);
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
return (*pat == LPAREN ? 1 : (*string == c));
|
||||
case '[':
|
||||
return (*string != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
umatchlen (pat, max)
|
||||
char *pat;
|
||||
size_t max;
|
||||
{
|
||||
char c, *brack;
|
||||
int matlen, t, in_cclass, in_collsym, in_equiv;
|
||||
|
||||
if (*pat == 0)
|
||||
return (0);
|
||||
|
||||
matlen = 0;
|
||||
while (c = *pat++)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
default:
|
||||
matlen++;
|
||||
break;
|
||||
case L'\\':
|
||||
if (*pat == 0)
|
||||
return ++matlen;
|
||||
else
|
||||
{
|
||||
matlen++;
|
||||
pat++;
|
||||
}
|
||||
break;
|
||||
case L'?':
|
||||
if (*pat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'*':
|
||||
return (matlen = -1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
if (*pat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'[':
|
||||
/* scan for ending `]', skipping over embedded [:...:] */
|
||||
brack = pat;
|
||||
c = *pat++;
|
||||
do
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
matlen += pat - brack - 1; /* incremented below */
|
||||
break;
|
||||
}
|
||||
else if (c == '\\')
|
||||
{
|
||||
c = *pat++;
|
||||
if (*pat == 0)
|
||||
break;
|
||||
}
|
||||
else if (c == '[' && *pat == ':') /* character class */
|
||||
{
|
||||
pat++;
|
||||
in_cclass = 1;
|
||||
}
|
||||
else if (in_cclass && c == ':' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_cclass = 0;
|
||||
}
|
||||
else if (c == '[' && *pat == '.') /* collating symbol */
|
||||
{
|
||||
pat++;
|
||||
if (*pat == ']') /* right bracket can appear as collating symbol */
|
||||
pat++;
|
||||
in_collsym = 1;
|
||||
}
|
||||
else if (in_collsym && c == '.' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_collsym = 0;
|
||||
}
|
||||
else if (c == '[' && *pat == '=') /* equivalence class */
|
||||
{
|
||||
pat++;
|
||||
if (*pat == ']') /* right bracket can appear as equivalence class */
|
||||
pat++;
|
||||
in_equiv = 1;
|
||||
}
|
||||
else if (in_equiv && c == '=' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_equiv = 0;
|
||||
}
|
||||
}
|
||||
while ((c = *pat++) != ']');
|
||||
matlen++; /* bracket expression can only match one char */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matlen;
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
/* gmisc.c -- miscellaneous pattern matching utility functions for Bash.
|
||||
|
||||
Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "bashtypes.h"
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#ifndef RPAREN
|
||||
# define RPAREN '('
|
||||
#endif
|
||||
#ifndef LPAREN
|
||||
# define LPAREN ')'
|
||||
#endif
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Return 1 of the first character of WSTRING could match the first
|
||||
character of pattern WPAT. Wide character version. */
|
||||
int
|
||||
match_pattern_wchar (wpat, wstring)
|
||||
wchar_t *wpat, *wstring;
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
if (*wstring == 0)
|
||||
return (0);
|
||||
|
||||
switch (wc = *wpat++)
|
||||
{
|
||||
default:
|
||||
return (*wstring == wc);
|
||||
case L'\\':
|
||||
return (*wstring == *wpat);
|
||||
case L'?':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring != L'\0'));
|
||||
case L'*':
|
||||
return (1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring == wc));
|
||||
case L'[':
|
||||
return (*wstring != L'\0');
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
wmatchlen (wpat, wmax)
|
||||
wchar_t *wpat;
|
||||
size_t wmax;
|
||||
{
|
||||
wchar_t wc, *wbrack;
|
||||
int matlen, t, in_cclass, in_collsym, in_equiv;
|
||||
|
||||
if (*wpat == 0)
|
||||
return (0);
|
||||
|
||||
matlen = 0;
|
||||
while (wc = *wpat++)
|
||||
{
|
||||
switch (wc)
|
||||
{
|
||||
default:
|
||||
matlen++;
|
||||
break;
|
||||
case L'\\':
|
||||
if (*wpat == 0)
|
||||
return ++matlen;
|
||||
else
|
||||
{
|
||||
matlen++;
|
||||
wpat++;
|
||||
}
|
||||
break;
|
||||
case L'?':
|
||||
if (*wpat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'*':
|
||||
return (matlen = -1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
if (*wpat == LPAREN)
|
||||
return (matlen = -1); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'[':
|
||||
/* scan for ending `]', skipping over embedded [:...:] */
|
||||
wbrack = wpat;
|
||||
wc = *wpat++;
|
||||
do
|
||||
{
|
||||
if (wc == 0)
|
||||
{
|
||||
matlen += wpat - wbrack - 1; /* incremented below */
|
||||
break;
|
||||
}
|
||||
else if (wc == L'\\')
|
||||
{
|
||||
wc = *wpat++;
|
||||
if (*wpat == 0)
|
||||
break;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L':') /* character class */
|
||||
{
|
||||
wpat++;
|
||||
in_cclass = 1;
|
||||
}
|
||||
else if (in_cclass && wc == L':' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_cclass = 0;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L'.') /* collating symbol */
|
||||
{
|
||||
wpat++;
|
||||
if (*wpat == L']') /* right bracket can appear as collating symbol */
|
||||
wpat++;
|
||||
in_collsym = 1;
|
||||
}
|
||||
else if (in_collsym && wc == L'.' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_collsym = 0;
|
||||
}
|
||||
else if (wc == L'[' && *wpat == L'=') /* equivalence class */
|
||||
{
|
||||
wpat++;
|
||||
if (*wpat == L']') /* right bracket can appear as equivalence class */
|
||||
wpat++;
|
||||
in_equiv = 1;
|
||||
}
|
||||
else if (in_equiv && wc == L'=' && *wpat == L']')
|
||||
{
|
||||
wpat++;
|
||||
in_equiv = 0;
|
||||
}
|
||||
}
|
||||
while ((wc = *wpat++) != L']');
|
||||
matlen++; /* bracket expression can only match one char */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matlen;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return 1 of the first character of STRING could match the first
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
|
||||
int
|
||||
match_pattern_char (pat, string)
|
||||
char *pat, *string;
|
||||
{
|
||||
char c;
|
||||
|
||||
if (*string == 0)
|
||||
return (0);
|
||||
|
||||
switch (c = *pat++)
|
||||
{
|
||||
default:
|
||||
return (*string == c);
|
||||
case '\\':
|
||||
return (*string == *pat);
|
||||
case '?':
|
||||
return (*pat == LPAREN ? 1 : (*string != '\0'));
|
||||
case '*':
|
||||
return (1);
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
return (*pat == LPAREN ? 1 : (*string == c));
|
||||
case '[':
|
||||
return (*string != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
umatchlen (pat, max)
|
||||
char *pat;
|
||||
size_t max;
|
||||
{
|
||||
char c, *brack;
|
||||
int matlen, t, in_cclass, in_collsym, in_equiv;
|
||||
|
||||
if (*pat == 0)
|
||||
return (0);
|
||||
|
||||
matlen = 0;
|
||||
while (c = *pat++)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
default:
|
||||
matlen++;
|
||||
break;
|
||||
case L'\\':
|
||||
if (*pat == 0)
|
||||
return ++matlen;
|
||||
else
|
||||
{
|
||||
matlen++;
|
||||
pat++;
|
||||
}
|
||||
break;
|
||||
case L'?':
|
||||
if (*pat == LPAREN)
|
||||
return (matlen = max); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'*':
|
||||
return (matlen = max);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
if (*pat == LPAREN)
|
||||
return (matlen = max); /* XXX for now */
|
||||
else
|
||||
matlen++;
|
||||
break;
|
||||
case L'[':
|
||||
/* scan for ending `]', skipping over embedded [:...:] */
|
||||
brack = pat;
|
||||
c = *pat++;
|
||||
do
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
matlen += pat - brack - 1; /* incremented below */
|
||||
break;
|
||||
}
|
||||
else if (c == '\\')
|
||||
{
|
||||
c = *pat++;
|
||||
if (*pat == 0)
|
||||
break;
|
||||
}
|
||||
else if (c == '[' && *pat == ':') /* character class */
|
||||
{
|
||||
pat++;
|
||||
in_cclass = 1;
|
||||
}
|
||||
else if (in_cclass && c == ':' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_cclass = 0;
|
||||
}
|
||||
else if (c == '[' && *pat == '.') /* collating symbol */
|
||||
{
|
||||
pat++;
|
||||
if (*pat == ']') /* right bracket can appear as collating symbol */
|
||||
pat++;
|
||||
in_collsym = 1;
|
||||
}
|
||||
else if (in_collsym && c == '.' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_collsym = 0;
|
||||
}
|
||||
else if (c == '[' && *pat == '=') /* equivalence class */
|
||||
{
|
||||
pat++;
|
||||
if (*pat == ']') /* right bracket can appear as equivalence class */
|
||||
pat++;
|
||||
in_equiv = 1;
|
||||
}
|
||||
else if (in_equiv && c == '=' && *pat == ']')
|
||||
{
|
||||
pat++;
|
||||
in_equiv = 0;
|
||||
}
|
||||
}
|
||||
while ((c = *pat++) != ']');
|
||||
matlen++; /* bracket expression can only match one char */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matlen;
|
||||
}
|
||||
@@ -2092,8 +2092,8 @@ complete_fncmp (convfn, convlen, filename, filename_len)
|
||||
return 1;
|
||||
if (convlen < filename_len)
|
||||
return 0;
|
||||
s1 = convfn;
|
||||
s2 = filename;
|
||||
s1 = (char *)convfn;
|
||||
s2 = (char *)filename;
|
||||
len = filename_len;
|
||||
do
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Thu Jul 31 08:46:08 EDT 2003
|
||||
.\" Last Change: Thu Aug 12 22:24:41 EDT 2010
|
||||
.\"
|
||||
.TH HISTORY 3 "2003 July 31" "GNU History 6.0"
|
||||
.TH HISTORY 3 "2010 August 12" "GNU History 6.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -40,8 +40,8 @@
|
||||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2002 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2002 by the Free Software Foundation, Inc.
|
||||
.if t The GNU History Library is Copyright \(co 1989-2010 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2010 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
|
||||
@@ -83,6 +83,8 @@ the history expansion character.
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
@@ -96,18 +98,22 @@ Refer to command line
|
||||
.IR n .
|
||||
.TP
|
||||
.B !\-\fIn\fR
|
||||
Refer to the current command line minus
|
||||
Refer to the current command minus
|
||||
.IR n .
|
||||
.TP
|
||||
.B !!
|
||||
Refer to the previous command. This is a synonym for `!\-1'.
|
||||
.TP
|
||||
.B !\fIstring\fR
|
||||
Refer to the most recent command starting with
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
starting with
|
||||
.IR string .
|
||||
.TP
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
Refer to the most recent command containing
|
||||
Refer to the most recent command
|
||||
preceding the current postition in the history list
|
||||
containing
|
||||
.IR string .
|
||||
The trailing \fB?\fP may be omitted if
|
||||
.I string
|
||||
@@ -569,10 +575,13 @@ The number of entries currently stored in the history list.
|
||||
The maximum number of history entries. This must be changed using
|
||||
\fBstifle_history()\fP.
|
||||
|
||||
.Vb int history_write_timestamps
|
||||
.Vb int history_wite_timestamps
|
||||
If non-zero, timestamps are written to the history file, so they can be
|
||||
preserved between sessions. The default value is 0, meaning that
|
||||
timestamps are not saved.
|
||||
The current timestamp format uses the value of \fIhistory_comment_char\fP
|
||||
to delimit timestamp entries in the history file. If that variable does
|
||||
not have a value (the default), timestamps will not be written.
|
||||
|
||||
.Vb char history_expansion_char
|
||||
The character that introduces a history event. The default is \fB!\fP.
|
||||
|
||||
@@ -0,0 +1,672 @@
|
||||
.\"
|
||||
.\" MAN PAGE COMMENTS to
|
||||
.\"
|
||||
.\" Chet Ramey
|
||||
.\" Information Network Services
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Tue Aug 3 15:23:38 EDT 2010
|
||||
.\"
|
||||
.TH HISTORY 3 "2010 August 3" "GNU History 6.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
.\"
|
||||
.de FN
|
||||
\fI\|\\$1\|\fP
|
||||
..
|
||||
.ds lp \fR\|(\fP
|
||||
.ds rp \fR\|)\fP
|
||||
.\" FnN return-value fun-name N arguments
|
||||
.de Fn1
|
||||
\fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp
|
||||
.br
|
||||
..
|
||||
.de Fn2
|
||||
.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp
|
||||
.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp
|
||||
.br
|
||||
..
|
||||
.de Fn3
|
||||
.if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp
|
||||
.if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp
|
||||
.br
|
||||
..
|
||||
.de Vb
|
||||
\fI\\$1\fP \fB\\$2\fP
|
||||
.br
|
||||
..
|
||||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2010 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2010 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
|
||||
data with each line, and utilize information from previous lines in
|
||||
composing new ones.
|
||||
.PP
|
||||
.SH "HISTORY EXPANSION"
|
||||
.PP
|
||||
The history library supports a history expansion feature that
|
||||
is identical to the history expansion in
|
||||
.BR bash.
|
||||
This section describes what syntax features are available.
|
||||
.PP
|
||||
History expansions introduce words from the history list into
|
||||
the input stream, making it easy to repeat commands, insert the
|
||||
arguments to a previous command into the current input line, or
|
||||
fix errors in previous commands quickly.
|
||||
.PP
|
||||
History expansion is usually performed immediately after a complete line
|
||||
is read.
|
||||
It takes place in two parts.
|
||||
The first is to determine which line from the history list
|
||||
to use during substitution.
|
||||
The second is to select portions of that line for inclusion into
|
||||
the current one.
|
||||
The line selected from the history is the \fIevent\fP,
|
||||
and the portions of that line that are acted upon are \fIwords\fP.
|
||||
Various \fImodifiers\fP are available to manipulate the selected words.
|
||||
The line is broken into words in the same fashion as \fBbash\fP
|
||||
does when reading input,
|
||||
so that several words that would otherwise be separated
|
||||
are considered one word when surrounded by quotes (see the
|
||||
description of \fBhistory_tokenize()\fP below).
|
||||
History expansions are introduced by the appearance of the
|
||||
history expansion character, which is \^\fB!\fP\^ by default.
|
||||
Only backslash (\^\fB\e\fP\^) and single quotes can quote
|
||||
the history expansion character.
|
||||
.SS Event Designators
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B !
|
||||
Start a history substitution, except when followed by a
|
||||
.BR blank ,
|
||||
newline, = or (.
|
||||
.TP
|
||||
.B !\fIn\fR
|
||||
Refer to command line
|
||||
.IR n .
|
||||
.TP
|
||||
.B !\-\fIn\fR
|
||||
Refer to the current command minus
|
||||
.IR n .
|
||||
.TP
|
||||
.B !!
|
||||
Refer to the previous command. This is a synonym for `!\-1'.
|
||||
.TP
|
||||
.B !\fIstring\fR
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
starting with
|
||||
.IR string .
|
||||
.TP
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
Refer to the most recent command
|
||||
preceding the current postition in the history list
|
||||
containing
|
||||
.IR string .
|
||||
The trailing \fB?\fP may be omitted if
|
||||
.I string
|
||||
is followed immediately by a newline.
|
||||
.TP
|
||||
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
|
||||
Quick substitution. Repeat the last command, replacing
|
||||
.I string1
|
||||
with
|
||||
.IR string2 .
|
||||
Equivalent to
|
||||
``!!:s/\fIstring1\fP/\fIstring2\fP/''
|
||||
(see \fBModifiers\fP below).
|
||||
.TP
|
||||
.B !#
|
||||
The entire command line typed so far.
|
||||
.PD
|
||||
.SS Word Designators
|
||||
.PP
|
||||
Word designators are used to select desired words from the event.
|
||||
A
|
||||
.B :
|
||||
separates the event specification from the word designator.
|
||||
It may be omitted if the word designator begins with a
|
||||
.BR ^ ,
|
||||
.BR $ ,
|
||||
.BR * ,
|
||||
.BR \- ,
|
||||
or
|
||||
.BR % .
|
||||
Words are numbered from the beginning of the line,
|
||||
with the first word being denoted by 0 (zero).
|
||||
Words are inserted into the current line separated by single spaces.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B 0 (zero)
|
||||
The zeroth word. For the shell, this is the command
|
||||
word.
|
||||
.TP
|
||||
.I n
|
||||
The \fIn\fRth word.
|
||||
.TP
|
||||
.B ^
|
||||
The first argument. That is, word 1.
|
||||
.TP
|
||||
.B $
|
||||
The last argument.
|
||||
.TP
|
||||
.B %
|
||||
The word matched by the most recent `?\fIstring\fR?' search.
|
||||
.TP
|
||||
.I x\fB\-\fPy
|
||||
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
|
||||
.TP
|
||||
.B *
|
||||
All of the words but the zeroth. This is a synonym
|
||||
for `\fI1\-$\fP'. It is not an error to use
|
||||
.B *
|
||||
if there is just one
|
||||
word in the event; the empty string is returned in that case.
|
||||
.TP
|
||||
.B x*
|
||||
Abbreviates \fIx\-$\fP.
|
||||
.TP
|
||||
.B x\-
|
||||
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
|
||||
.PD
|
||||
.PP
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
.SS Modifiers
|
||||
.PP
|
||||
After the optional word designator, there may appear a sequence of
|
||||
one or more of the following modifiers, each preceded by a `:'.
|
||||
.PP
|
||||
.PD 0
|
||||
.PP
|
||||
.TP
|
||||
.B h
|
||||
Remove a trailing file name component, leaving only the head.
|
||||
.TP
|
||||
.B t
|
||||
Remove all leading file name components, leaving the tail.
|
||||
.TP
|
||||
.B r
|
||||
Remove a trailing suffix of the form \fI.xxx\fP, leaving the
|
||||
basename.
|
||||
.TP
|
||||
.B e
|
||||
Remove all but the trailing suffix.
|
||||
.TP
|
||||
.B p
|
||||
Print the new command but do not execute it.
|
||||
.TP
|
||||
.B q
|
||||
Quote the substituted words, escaping further substitutions.
|
||||
.TP
|
||||
.B x
|
||||
Quote the substituted words as with
|
||||
.BR q ,
|
||||
but break into words at
|
||||
.B blanks
|
||||
and newlines.
|
||||
.TP
|
||||
.B s/\fIold\fP/\fInew\fP/
|
||||
Substitute
|
||||
.I new
|
||||
for the first occurrence of
|
||||
.I old
|
||||
in the event line. Any delimiter can be used in place of /. The
|
||||
final delimiter is optional if it is the last character of the
|
||||
event line. The delimiter may be quoted in
|
||||
.I old
|
||||
and
|
||||
.I new
|
||||
with a single backslash. If & appears in
|
||||
.IR new ,
|
||||
it is replaced by
|
||||
.IR old .
|
||||
A single backslash will quote the &. If
|
||||
.I old
|
||||
is null, it is set to the last
|
||||
.I old
|
||||
substituted, or, if no previous history substitutions took place,
|
||||
the last
|
||||
.I string
|
||||
in a
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
search.
|
||||
.TP
|
||||
.B &
|
||||
Repeat the previous substitution.
|
||||
.TP
|
||||
.B g
|
||||
Cause changes to be applied over the entire event line. This is
|
||||
used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR')
|
||||
or `\fB:&\fP'. If used with
|
||||
`\fB:s\fP', any delimiter can be used
|
||||
in place of /, and the final delimiter is optional
|
||||
if it is the last character of the event line.
|
||||
An \fBa\fP may be used as a synonym for \fBg\fP.
|
||||
.TP
|
||||
.B G
|
||||
Apply the following `\fBs\fP' modifier once to each word in the event line.
|
||||
.PD
|
||||
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
|
||||
This section describes how to use the History library in other programs.
|
||||
.SS Introduction to History
|
||||
.PP
|
||||
The programmer using the History library has available functions
|
||||
for remembering lines on a history list, associating arbitrary data
|
||||
with a line, removing lines from the list, searching through the list
|
||||
for a line containing an arbitrary text string, and referencing any line
|
||||
in the list directly. In addition, a history \fIexpansion\fP function
|
||||
is available which provides for a consistent user interface across
|
||||
different programs.
|
||||
.PP
|
||||
The user using programs written with the History library has the
|
||||
benefit of a consistent user interface with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that text
|
||||
in new commands. The basic history manipulation commands are
|
||||
identical to
|
||||
the history substitution provided by \fBbash\fP.
|
||||
.PP
|
||||
If the programmer desires, he can use the Readline library, which
|
||||
includes some history manipulation by default, and has the added
|
||||
advantage of command line editing.
|
||||
.PP
|
||||
Before declaring any functions using any functionality the History
|
||||
library provides in other code, an application writer should include
|
||||
the file
|
||||
.FN <readline/history.h>
|
||||
in any file that uses the
|
||||
History library's features. It supplies extern declarations for all
|
||||
of the library's public functions and variables, and declares all of
|
||||
the public data structures.
|
||||
|
||||
.SS History Storage
|
||||
.PP
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
.PP
|
||||
.Vb "typedef void *" histdata_t;
|
||||
.PP
|
||||
.nf
|
||||
typedef struct _hist_entry {
|
||||
char *line;
|
||||
char *timestamp;
|
||||
histdata_t data;
|
||||
} HIST_ENTRY;
|
||||
.fi
|
||||
.PP
|
||||
The history list itself might therefore be declared as
|
||||
.PP
|
||||
.Vb "HIST_ENTRY **" the_history_list;
|
||||
.PP
|
||||
The state of the History library is encapsulated into a single structure:
|
||||
.PP
|
||||
.nf
|
||||
/*
|
||||
* A structure used to pass around the current state of the history.
|
||||
*/
|
||||
typedef struct _hist_state {
|
||||
HIST_ENTRY **entries; /* Pointer to the entries themselves. */
|
||||
int offset; /* The location pointer within this array. */
|
||||
int length; /* Number of elements within this array. */
|
||||
int size; /* Number of slots allocated to this array. */
|
||||
int flags;
|
||||
} HISTORY_STATE;
|
||||
.fi
|
||||
.PP
|
||||
If the flags member includes \fBHS_STIFLED\fP, the history has been
|
||||
stifled.
|
||||
.SH "History Functions"
|
||||
.PP
|
||||
This section describes the calling sequence for the various functions
|
||||
exported by the GNU History library.
|
||||
.SS Initializing History and State Management
|
||||
This section describes functions used to initialize and manage
|
||||
the state of the History library when you want to use the history
|
||||
functions in your program.
|
||||
|
||||
.Fn1 void using_history void
|
||||
Begin a session in which the history functions might be used. This
|
||||
initializes the interactive variables.
|
||||
|
||||
.Fn1 "HISTORY_STATE *" history_get_history_state void
|
||||
Return a structure describing the current state of the input history.
|
||||
|
||||
.Fn1 void history_set_history_state "HISTORY_STATE *state"
|
||||
Set the state of the history list according to \fIstate\fP.
|
||||
|
||||
.SS History List Management
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
parameters managing the list itself.
|
||||
|
||||
.Fn1 void add_history "const char *string"
|
||||
Place \fIstring\fP at the end of the history list. The associated data
|
||||
field (if any) is set to \fBNULL\fP.
|
||||
|
||||
.Fn1 void add_history_time "const char *string"
|
||||
Change the time stamp associated with the most recent history entry to
|
||||
\fIstring\fP.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" remove_history "int which"
|
||||
Remove history entry at offset \fIwhich\fP from the history. The
|
||||
removed element is returned so you can free the line, data,
|
||||
and containing structure.
|
||||
|
||||
.Fn1 "histdata_t" free_history_entry "HIST_ENTRY *histent"
|
||||
Free the history entry \fIhistent\fP and any history library private
|
||||
data associated with it. Returns the application-specific data
|
||||
so the caller can dispose of it.
|
||||
|
||||
.Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data"
|
||||
Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP.
|
||||
This returns the old entry so the caller can dispose of any
|
||||
application-specific data. In the case
|
||||
of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned.
|
||||
|
||||
.Fn1 void clear_history "void"
|
||||
Clear the history list by deleting all the entries.
|
||||
|
||||
.Fn1 void stifle_history "int max"
|
||||
Stifle the history list, remembering only the last \fImax\fP entries.
|
||||
|
||||
.Fn1 int unstifle_history "void"
|
||||
Stop stifling the history. This returns the previously-set
|
||||
maximum number of history entries (as set by \fBstifle_history()\fP).
|
||||
history was stifled. The value is positive if the history was
|
||||
stifled, negative if it wasn't.
|
||||
|
||||
.Fn1 int history_is_stifled "void"
|
||||
Returns non-zero if the history is stifled, zero if it is not.
|
||||
|
||||
.SS Information About the History List
|
||||
|
||||
These functions return information about the entire history list or
|
||||
individual list entries.
|
||||
|
||||
.Fn1 "HIST_ENTRY **" history_list "void"
|
||||
Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the
|
||||
current input history. Element 0 of this list is the beginning of time.
|
||||
If there is no history, return \fBNULL\fP.
|
||||
|
||||
.Fn1 int where_history "void"
|
||||
Returns the offset of the current history element.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" current_history "void"
|
||||
Return the history entry at the current position, as determined by
|
||||
\fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP
|
||||
pointer.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" history_get "int offset"
|
||||
Return the history entry at position \fIoffset\fP, starting from
|
||||
\fBhistory_base\fP.
|
||||
If there is no entry there, or if \fIoffset\fP
|
||||
is greater than the history length, return a \fBNULL\fP pointer.
|
||||
|
||||
.Fn1 "time_t" history_get_time "HIST_ENTRY *"
|
||||
Return the time stamp associated with the history entry passed as the argument.
|
||||
|
||||
.Fn1 int history_total_bytes "void"
|
||||
Return the number of bytes that the primary history entries are using.
|
||||
This function returns the sum of the lengths of all the lines in the
|
||||
history.
|
||||
|
||||
.SS Moving Around the History List
|
||||
|
||||
These functions allow the current index into the history list to be
|
||||
set or changed.
|
||||
|
||||
.Fn1 int history_set_pos "int pos"
|
||||
Set the current history offset to \fIpos\fP, an absolute index
|
||||
into the list.
|
||||
Returns 1 on success, 0 if \fIpos\fP is less than zero or greater
|
||||
than the number of history entries.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" previous_history "void"
|
||||
Back up the current history offset to the previous history entry, and
|
||||
return a pointer to that entry. If there is no previous entry, return
|
||||
a \fBNULL\fP pointer.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" next_history "void"
|
||||
Move the current history offset forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry, return
|
||||
a \fBNULL\fP pointer.
|
||||
|
||||
.SS Searching the History List
|
||||
|
||||
These functions allow searching of the history list for entries containing
|
||||
a specific string. Searching may be performed both forward and backward
|
||||
from the current history position. The search may be \fIanchored\fP,
|
||||
meaning that the string must match at the beginning of the history entry.
|
||||
|
||||
.Fn2 int history_search "const char *string" "int direction"
|
||||
Search the history for \fIstring\fP, starting at the current history offset.
|
||||
If \fIdirection\fP is less than 0, then the search is through
|
||||
previous entries, otherwise through subsequent entries.
|
||||
If \fIstring\fP is found, then
|
||||
the current history index is set to that history entry, and the value
|
||||
returned is the offset in the line of the entry where
|
||||
\fIstring\fP was found. Otherwise, nothing is changed, and a -1 is
|
||||
returned.
|
||||
|
||||
.Fn2 int history_search_prefix "const char *string" "int direction"
|
||||
Search the history for \fIstring\fP, starting at the current history
|
||||
offset. The search is anchored: matching lines must begin with
|
||||
\fIstring\fP. If \fIdirection\fP is less than 0, then the search is
|
||||
through previous entries, otherwise through subsequent entries.
|
||||
If \fIstring\fP is found, then the
|
||||
current history index is set to that entry, and the return value is 0.
|
||||
Otherwise, nothing is changed, and a -1 is returned.
|
||||
|
||||
.Fn3 int history_search_pos "const char *string" "int direction" "int pos"
|
||||
Search for \fIstring\fP in the history list, starting at \fIpos\fP, an
|
||||
absolute index into the list. If \fIdirection\fP is negative, the search
|
||||
proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute
|
||||
index of the history element where \fIstring\fP was found, or -1 otherwise.
|
||||
|
||||
.SS Managing the History File
|
||||
The History library can read the history from and write it to a file.
|
||||
This section documents the functions for managing a history file.
|
||||
|
||||
.Fn1 int read_history "const char *filename"
|
||||
Add the contents of \fIfilename\fP to the history list, a line at a time.
|
||||
If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP.
|
||||
Returns 0 if successful, or \fBerrno\fP if not.
|
||||
|
||||
.Fn3 int read_history_range "const char *filename" "int from" "int to"
|
||||
Read a range of lines from \fIfilename\fP, adding them to the history list.
|
||||
Start reading at line \fIfrom\fP and end at \fIto\fP.
|
||||
If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than
|
||||
\fIfrom\fP, then read until the end of the file. If \fIfilename\fP is
|
||||
\fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful,
|
||||
or \fBerrno\fP if not.
|
||||
|
||||
.Fn1 int write_history "const char *filename"
|
||||
Write the current history to \fIfilename\fP, overwriting \fIfilename\fP
|
||||
if necessary.
|
||||
If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP.
|
||||
Returns 0 on success, or \fBerrno\fP on a read or write error.
|
||||
|
||||
|
||||
.Fn2 int append_history "int nelements" "const char *filename"
|
||||
Append the last \fInelements\fP of the history list to \fIfilename\fP.
|
||||
If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP.
|
||||
Returns 0 on success, or \fBerrno\fP on a read or write error.
|
||||
|
||||
.Fn2 int history_truncate_file "const char *filename" "int nlines"
|
||||
Truncate the history file \fIfilename\fP, leaving only the last
|
||||
\fInlines\fP lines.
|
||||
If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated.
|
||||
Returns 0 on success, or \fBerrno\fP on failure.
|
||||
|
||||
.SS History Expansion
|
||||
|
||||
These functions implement history expansion.
|
||||
|
||||
.Fn2 int history_expand "char *string" "char **output"
|
||||
Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer
|
||||
to a string. Returns:
|
||||
.RS
|
||||
.PD 0
|
||||
.TP
|
||||
0
|
||||
If no expansions took place (or, if the only change in
|
||||
the text was the removal of escape characters preceding the history expansion
|
||||
character);
|
||||
.TP
|
||||
1
|
||||
if expansions did take place;
|
||||
.TP
|
||||
-1
|
||||
if there was an error in expansion;
|
||||
.TP
|
||||
2
|
||||
if the returned line should be displayed, but not executed,
|
||||
as with the \fB:p\fP modifier.
|
||||
.PD
|
||||
.RE
|
||||
If an error ocurred in expansion, then \fIoutput\fP contains a descriptive
|
||||
error message.
|
||||
|
||||
.Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar"
|
||||
Returns the text of the history event beginning at \fIstring\fP +
|
||||
\fI*cindex\fP. \fI*cindex\fP is modified to point to after the event
|
||||
specifier. At function entry, \fIcindex\fP points to the index into
|
||||
\fIstring\fP where the history event specification begins. \fIqchar\fP
|
||||
is a character that is allowed to end the event specification in addition
|
||||
to the ``normal'' terminating characters.
|
||||
|
||||
.Fn1 "char **" history_tokenize "const char *string"
|
||||
Return an array of tokens parsed out of \fIstring\fP, much as the
|
||||
shell might.
|
||||
The tokens are split on the characters in the
|
||||
\fBhistory_word_delimiters\fP variable,
|
||||
and shell quoting conventions are obeyed.
|
||||
|
||||
.Fn3 "char *" history_arg_extract "int first" "int last" "const char *string"
|
||||
Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP
|
||||
arguments present in \fIstring\fP. Arguments are split using
|
||||
\fBhistory_tokenize()\fP.
|
||||
|
||||
.SS History Variables
|
||||
|
||||
This section describes the externally-visible variables exported by
|
||||
the GNU History Library.
|
||||
|
||||
.Vb int history_base
|
||||
The logical offset of the first entry in the history list.
|
||||
|
||||
.Vb int history_length
|
||||
The number of entries currently stored in the history list.
|
||||
|
||||
.Vb int history_max_entries
|
||||
The maximum number of history entries. This must be changed using
|
||||
\fBstifle_history()\fP.
|
||||
|
||||
.Vb int history_wite_timestamps
|
||||
If non-zero, timestamps are written to the history file, so they can be
|
||||
preserved between sessions. The default value is 0, meaning that
|
||||
timestamps are not saved.
|
||||
The current timestamp format uses the value of \fIhistory_comment_char\fP
|
||||
to delimit timestamp entries in the history file. If that variable does
|
||||
not have a value (the default), timestamps will not be written.
|
||||
|
||||
.Vb char history_expansion_char
|
||||
The character that introduces a history event. The default is \fB!\fP.
|
||||
Setting this to 0 inhibits history expansion.
|
||||
|
||||
.Vb char history_subst_char
|
||||
The character that invokes word substitution if found at the start of
|
||||
a line. The default is \fB^\fP.
|
||||
|
||||
.Vb char history_comment_char
|
||||
During tokenization, if this character is seen as the first character
|
||||
of a word, then it and all subsequent characters up to a newline are
|
||||
ignored, suppressing history expansion for the remainder of the line.
|
||||
This is disabled by default.
|
||||
|
||||
.Vb "char *" history_word_delimiters
|
||||
The characters that separate tokens for \fBhistory_tokenize()\fP.
|
||||
The default value is \fB"\ \et\en()<>;&|"\fP.
|
||||
|
||||
.Vb "char *" history_no_expand_chars
|
||||
The list of characters which inhibit history expansion if found immediately
|
||||
following \fBhistory_expansion_char\fP. The default is space, tab, newline,
|
||||
\fB\er\fP, and \fB=\fP.
|
||||
|
||||
.Vb "char *" history_search_delimiter_chars
|
||||
The list of additional characters which can delimit a history search
|
||||
string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of
|
||||
a substring search. The default is empty.
|
||||
|
||||
.Vb int history_quotes_inhibit_expansion
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
|
||||
.Vb "rl_linebuf_func_t *" history_inhibit_expansion_function
|
||||
This should be set to the address of a function that takes two arguments:
|
||||
a \fBchar *\fP (\fIstring\fP)
|
||||
and an \fBint\fP index into that string (\fIi\fP).
|
||||
It should return a non-zero value if the history expansion starting at
|
||||
\fIstring[i]\fP should not be performed; zero if the expansion should
|
||||
be done.
|
||||
It is intended for use by applications like \fBbash\fP that use the history
|
||||
expansion character for additional purposes.
|
||||
By default, this variable is set to \fBNULL\fP.
|
||||
.SH FILES
|
||||
.PD 0
|
||||
.TP
|
||||
.FN ~/.history
|
||||
Default filename for reading and writing saved history
|
||||
.PD
|
||||
.SH "SEE ALSO"
|
||||
.PD 0
|
||||
.TP
|
||||
\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey
|
||||
.TP
|
||||
\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
|
||||
.TP
|
||||
\fIbash\fP(1)
|
||||
.TP
|
||||
\fIreadline\fP(3)
|
||||
.PD
|
||||
.SH AUTHORS
|
||||
Brian Fox, Free Software Foundation
|
||||
.br
|
||||
bfox@gnu.org
|
||||
.PP
|
||||
Chet Ramey, Case Western Reserve University
|
||||
.br
|
||||
chet@ins.CWRU.Edu
|
||||
.SH BUG REPORTS
|
||||
If you find a bug in the
|
||||
.B history
|
||||
library, you should report it. But first, you should
|
||||
make sure that it really is a bug, and that it appears in the latest
|
||||
version of the
|
||||
.B history
|
||||
library that you have.
|
||||
.PP
|
||||
Once you have determined that a bug actually exists, mail a
|
||||
bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
|
||||
If you have a fix, you are welcome to mail that
|
||||
as well! Suggestions and `philosophical' bug reports may be mailed
|
||||
to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
|
||||
newsgroup
|
||||
.BR gnu.bash.bug .
|
||||
.PP
|
||||
Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet@ins.CWRU.Edu .
|
||||
@@ -426,6 +426,10 @@ The maximum number of history entries. This must be changed using
|
||||
If non-zero, timestamps are written to the history file, so they can be
|
||||
preserved between sessions. The default value is 0, meaning that
|
||||
timestamps are not saved.
|
||||
|
||||
The current timestamp format uses the value of @var{history_comment_char}
|
||||
to delimit timestamp entries in the history file. If that variable does
|
||||
not have a value (the default), timestamps will not be written.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_expansion_char
|
||||
|
||||
@@ -0,0 +1,573 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
all copies.
|
||||
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that the
|
||||
GNU Copyright statement is available to the distributee, and provided that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ignore
|
||||
|
||||
@node Programming with GNU History
|
||||
@chapter Programming with GNU History
|
||||
|
||||
This chapter describes how to interface programs that you write
|
||||
with the @sc{gnu} History Library.
|
||||
It should be considered a technical guide.
|
||||
For information on the interactive use of @sc{gnu} History, @pxref{Using
|
||||
History Interactively}.
|
||||
|
||||
@menu
|
||||
* Introduction to History:: What is the GNU History library for?
|
||||
* History Storage:: How information is stored.
|
||||
* History Functions:: Functions that you can use.
|
||||
* History Variables:: Variables that control behaviour.
|
||||
* History Programming Example:: Example of using the GNU History Library.
|
||||
@end menu
|
||||
|
||||
@node Introduction to History
|
||||
@section Introduction to History
|
||||
|
||||
Many programs read input from the user a line at a time. The @sc{gnu}
|
||||
History library is able to keep track of those lines, associate arbitrary
|
||||
data with each line, and utilize information from previous lines in
|
||||
composing new ones.
|
||||
|
||||
The programmer using the History library has available functions
|
||||
for remembering lines on a history list, associating arbitrary data
|
||||
with a line, removing lines from the list, searching through the list
|
||||
for a line containing an arbitrary text string, and referencing any line
|
||||
in the list directly. In addition, a history @dfn{expansion} function
|
||||
is available which provides for a consistent user interface across
|
||||
different programs.
|
||||
|
||||
The user using programs written with the History library has the
|
||||
benefit of a consistent user interface with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that text
|
||||
in new commands. The basic history manipulation commands are similar to
|
||||
the history substitution provided by @code{csh}.
|
||||
|
||||
If the programmer desires, he can use the Readline library, which
|
||||
includes some history manipulation by default, and has the added
|
||||
advantage of command line editing.
|
||||
|
||||
Before declaring any functions using any functionality the History
|
||||
library provides in other code, an application writer should include
|
||||
the file @code{<readline/history.h>} in any file that uses the
|
||||
History library's features. It supplies extern declarations for all
|
||||
of the library's public functions and variables, and declares all of
|
||||
the public data structures.
|
||||
|
||||
@node History Storage
|
||||
@section History Storage
|
||||
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
|
||||
@example
|
||||
typedef void *histdata_t;
|
||||
|
||||
typedef struct _hist_entry @{
|
||||
char *line;
|
||||
char *timestamp;
|
||||
histdata_t data;
|
||||
@} HIST_ENTRY;
|
||||
@end example
|
||||
|
||||
The history list itself might therefore be declared as
|
||||
|
||||
@example
|
||||
HIST_ENTRY **the_history_list;
|
||||
@end example
|
||||
|
||||
The state of the History library is encapsulated into a single structure:
|
||||
|
||||
@example
|
||||
/*
|
||||
* A structure used to pass around the current state of the history.
|
||||
*/
|
||||
typedef struct _hist_state @{
|
||||
HIST_ENTRY **entries; /* Pointer to the entries themselves. */
|
||||
int offset; /* The location pointer within this array. */
|
||||
int length; /* Number of elements within this array. */
|
||||
int size; /* Number of slots allocated to this array. */
|
||||
int flags;
|
||||
@} HISTORY_STATE;
|
||||
@end example
|
||||
|
||||
If the flags member includes @code{HS_STIFLED}, the history has been
|
||||
stifled.
|
||||
|
||||
@node History Functions
|
||||
@section History Functions
|
||||
|
||||
This section describes the calling sequence for the various functions
|
||||
exported by the @sc{gnu} History library.
|
||||
|
||||
@menu
|
||||
* Initializing History and State Management:: Functions to call when you
|
||||
want to use history in a
|
||||
program.
|
||||
* History List Management:: Functions used to manage the list
|
||||
of history entries.
|
||||
* Information About the History List:: Functions returning information about
|
||||
the history list.
|
||||
* Moving Around the History List:: Functions used to change the position
|
||||
in the history list.
|
||||
* Searching the History List:: Functions to search the history list
|
||||
for entries containing a string.
|
||||
* Managing the History File:: Functions that read and write a file
|
||||
containing the history list.
|
||||
* History Expansion:: Functions to perform csh-like history
|
||||
expansion.
|
||||
@end menu
|
||||
|
||||
@node Initializing History and State Management
|
||||
@subsection Initializing History and State Management
|
||||
|
||||
This section describes functions used to initialize and manage
|
||||
the state of the History library when you want to use the history
|
||||
functions in your program.
|
||||
|
||||
@deftypefun void using_history (void)
|
||||
Begin a session in which the history functions might be used. This
|
||||
initializes the interactive variables.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HISTORY_STATE *} history_get_history_state (void)
|
||||
Return a structure describing the current state of the input history.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void history_set_history_state (HISTORY_STATE *state)
|
||||
Set the state of the history list according to @var{state}.
|
||||
@end deftypefun
|
||||
|
||||
@node History List Management
|
||||
@subsection History List Management
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
parameters managing the list itself.
|
||||
|
||||
@deftypefun void add_history (const char *string)
|
||||
Place @var{string} at the end of the history list. The associated data
|
||||
field (if any) is set to @code{NULL}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void add_history_time (const char *string)
|
||||
Change the time stamp associated with the most recent history entry to
|
||||
@var{string}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} remove_history (int which)
|
||||
Remove history entry at offset @var{which} from the history. The
|
||||
removed element is returned so you can free the line, data,
|
||||
and containing structure.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {histdata_t} free_history_entry (HIST_ENTRY *histent)
|
||||
Free the history entry @var{histent} and any history library private
|
||||
data associated with it. Returns the application-specific data
|
||||
so the caller can dispose of it.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} replace_history_entry (int which, const char *line, histdata_t data)
|
||||
Make the history entry at offset @var{which} have @var{line} and @var{data}.
|
||||
This returns the old entry so the caller can dispose of any
|
||||
application-specific data. In the case
|
||||
of an invalid @var{which}, a @code{NULL} pointer is returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void clear_history (void)
|
||||
Clear the history list by deleting all the entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void stifle_history (int max)
|
||||
Stifle the history list, remembering only the last @var{max} entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int unstifle_history (void)
|
||||
Stop stifling the history. This returns the previously-set
|
||||
maximum number of history entries (as set by @code{stifle_history()}).
|
||||
The value is positive if the history was
|
||||
stifled, negative if it wasn't.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_is_stifled (void)
|
||||
Returns non-zero if the history is stifled, zero if it is not.
|
||||
@end deftypefun
|
||||
|
||||
@node Information About the History List
|
||||
@subsection Information About the History List
|
||||
|
||||
These functions return information about the entire history list or
|
||||
individual list entries.
|
||||
|
||||
@deftypefun {HIST_ENTRY **} history_list (void)
|
||||
Return a @code{NULL} terminated array of @code{HIST_ENTRY *} which is the
|
||||
current input history. Element 0 of this list is the beginning of time.
|
||||
If there is no history, return @code{NULL}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int where_history (void)
|
||||
Returns the offset of the current history element.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} current_history (void)
|
||||
Return the history entry at the current position, as determined by
|
||||
@code{where_history()}. If there is no entry there, return a @code{NULL}
|
||||
pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} history_get (int offset)
|
||||
Return the history entry at position @var{offset}, starting from
|
||||
@code{history_base} (@pxref{History Variables}).
|
||||
If there is no entry there, or if @var{offset}
|
||||
is greater than the history length, return a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun time_t history_get_time (HIST_ENTRY *entry)
|
||||
Return the time stamp associated with the history entry @var{entry}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_total_bytes (void)
|
||||
Return the number of bytes that the primary history entries are using.
|
||||
This function returns the sum of the lengths of all the lines in the
|
||||
history.
|
||||
@end deftypefun
|
||||
|
||||
@node Moving Around the History List
|
||||
@subsection Moving Around the History List
|
||||
|
||||
These functions allow the current index into the history list to be
|
||||
set or changed.
|
||||
|
||||
@deftypefun int history_set_pos (int pos)
|
||||
Set the current history offset to @var{pos}, an absolute index
|
||||
into the list.
|
||||
Returns 1 on success, 0 if @var{pos} is less than zero or greater
|
||||
than the number of history entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} previous_history (void)
|
||||
Back up the current history offset to the previous history entry, and
|
||||
return a pointer to that entry. If there is no previous entry, return
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} next_history (void)
|
||||
Move the current history offset forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry, return
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@node Searching the History List
|
||||
@subsection Searching the History List
|
||||
@cindex History Searching
|
||||
|
||||
These functions allow searching of the history list for entries containing
|
||||
a specific string. Searching may be performed both forward and backward
|
||||
from the current history position. The search may be @dfn{anchored},
|
||||
meaning that the string must match at the beginning of the history entry.
|
||||
@cindex anchored search
|
||||
|
||||
@deftypefun int history_search (const char *string, int direction)
|
||||
Search the history for @var{string}, starting at the current history offset.
|
||||
If @var{direction} is less than 0, then the search is through
|
||||
previous entries, otherwise through subsequent entries.
|
||||
If @var{string} is found, then
|
||||
the current history index is set to that history entry, and the value
|
||||
returned is the offset in the line of the entry where
|
||||
@var{string} was found. Otherwise, nothing is changed, and a -1 is
|
||||
returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_search_prefix (const char *string, int direction)
|
||||
Search the history for @var{string}, starting at the current history
|
||||
offset. The search is anchored: matching lines must begin with
|
||||
@var{string}. If @var{direction} is less than 0, then the search is
|
||||
through previous entries, otherwise through subsequent entries.
|
||||
If @var{string} is found, then the
|
||||
current history index is set to that entry, and the return value is 0.
|
||||
Otherwise, nothing is changed, and a -1 is returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_search_pos (const char *string, int direction, int pos)
|
||||
Search for @var{string} in the history list, starting at @var{pos}, an
|
||||
absolute index into the list. If @var{direction} is negative, the search
|
||||
proceeds backward from @var{pos}, otherwise forward. Returns the absolute
|
||||
index of the history element where @var{string} was found, or -1 otherwise.
|
||||
@end deftypefun
|
||||
|
||||
@node Managing the History File
|
||||
@subsection Managing the History File
|
||||
|
||||
The History library can read the history from and write it to a file.
|
||||
This section documents the functions for managing a history file.
|
||||
|
||||
@deftypefun int read_history (const char *filename)
|
||||
Add the contents of @var{filename} to the history list, a line at a time.
|
||||
If @var{filename} is @code{NULL}, then read from @file{~/.history}.
|
||||
Returns 0 if successful, or @code{errno} if not.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int read_history_range (const char *filename, int from, int to)
|
||||
Read a range of lines from @var{filename}, adding them to the history list.
|
||||
Start reading at line @var{from} and end at @var{to}.
|
||||
If @var{from} is zero, start at the beginning. If @var{to} is less than
|
||||
@var{from}, then read until the end of the file. If @var{filename} is
|
||||
@code{NULL}, then read from @file{~/.history}. Returns 0 if successful,
|
||||
or @code{errno} if not.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int write_history (const char *filename)
|
||||
Write the current history to @var{filename}, overwriting @var{filename}
|
||||
if necessary.
|
||||
If @var{filename} is @code{NULL}, then write the history list to
|
||||
@file{~/.history}.
|
||||
Returns 0 on success, or @code{errno} on a read or write error.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int append_history (int nelements, const char *filename)
|
||||
Append the last @var{nelements} of the history list to @var{filename}.
|
||||
If @var{filename} is @code{NULL}, then append to @file{~/.history}.
|
||||
Returns 0 on success, or @code{errno} on a read or write error.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_truncate_file (const char *filename, int nlines)
|
||||
Truncate the history file @var{filename}, leaving only the last
|
||||
@var{nlines} lines.
|
||||
If @var{filename} is @code{NULL}, then @file{~/.history} is truncated.
|
||||
Returns 0 on success, or @code{errno} on failure.
|
||||
@end deftypefun
|
||||
|
||||
@node History Expansion
|
||||
@subsection History Expansion
|
||||
|
||||
These functions implement history expansion.
|
||||
|
||||
@deftypefun int history_expand (char *string, char **output)
|
||||
Expand @var{string}, placing the result into @var{output}, a pointer
|
||||
to a string (@pxref{History Interaction}). Returns:
|
||||
@table @code
|
||||
@item 0
|
||||
If no expansions took place (or, if the only change in
|
||||
the text was the removal of escape characters preceding the history expansion
|
||||
character);
|
||||
@item 1
|
||||
if expansions did take place;
|
||||
@item -1
|
||||
if there was an error in expansion;
|
||||
@item 2
|
||||
if the returned line should be displayed, but not executed,
|
||||
as with the @code{:p} modifier (@pxref{Modifiers}).
|
||||
@end table
|
||||
|
||||
If an error ocurred in expansion, then @var{output} contains a descriptive
|
||||
error message.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar)
|
||||
Returns the text of the history event beginning at @var{string} +
|
||||
@var{*cindex}. @var{*cindex} is modified to point to after the event
|
||||
specifier. At function entry, @var{cindex} points to the index into
|
||||
@var{string} where the history event specification begins. @var{qchar}
|
||||
is a character that is allowed to end the event specification in addition
|
||||
to the ``normal'' terminating characters.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char **} history_tokenize (const char *string)
|
||||
Return an array of tokens parsed out of @var{string}, much as the
|
||||
shell might. The tokens are split on the characters in the
|
||||
@var{history_word_delimiters} variable,
|
||||
and shell quoting conventions are obeyed.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char *} history_arg_extract (int first, int last, const char *string)
|
||||
Extract a string segment consisting of the @var{first} through @var{last}
|
||||
arguments present in @var{string}. Arguments are split using
|
||||
@code{history_tokenize}.
|
||||
@end deftypefun
|
||||
|
||||
@node History Variables
|
||||
@section History Variables
|
||||
|
||||
This section describes the externally-visible variables exported by
|
||||
the @sc{gnu} History Library.
|
||||
|
||||
@deftypevar int history_base
|
||||
The logical offset of the first entry in the history list.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_length
|
||||
The number of entries currently stored in the history list.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_max_entries
|
||||
The maximum number of history entries. This must be changed using
|
||||
@code{stifle_history()}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_write_timestamps
|
||||
If non-zero, timestamps are written to the history file, so they can be
|
||||
preserved between sessions. The default value is 0, meaning that
|
||||
timestamps are not saved.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_expansion_char
|
||||
The character that introduces a history event. The default is @samp{!}.
|
||||
Setting this to 0 inhibits history expansion.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_subst_char
|
||||
The character that invokes word substitution if found at the start of
|
||||
a line. The default is @samp{^}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_comment_char
|
||||
During tokenization, if this character is seen as the first character
|
||||
of a word, then it and all subsequent characters up to a newline are
|
||||
ignored, suppressing history expansion for the remainder of the line.
|
||||
This is disabled by default.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} history_word_delimiters
|
||||
The characters that separate tokens for @code{history_tokenize()}.
|
||||
The default value is @code{" \t\n()<>;&|"}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} history_search_delimiter_chars
|
||||
The list of additional characters which can delimit a history search
|
||||
string, in addition to space, TAB, @samp{:} and @samp{?} in the case of
|
||||
a substring search. The default is empty.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} history_no_expand_chars
|
||||
The list of characters which inhibit history expansion if found immediately
|
||||
following @var{history_expansion_char}. The default is space, tab, newline,
|
||||
carriage return, and @samp{=}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_quotes_inhibit_expansion
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function
|
||||
This should be set to the address of a function that takes two arguments:
|
||||
a @code{char *} (@var{string})
|
||||
and an @code{int} index into that string (@var{i}).
|
||||
It should return a non-zero value if the history expansion starting at
|
||||
@var{string[i]} should not be performed; zero if the expansion should
|
||||
be done.
|
||||
It is intended for use by applications like Bash that use the history
|
||||
expansion character for additional purposes.
|
||||
By default, this variable is set to @code{NULL}.
|
||||
@end deftypevar
|
||||
|
||||
@node History Programming Example
|
||||
@section History Programming Example
|
||||
|
||||
The following program demonstrates simple use of the @sc{gnu} History Library.
|
||||
|
||||
@smallexample
|
||||
#include <stdio.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@{
|
||||
char line[1024], *t;
|
||||
int len, done = 0;
|
||||
|
||||
line[0] = 0;
|
||||
|
||||
using_history ();
|
||||
while (!done)
|
||||
@{
|
||||
printf ("history$ ");
|
||||
fflush (stdout);
|
||||
t = fgets (line, sizeof (line) - 1, stdin);
|
||||
if (t && *t)
|
||||
@{
|
||||
len = strlen (t);
|
||||
if (t[len - 1] == '\n')
|
||||
t[len - 1] = '\0';
|
||||
@}
|
||||
|
||||
if (!t)
|
||||
strcpy (line, "quit");
|
||||
|
||||
if (line[0])
|
||||
@{
|
||||
char *expansion;
|
||||
int result;
|
||||
|
||||
result = history_expand (line, &expansion);
|
||||
if (result)
|
||||
fprintf (stderr, "%s\n", expansion);
|
||||
|
||||
if (result < 0 || result == 2)
|
||||
@{
|
||||
free (expansion);
|
||||
continue;
|
||||
@}
|
||||
|
||||
add_history (expansion);
|
||||
strncpy (line, expansion, sizeof (line) - 1);
|
||||
free (expansion);
|
||||
@}
|
||||
|
||||
if (strcmp (line, "quit") == 0)
|
||||
done = 1;
|
||||
else if (strcmp (line, "save") == 0)
|
||||
write_history ("history_file");
|
||||
else if (strcmp (line, "read") == 0)
|
||||
read_history ("history_file");
|
||||
else if (strcmp (line, "list") == 0)
|
||||
@{
|
||||
register HIST_ENTRY **the_list;
|
||||
register int i;
|
||||
|
||||
the_list = history_list ();
|
||||
if (the_list)
|
||||
for (i = 0; the_list[i]; i++)
|
||||
printf ("%d: %s\n", i + history_base, the_list[i]->line);
|
||||
@}
|
||||
else if (strncmp (line, "delete", 6) == 0)
|
||||
@{
|
||||
int which;
|
||||
if ((sscanf (line + 6, "%d", &which)) == 1)
|
||||
@{
|
||||
HIST_ENTRY *entry = remove_history (which);
|
||||
if (!entry)
|
||||
fprintf (stderr, "No such entry %d\n", which);
|
||||
else
|
||||
@{
|
||||
free (entry->line);
|
||||
free (entry);
|
||||
@}
|
||||
@}
|
||||
else
|
||||
@{
|
||||
fprintf (stderr, "non-numeric arg given to `delete'\n");
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end smallexample
|
||||
@@ -1,7 +1,7 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2010 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
@@ -299,6 +299,8 @@ writing the history file.
|
||||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
@cindex history events
|
||||
|
||||
@table @asis
|
||||
@@ -324,10 +326,15 @@ Refer to the command @var{n} lines back.
|
||||
Refer to the previous command. This is a synonym for @samp{!-1}.
|
||||
|
||||
@item @code{!@var{string}}
|
||||
Refer to the most recent command starting with @var{string}.
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
starting with @var{string}.
|
||||
|
||||
@item @code{!?@var{string}[?]}
|
||||
Refer to the most recent command containing @var{string}. The trailing
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
containing @var{string}.
|
||||
The trailing
|
||||
@samp{?} may be omitted if the @var{string} is followed immediately by
|
||||
a newline.
|
||||
|
||||
|
||||
@@ -0,0 +1,471 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
all copies.
|
||||
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that the
|
||||
GNU Copyright statement is available to the distributee, and provided that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ignore
|
||||
|
||||
@node Using History Interactively
|
||||
@chapter Using History Interactively
|
||||
|
||||
@ifclear BashFeatures
|
||||
@defcodeindex bt
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
This chapter describes how to use the @sc{gnu} History Library
|
||||
interactively, from a user's standpoint.
|
||||
It should be considered a user's guide.
|
||||
For information on using the @sc{gnu} History Library in other programs,
|
||||
see the @sc{gnu} Readline Library Manual.
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
This chapter describes how to use the @sc{gnu} History Library interactively,
|
||||
from a user's standpoint. It should be considered a user's guide. For
|
||||
information on using the @sc{gnu} History Library in your own programs,
|
||||
@pxref{Programming with GNU History}.
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
@menu
|
||||
* Bash History Facilities:: How Bash lets you manipulate your command
|
||||
history.
|
||||
* Bash History Builtins:: The Bash builtin commands that manipulate
|
||||
the command history.
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
@menu
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
@node Bash History Facilities
|
||||
@section Bash History Facilities
|
||||
@cindex command history
|
||||
@cindex history list
|
||||
|
||||
When the @option{-o history} option to the @code{set} builtin
|
||||
is enabled (@pxref{The Set Builtin}),
|
||||
the shell provides access to the @dfn{command history},
|
||||
the list of commands previously typed.
|
||||
The value of the @env{HISTSIZE} shell variable is used as the
|
||||
number of commands to save in a history list.
|
||||
The text of the last @env{$HISTSIZE}
|
||||
commands (default 500) is saved.
|
||||
The shell stores each command in the history list prior to
|
||||
parameter and variable expansion
|
||||
but after history expansion is performed, subject to the
|
||||
values of the shell variables
|
||||
@env{HISTIGNORE} and @env{HISTCONTROL}.
|
||||
|
||||
When the shell starts up, the history is initialized from the
|
||||
file named by the @env{HISTFILE} variable (default @file{~/.bash_history}).
|
||||
The file named by the value of @env{HISTFILE} is truncated, if
|
||||
necessary, to contain no more than the number of lines specified by
|
||||
the value of the @env{HISTFILESIZE} variable.
|
||||
When an interactive shell exits, the last
|
||||
@env{$HISTSIZE} lines are copied from the history list to the file
|
||||
named by @env{$HISTFILE}.
|
||||
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
|
||||
the lines are appended to the history file,
|
||||
otherwise the history file is overwritten.
|
||||
If @env{HISTFILE}
|
||||
is unset, or if the history file is unwritable, the history is
|
||||
not saved. After saving the history, the history file is truncated
|
||||
to contain no more than @env{$HISTFILESIZE}
|
||||
lines. If @env{HISTFILESIZE} is not set, no truncation is performed.
|
||||
|
||||
If the @env{HISTTIMEFORMAT} is set, the time stamp information
|
||||
associated with each history entry is written to the history file,
|
||||
marked with the history comment character.
|
||||
When the history file is read, lines beginning with the history
|
||||
comment character followed immediately by a digit are interpreted
|
||||
as timestamps for the previous history line.
|
||||
|
||||
The builtin command @code{fc} may be used to list or edit and re-execute
|
||||
a portion of the history list.
|
||||
The @code{history} builtin may be used to display or modify the history
|
||||
list and manipulate the history file.
|
||||
When using command-line editing, search commands
|
||||
are available in each editing mode that provide access to the
|
||||
history list (@pxref{Commands For History}).
|
||||
|
||||
The shell allows control over which commands are saved on the history
|
||||
list. The @env{HISTCONTROL} and @env{HISTIGNORE}
|
||||
variables may be set to cause the shell to save only a subset of the
|
||||
commands entered.
|
||||
The @code{cmdhist}
|
||||
shell option, if enabled, causes the shell to attempt to save each
|
||||
line of a multi-line command in the same history entry, adding
|
||||
semicolons where necessary to preserve syntactic correctness.
|
||||
The @code{lithist}
|
||||
shell option causes the shell to save the command with embedded newlines
|
||||
instead of semicolons.
|
||||
The @code{shopt} builtin is used to set these options.
|
||||
@xref{Bash Builtins}, for a description of @code{shopt}.
|
||||
|
||||
@node Bash History Builtins
|
||||
@section Bash History Builtins
|
||||
@cindex history builtins
|
||||
|
||||
Bash provides two builtin commands which manipulate the
|
||||
history list and history file.
|
||||
|
||||
@table @code
|
||||
|
||||
@item fc
|
||||
@btindex fc
|
||||
@example
|
||||
@code{fc [-e @var{ename}] [-lnr] [@var{first}] [@var{last}]}
|
||||
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
|
||||
@end example
|
||||
|
||||
Fix Command. In the first form, a range of commands from @var{first} to
|
||||
@var{last} is selected from the history list. Both @var{first} and
|
||||
@var{last} may be specified as a string (to locate the most recent
|
||||
command beginning with that string) or as a number (an index into the
|
||||
history list, where a negative number is used as an offset from the
|
||||
current command number). If @var{last} is not specified it is set to
|
||||
@var{first}. If @var{first} is not specified it is set to the previous
|
||||
command for editing and @minus{}16 for listing. If the @option{-l} flag is
|
||||
given, the commands are listed on standard output. The @option{-n} flag
|
||||
suppresses the command numbers when listing. The @option{-r} flag
|
||||
reverses the order of the listing. Otherwise, the editor given by
|
||||
@var{ename} is invoked on a file containing those commands. If
|
||||
@var{ename} is not given, the value of the following variable expansion
|
||||
is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the
|
||||
value of the @env{FCEDIT} variable if set, or the value of the
|
||||
@env{EDITOR} variable if that is set, or @code{vi} if neither is set.
|
||||
When editing is complete, the edited commands are echoed and executed.
|
||||
|
||||
In the second form, @var{command} is re-executed after each instance
|
||||
of @var{pat} in the selected command is replaced by @var{rep}.
|
||||
|
||||
A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
|
||||
that typing @samp{r cc} runs the last command beginning with @code{cc}
|
||||
and typing @samp{r} re-executes the last command (@pxref{Aliases}).
|
||||
|
||||
@item history
|
||||
@btindex history
|
||||
@example
|
||||
history [@var{n}]
|
||||
history -c
|
||||
history -d @var{offset}
|
||||
history [-anrw] [@var{filename}]
|
||||
history -ps @var{arg}
|
||||
@end example
|
||||
|
||||
With no options, display the history list with line numbers.
|
||||
Lines prefixed with a @samp{*} have been modified.
|
||||
An argument of @var{n} lists only the last @var{n} lines.
|
||||
If the shell variable @env{HISTTIMEFORMAT} is set and not null,
|
||||
it is used as a format string for @var{strftime} to display
|
||||
the time stamp associated with each displayed history entry.
|
||||
No intervening blank is printed between the formatted time stamp
|
||||
and the history line.
|
||||
|
||||
Options, if supplied, have the following meanings:
|
||||
|
||||
@table @code
|
||||
@item -c
|
||||
Clear the history list. This may be combined
|
||||
with the other options to replace the history list completely.
|
||||
|
||||
@item -d @var{offset}
|
||||
Delete the history entry at position @var{offset}.
|
||||
@var{offset} should be specified as it appears when the history is
|
||||
displayed.
|
||||
|
||||
@item -a
|
||||
Append the new
|
||||
history lines (history lines entered since the beginning of the
|
||||
current Bash session) to the history file.
|
||||
|
||||
@item -n
|
||||
Append the history lines not already read from the history file
|
||||
to the current history list. These are lines appended to the history
|
||||
file since the beginning of the current Bash session.
|
||||
|
||||
@item -r
|
||||
Read the current history file and append its contents to
|
||||
the history list.
|
||||
|
||||
@item -w
|
||||
Write out the current history to the history file.
|
||||
|
||||
@item -p
|
||||
Perform history substitution on the @var{arg}s and display the result
|
||||
on the standard output, without storing the results in the history list.
|
||||
|
||||
@item -s
|
||||
The @var{arg}s are added to the end of
|
||||
the history list as a single entry.
|
||||
|
||||
@end table
|
||||
|
||||
When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is
|
||||
used, if @var{filename}
|
||||
is given, then it is used as the history file. If not, then
|
||||
the value of the @env{HISTFILE} variable is used.
|
||||
|
||||
@end table
|
||||
@end ifset
|
||||
|
||||
@node History Interaction
|
||||
@section History Expansion
|
||||
@cindex history expansion
|
||||
|
||||
The History library provides a history expansion feature that is similar
|
||||
to the history expansion provided by @code{csh}. This section
|
||||
describes the syntax used to manipulate the history information.
|
||||
|
||||
History expansions introduce words from the history list into
|
||||
the input stream, making it easy to repeat commands, insert the
|
||||
arguments to a previous command into the current input line, or
|
||||
fix errors in previous commands quickly.
|
||||
|
||||
History expansion takes place in two parts. The first is to determine
|
||||
which line from the history list should be used during substitution.
|
||||
The second is to select portions of that line for inclusion into the
|
||||
current one. The line selected from the history is called the
|
||||
@dfn{event}, and the portions of that line that are acted upon are
|
||||
called @dfn{words}. Various @dfn{modifiers} are available to manipulate
|
||||
the selected words. The line is broken into words in the same fashion
|
||||
that Bash does, so that several words
|
||||
surrounded by quotes are considered one word.
|
||||
History expansions are introduced by the appearance of the
|
||||
history expansion character, which is @samp{!} by default.
|
||||
@ifset BashFeatures
|
||||
Only @samp{\} and @samp{'} may be used to escape the history expansion
|
||||
character.
|
||||
@end ifset
|
||||
|
||||
@ifset BashFeatures
|
||||
Several shell options settable with the @code{shopt}
|
||||
builtin (@pxref{Bash Builtins}) may be used to tailor
|
||||
the behavior of history expansion. If the
|
||||
@code{histverify} shell option is enabled, and Readline
|
||||
is being used, history substitutions are not immediately passed to
|
||||
the shell parser.
|
||||
Instead, the expanded line is reloaded into the Readline
|
||||
editing buffer for further modification.
|
||||
If Readline is being used, and the @code{histreedit}
|
||||
shell option is enabled, a failed history expansion will be
|
||||
reloaded into the Readline editing buffer for correction.
|
||||
The @option{-p} option to the @code{history} builtin command
|
||||
may be used to see what a history expansion will do before using it.
|
||||
The @option{-s} option to the @code{history} builtin may be used to
|
||||
add commands to the end of the history list without actually executing
|
||||
them, so that they are available for subsequent recall.
|
||||
This is most useful in conjunction with Readline.
|
||||
|
||||
The shell allows control of the various characters used by the
|
||||
history expansion mechanism with the @code{histchars} variable,
|
||||
as explained above (@pxref{Bash Variables}). The shell uses
|
||||
the history comment character to mark history timestamps when
|
||||
writing the history file.
|
||||
@end ifset
|
||||
|
||||
@menu
|
||||
* Event Designators:: How to specify which history line to use.
|
||||
* Word Designators:: Specifying which words are of interest.
|
||||
* Modifiers:: Modifying the results of substitution.
|
||||
@end menu
|
||||
|
||||
@node Event Designators
|
||||
@subsection Event Designators
|
||||
@cindex event designators
|
||||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
position in the history list.
|
||||
@cindex history events
|
||||
|
||||
@table @asis
|
||||
|
||||
@item @code{!}
|
||||
@ifset BashFeatures
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
the end of the line, @samp{=} or @samp{(} (when the
|
||||
@code{extglob} shell option is enabled using the @code{shopt} builtin).
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
the end of the line, or @samp{=}.
|
||||
@end ifclear
|
||||
|
||||
@item @code{!@var{n}}
|
||||
Refer to command line @var{n}.
|
||||
|
||||
@item @code{!-@var{n}}
|
||||
Refer to the command @var{n} lines back.
|
||||
|
||||
@item @code{!!}
|
||||
Refer to the previous command. This is a synonym for @samp{!-1}.
|
||||
|
||||
@item @code{!@var{string}}
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
starting with @var{string}.
|
||||
|
||||
@item @code{!?@var{string}[?]}
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
containing @var{string}.
|
||||
The trailing
|
||||
@samp{?} may be omitted if the @var{string} is followed immediately by
|
||||
a newline.
|
||||
|
||||
@item @code{^@var{string1}^@var{string2}^}
|
||||
Quick Substitution. Repeat the last command, replacing @var{string1}
|
||||
with @var{string2}. Equivalent to
|
||||
@code{!!:s/@var{string1}/@var{string2}/}.
|
||||
|
||||
@item @code{!#}
|
||||
The entire command line typed so far.
|
||||
|
||||
@end table
|
||||
|
||||
@node Word Designators
|
||||
@subsection Word Designators
|
||||
|
||||
Word designators are used to select desired words from the event.
|
||||
A @samp{:} separates the event specification from the word designator. It
|
||||
may be omitted if the word designator begins with a @samp{^}, @samp{$},
|
||||
@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning
|
||||
of the line, with the first word being denoted by 0 (zero). Words are
|
||||
inserted into the current line separated by single spaces.
|
||||
|
||||
@need 0.75
|
||||
For example,
|
||||
|
||||
@table @code
|
||||
@item !!
|
||||
designates the preceding command. When you type this, the preceding
|
||||
command is repeated in toto.
|
||||
|
||||
@item !!:$
|
||||
designates the last argument of the preceding command. This may be
|
||||
shortened to @code{!$}.
|
||||
|
||||
@item !fi:2
|
||||
designates the second argument of the most recent command starting with
|
||||
the letters @code{fi}.
|
||||
@end table
|
||||
|
||||
@need 0.75
|
||||
Here are the word designators:
|
||||
|
||||
@table @code
|
||||
|
||||
@item 0 (zero)
|
||||
The @code{0}th word. For many applications, this is the command word.
|
||||
|
||||
@item @var{n}
|
||||
The @var{n}th word.
|
||||
|
||||
@item ^
|
||||
The first argument; that is, word 1.
|
||||
|
||||
@item $
|
||||
The last argument.
|
||||
|
||||
@item %
|
||||
The word matched by the most recent @samp{?@var{string}?} search.
|
||||
|
||||
@item @var{x}-@var{y}
|
||||
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
|
||||
|
||||
@item *
|
||||
All of the words, except the @code{0}th. This is a synonym for @samp{1-$}.
|
||||
It is not an error to use @samp{*} if there is just one word in the event;
|
||||
the empty string is returned in that case.
|
||||
|
||||
@item @var{x}*
|
||||
Abbreviates @samp{@var{x}-$}
|
||||
|
||||
@item @var{x}-
|
||||
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
|
||||
|
||||
@end table
|
||||
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
|
||||
@node Modifiers
|
||||
@subsection Modifiers
|
||||
|
||||
After the optional word designator, you can add a sequence of one or more
|
||||
of the following modifiers, each preceded by a @samp{:}.
|
||||
|
||||
@table @code
|
||||
|
||||
@item h
|
||||
Remove a trailing pathname component, leaving only the head.
|
||||
|
||||
@item t
|
||||
Remove all leading pathname components, leaving the tail.
|
||||
|
||||
@item r
|
||||
Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
|
||||
the basename.
|
||||
|
||||
@item e
|
||||
Remove all but the trailing suffix.
|
||||
|
||||
@item p
|
||||
Print the new command but do not execute it.
|
||||
|
||||
@ifset BashFeatures
|
||||
@item q
|
||||
Quote the substituted words, escaping further substitutions.
|
||||
|
||||
@item x
|
||||
Quote the substituted words as with @samp{q},
|
||||
but break into words at spaces, tabs, and newlines.
|
||||
@end ifset
|
||||
|
||||
@item s/@var{old}/@var{new}/
|
||||
Substitute @var{new} for the first occurrence of @var{old} in the
|
||||
event line. Any delimiter may be used in place of @samp{/}.
|
||||
The delimiter may be quoted in @var{old} and @var{new}
|
||||
with a single backslash. If @samp{&} appears in @var{new},
|
||||
it is replaced by @var{old}. A single backslash will quote
|
||||
the @samp{&}. The final delimiter is optional if it is the last
|
||||
character on the input line.
|
||||
|
||||
@item &
|
||||
Repeat the previous substitution.
|
||||
|
||||
@item g
|
||||
@itemx a
|
||||
Cause changes to be applied over the entire event line. Used in
|
||||
conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
|
||||
or with @samp{&}.
|
||||
|
||||
@item G
|
||||
Apply the following @samp{s} modifier once to each word in the event.
|
||||
|
||||
@end table
|
||||
@@ -8,7 +8,7 @@
|
||||
.\"
|
||||
.\" Last Change: Thu Apr 22 18:59:21 EDT 2010
|
||||
.\"
|
||||
.TH READLINE 3 "2010 April 22" "GNU Readline 6.1"
|
||||
.TH READLINE 3 "2010 April 22" "GNU Readline 6.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.\"
|
||||
.\" Last Change: Thu Apr 22 18:59:21 EDT 2010
|
||||
.\"
|
||||
.TH READLINE 3 "2009 April 22" "GNU Readline 6.1"
|
||||
.TH READLINE 3 "2010 April 22" "GNU Readline 6.1"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
|
||||
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2010 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
||||
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2010 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename rluserman.info
|
||||
@settitle GNU Readline Library
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@include version.texi
|
||||
|
||||
@copying
|
||||
This manual describes the end user interface of the GNU Readline Library
|
||||
(version @value{VERSION}, @value{UPDATED}), a library which aids in the
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||
included in the section entitled ``GNU Free Documentation License''.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: You are free to copy and modify
|
||||
this GNU manual. Buying copies from GNU Press supports the FSF in
|
||||
developing GNU and promoting software freedom.''
|
||||
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Libraries
|
||||
@direntry
|
||||
* RLuserman: (rluserman). The GNU readline library User's Manual.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title GNU Readline Library User Interface
|
||||
@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATED-MONTH}
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
@author Brian Fox, Free Software Foundation
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
|
||||
@sp 1
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place, Suite 330, @*
|
||||
Boston, MA 02111-1307 @*
|
||||
USA @*
|
||||
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top GNU Readline Library
|
||||
|
||||
This document describes the end user interface of the GNU Readline Library,
|
||||
a utility which aids in the consistency of user interface across discrete
|
||||
programs which provide a command line interface.
|
||||
|
||||
@menu
|
||||
* Command Line Editing:: GNU Readline User's Manual.
|
||||
* GNU Free Documentation License:: License for copying this manual.
|
||||
@end menu
|
||||
@end ifnottex
|
||||
|
||||
@include rluser.texi
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
|
||||
@include fdl.texi
|
||||
|
||||
@bye
|
||||
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 6.1
|
||||
@set VERSION 6.1
|
||||
@set UPDATED May 292010
|
||||
@set UPDATED-MONTH May 2010
|
||||
@set EDITION 6.2
|
||||
@set VERSION 6.2
|
||||
@set UPDATED August 12 2010
|
||||
@set UPDATED-MONTH August 2010
|
||||
|
||||
@set LASTCHANGE Sat May 29 17:14:10 EDT 2010
|
||||
@set LASTCHANGE Thu Aug 12 22:24:28 EDT 2010
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 6.1
|
||||
@set VERSION 6.1
|
||||
@set UPDATED April 22 2010
|
||||
@set UPDATED-MONTH April 2010
|
||||
@set EDITION 6.2
|
||||
@set VERSION 6.2
|
||||
@set UPDATED August 3 2010
|
||||
@set UPDATED-MONTH August 2010
|
||||
|
||||
@set LASTCHANGE Thu Apr 22 18:59:44 EDT 2010
|
||||
@set LASTCHANGE Tue Aug 3 15:30:05 EDT 2010
|
||||
|
||||
@@ -604,7 +604,7 @@ rl_prep_terminal (meta_flag)
|
||||
/* Try to keep this function from being INTerrupted. */
|
||||
_rl_block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
|
||||
|
||||
if (get_tty_settings (tty, &tio) < 0)
|
||||
{
|
||||
@@ -678,7 +678,7 @@ rl_deprep_terminal ()
|
||||
/* Try to keep this function from being interrupted. */
|
||||
_rl_block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
tty = rl_instream ? fileno (rl_instream) : fileno (stdout);
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (0);
|
||||
|
||||
@@ -0,0 +1,975 @@
|
||||
/* rltty.c -- functions to prepare and restore the terminal for readline's
|
||||
use. */
|
||||
|
||||
/* Copyright (C) 1992-2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
Readline 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.
|
||||
|
||||
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include "rldefs.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
#include "rltty.h"
|
||||
#include "readline.h"
|
||||
#include "rlprivate.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
|
||||
rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
|
||||
|
||||
static void set_winsize PARAMS((int));
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Saving and Restoring the TTY */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Non-zero means that the terminal is in a prepped state. */
|
||||
static int terminal_prepped;
|
||||
|
||||
static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
|
||||
|
||||
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
|
||||
and output is suspended. */
|
||||
#if defined (__ksr1__)
|
||||
static int ksrflow;
|
||||
#endif
|
||||
|
||||
/* Dummy call to force a backgrounded readline to stop before it tries
|
||||
to get the tty settings. */
|
||||
static void
|
||||
set_winsize (tty)
|
||||
int tty;
|
||||
{
|
||||
#if defined (TIOCGWINSZ)
|
||||
struct winsize w;
|
||||
|
||||
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
|
||||
(void) ioctl (tty, TIOCSWINSZ, &w);
|
||||
#endif /* TIOCGWINSZ */
|
||||
}
|
||||
|
||||
#if defined (NO_TTY_DRIVER)
|
||||
/* Nothing */
|
||||
#elif defined (NEW_TTY_DRIVER)
|
||||
|
||||
/* Values for the `flags' field of a struct bsdtty. This tells which
|
||||
elements of the struct bsdtty have been fetched from the system and
|
||||
are valid. */
|
||||
#define SGTTY_SET 0x01
|
||||
#define LFLAG_SET 0x02
|
||||
#define TCHARS_SET 0x04
|
||||
#define LTCHARS_SET 0x08
|
||||
|
||||
struct bsdtty {
|
||||
struct sgttyb sgttyb; /* Basic BSD tty driver information. */
|
||||
int lflag; /* Local mode flags, like LPASS8. */
|
||||
#if defined (TIOCGETC)
|
||||
struct tchars tchars; /* Terminal special characters, including ^S and ^Q. */
|
||||
#endif
|
||||
#if defined (TIOCGLTC)
|
||||
struct ltchars ltchars; /* 4.2 BSD editing characters */
|
||||
#endif
|
||||
int flags; /* Bitmap saying which parts of the struct are valid. */
|
||||
};
|
||||
|
||||
#define TIOTYPE struct bsdtty
|
||||
|
||||
static TIOTYPE otio;
|
||||
|
||||
static void save_tty_chars PARAMS((TIOTYPE *));
|
||||
static int _get_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int get_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int _set_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int set_tty_settings PARAMS((int, TIOTYPE *));
|
||||
|
||||
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
|
||||
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
|
||||
|
||||
static void
|
||||
save_tty_chars (tiop)
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
_rl_last_tty_chars = _rl_tty_chars;
|
||||
|
||||
if (tiop->flags & SGTTY_SET)
|
||||
{
|
||||
_rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
|
||||
_rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
|
||||
}
|
||||
|
||||
if (tiop->flags & TCHARS_SET)
|
||||
{
|
||||
_rl_intr_char = _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
|
||||
_rl_quit_char = _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
|
||||
|
||||
_rl_tty_chars.t_start = tiop->tchars.t_startc;
|
||||
_rl_tty_chars.t_stop = tiop->tchars.t_stopc;
|
||||
_rl_tty_chars.t_eof = tiop->tchars.t_eofc;
|
||||
_rl_tty_chars.t_eol = '\n';
|
||||
_rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
|
||||
}
|
||||
|
||||
if (tiop->flags & LTCHARS_SET)
|
||||
{
|
||||
_rl_susp_char = _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
|
||||
|
||||
_rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
|
||||
_rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
|
||||
_rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
|
||||
_rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
|
||||
_rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
|
||||
}
|
||||
|
||||
_rl_tty_chars.t_status = -1;
|
||||
}
|
||||
|
||||
static int
|
||||
get_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
set_winsize (tty);
|
||||
|
||||
tiop->flags = tiop->lflag = 0;
|
||||
|
||||
errno = 0;
|
||||
if (ioctl (tty, TIOCGETP, &(tiop->sgttyb)) < 0)
|
||||
return -1;
|
||||
tiop->flags |= SGTTY_SET;
|
||||
|
||||
#if defined (TIOCLGET)
|
||||
if (ioctl (tty, TIOCLGET, &(tiop->lflag)) == 0)
|
||||
tiop->flags |= LFLAG_SET;
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGETC)
|
||||
if (ioctl (tty, TIOCGETC, &(tiop->tchars)) == 0)
|
||||
tiop->flags |= TCHARS_SET;
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGLTC)
|
||||
if (ioctl (tty, TIOCGLTC, &(tiop->ltchars)) == 0)
|
||||
tiop->flags |= LTCHARS_SET;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
if (tiop->flags & SGTTY_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSETN, &(tiop->sgttyb));
|
||||
tiop->flags &= ~SGTTY_SET;
|
||||
}
|
||||
_rl_echoing_p = 1;
|
||||
|
||||
#if defined (TIOCLSET)
|
||||
if (tiop->flags & LFLAG_SET)
|
||||
{
|
||||
ioctl (tty, TIOCLSET, &(tiop->lflag));
|
||||
tiop->flags &= ~LFLAG_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (TIOCSETC)
|
||||
if (tiop->flags & TCHARS_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSETC, &(tiop->tchars));
|
||||
tiop->flags &= ~TCHARS_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (TIOCSLTC)
|
||||
if (tiop->flags & LTCHARS_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSLTC, &(tiop->ltchars));
|
||||
tiop->flags &= ~LTCHARS_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_terminal_settings (meta_flag, oldtio, tiop)
|
||||
int meta_flag;
|
||||
TIOTYPE oldtio, *tiop;
|
||||
{
|
||||
_rl_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
|
||||
_rl_echoctl = (oldtio.sgttyb.sg_flags & ECHOCTL);
|
||||
|
||||
/* Copy the original settings to the structure we're going to use for
|
||||
our settings. */
|
||||
tiop->sgttyb = oldtio.sgttyb;
|
||||
tiop->lflag = oldtio.lflag;
|
||||
#if defined (TIOCGETC)
|
||||
tiop->tchars = oldtio.tchars;
|
||||
#endif
|
||||
#if defined (TIOCGLTC)
|
||||
tiop->ltchars = oldtio.ltchars;
|
||||
#endif
|
||||
tiop->flags = oldtio.flags;
|
||||
|
||||
/* First, the basic settings to put us into character-at-a-time, no-echo
|
||||
input mode. */
|
||||
tiop->sgttyb.sg_flags &= ~(ECHO | CRMOD);
|
||||
tiop->sgttyb.sg_flags |= CBREAK;
|
||||
|
||||
/* If this terminal doesn't care how the 8th bit is used, then we can
|
||||
use it for the meta-key. If only one of even or odd parity is
|
||||
specified, then the terminal is using parity, and we cannot. */
|
||||
#if !defined (ANYP)
|
||||
# define ANYP (EVENP | ODDP)
|
||||
#endif
|
||||
if (((oldtio.sgttyb.sg_flags & ANYP) == ANYP) ||
|
||||
((oldtio.sgttyb.sg_flags & ANYP) == 0))
|
||||
{
|
||||
tiop->sgttyb.sg_flags |= ANYP;
|
||||
|
||||
/* Hack on local mode flags if we can. */
|
||||
#if defined (TIOCLGET)
|
||||
# if defined (LPASS8)
|
||||
tiop->lflag |= LPASS8;
|
||||
# endif /* LPASS8 */
|
||||
#endif /* TIOCLGET */
|
||||
}
|
||||
|
||||
#if defined (TIOCGETC)
|
||||
# if defined (USE_XON_XOFF)
|
||||
/* Get rid of terminal output start and stop characters. */
|
||||
tiop->tchars.t_stopc = -1; /* C-s */
|
||||
tiop->tchars.t_startc = -1; /* C-q */
|
||||
|
||||
/* If there is an XON character, bind it to restart the output. */
|
||||
if (oldtio.tchars.t_startc != -1)
|
||||
rl_bind_key (oldtio.tchars.t_startc, rl_restart_output);
|
||||
# endif /* USE_XON_XOFF */
|
||||
|
||||
/* If there is an EOF char, bind _rl_eof_char to it. */
|
||||
if (oldtio.tchars.t_eofc != -1)
|
||||
_rl_eof_char = oldtio.tchars.t_eofc;
|
||||
|
||||
# if defined (NO_KILL_INTR)
|
||||
/* Get rid of terminal-generated SIGQUIT and SIGINT. */
|
||||
tiop->tchars.t_quitc = -1; /* C-\ */
|
||||
tiop->tchars.t_intrc = -1; /* C-c */
|
||||
# endif /* NO_KILL_INTR */
|
||||
#endif /* TIOCGETC */
|
||||
|
||||
#if defined (TIOCGLTC)
|
||||
/* Make the interrupt keys go away. Just enough to make people happy. */
|
||||
tiop->ltchars.t_dsuspc = -1; /* C-y */
|
||||
tiop->ltchars.t_lnextc = -1; /* C-v */
|
||||
#endif /* TIOCGLTC */
|
||||
}
|
||||
|
||||
#else /* !defined (NEW_TTY_DRIVER) */
|
||||
|
||||
#if !defined (VMIN)
|
||||
# define VMIN VEOF
|
||||
#endif
|
||||
|
||||
#if !defined (VTIME)
|
||||
# define VTIME VEOL
|
||||
#endif
|
||||
|
||||
#if defined (TERMIOS_TTY_DRIVER)
|
||||
# define TIOTYPE struct termios
|
||||
# define DRAIN_OUTPUT(fd) tcdrain (fd)
|
||||
# define GETATTR(tty, tiop) (tcgetattr (tty, tiop))
|
||||
# ifdef M_UNIX
|
||||
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSANOW, tiop))
|
||||
# else
|
||||
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSADRAIN, tiop))
|
||||
# endif /* !M_UNIX */
|
||||
#else
|
||||
# define TIOTYPE struct termio
|
||||
# define DRAIN_OUTPUT(fd)
|
||||
# define GETATTR(tty, tiop) (ioctl (tty, TCGETA, tiop))
|
||||
# define SETATTR(tty, tiop) (ioctl (tty, TCSETAW, tiop))
|
||||
#endif /* !TERMIOS_TTY_DRIVER */
|
||||
|
||||
static TIOTYPE otio;
|
||||
|
||||
static void save_tty_chars PARAMS((TIOTYPE *));
|
||||
static int _get_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int get_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int _set_tty_settings PARAMS((int, TIOTYPE *));
|
||||
static int set_tty_settings PARAMS((int, TIOTYPE *));
|
||||
|
||||
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
|
||||
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
|
||||
static void _rl_bind_tty_special_chars PARAMS((Keymap, TIOTYPE));
|
||||
|
||||
#if defined (FLUSHO)
|
||||
# define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO)
|
||||
#else
|
||||
# define OUTPUT_BEING_FLUSHED(tp) 0
|
||||
#endif
|
||||
|
||||
static void
|
||||
save_tty_chars (tiop)
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
_rl_last_tty_chars = _rl_tty_chars;
|
||||
|
||||
_rl_tty_chars.t_eof = tiop->c_cc[VEOF];
|
||||
_rl_tty_chars.t_eol = tiop->c_cc[VEOL];
|
||||
#ifdef VEOL2
|
||||
_rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
|
||||
#endif
|
||||
_rl_tty_chars.t_erase = tiop->c_cc[VERASE];
|
||||
#ifdef VWERASE
|
||||
_rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
|
||||
#endif
|
||||
_rl_tty_chars.t_kill = tiop->c_cc[VKILL];
|
||||
#ifdef VREPRINT
|
||||
_rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
|
||||
#endif
|
||||
_rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
|
||||
_rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
|
||||
#ifdef VSUSP
|
||||
_rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
|
||||
#endif
|
||||
#ifdef VDSUSP
|
||||
_rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
|
||||
#endif
|
||||
#ifdef VSTART
|
||||
_rl_tty_chars.t_start = tiop->c_cc[VSTART];
|
||||
#endif
|
||||
#ifdef VSTOP
|
||||
_rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
|
||||
#endif
|
||||
#ifdef VLNEXT
|
||||
_rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
|
||||
#endif
|
||||
#ifdef VDISCARD
|
||||
_rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
|
||||
#endif
|
||||
#ifdef VSTATUS
|
||||
_rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (_AIX) || defined (_AIX41)
|
||||
/* Currently this is only used on AIX */
|
||||
static void
|
||||
rltty_warning (msg)
|
||||
char *msg;
|
||||
{
|
||||
_rl_errmsg ("warning: %s", msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (_AIX)
|
||||
void
|
||||
setopost(tp)
|
||||
TIOTYPE *tp;
|
||||
{
|
||||
if ((tp->c_oflag & OPOST) == 0)
|
||||
{
|
||||
_rl_errmsg ("warning: turning on OPOST for terminal\r");
|
||||
tp->c_oflag |= OPOST|ONLCR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
_get_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
int ioctl_ret;
|
||||
|
||||
while (1)
|
||||
{
|
||||
ioctl_ret = GETATTR (tty, tiop);
|
||||
if (ioctl_ret < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
return -1;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (OUTPUT_BEING_FLUSHED (tiop))
|
||||
{
|
||||
#if defined (FLUSHO)
|
||||
_rl_errmsg ("warning: turning off output flushing");
|
||||
tiop->c_lflag &= ~FLUSHO;
|
||||
break;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
set_winsize (tty);
|
||||
|
||||
errno = 0;
|
||||
if (_get_tty_settings (tty, tiop) < 0)
|
||||
return -1;
|
||||
|
||||
#if defined (_AIX)
|
||||
setopost(tiop);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_set_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
while (SETATTR (tty, tiop) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
return -1;
|
||||
errno = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
if (_set_tty_settings (tty, tiop) < 0)
|
||||
return -1;
|
||||
|
||||
#if 0
|
||||
|
||||
#if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
if (ksrflow)
|
||||
{
|
||||
ksrflow = 0;
|
||||
tcflow (tty, TCOON);
|
||||
}
|
||||
# else /* !ksr1 */
|
||||
tcflow (tty, TCOON); /* Simulate a ^Q. */
|
||||
# endif /* !ksr1 */
|
||||
#else
|
||||
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
|
||||
#endif /* !TERMIOS_TTY_DRIVER */
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_terminal_settings (meta_flag, oldtio, tiop)
|
||||
int meta_flag;
|
||||
TIOTYPE oldtio, *tiop;
|
||||
{
|
||||
_rl_echoing_p = (oldtio.c_lflag & ECHO);
|
||||
#if defined (ECHOCTL)
|
||||
_rl_echoctl = (oldtio.c_lflag & ECHOCTL);
|
||||
#endif
|
||||
|
||||
tiop->c_lflag &= ~(ICANON | ECHO);
|
||||
|
||||
if ((unsigned char) oldtio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
|
||||
_rl_eof_char = oldtio.c_cc[VEOF];
|
||||
|
||||
#if defined (USE_XON_XOFF)
|
||||
#if defined (IXANY)
|
||||
tiop->c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
#else
|
||||
/* `strict' Posix systems do not define IXANY. */
|
||||
tiop->c_iflag &= ~(IXON | IXOFF);
|
||||
#endif /* IXANY */
|
||||
#endif /* USE_XON_XOFF */
|
||||
|
||||
/* Only turn this off if we are using all 8 bits. */
|
||||
if (((tiop->c_cflag & CSIZE) == CS8) || meta_flag)
|
||||
tiop->c_iflag &= ~(ISTRIP | INPCK);
|
||||
|
||||
/* Make sure we differentiate between CR and NL on input. */
|
||||
tiop->c_iflag &= ~(ICRNL | INLCR);
|
||||
|
||||
#if !defined (HANDLE_SIGNALS)
|
||||
tiop->c_lflag &= ~ISIG;
|
||||
#else
|
||||
tiop->c_lflag |= ISIG;
|
||||
#endif
|
||||
|
||||
tiop->c_cc[VMIN] = 1;
|
||||
tiop->c_cc[VTIME] = 0;
|
||||
|
||||
#if defined (FLUSHO)
|
||||
if (OUTPUT_BEING_FLUSHED (tiop))
|
||||
{
|
||||
tiop->c_lflag &= ~FLUSHO;
|
||||
oldtio.c_lflag &= ~FLUSHO;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Turn off characters that we need on Posix systems with job control,
|
||||
just to be sure. This includes ^Y and ^V. This should not really
|
||||
be necessary. */
|
||||
#if defined (TERMIOS_TTY_DRIVER) && defined (_POSIX_VDISABLE)
|
||||
|
||||
#if defined (VLNEXT)
|
||||
tiop->c_cc[VLNEXT] = _POSIX_VDISABLE;
|
||||
#endif
|
||||
|
||||
#if defined (VDSUSP)
|
||||
tiop->c_cc[VDSUSP] = _POSIX_VDISABLE;
|
||||
#endif
|
||||
|
||||
#endif /* TERMIOS_TTY_DRIVER && _POSIX_VDISABLE */
|
||||
}
|
||||
#endif /* !NEW_TTY_DRIVER */
|
||||
|
||||
/* Put the terminal in CBREAK mode so that we can detect key presses. */
|
||||
#if defined (NO_TTY_DRIVER)
|
||||
void
|
||||
rl_prep_terminal (meta_flag)
|
||||
int meta_flag;
|
||||
{
|
||||
_rl_echoing_p = 1;
|
||||
}
|
||||
|
||||
void
|
||||
rl_deprep_terminal ()
|
||||
{
|
||||
}
|
||||
|
||||
#else /* ! NO_TTY_DRIVER */
|
||||
void
|
||||
rl_prep_terminal (meta_flag)
|
||||
int meta_flag;
|
||||
{
|
||||
int tty;
|
||||
TIOTYPE tio;
|
||||
|
||||
if (terminal_prepped)
|
||||
return;
|
||||
|
||||
/* Try to keep this function from being INTerrupted. */
|
||||
_rl_block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
if (get_tty_settings (tty, &tio) < 0)
|
||||
{
|
||||
#if defined (ENOTSUP)
|
||||
/* MacOS X and Linux, at least, lie about the value of errno if
|
||||
tcgetattr fails. */
|
||||
if (errno == ENOTTY || errno == EINVAL || errno == ENOTSUP)
|
||||
#else
|
||||
if (errno == ENOTTY || errno == EINVAL)
|
||||
#endif
|
||||
_rl_echoing_p = 1; /* XXX */
|
||||
|
||||
_rl_release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
otio = tio;
|
||||
|
||||
if (_rl_bind_stty_chars)
|
||||
{
|
||||
#if defined (VI_MODE)
|
||||
/* If editing in vi mode, make sure we restore the bindings in the
|
||||
insertion keymap no matter what keymap we ended up in. */
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_tty_unset_default_bindings (vi_insertion_keymap);
|
||||
else
|
||||
#endif
|
||||
rl_tty_unset_default_bindings (_rl_keymap);
|
||||
}
|
||||
save_tty_chars (&otio);
|
||||
RL_SETSTATE(RL_STATE_TTYCSAVED);
|
||||
if (_rl_bind_stty_chars)
|
||||
{
|
||||
#if defined (VI_MODE)
|
||||
/* If editing in vi mode, make sure we set the bindings in the
|
||||
insertion keymap no matter what keymap we ended up in. */
|
||||
if (rl_editing_mode == vi_mode)
|
||||
_rl_bind_tty_special_chars (vi_insertion_keymap, tio);
|
||||
else
|
||||
#endif
|
||||
_rl_bind_tty_special_chars (_rl_keymap, tio);
|
||||
}
|
||||
|
||||
prepare_terminal_settings (meta_flag, otio, &tio);
|
||||
|
||||
if (set_tty_settings (tty, &tio) < 0)
|
||||
{
|
||||
_rl_release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (1);
|
||||
|
||||
fflush (rl_outstream);
|
||||
terminal_prepped = 1;
|
||||
RL_SETSTATE(RL_STATE_TERMPREPPED);
|
||||
|
||||
_rl_release_sigint ();
|
||||
}
|
||||
|
||||
/* Restore the terminal's normal settings and modes. */
|
||||
void
|
||||
rl_deprep_terminal ()
|
||||
{
|
||||
int tty;
|
||||
|
||||
if (!terminal_prepped)
|
||||
return;
|
||||
|
||||
/* Try to keep this function from being interrupted. */
|
||||
_rl_block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (0);
|
||||
|
||||
fflush (rl_outstream);
|
||||
|
||||
if (set_tty_settings (tty, &otio) < 0)
|
||||
{
|
||||
_rl_release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
terminal_prepped = 0;
|
||||
RL_UNSETSTATE(RL_STATE_TERMPREPPED);
|
||||
|
||||
_rl_release_sigint ();
|
||||
}
|
||||
#endif /* !NO_TTY_DRIVER */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Bogus Flow Control */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
rl_restart_output (count, key)
|
||||
int count, key;
|
||||
{
|
||||
#if defined (__MINGW32__)
|
||||
return 0;
|
||||
#else /* !__MING32__ */
|
||||
|
||||
int fildes = fileno (rl_outstream);
|
||||
#if defined (TIOCSTART)
|
||||
#if defined (apollo)
|
||||
ioctl (&fildes, TIOCSTART, 0);
|
||||
#else
|
||||
ioctl (fildes, TIOCSTART, 0);
|
||||
#endif /* apollo */
|
||||
|
||||
#else /* !TIOCSTART */
|
||||
# if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
if (ksrflow)
|
||||
{
|
||||
ksrflow = 0;
|
||||
tcflow (fildes, TCOON);
|
||||
}
|
||||
# else /* !ksr1 */
|
||||
tcflow (fildes, TCOON); /* Simulate a ^Q. */
|
||||
# endif /* !ksr1 */
|
||||
# else /* !TERMIOS_TTY_DRIVER */
|
||||
# if defined (TCXONC)
|
||||
ioctl (fildes, TCXONC, TCOON);
|
||||
# endif /* TCXONC */
|
||||
# endif /* !TERMIOS_TTY_DRIVER */
|
||||
#endif /* !TIOCSTART */
|
||||
|
||||
return 0;
|
||||
#endif /* !__MINGW32__ */
|
||||
}
|
||||
|
||||
int
|
||||
rl_stop_output (count, key)
|
||||
int count, key;
|
||||
{
|
||||
#if defined (__MINGW32__)
|
||||
return 0;
|
||||
#else
|
||||
|
||||
int fildes = fileno (rl_instream);
|
||||
|
||||
#if defined (TIOCSTOP)
|
||||
# if defined (apollo)
|
||||
ioctl (&fildes, TIOCSTOP, 0);
|
||||
# else
|
||||
ioctl (fildes, TIOCSTOP, 0);
|
||||
# endif /* apollo */
|
||||
#else /* !TIOCSTOP */
|
||||
# if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
ksrflow = 1;
|
||||
# endif /* ksr1 */
|
||||
tcflow (fildes, TCOOFF);
|
||||
# else
|
||||
# if defined (TCXONC)
|
||||
ioctl (fildes, TCXONC, TCOON);
|
||||
# endif /* TCXONC */
|
||||
# endif /* !TERMIOS_TTY_DRIVER */
|
||||
#endif /* !TIOCSTOP */
|
||||
|
||||
return 0;
|
||||
#endif /* !__MINGW32__ */
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Default Key Bindings */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if !defined (NO_TTY_DRIVER)
|
||||
#define SET_SPECIAL(sc, func) set_special_char(kmap, &ttybuff, sc, func)
|
||||
#endif
|
||||
|
||||
#if defined (NO_TTY_DRIVER)
|
||||
|
||||
#define SET_SPECIAL(sc, func)
|
||||
#define RESET_SPECIAL(c)
|
||||
|
||||
#elif defined (NEW_TTY_DRIVER)
|
||||
static void
|
||||
set_special_char (kmap, tiop, sc, func)
|
||||
Keymap kmap;
|
||||
TIOTYPE *tiop;
|
||||
int sc;
|
||||
rl_command_func_t *func;
|
||||
{
|
||||
if (sc != -1 && kmap[(unsigned char)sc].type == ISFUNC)
|
||||
kmap[(unsigned char)sc].function = func;
|
||||
}
|
||||
|
||||
#define RESET_SPECIAL(c) \
|
||||
if (c != -1 && kmap[(unsigned char)c].type == ISFUNC) \
|
||||
kmap[(unsigned char)c].function = rl_insert;
|
||||
|
||||
static void
|
||||
_rl_bind_tty_special_chars (kmap, ttybuff)
|
||||
Keymap kmap;
|
||||
TIOTYPE ttybuff;
|
||||
{
|
||||
if (ttybuff.flags & SGTTY_SET)
|
||||
{
|
||||
SET_SPECIAL (ttybuff.sgttyb.sg_erase, rl_rubout);
|
||||
SET_SPECIAL (ttybuff.sgttyb.sg_kill, rl_unix_line_discard);
|
||||
}
|
||||
|
||||
# if defined (TIOCGLTC)
|
||||
if (ttybuff.flags & LTCHARS_SET)
|
||||
{
|
||||
SET_SPECIAL (ttybuff.ltchars.t_werasc, rl_unix_word_rubout);
|
||||
SET_SPECIAL (ttybuff.ltchars.t_lnextc, rl_quoted_insert);
|
||||
}
|
||||
# endif /* TIOCGLTC */
|
||||
}
|
||||
|
||||
#else /* !NEW_TTY_DRIVER */
|
||||
static void
|
||||
set_special_char (kmap, tiop, sc, func)
|
||||
Keymap kmap;
|
||||
TIOTYPE *tiop;
|
||||
int sc;
|
||||
rl_command_func_t *func;
|
||||
{
|
||||
unsigned char uc;
|
||||
|
||||
uc = tiop->c_cc[sc];
|
||||
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC)
|
||||
kmap[uc].function = func;
|
||||
}
|
||||
|
||||
/* used later */
|
||||
#define RESET_SPECIAL(uc) \
|
||||
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \
|
||||
kmap[uc].function = rl_insert;
|
||||
|
||||
static void
|
||||
_rl_bind_tty_special_chars (kmap, ttybuff)
|
||||
Keymap kmap;
|
||||
TIOTYPE ttybuff;
|
||||
{
|
||||
SET_SPECIAL (VERASE, rl_rubout);
|
||||
SET_SPECIAL (VKILL, rl_unix_line_discard);
|
||||
|
||||
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
|
||||
SET_SPECIAL (VLNEXT, rl_quoted_insert);
|
||||
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
|
||||
|
||||
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
|
||||
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
|
||||
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
|
||||
}
|
||||
|
||||
#endif /* !NEW_TTY_DRIVER */
|
||||
|
||||
/* Set the system's default editing characters to their readline equivalents
|
||||
in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */
|
||||
void
|
||||
rltty_set_default_bindings (kmap)
|
||||
Keymap kmap;
|
||||
{
|
||||
#if !defined (NO_TTY_DRIVER)
|
||||
TIOTYPE ttybuff;
|
||||
int tty;
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
if (get_tty_settings (tty, &ttybuff) == 0)
|
||||
_rl_bind_tty_special_chars (kmap, ttybuff);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* New public way to set the system default editing chars to their readline
|
||||
equivalents. */
|
||||
void
|
||||
rl_tty_set_default_bindings (kmap)
|
||||
Keymap kmap;
|
||||
{
|
||||
rltty_set_default_bindings (kmap);
|
||||
}
|
||||
|
||||
/* Rebind all of the tty special chars that readline worries about back
|
||||
to self-insert. Call this before saving the current terminal special
|
||||
chars with save_tty_chars(). This only works on POSIX termios or termio
|
||||
systems. */
|
||||
void
|
||||
rl_tty_unset_default_bindings (kmap)
|
||||
Keymap kmap;
|
||||
{
|
||||
/* Don't bother before we've saved the tty special chars at least once. */
|
||||
if (RL_ISSTATE(RL_STATE_TTYCSAVED) == 0)
|
||||
return;
|
||||
|
||||
RESET_SPECIAL (_rl_tty_chars.t_erase);
|
||||
RESET_SPECIAL (_rl_tty_chars.t_kill);
|
||||
|
||||
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
|
||||
RESET_SPECIAL (_rl_tty_chars.t_lnext);
|
||||
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
|
||||
|
||||
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
|
||||
RESET_SPECIAL (_rl_tty_chars.t_werase);
|
||||
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
|
||||
}
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
|
||||
#if defined (NEW_TTY_DRIVER) || defined (NO_TTY_DRIVER)
|
||||
int
|
||||
_rl_disable_tty_signals ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_restore_tty_signals ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
static TIOTYPE sigstty, nosigstty;
|
||||
static int tty_sigs_disabled = 0;
|
||||
|
||||
int
|
||||
_rl_disable_tty_signals ()
|
||||
{
|
||||
if (tty_sigs_disabled)
|
||||
return 0;
|
||||
|
||||
if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
|
||||
return -1;
|
||||
|
||||
nosigstty = sigstty;
|
||||
|
||||
nosigstty.c_lflag &= ~ISIG;
|
||||
nosigstty.c_iflag &= ~IXON;
|
||||
|
||||
if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
|
||||
return (_set_tty_settings (fileno (rl_instream), &sigstty));
|
||||
|
||||
tty_sigs_disabled = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_restore_tty_signals ()
|
||||
{
|
||||
int r;
|
||||
|
||||
if (tty_sigs_disabled == 0)
|
||||
return 0;
|
||||
|
||||
r = _set_tty_settings (fileno (rl_instream), &sigstty);
|
||||
|
||||
if (r == 0)
|
||||
tty_sigs_disabled = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif /* !NEW_TTY_DRIVER */
|
||||
|
||||
#endif /* HANDLE_SIGNALS */
|
||||
@@ -33,5 +33,9 @@ char *
|
||||
savestring (s)
|
||||
const char *s;
|
||||
{
|
||||
return ((char *)strcpy ((char *)xmalloc (1 + strlen (s)), (s)));
|
||||
char *ret;
|
||||
|
||||
ret = (char *)xmalloc (strlen (s) + 1);
|
||||
strcpy (ret, s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* savestring.c - function version of savestring for backwards compatibility */
|
||||
|
||||
/* Copyright (C) 1998,2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
Readline 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.
|
||||
|
||||
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#include <config.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* Backwards compatibility, now that savestring has been removed from
|
||||
all `public' readline header files. */
|
||||
char *
|
||||
savestring (s)
|
||||
const char *s;
|
||||
{
|
||||
return ((char *)strcpy ((char *)xmalloc (1 + strlen (s)), (s)));
|
||||
}
|
||||
@@ -111,6 +111,13 @@ sh_modcase (string, pat, flags)
|
||||
mbstate_t state;
|
||||
#endif
|
||||
|
||||
if (string == 0 || *string == 0)
|
||||
{
|
||||
ret = (char *)xmalloc (1);
|
||||
ret[0] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
memset (&state, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/* casemod.c -- functions to change case of strings */
|
||||
|
||||
/* Copyright (C) 2008,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/>.
|
||||
*/
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
#include <bashansi.h>
|
||||
#include <bashintl.h>
|
||||
#include <bashtypes.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <xmalloc.h>
|
||||
|
||||
#include <shmbutil.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
#include <glob/strmatch.h>
|
||||
|
||||
#define _to_wupper(wc) (iswlower (wc) ? towupper (wc) : (wc))
|
||||
#define _to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
|
||||
|
||||
#if !defined (HANDLE_MULTIBYTE)
|
||||
# define cval(s, i) ((s)[(i)])
|
||||
# define iswalnum(c) (isalnum(c))
|
||||
# define TOGGLE(x) (ISUPPER (x) ? tolower (x) : (TOUPPER (x)))
|
||||
#else
|
||||
# define TOGGLE(x) (iswupper (x) ? towlower (x) : (_to_wupper(x)))
|
||||
#endif
|
||||
|
||||
/* These must agree with the defines in externs.h */
|
||||
#define CASE_NOOP 0x0000
|
||||
#define CASE_LOWER 0x0001
|
||||
#define CASE_UPPER 0x0002
|
||||
#define CASE_CAPITALIZE 0x0004
|
||||
#define CASE_UNCAP 0x0008
|
||||
#define CASE_TOGGLE 0x0010
|
||||
#define CASE_TOGGLEALL 0x0020
|
||||
#define CASE_UPFIRST 0x0040
|
||||
#define CASE_LOWFIRST 0x0080
|
||||
|
||||
#define CASE_USEWORDS 0x1000 /* modify behavior to act on words in passed string */
|
||||
|
||||
extern char *substring __P((char *, int, int));
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
static wchar_t
|
||||
cval (s, i)
|
||||
char *s;
|
||||
int i;
|
||||
{
|
||||
size_t tmp;
|
||||
wchar_t wc;
|
||||
int l;
|
||||
mbstate_t mps;
|
||||
|
||||
if (MB_CUR_MAX == 1)
|
||||
return ((wchar_t)s[i]);
|
||||
l = strlen (s);
|
||||
if (i >= (l - 1))
|
||||
return ((wchar_t)s[i]);
|
||||
memset (&mps, 0, sizeof (mbstate_t));
|
||||
tmp = mbrtowc (&wc, s + i, l - i, &mps);
|
||||
if (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp))
|
||||
return ((wchar_t)s[i]);
|
||||
return wc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Modify the case of characters in STRING matching PAT based on the value of
|
||||
FLAGS. If PAT is null, modify the case of each character */
|
||||
char *
|
||||
sh_modcase (string, pat, flags)
|
||||
const char *string;
|
||||
char *pat;
|
||||
int flags;
|
||||
{
|
||||
int start, next, end;
|
||||
int inword, c, nc, nop, match, usewords;
|
||||
char *ret, *s;
|
||||
wchar_t wc;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
wchar_t nwc;
|
||||
char mb[MB_LEN_MAX+1];
|
||||
int mlen;
|
||||
size_t m;
|
||||
mbstate_t state;
|
||||
#endif
|
||||
|
||||
if (string == 0 || *string == 0)
|
||||
{
|
||||
#if 0
|
||||
ret = (char *)xmalloc (1);
|
||||
ret[0] = '\0';
|
||||
return ret;
|
||||
#else
|
||||
extern char *savestring();
|
||||
return (char *)savestring ("");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
memset (&state, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
start = 0;
|
||||
end = strlen (string);
|
||||
|
||||
ret = (char *)xmalloc (end + 1);
|
||||
strcpy (ret, string);
|
||||
|
||||
/* See if we are supposed to split on alphanumerics and operate on each word */
|
||||
usewords = (flags & CASE_USEWORDS);
|
||||
flags &= ~CASE_USEWORDS;
|
||||
|
||||
inword = 0;
|
||||
while (start < end)
|
||||
{
|
||||
wc = cval (ret, start);
|
||||
|
||||
if (iswalnum (wc) == 0)
|
||||
{
|
||||
inword = 0;
|
||||
ADVANCE_CHAR (ret, end, start);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pat)
|
||||
{
|
||||
next = start;
|
||||
ADVANCE_CHAR (ret, end, next);
|
||||
s = substring (ret, start, next);
|
||||
match = strmatch (pat, s, FNM_EXTMATCH) != FNM_NOMATCH;
|
||||
free (s);
|
||||
if (match == 0)
|
||||
{
|
||||
start = next;
|
||||
inword = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX - for now, the toggling operators work on the individual
|
||||
words in the string, breaking on alphanumerics. Should I
|
||||
leave the capitalization operators to do that also? */
|
||||
if (flags == CASE_CAPITALIZE)
|
||||
{
|
||||
if (usewords)
|
||||
nop = inword ? CASE_LOWER : CASE_UPPER;
|
||||
else
|
||||
nop = (start > 0) ? CASE_LOWER : CASE_UPPER;
|
||||
inword = 1;
|
||||
}
|
||||
else if (flags == CASE_UNCAP)
|
||||
{
|
||||
if (usewords)
|
||||
nop = inword ? CASE_UPPER : CASE_LOWER;
|
||||
else
|
||||
nop = (start > 0) ? CASE_UPPER : CASE_LOWER;
|
||||
inword = 1;
|
||||
}
|
||||
else if (flags == CASE_UPFIRST)
|
||||
{
|
||||
if (usewords)
|
||||
nop = inword ? CASE_NOOP : CASE_UPPER;
|
||||
else
|
||||
nop = (start > 0) ? CASE_NOOP : CASE_UPPER;
|
||||
inword = 1;
|
||||
}
|
||||
else if (flags == CASE_LOWFIRST)
|
||||
{
|
||||
if (usewords)
|
||||
nop = inword ? CASE_NOOP : CASE_LOWER;
|
||||
else
|
||||
nop = (start > 0) ? CASE_NOOP : CASE_LOWER;
|
||||
inword = 1;
|
||||
}
|
||||
else if (flags == CASE_TOGGLE)
|
||||
{
|
||||
nop = inword ? CASE_NOOP : CASE_TOGGLE;
|
||||
inword = 1;
|
||||
}
|
||||
else
|
||||
nop = flags;
|
||||
|
||||
if (MB_CUR_MAX == 1 || isascii (wc))
|
||||
{
|
||||
switch (nop)
|
||||
{
|
||||
default:
|
||||
case CASE_NOOP: nc = wc; break;
|
||||
case CASE_UPPER: nc = TOUPPER (wc); break;
|
||||
case CASE_LOWER: nc = TOLOWER (wc); break;
|
||||
case CASE_TOGGLEALL:
|
||||
case CASE_TOGGLE: nc = TOGGLE (wc); break;
|
||||
}
|
||||
ret[start] = nc;
|
||||
}
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
else
|
||||
{
|
||||
m = mbrtowc (&wc, string + start, end - start, &state);
|
||||
if (MB_INVALIDCH (m))
|
||||
wc = (wchar_t)string[start];
|
||||
else if (MB_NULLWCH (m))
|
||||
wc = L'\0';
|
||||
switch (nop)
|
||||
{
|
||||
default:
|
||||
case CASE_NOOP: nwc = wc; break;
|
||||
case CASE_UPPER: nwc = TOUPPER (wc); break;
|
||||
case CASE_LOWER: nwc = TOLOWER (wc); break;
|
||||
case CASE_TOGGLEALL:
|
||||
case CASE_TOGGLE: nwc = TOGGLE (wc); break;
|
||||
}
|
||||
if (nwc != wc) /* just skip unchanged characters */
|
||||
{
|
||||
mlen = wcrtomb (mb, nwc, &state);
|
||||
if (mlen > 0)
|
||||
mb[mlen] = '\0';
|
||||
/* Assume the same width */
|
||||
strncpy (ret + start, mb, mlen);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This assumes that the upper and lower case versions are the same width. */
|
||||
ADVANCE_CHAR (ret, end, start);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -5875,6 +5875,8 @@ save_parser_state (ps)
|
||||
ps->input_line_terminator = shell_input_line_terminator;
|
||||
ps->eof_encountered = eof_encountered;
|
||||
|
||||
ps->prompt_string_pointer = prompt_string_pointer;
|
||||
|
||||
ps->current_command_line_count = current_command_line_count;
|
||||
|
||||
#if defined (HISTORY)
|
||||
@@ -5915,6 +5917,8 @@ restore_parser_state (ps)
|
||||
shell_input_line_terminator = ps->input_line_terminator;
|
||||
eof_encountered = ps->eof_encountered;
|
||||
|
||||
prompt_string_pointer = ps->prompt_string_pointer;
|
||||
|
||||
current_command_line_count = ps->current_command_line_count;
|
||||
|
||||
#if defined (HISTORY)
|
||||
|
||||
@@ -2658,10 +2658,13 @@ static int
|
||||
time_command_acceptable ()
|
||||
{
|
||||
#if defined (COMMAND_TIMING)
|
||||
int c, i;
|
||||
int i;
|
||||
|
||||
if (posixly_correct && shell_compatibility_level > 41)
|
||||
{
|
||||
/* Quick check of the rest of the line to find the next token. If it
|
||||
begins with a `-', Posix says to not return `time' as the token.
|
||||
This was interp 267. */
|
||||
i = shell_input_line_index;
|
||||
while (i < shell_input_line_len && (shell_input_line[i] == ' ' || shell_input_line[i] == '\t'))
|
||||
i++;
|
||||
@@ -3552,7 +3555,7 @@ eof_error:
|
||||
}
|
||||
|
||||
/* Skip whitespace */
|
||||
if MBTEST(shellblank (ch) && lex_rwlen == 0)
|
||||
if MBTEST(shellblank (ch) && (tflags & LEX_HEREDELIM) == 0 && lex_rwlen == 0)
|
||||
{
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
@@ -4798,6 +4801,8 @@ reserved_word_acceptable (toksym)
|
||||
if (last_read_token == WORD && token_before_that == COPROC)
|
||||
return 1;
|
||||
#endif
|
||||
if (last_read_token == WORD && token_before_that == FUNCTION)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -4948,6 +4953,7 @@ prompt_again ()
|
||||
{
|
||||
char *temp_prompt;
|
||||
|
||||
itrace("prompt_again()");
|
||||
if (interactive == 0 || expanding_alias ()) /* XXX */
|
||||
return;
|
||||
|
||||
@@ -4982,6 +4988,7 @@ prompt_again ()
|
||||
FREE (current_decoded_prompt);
|
||||
current_decoded_prompt = temp_prompt;
|
||||
}
|
||||
itrace("prompt_again: current_prompt_string = %s", current_prompt_string);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -5870,6 +5877,8 @@ save_parser_state (ps)
|
||||
ps->input_line_terminator = shell_input_line_terminator;
|
||||
ps->eof_encountered = eof_encountered;
|
||||
|
||||
ps->prompt_string_pointer = prompt_string_pointer;
|
||||
|
||||
ps->current_command_line_count = current_command_line_count;
|
||||
|
||||
#if defined (HISTORY)
|
||||
@@ -5910,6 +5919,8 @@ restore_parser_state (ps)
|
||||
shell_input_line_terminator = ps->input_line_terminator;
|
||||
eof_encountered = ps->eof_encountered;
|
||||
|
||||
prompt_string_pointer = ps->prompt_string_pointer;
|
||||
|
||||
current_command_line_count = ps->current_command_line_count;
|
||||
|
||||
#if defined (HISTORY)
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
static int glob_name_is_acceptable __P((const char *));
|
||||
static void ignore_globbed_names __P((char **, sh_ignore_func_t *));
|
||||
static char *split_ignorespec __P((char *, int *));
|
||||
|
||||
#if defined (USE_POSIX_GLOB_LIBRARY)
|
||||
# include <glob.h>
|
||||
@@ -428,6 +429,30 @@ ignore_glob_matches (names)
|
||||
ignore_globbed_names (names, glob_name_is_acceptable);
|
||||
}
|
||||
|
||||
static char *
|
||||
split_ignorespec (s, ip)
|
||||
char *s;
|
||||
int *ip;
|
||||
{
|
||||
char *t;
|
||||
int n, i;
|
||||
|
||||
if (s == 0)
|
||||
return 0;
|
||||
|
||||
i = *ip;
|
||||
if (s[i] == 0)
|
||||
return 0;
|
||||
|
||||
n = skip_to_delim (s, i, ":", SD_NOJMP|SD_EXTGLOB);
|
||||
t = substring (s, i, n);
|
||||
|
||||
if (s[n] == ':')
|
||||
n++;
|
||||
*ip = n;
|
||||
return t;
|
||||
}
|
||||
|
||||
void
|
||||
setup_ignore_patterns (ivp)
|
||||
struct ignorevar *ivp;
|
||||
@@ -467,7 +492,11 @@ setup_ignore_patterns (ivp)
|
||||
|
||||
numitems = maxitems = ptr = 0;
|
||||
|
||||
#if 0
|
||||
while (colon_bit = extract_colon_unit (this_ignoreval, &ptr))
|
||||
#else
|
||||
while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
|
||||
#endif
|
||||
{
|
||||
if (numitems + 1 >= maxitems)
|
||||
{
|
||||
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
/* pathexp.c -- The shell interface to the globbing library. */
|
||||
|
||||
/* Copyright (C) 1995-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"
|
||||
|
||||
#include "bashtypes.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
|
||||
#include "shell.h"
|
||||
#include "pathexp.h"
|
||||
#include "flags.h"
|
||||
|
||||
#include "shmbutil.h"
|
||||
#include "bashintl.h"
|
||||
|
||||
#include <glob/strmatch.h>
|
||||
|
||||
static int glob_name_is_acceptable __P((const char *));
|
||||
static void ignore_globbed_names __P((char **, sh_ignore_func_t *));
|
||||
|
||||
#if defined (USE_POSIX_GLOB_LIBRARY)
|
||||
# include <glob.h>
|
||||
typedef int posix_glob_errfunc_t __P((const char *, int));
|
||||
#else
|
||||
# include <glob/glob.h>
|
||||
#endif
|
||||
|
||||
/* Control whether * matches .files in globbing. */
|
||||
int glob_dot_filenames;
|
||||
|
||||
/* Control whether the extended globbing features are enabled. */
|
||||
int extended_glob = EXTGLOB_DEFAULT;
|
||||
|
||||
/* Control enabling special handling of `**' */
|
||||
int glob_star = 0;
|
||||
|
||||
/* Return nonzero if STRING has any unquoted special globbing chars in it. */
|
||||
int
|
||||
unquoted_glob_pattern_p (string)
|
||||
register char *string;
|
||||
{
|
||||
register int c;
|
||||
char *send;
|
||||
int open;
|
||||
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
open = 0;
|
||||
send = string + strlen (string);
|
||||
|
||||
while (c = *string++)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
case '*':
|
||||
return (1);
|
||||
|
||||
case '[':
|
||||
open++;
|
||||
continue;
|
||||
|
||||
case ']':
|
||||
if (open)
|
||||
return (1);
|
||||
continue;
|
||||
|
||||
case '+':
|
||||
case '@':
|
||||
case '!':
|
||||
if (*string == '(') /*)*/
|
||||
return (1);
|
||||
continue;
|
||||
|
||||
case CTLESC:
|
||||
case '\\':
|
||||
if (*string++ == '\0')
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Advance one fewer byte than an entire multibyte character to
|
||||
account for the auto-increment in the loop above. */
|
||||
#ifdef HANDLE_MULTIBYTE
|
||||
string--;
|
||||
ADVANCE_CHAR_P (string, send - string);
|
||||
string++;
|
||||
#else
|
||||
ADVANCE_CHAR_P (string, send - string);
|
||||
#endif
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Return 1 if C is a character that is `special' in a POSIX ERE and needs to
|
||||
be quoted to match itself. */
|
||||
static inline int
|
||||
ere_char (c)
|
||||
int c;
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '.':
|
||||
case '[':
|
||||
case '\\':
|
||||
case '(':
|
||||
case ')':
|
||||
case '*':
|
||||
case '+':
|
||||
case '?':
|
||||
case '{':
|
||||
case '|':
|
||||
case '^':
|
||||
case '$':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
glob_char_p (s)
|
||||
const char *s;
|
||||
{
|
||||
switch (*s)
|
||||
{
|
||||
case '*':
|
||||
case '[':
|
||||
case ']':
|
||||
case '?':
|
||||
case '\\':
|
||||
return 1;
|
||||
case '+':
|
||||
case '@':
|
||||
case '!':
|
||||
if (s[1] == '(') /*(*/
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PATHNAME can contain characters prefixed by CTLESC; this indicates
|
||||
that the character is to be quoted. We quote it here in the style
|
||||
that the glob library recognizes. If flags includes QGLOB_CVTNULL,
|
||||
we change quoted null strings (pathname[0] == CTLNUL) into empty
|
||||
strings (pathname[0] == 0). If this is called after quote removal
|
||||
is performed, (flags & QGLOB_CVTNULL) should be 0; if called when quote
|
||||
removal has not been done (for example, before attempting to match a
|
||||
pattern while executing a case statement), flags should include
|
||||
QGLOB_CVTNULL. If flags includes QGLOB_FILENAME, appropriate quoting
|
||||
to match a filename should be performed. */
|
||||
char *
|
||||
quote_string_for_globbing (pathname, qflags)
|
||||
const char *pathname;
|
||||
int qflags;
|
||||
{
|
||||
char *temp;
|
||||
register int i, j;
|
||||
|
||||
temp = (char *)xmalloc (strlen (pathname) + 1);
|
||||
|
||||
if ((qflags & QGLOB_CVTNULL) && QUOTED_NULL (pathname))
|
||||
{
|
||||
temp[0] = '\0';
|
||||
return temp;
|
||||
}
|
||||
|
||||
for (i = j = 0; pathname[i]; i++)
|
||||
{
|
||||
if (pathname[i] == CTLESC)
|
||||
{
|
||||
if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
|
||||
continue;
|
||||
if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
|
||||
continue;
|
||||
temp[j++] = '\\';
|
||||
i++;
|
||||
if (pathname[i] == '\0')
|
||||
break;
|
||||
}
|
||||
else if (pathname[i] == '\\')
|
||||
{
|
||||
temp[j++] = '\\';
|
||||
i++;
|
||||
if (pathname[i] == '\0')
|
||||
break;
|
||||
}
|
||||
temp[j++] = pathname[i];
|
||||
}
|
||||
temp[j] = '\0';
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
char *
|
||||
quote_globbing_chars (string)
|
||||
char *string;
|
||||
{
|
||||
size_t slen;
|
||||
char *temp, *s, *t, *send;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
slen = strlen (string);
|
||||
send = string + slen;
|
||||
|
||||
temp = (char *)xmalloc (slen * 2 + 1);
|
||||
for (t = temp, s = string; *s; )
|
||||
{
|
||||
if (glob_char_p (s))
|
||||
*t++ = '\\';
|
||||
|
||||
/* Copy a single (possibly multibyte) character from s to t,
|
||||
incrementing both. */
|
||||
COPY_CHAR_P (t, s, send);
|
||||
}
|
||||
*t = '\0';
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* Call the glob library to do globbing on PATHNAME. */
|
||||
char **
|
||||
shell_glob_filename (pathname)
|
||||
const char *pathname;
|
||||
{
|
||||
#if defined (USE_POSIX_GLOB_LIBRARY)
|
||||
register int i;
|
||||
char *temp, **results;
|
||||
glob_t filenames;
|
||||
int glob_flags;
|
||||
|
||||
temp = quote_string_for_globbing (pathname, QGLOB_FILENAME);
|
||||
|
||||
filenames.gl_offs = 0;
|
||||
|
||||
# if defined (GLOB_PERIOD)
|
||||
glob_flags = glob_dot_filenames ? GLOB_PERIOD : 0;
|
||||
# else
|
||||
glob_flags = 0;
|
||||
# endif /* !GLOB_PERIOD */
|
||||
|
||||
glob_flags |= (GLOB_ERR | GLOB_DOOFFS);
|
||||
|
||||
i = glob (temp, glob_flags, (posix_glob_errfunc_t *)NULL, &filenames);
|
||||
|
||||
free (temp);
|
||||
|
||||
if (i == GLOB_NOSPACE || i == GLOB_ABORTED)
|
||||
return ((char **)NULL);
|
||||
else if (i == GLOB_NOMATCH)
|
||||
filenames.gl_pathv = (char **)NULL;
|
||||
else if (i != 0) /* other error codes not in POSIX.2 */
|
||||
filenames.gl_pathv = (char **)NULL;
|
||||
|
||||
results = filenames.gl_pathv;
|
||||
|
||||
if (results && ((GLOB_FAILED (results)) == 0))
|
||||
{
|
||||
if (should_ignore_glob_matches ())
|
||||
ignore_glob_matches (results);
|
||||
if (results && results[0])
|
||||
strvec_sort (results);
|
||||
else
|
||||
{
|
||||
FREE (results);
|
||||
results = (char **)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (results);
|
||||
|
||||
#else /* !USE_POSIX_GLOB_LIBRARY */
|
||||
|
||||
char *temp, **results;
|
||||
|
||||
noglob_dot_filenames = glob_dot_filenames == 0;
|
||||
|
||||
temp = quote_string_for_globbing (pathname, QGLOB_FILENAME);
|
||||
results = glob_filename (temp, glob_star ? GX_GLOBSTAR : 0);
|
||||
free (temp);
|
||||
|
||||
if (results && ((GLOB_FAILED (results)) == 0))
|
||||
{
|
||||
if (should_ignore_glob_matches ())
|
||||
ignore_glob_matches (results);
|
||||
if (results && results[0])
|
||||
strvec_sort (results);
|
||||
else
|
||||
{
|
||||
FREE (results);
|
||||
results = (char **)&glob_error_return;
|
||||
}
|
||||
}
|
||||
|
||||
return (results);
|
||||
#endif /* !USE_POSIX_GLOB_LIBRARY */
|
||||
}
|
||||
|
||||
/* Stuff for GLOBIGNORE. */
|
||||
|
||||
static struct ignorevar globignore =
|
||||
{
|
||||
"GLOBIGNORE",
|
||||
(struct ign *)0,
|
||||
0,
|
||||
(char *)0,
|
||||
(sh_iv_item_func_t *)0,
|
||||
};
|
||||
|
||||
/* Set up to ignore some glob matches because the value of GLOBIGNORE
|
||||
has changed. If GLOBIGNORE is being unset, we also need to disable
|
||||
the globbing of filenames beginning with a `.'. */
|
||||
void
|
||||
setup_glob_ignore (name)
|
||||
char *name;
|
||||
{
|
||||
char *v;
|
||||
|
||||
v = get_string_value (name);
|
||||
setup_ignore_patterns (&globignore);
|
||||
|
||||
if (globignore.num_ignores)
|
||||
glob_dot_filenames = 1;
|
||||
else if (v == 0)
|
||||
glob_dot_filenames = 0;
|
||||
}
|
||||
|
||||
int
|
||||
should_ignore_glob_matches ()
|
||||
{
|
||||
return globignore.num_ignores;
|
||||
}
|
||||
|
||||
/* Return 0 if NAME matches a pattern in the globignore.ignores list. */
|
||||
static int
|
||||
glob_name_is_acceptable (name)
|
||||
const char *name;
|
||||
{
|
||||
struct ign *p;
|
||||
int flags;
|
||||
|
||||
/* . and .. are never matched */
|
||||
if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
|
||||
return (0);
|
||||
|
||||
flags = FNM_PATHNAME | FNMATCH_EXTFLAG;
|
||||
for (p = globignore.ignores; p->val; p++)
|
||||
{
|
||||
if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH)
|
||||
return (0);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Internal function to test whether filenames in NAMES should be
|
||||
ignored. NAME_FUNC is a pointer to a function to call with each
|
||||
name. It returns non-zero if the name is acceptable to the particular
|
||||
ignore function which called _ignore_names; zero if the name should
|
||||
be removed from NAMES. */
|
||||
|
||||
static void
|
||||
ignore_globbed_names (names, name_func)
|
||||
char **names;
|
||||
sh_ignore_func_t *name_func;
|
||||
{
|
||||
char **newnames;
|
||||
int n, i;
|
||||
|
||||
for (i = 0; names[i]; i++)
|
||||
;
|
||||
newnames = strvec_create (i + 1);
|
||||
|
||||
for (n = i = 0; names[i]; i++)
|
||||
{
|
||||
if ((*name_func) (names[i]))
|
||||
newnames[n++] = names[i];
|
||||
else
|
||||
free (names[i]);
|
||||
}
|
||||
|
||||
newnames[n] = (char *)NULL;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
names[0] = (char *)NULL;
|
||||
free (newnames);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy the acceptable names from NEWNAMES back to NAMES and set the
|
||||
new array end. */
|
||||
for (n = 0; newnames[n]; n++)
|
||||
names[n] = newnames[n];
|
||||
names[n] = (char *)NULL;
|
||||
free (newnames);
|
||||
}
|
||||
|
||||
void
|
||||
ignore_glob_matches (names)
|
||||
char **names;
|
||||
{
|
||||
if (globignore.num_ignores == 0)
|
||||
return;
|
||||
|
||||
ignore_globbed_names (names, glob_name_is_acceptable);
|
||||
}
|
||||
|
||||
static char *
|
||||
split_ignorespec (s, ip)
|
||||
char *s;
|
||||
int *ip;
|
||||
{
|
||||
char *t;
|
||||
int n, i;
|
||||
|
||||
i = *ip;
|
||||
if (s[i] == 0)
|
||||
return 0;
|
||||
|
||||
n = skip_to_delim (s, i, ":", SD_NOJMP|SD_EXTGLOB);
|
||||
t = substring (s, i, n);
|
||||
|
||||
if (s[n] == ':')
|
||||
n++;
|
||||
*ip = n;
|
||||
return t;
|
||||
}
|
||||
|
||||
void
|
||||
setup_ignore_patterns (ivp)
|
||||
struct ignorevar *ivp;
|
||||
{
|
||||
int numitems, maxitems, ptr;
|
||||
char *colon_bit, *this_ignoreval;
|
||||
struct ign *p;
|
||||
|
||||
this_ignoreval = get_string_value (ivp->varname);
|
||||
|
||||
/* If nothing has changed then just exit now. */
|
||||
if ((this_ignoreval && ivp->last_ignoreval && STREQ (this_ignoreval, ivp->last_ignoreval)) ||
|
||||
(!this_ignoreval && !ivp->last_ignoreval))
|
||||
return;
|
||||
|
||||
/* Oops. The ignore variable has changed. Re-parse it. */
|
||||
ivp->num_ignores = 0;
|
||||
|
||||
if (ivp->ignores)
|
||||
{
|
||||
for (p = ivp->ignores; p->val; p++)
|
||||
free(p->val);
|
||||
free (ivp->ignores);
|
||||
ivp->ignores = (struct ign *)NULL;
|
||||
}
|
||||
|
||||
if (ivp->last_ignoreval)
|
||||
{
|
||||
free (ivp->last_ignoreval);
|
||||
ivp->last_ignoreval = (char *)NULL;
|
||||
}
|
||||
|
||||
if (this_ignoreval == 0 || *this_ignoreval == '\0')
|
||||
return;
|
||||
|
||||
ivp->last_ignoreval = savestring (this_ignoreval);
|
||||
|
||||
numitems = maxitems = ptr = 0;
|
||||
|
||||
#if 0
|
||||
while (colon_bit = extract_colon_unit (this_ignoreval, &ptr))
|
||||
#else
|
||||
while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
|
||||
#endif
|
||||
{
|
||||
if (numitems + 1 >= maxitems)
|
||||
{
|
||||
maxitems += 10;
|
||||
ivp->ignores = (struct ign *)xrealloc (ivp->ignores, maxitems * sizeof (struct ign));
|
||||
}
|
||||
ivp->ignores[numitems].val = colon_bit;
|
||||
ivp->ignores[numitems].len = strlen (colon_bit);
|
||||
ivp->ignores[numitems].flags = 0;
|
||||
if (ivp->item_func)
|
||||
(*ivp->item_func) (&ivp->ignores[numitems]);
|
||||
numitems++;
|
||||
}
|
||||
ivp->ignores[numitems].val = (char *)NULL;
|
||||
ivp->num_ignores = numitems;
|
||||
}
|
||||
@@ -142,6 +142,8 @@ typedef struct _sh_parser_state_t {
|
||||
/* Nothing right now for multibyte state, but might want something later. */
|
||||
#endif
|
||||
|
||||
char **prompt_string_pointer;
|
||||
|
||||
/* history state affecting or modified by the parser */
|
||||
int current_command_line_count;
|
||||
#if defined (HISTORY)
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
/* shell.h -- The data structures used by the shell */
|
||||
|
||||
/* Copyright (C) 1993-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/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "bashjmp.h"
|
||||
|
||||
#include "command.h"
|
||||
#include "syntax.h"
|
||||
#include "general.h"
|
||||
#include "error.h"
|
||||
#include "variables.h"
|
||||
#include "arrayfunc.h"
|
||||
#include "quit.h"
|
||||
#include "maxpath.h"
|
||||
#include "unwind_prot.h"
|
||||
#include "dispose_cmd.h"
|
||||
#include "make_cmd.h"
|
||||
#include "ocache.h"
|
||||
#include "subst.h"
|
||||
#include "sig.h"
|
||||
#include "pathnames.h"
|
||||
#include "externs.h"
|
||||
|
||||
extern int EOF_Reached;
|
||||
|
||||
#define NO_PIPE -1
|
||||
#define REDIRECT_BOTH -2
|
||||
|
||||
#define NO_VARIABLE -1
|
||||
|
||||
/* Values that can be returned by execute_command (). */
|
||||
#define EXECUTION_FAILURE 1
|
||||
#define EXECUTION_SUCCESS 0
|
||||
|
||||
/* Usage messages by builtins result in a return status of 2. */
|
||||
#define EX_BADUSAGE 2
|
||||
|
||||
/* Special exit statuses used by the shell, internally and externally. */
|
||||
#define EX_RETRYFAIL 124
|
||||
#define EX_WEXPCOMSUB 125
|
||||
#define EX_BINARY_FILE 126
|
||||
#define EX_NOEXEC 126
|
||||
#define EX_NOINPUT 126
|
||||
#define EX_NOTFOUND 127
|
||||
|
||||
#define EX_SHERRBASE 256 /* all special error values are > this. */
|
||||
|
||||
#define EX_BADSYNTAX 257 /* shell syntax error */
|
||||
#define EX_USAGE 258 /* syntax error in usage */
|
||||
#define EX_REDIRFAIL 259 /* redirection failed */
|
||||
#define EX_BADASSIGN 260 /* variable assignment error */
|
||||
#define EX_EXPFAIL 261 /* word expansion failed */
|
||||
|
||||
/* Flag values that control parameter pattern substitution. */
|
||||
#define MATCH_ANY 0x000
|
||||
#define MATCH_BEG 0x001
|
||||
#define MATCH_END 0x002
|
||||
|
||||
#define MATCH_TYPEMASK 0x003
|
||||
|
||||
#define MATCH_GLOBREP 0x010
|
||||
#define MATCH_QUOTED 0x020
|
||||
#define MATCH_STARSUB 0x040
|
||||
|
||||
/* Some needed external declarations. */
|
||||
extern char **shell_environment;
|
||||
extern WORD_LIST *rest_of_args;
|
||||
|
||||
/* Generalized global variables. */
|
||||
extern int debugging_mode;
|
||||
extern int executing, login_shell;
|
||||
extern int interactive, interactive_shell;
|
||||
extern int startup_state;
|
||||
extern int subshell_environment;
|
||||
extern int shell_compatibility_level;
|
||||
|
||||
/* Structure to pass around that holds a bitmap of file descriptors
|
||||
to close, and the size of that structure. Used in execute_cmd.c. */
|
||||
struct fd_bitmap {
|
||||
int size;
|
||||
char *bitmap;
|
||||
};
|
||||
|
||||
#define FD_BITMAP_SIZE 32
|
||||
|
||||
#define CTLESC '\001'
|
||||
#define CTLNUL '\177'
|
||||
|
||||
/* Information about the current user. */
|
||||
struct user_info {
|
||||
uid_t uid, euid;
|
||||
gid_t gid, egid;
|
||||
char *user_name;
|
||||
char *shell; /* shell from the password file */
|
||||
char *home_dir;
|
||||
};
|
||||
|
||||
extern struct user_info current_user;
|
||||
|
||||
/* Force gcc to not clobber X on a longjmp(). Old versions of gcc mangle
|
||||
this badly. */
|
||||
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 8)
|
||||
# define USE_VAR(x) ((void) &(x))
|
||||
#else
|
||||
# define USE_VAR(x)
|
||||
#endif
|
||||
|
||||
/* Structure in which to save partial parsing state when doing things like
|
||||
PROMPT_COMMAND and bash_execute_unix_command execution. */
|
||||
|
||||
typedef struct _sh_parser_state_t {
|
||||
|
||||
/* parsing state */
|
||||
int parser_state;
|
||||
int *token_state;
|
||||
|
||||
/* input line state -- line number saved elsewhere */
|
||||
int input_line_terminator;
|
||||
int eof_encountered;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Nothing right now for multibyte state, but might want something later. */
|
||||
#endif
|
||||
|
||||
/* history state affecting or modified by the parser */
|
||||
int current_command_line_count;
|
||||
#if defined (HISTORY)
|
||||
int remember_on_history;
|
||||
int history_expansion_inhibited;
|
||||
#endif
|
||||
|
||||
/* execution state possibly modified by the parser */
|
||||
int last_command_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *pipestatus;
|
||||
#endif
|
||||
sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
|
||||
|
||||
/* flags state affecting the parser */
|
||||
int expand_aliases;
|
||||
int echo_input_at_read;
|
||||
|
||||
} sh_parser_state_t;
|
||||
|
||||
/* Let's try declaring these here. */
|
||||
extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *));
|
||||
extern void restore_parser_state __P((sh_parser_state_t *));
|
||||
@@ -245,10 +245,8 @@ static wchar_t *remove_wpattern __P((wchar_t *, size_t, wchar_t *, int));
|
||||
#endif
|
||||
static char *remove_pattern __P((char *, char *, int));
|
||||
|
||||
static int match_pattern_char __P((char *, char *));
|
||||
static int match_upattern __P((char *, char *, int, char **, char **));
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
static int match_pattern_wchar __P((wchar_t *, wchar_t *));
|
||||
static int match_wpattern __P((wchar_t *, char **, size_t, wchar_t *, int, char **, char **));
|
||||
#endif
|
||||
static int match_pattern __P((char *, char *, int, char **, char **));
|
||||
@@ -260,7 +258,7 @@ static char *parameter_list_remove_pattern __P((int, char *, int, int));
|
||||
#ifdef ARRAY_VARS
|
||||
static char *array_remove_pattern __P((SHELL_VAR *, char *, int, char *, int));
|
||||
#endif
|
||||
static char *parameter_brace_remove_pattern __P((char *, char *, char *, int, int));
|
||||
static char *parameter_brace_remove_pattern __P((char *, char *, int, char *, int, int, int));
|
||||
|
||||
static char *process_substitute __P((char *, int));
|
||||
|
||||
@@ -274,7 +272,7 @@ static int valid_brace_expansion_word __P((char *, int));
|
||||
static int chk_atstar __P((char *, int, int *, int *));
|
||||
static int chk_arithsub __P((const char *, int));
|
||||
|
||||
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int));
|
||||
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int, arrayind_t *));
|
||||
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
|
||||
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
|
||||
static void parameter_brace_expand_error __P((char *, char *));
|
||||
@@ -284,18 +282,18 @@ static intmax_t parameter_brace_expand_length __P((char *));
|
||||
|
||||
static char *skiparith __P((char *, int));
|
||||
static int verify_substring_values __P((SHELL_VAR *, char *, char *, int, intmax_t *, intmax_t *));
|
||||
static int get_var_and_type __P((char *, char *, int, SHELL_VAR **, char **));
|
||||
static int get_var_and_type __P((char *, char *, arrayind_t, int, int, SHELL_VAR **, char **));
|
||||
static char *mb_substring __P((char *, int, int));
|
||||
static char *parameter_brace_substring __P((char *, char *, char *, int));
|
||||
static char *parameter_brace_substring __P((char *, char *, int, char *, int, int));
|
||||
|
||||
static int shouldexp_replacement __P((char *));
|
||||
|
||||
static char *pos_params_pat_subst __P((char *, char *, char *, int));
|
||||
|
||||
static char *parameter_brace_patsub __P((char *, char *, char *, int));
|
||||
static char *parameter_brace_patsub __P((char *, char *, int, char *, int, int));
|
||||
|
||||
static char *pos_params_casemod __P((char *, char *, int, int));
|
||||
static char *parameter_brace_casemod __P((char *, char *, int, char *, int));
|
||||
static char *parameter_brace_casemod __P((char *, char *, int, int, char *, int, int));
|
||||
|
||||
static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int, int *, int *));
|
||||
static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
|
||||
@@ -611,7 +609,6 @@ unquoted_substring (substr, string)
|
||||
{
|
||||
case '\\':
|
||||
sindex++;
|
||||
|
||||
if (string[sindex])
|
||||
ADVANCE_CHAR (string, slen, sindex);
|
||||
break;
|
||||
@@ -1695,7 +1692,7 @@ skip_to_delim (string, start, delims, flags)
|
||||
{
|
||||
int i, pass_next, backq, si, c, invert, skipquote, skipcmd;
|
||||
size_t slen;
|
||||
char *temp;
|
||||
char *temp, open[3];
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
slen = strlen (string + start) + start;
|
||||
@@ -1778,6 +1775,25 @@ skip_to_delim (string, start, delims, flags)
|
||||
continue;
|
||||
}
|
||||
#endif /* PROCESS_SUBSTITUTION */
|
||||
#if defined (EXTENDED_GLOB)
|
||||
else if ((flags & SD_EXTGLOB) && extended_glob && string[i+1] == LPAREN && member (c, "?*+!@"))
|
||||
{
|
||||
si = i + 2;
|
||||
if (string[si] == '\0')
|
||||
CQ_RETURN(si);
|
||||
|
||||
open[0] = c;
|
||||
open[1] = LPAREN;
|
||||
open[2] = '\0';
|
||||
temp = extract_delimited_string (string, &si, open, "(", ")", SX_NOALLOC); /* ) */
|
||||
|
||||
i = si;
|
||||
if (string[i] == '\0') /* don't increment i past EOS in loop */
|
||||
break;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
else if ((skipquote || invert) && (member (c, delims) == 0))
|
||||
break;
|
||||
else
|
||||
@@ -3972,36 +3988,6 @@ remove_pattern (param, pattern, op)
|
||||
}
|
||||
}
|
||||
|
||||
/* Return 1 of the first character of STRING could match the first
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
|
||||
static int
|
||||
match_pattern_char (pat, string)
|
||||
char *pat, *string;
|
||||
{
|
||||
char c;
|
||||
|
||||
if (*string == 0)
|
||||
return (0);
|
||||
|
||||
switch (c = *pat++)
|
||||
{
|
||||
default:
|
||||
return (*string == c);
|
||||
case '\\':
|
||||
return (*string == *pat);
|
||||
case '?':
|
||||
return (*pat == LPAREN ? 1 : (*string != '\0'));
|
||||
case '*':
|
||||
return (1);
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
return (*pat == LPAREN ? 1 : (*string == c));
|
||||
case '[':
|
||||
return (*string != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
/* Match PAT anywhere in STRING and return the match boundaries.
|
||||
This returns 1 in case of a successful match, 0 otherwise. SP
|
||||
and EP are pointers into the string where the match begins and
|
||||
@@ -4014,7 +4000,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
int mtype;
|
||||
char **sp, **ep;
|
||||
{
|
||||
int c, len;
|
||||
int c, len, mlen;
|
||||
register char *p, *p1, *npat;
|
||||
char *end;
|
||||
|
||||
@@ -4050,6 +4036,8 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
len = STRLEN (string);
|
||||
end = string + len;
|
||||
|
||||
mlen = umatchlen (pat, len);
|
||||
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
@@ -4057,7 +4045,15 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
{
|
||||
if (match_pattern_char (pat, p))
|
||||
{
|
||||
#if 0
|
||||
for (p1 = end; p1 >= p; p1--)
|
||||
#else
|
||||
p1 = (mlen == -1) ? end : p + mlen;
|
||||
/* extra -1 to handle case of p1 == end */
|
||||
if (p1 - p + mlen - 1 > len)
|
||||
break;
|
||||
for ( ; p1 >= p; p1--)
|
||||
#endif
|
||||
{
|
||||
c = *p1; *p1 = '\0';
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4068,6 +4064,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
*p1 = c;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4078,7 +4079,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
if (match_pattern_char (pat, string) == 0)
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
for (p = end; p >= string; p--)
|
||||
#else
|
||||
for (p = (mlen == -1) ? end : string + mlen; p >= string; p--)
|
||||
#endif
|
||||
{
|
||||
c = *p; *p = '\0';
|
||||
if (strmatch (pat, string, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4089,12 +4094,21 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
*p = c;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
case MATCH_END:
|
||||
#if 0
|
||||
for (p = string; p <= end; p++)
|
||||
#else
|
||||
for (p = end - ((mlen == -1) ? len : mlen); p <= end; p++)
|
||||
#endif
|
||||
{
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
{
|
||||
@@ -4102,7 +4116,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
*ep = end;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -4112,36 +4130,6 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Return 1 of the first character of WSTRING could match the first
|
||||
character of pattern WPAT. Wide character version. */
|
||||
static int
|
||||
match_pattern_wchar (wpat, wstring)
|
||||
wchar_t *wpat, *wstring;
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
if (*wstring == 0)
|
||||
return (0);
|
||||
|
||||
switch (wc = *wpat++)
|
||||
{
|
||||
default:
|
||||
return (*wstring == wc);
|
||||
case L'\\':
|
||||
return (*wstring == *wpat);
|
||||
case L'?':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring != L'\0'));
|
||||
case L'*':
|
||||
return (1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring == wc));
|
||||
case L'[':
|
||||
return (*wstring != L'\0');
|
||||
}
|
||||
}
|
||||
|
||||
/* Match WPAT anywhere in WSTRING and return the match boundaries.
|
||||
This returns 1 in case of a successful match, 0 otherwise. Wide
|
||||
character version. */
|
||||
@@ -4155,12 +4143,9 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
char **sp, **ep;
|
||||
{
|
||||
wchar_t wc, *wp, *nwpat, *wp1;
|
||||
int len;
|
||||
#if 0
|
||||
size_t n, n1; /* Apple's gcc seems to miscompile this badly */
|
||||
#else
|
||||
size_t len;
|
||||
int mlen;
|
||||
int n, n1;
|
||||
#endif
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
@@ -4168,8 +4153,6 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = wcslen (wpat);
|
||||
if (wpat[0] != L'*' || (wpat[0] == L'*' && wpat[1] == WLPAREN && extended_glob) || wpat[len - 1] != L'*')
|
||||
{
|
||||
@@ -4191,6 +4174,8 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
if (len == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
mlen = wmatchlen (wpat, wstrlen);
|
||||
/* itrace("wmatchlen (%ls) -> %d", wpat, mlen); */
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
@@ -4198,7 +4183,15 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
{
|
||||
if (match_pattern_wchar (wpat, wstring + n))
|
||||
{
|
||||
#if 0
|
||||
for (n1 = wstrlen; n1 >= n; n1--)
|
||||
#else
|
||||
n1 = (mlen == -1) ? wstrlen : n + mlen;
|
||||
if (n1 > wstrlen)
|
||||
break;
|
||||
|
||||
for ( ; n1 >= n; n1--)
|
||||
#endif
|
||||
{
|
||||
wc = wstring[n1]; wstring[n1] = L'\0';
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4209,6 +4202,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
wstring[n1] = wc;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4219,7 +4217,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
if (match_pattern_wchar (wpat, wstring) == 0)
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
for (n = wstrlen; n >= 0; n--)
|
||||
#else
|
||||
for (n = (mlen == -1) ? wstrlen : mlen; n >= 0; n--)
|
||||
#endif
|
||||
{
|
||||
wc = wstring[n]; wstring[n] = L'\0';
|
||||
if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4230,12 +4232,21 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
wstring[n] = wc;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
case MATCH_END:
|
||||
#if 0
|
||||
for (n = 0; n <= wstrlen; n++)
|
||||
#else
|
||||
for (n = wstrlen - ((mlen == -1) ? wstrlen : mlen); n <= wstrlen; n++)
|
||||
#endif
|
||||
{
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
{
|
||||
@@ -4243,6 +4254,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
*ep = indices[wstrlen];
|
||||
return 1;
|
||||
}
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -4446,9 +4462,11 @@ array_remove_pattern (var, pattern, patspec, varname, quoted)
|
||||
#endif /* ARRAY_VARS */
|
||||
|
||||
static char *
|
||||
parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted)
|
||||
char *varname, *value, *patstr;
|
||||
int rtype, quoted;
|
||||
parameter_brace_remove_pattern (varname, value, ind, patstr, rtype, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *patstr;
|
||||
int rtype, quoted, flags;
|
||||
{
|
||||
int vtype, patspec, starsub;
|
||||
char *temp1, *val, *pattern;
|
||||
@@ -4459,7 +4477,7 @@ parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -5571,20 +5589,25 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
|
||||
the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that
|
||||
NAME was found inside of a double-quoted expression. */
|
||||
static WORD_DESC *
|
||||
parameter_brace_expand_word (name, var_is_special, quoted, pflags)
|
||||
parameter_brace_expand_word (name, var_is_special, quoted, pflags, indp)
|
||||
char *name;
|
||||
int var_is_special, quoted, pflags;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
WORD_DESC *ret;
|
||||
char *temp, *tt;
|
||||
intmax_t arg_index;
|
||||
SHELL_VAR *var;
|
||||
int atype, rflags;
|
||||
arrayind_t ind;
|
||||
|
||||
ret = 0;
|
||||
temp = 0;
|
||||
rflags = 0;
|
||||
|
||||
if (indp)
|
||||
*indp = INTMAX_MIN;
|
||||
|
||||
/* Handle multiple digit arguments, as in ${11}. */
|
||||
if (legal_number (name, &arg_index))
|
||||
{
|
||||
@@ -5611,11 +5634,16 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags)
|
||||
#if defined (ARRAY_VARS)
|
||||
else if (valid_array_reference (name))
|
||||
{
|
||||
temp = array_value (name, quoted, &atype, (arrayind_t *)NULL);
|
||||
temp = array_value (name, quoted, 0, &atype, &ind);
|
||||
if (atype == 0 && temp)
|
||||
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
? quote_string (temp)
|
||||
: quote_escapes (temp);
|
||||
{
|
||||
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
? quote_string (temp)
|
||||
: quote_escapes (temp);
|
||||
rflags |= W_ARRAYIND;
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
}
|
||||
else if (atype == 1 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
rflags |= W_HASQUOTEDNULL;
|
||||
}
|
||||
@@ -5666,7 +5694,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
|
||||
char *temp, *t;
|
||||
WORD_DESC *w;
|
||||
|
||||
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
|
||||
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND, 0);
|
||||
t = w->word;
|
||||
/* Have to dequote here if necessary */
|
||||
if (t)
|
||||
@@ -5683,7 +5711,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
|
||||
if (t == 0)
|
||||
return (WORD_DESC *)NULL;
|
||||
|
||||
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0);
|
||||
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0, 0);
|
||||
free (t);
|
||||
|
||||
return w;
|
||||
@@ -6119,13 +6147,18 @@ verify_substring_values (v, value, substr, vtype, e1p, e2p)
|
||||
/* Return the type of variable specified by VARNAME (simple variable,
|
||||
positional param, or array variable). Also return the value specified
|
||||
by VARNAME (value of a variable or a reference to an array element).
|
||||
QUOTED is the standard description of quoting state, using Q_* defines.
|
||||
FLAGS is currently a set of flags to pass to array_value. If IND is
|
||||
non-null and not INTMAX_MIN, and FLAGS includes AV_USEIND, IND is
|
||||
passed to array_value so the array index is not computed again.
|
||||
If this returns VT_VARIABLE, the caller assumes that CTLESC and CTLNUL
|
||||
characters in the value are quoted with CTLESC and takes appropriate
|
||||
steps. For convenience, *VALP is set to the dequoted VALUE. */
|
||||
static int
|
||||
get_var_and_type (varname, value, quoted, varp, valp)
|
||||
get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
|
||||
char *varname, *value;
|
||||
int quoted;
|
||||
arrayind_t ind;
|
||||
int quoted, flags;
|
||||
SHELL_VAR **varp;
|
||||
char **valp;
|
||||
{
|
||||
@@ -6134,6 +6167,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *v;
|
||||
#endif
|
||||
arrayind_t lind;
|
||||
|
||||
/* This sets vtype to VT_VARIABLE or VT_POSPARMS */
|
||||
vtype = (varname[0] == '@' || varname[0] == '*') && varname[1] == '\0';
|
||||
@@ -6145,6 +6179,9 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
if (valid_array_reference (varname))
|
||||
{
|
||||
v = array_variable_part (varname, &temp, (int *)0);
|
||||
/* If we want to signal array_value to use an already-computed index,
|
||||
set LIND to that index */
|
||||
lind = (ind != INTMAX_MIN && (flags & AV_USEIND)) ? ind : 0;
|
||||
if (v && (array_p (v) || assoc_p (v)))
|
||||
{ /* [ */
|
||||
if (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']')
|
||||
@@ -6158,7 +6195,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
else
|
||||
{
|
||||
vtype = VT_ARRAYMEMBER;
|
||||
*valp = array_value (varname, 1, (int *)NULL, (arrayind_t *)NULL);
|
||||
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
|
||||
}
|
||||
*varp = v;
|
||||
}
|
||||
@@ -6175,7 +6212,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
{
|
||||
vtype = VT_ARRAYMEMBER;
|
||||
*varp = v;
|
||||
*valp = array_value (varname, 1, (int *)NULL, (arrayind_t *)NULL);
|
||||
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
|
||||
}
|
||||
}
|
||||
else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && (assoc_p (v) || array_p (v)))
|
||||
@@ -6242,9 +6279,11 @@ mb_substring (string, s, e)
|
||||
VARNAME. If VARNAME is an array variable, use the array elements. */
|
||||
|
||||
static char *
|
||||
parameter_brace_substring (varname, value, substr, quoted)
|
||||
char *varname, *value, *substr;
|
||||
int quoted;
|
||||
parameter_brace_substring (varname, value, ind, substr, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *substr;
|
||||
int quoted, flags;
|
||||
{
|
||||
intmax_t e1, e2;
|
||||
int vtype, r, starsub;
|
||||
@@ -6257,7 +6296,7 @@ parameter_brace_substring (varname, value, substr, quoted)
|
||||
oname = this_command_name;
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
{
|
||||
this_command_name = oname;
|
||||
@@ -6353,6 +6392,9 @@ pat_subst (string, pat, rep, mflags)
|
||||
char *ret, *s, *e, *str, *rstr, *mstr;
|
||||
int rsize, rptr, l, replen, mtype, rxpand, rslen, mlen;
|
||||
|
||||
if (string == 0)
|
||||
return (savestring (""));
|
||||
|
||||
mtype = mflags & MATCH_TYPEMASK;
|
||||
|
||||
#if 0 /* bash-4.2 ? */
|
||||
@@ -6371,7 +6413,7 @@ pat_subst (string, pat, rep, mflags)
|
||||
if ((pat == 0 || *pat == 0) && (mtype == MATCH_BEG || mtype == MATCH_END))
|
||||
{
|
||||
replen = STRLEN (rep);
|
||||
l = strlen (string);
|
||||
l = STRLEN (string);
|
||||
ret = (char *)xmalloc (replen + l + 2);
|
||||
if (replen == 0)
|
||||
strcpy (ret, string);
|
||||
@@ -6449,7 +6491,7 @@ pat_subst (string, pat, rep, mflags)
|
||||
}
|
||||
|
||||
/* Now copy the unmatched portion of the input string */
|
||||
if (*str)
|
||||
if (str && *str)
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, rptr, STRLEN(str) + 1, rsize, 64);
|
||||
strcpy (ret + rptr, str);
|
||||
@@ -6510,9 +6552,11 @@ pos_params_pat_subst (string, pat, rep, mflags)
|
||||
and the string to substitute. QUOTED is a flags word containing
|
||||
the type of quoting currently in effect. */
|
||||
static char *
|
||||
parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
char *varname, *value, *patsub;
|
||||
int quoted;
|
||||
parameter_brace_patsub (varname, value, ind, patsub, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *patsub;
|
||||
int quoted, flags;
|
||||
{
|
||||
int vtype, mflags, starsub, delim;
|
||||
char *val, *temp, *pat, *rep, *p, *lpatsub, *tt;
|
||||
@@ -6523,7 +6567,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -6698,11 +6742,11 @@ pos_params_modcase (string, pat, modop, mflags)
|
||||
to perform. QUOTED is a flags word containing the type of quoting
|
||||
currently in effect. */
|
||||
static char *
|
||||
parameter_brace_casemod (varname, value, modspec, patspec, quoted)
|
||||
parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, flags)
|
||||
char *varname, *value;
|
||||
int modspec;
|
||||
int ind, modspec;
|
||||
char *patspec;
|
||||
int quoted;
|
||||
int quoted, flags;
|
||||
{
|
||||
int vtype, starsub, modop, mflags, x;
|
||||
char *val, *temp, *pat, *p, *lpat, *tt;
|
||||
@@ -6713,7 +6757,7 @@ parameter_brace_casemod (varname, value, modspec, patspec, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -6864,6 +6908,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
WORD_DESC *tdesc, *ret;
|
||||
int t_index, sindex, c, tflag, modspec;
|
||||
intmax_t number;
|
||||
arrayind_t ind;
|
||||
|
||||
temp = temp1 = value = (char *)NULL;
|
||||
var_is_set = var_is_null = var_is_special = check_nullness = 0;
|
||||
@@ -6890,6 +6935,8 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
ret = 0;
|
||||
tflag = 0;
|
||||
|
||||
ind = INTMAX_MIN;
|
||||
|
||||
/* If the name really consists of a special variable, then make sure
|
||||
that we have the entire name. We don't allow indirect references
|
||||
to special variables except `#', `?', `@' and `*'. */
|
||||
@@ -7096,7 +7143,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
if (want_indir)
|
||||
tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
|
||||
else
|
||||
tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&PF_NOSPLIT2));
|
||||
tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&PF_NOSPLIT2), &ind);
|
||||
|
||||
if (tdesc)
|
||||
{
|
||||
@@ -7134,7 +7181,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
/* If this is a substring spec, process it and add the result. */
|
||||
if (want_substring)
|
||||
{
|
||||
temp1 = parameter_brace_substring (name, temp, value, quoted);
|
||||
temp1 = parameter_brace_substring (name, temp, ind, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7152,7 +7199,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
}
|
||||
else if (want_patsub)
|
||||
{
|
||||
temp1 = parameter_brace_patsub (name, temp, value, quoted);
|
||||
temp1 = parameter_brace_patsub (name, temp, ind, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7173,7 +7220,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
#if defined (CASEMOD_EXPANSIONS)
|
||||
else if (want_casemod)
|
||||
{
|
||||
temp1 = parameter_brace_casemod (name, temp, modspec, value, quoted);
|
||||
temp1 = parameter_brace_casemod (name, temp, ind, modspec, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7222,7 +7269,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
FREE (value);
|
||||
break;
|
||||
}
|
||||
temp1 = parameter_brace_remove_pattern (name, temp, value, c, quoted);
|
||||
temp1 = parameter_brace_remove_pattern (name, temp, ind, value, c, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
free (temp);
|
||||
free (value);
|
||||
free (name);
|
||||
@@ -8286,10 +8333,12 @@ add_twochars:
|
||||
else
|
||||
temp = (char *)NULL;
|
||||
|
||||
#if 0
|
||||
/* We do not want to add quoted nulls to strings that are only
|
||||
partially quoted; we can throw them away. */
|
||||
if (temp == 0 && quoted_state == PARTIALLY_QUOTED)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
add_quoted_string:
|
||||
|
||||
|
||||
+9407
File diff suppressed because it is too large
Load Diff
+9352
File diff suppressed because it is too large
Load Diff
+9493
File diff suppressed because it is too large
Load Diff
@@ -245,10 +245,8 @@ static wchar_t *remove_wpattern __P((wchar_t *, size_t, wchar_t *, int));
|
||||
#endif
|
||||
static char *remove_pattern __P((char *, char *, int));
|
||||
|
||||
static int match_pattern_char __P((char *, char *));
|
||||
static int match_upattern __P((char *, char *, int, char **, char **));
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
static int match_pattern_wchar __P((wchar_t *, wchar_t *));
|
||||
static int match_wpattern __P((wchar_t *, char **, size_t, wchar_t *, int, char **, char **));
|
||||
#endif
|
||||
static int match_pattern __P((char *, char *, int, char **, char **));
|
||||
@@ -260,7 +258,7 @@ static char *parameter_list_remove_pattern __P((int, char *, int, int));
|
||||
#ifdef ARRAY_VARS
|
||||
static char *array_remove_pattern __P((SHELL_VAR *, char *, int, char *, int));
|
||||
#endif
|
||||
static char *parameter_brace_remove_pattern __P((char *, char *, char *, int, int));
|
||||
static char *parameter_brace_remove_pattern __P((char *, char *, int, char *, int, int, int));
|
||||
|
||||
static char *process_substitute __P((char *, int));
|
||||
|
||||
@@ -274,7 +272,7 @@ static int valid_brace_expansion_word __P((char *, int));
|
||||
static int chk_atstar __P((char *, int, int *, int *));
|
||||
static int chk_arithsub __P((const char *, int));
|
||||
|
||||
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int));
|
||||
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int, arrayind_t *));
|
||||
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
|
||||
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
|
||||
static void parameter_brace_expand_error __P((char *, char *));
|
||||
@@ -284,18 +282,18 @@ static intmax_t parameter_brace_expand_length __P((char *));
|
||||
|
||||
static char *skiparith __P((char *, int));
|
||||
static int verify_substring_values __P((SHELL_VAR *, char *, char *, int, intmax_t *, intmax_t *));
|
||||
static int get_var_and_type __P((char *, char *, int, SHELL_VAR **, char **));
|
||||
static int get_var_and_type __P((char *, char *, arrayind_t, int, int, SHELL_VAR **, char **));
|
||||
static char *mb_substring __P((char *, int, int));
|
||||
static char *parameter_brace_substring __P((char *, char *, char *, int));
|
||||
static char *parameter_brace_substring __P((char *, char *, int, char *, int, int));
|
||||
|
||||
static int shouldexp_replacement __P((char *));
|
||||
|
||||
static char *pos_params_pat_subst __P((char *, char *, char *, int));
|
||||
|
||||
static char *parameter_brace_patsub __P((char *, char *, char *, int));
|
||||
static char *parameter_brace_patsub __P((char *, char *, int, char *, int, int));
|
||||
|
||||
static char *pos_params_casemod __P((char *, char *, int, int));
|
||||
static char *parameter_brace_casemod __P((char *, char *, int, char *, int));
|
||||
static char *parameter_brace_casemod __P((char *, char *, int, int, char *, int, int));
|
||||
|
||||
static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int, int *, int *));
|
||||
static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
|
||||
@@ -611,7 +609,6 @@ unquoted_substring (substr, string)
|
||||
{
|
||||
case '\\':
|
||||
sindex++;
|
||||
|
||||
if (string[sindex])
|
||||
ADVANCE_CHAR (string, slen, sindex);
|
||||
break;
|
||||
@@ -3972,36 +3969,6 @@ remove_pattern (param, pattern, op)
|
||||
}
|
||||
}
|
||||
|
||||
/* Return 1 of the first character of STRING could match the first
|
||||
character of pattern PAT. Used to avoid n2 calls to strmatch(). */
|
||||
static int
|
||||
match_pattern_char (pat, string)
|
||||
char *pat, *string;
|
||||
{
|
||||
char c;
|
||||
|
||||
if (*string == 0)
|
||||
return (0);
|
||||
|
||||
switch (c = *pat++)
|
||||
{
|
||||
default:
|
||||
return (*string == c);
|
||||
case '\\':
|
||||
return (*string == *pat);
|
||||
case '?':
|
||||
return (*pat == LPAREN ? 1 : (*string != '\0'));
|
||||
case '*':
|
||||
return (1);
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
return (*pat == LPAREN ? 1 : (*string == c));
|
||||
case '[':
|
||||
return (*string != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
/* Match PAT anywhere in STRING and return the match boundaries.
|
||||
This returns 1 in case of a successful match, 0 otherwise. SP
|
||||
and EP are pointers into the string where the match begins and
|
||||
@@ -4014,7 +3981,7 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
int mtype;
|
||||
char **sp, **ep;
|
||||
{
|
||||
int c, len;
|
||||
int c, len, mlen;
|
||||
register char *p, *p1, *npat;
|
||||
char *end;
|
||||
|
||||
@@ -4050,6 +4017,8 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
len = STRLEN (string);
|
||||
end = string + len;
|
||||
|
||||
mlen = umatchlen (pat, len);
|
||||
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
@@ -4057,7 +4026,15 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
{
|
||||
if (match_pattern_char (pat, p))
|
||||
{
|
||||
#if 0
|
||||
for (p1 = end; p1 >= p; p1--)
|
||||
#else
|
||||
p1 = (mlen == -1) ? end : p + mlen;
|
||||
/* extra -1 to handle case of p1 == end */
|
||||
if (p1 - p + mlen - 1 > len)
|
||||
break;
|
||||
for ( ; p1 >= p; p1--)
|
||||
#endif
|
||||
{
|
||||
c = *p1; *p1 = '\0';
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4068,6 +4045,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
*p1 = c;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4078,7 +4060,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
if (match_pattern_char (pat, string) == 0)
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
for (p = end; p >= string; p--)
|
||||
#else
|
||||
for (p = (mlen == -1) ? end : string + mlen; p >= string; p--)
|
||||
#endif
|
||||
{
|
||||
c = *p; *p = '\0';
|
||||
if (strmatch (pat, string, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4089,12 +4075,21 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
*p = c;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
case MATCH_END:
|
||||
#if 0
|
||||
for (p = string; p <= end; p++)
|
||||
#else
|
||||
for (p = end - ((mlen == -1) ? len : mlen); p <= end; p++)
|
||||
#endif
|
||||
{
|
||||
if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0)
|
||||
{
|
||||
@@ -4102,7 +4097,11 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
*ep = end;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -4112,36 +4111,6 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Return 1 of the first character of WSTRING could match the first
|
||||
character of pattern WPAT. Wide character version. */
|
||||
static int
|
||||
match_pattern_wchar (wpat, wstring)
|
||||
wchar_t *wpat, *wstring;
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
if (*wstring == 0)
|
||||
return (0);
|
||||
|
||||
switch (wc = *wpat++)
|
||||
{
|
||||
default:
|
||||
return (*wstring == wc);
|
||||
case L'\\':
|
||||
return (*wstring == *wpat);
|
||||
case L'?':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring != L'\0'));
|
||||
case L'*':
|
||||
return (1);
|
||||
case L'+':
|
||||
case L'!':
|
||||
case L'@':
|
||||
return (*wpat == LPAREN ? 1 : (*wstring == wc));
|
||||
case L'[':
|
||||
return (*wstring != L'\0');
|
||||
}
|
||||
}
|
||||
|
||||
/* Match WPAT anywhere in WSTRING and return the match boundaries.
|
||||
This returns 1 in case of a successful match, 0 otherwise. Wide
|
||||
character version. */
|
||||
@@ -4155,12 +4124,9 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
char **sp, **ep;
|
||||
{
|
||||
wchar_t wc, *wp, *nwpat, *wp1;
|
||||
int len;
|
||||
#if 0
|
||||
size_t n, n1; /* Apple's gcc seems to miscompile this badly */
|
||||
#else
|
||||
size_t len;
|
||||
int mlen;
|
||||
int n, n1;
|
||||
#endif
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
@@ -4168,8 +4134,6 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = wcslen (wpat);
|
||||
if (wpat[0] != L'*' || (wpat[0] == L'*' && wpat[1] == WLPAREN && extended_glob) || wpat[len - 1] != L'*')
|
||||
{
|
||||
@@ -4191,6 +4155,8 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
if (len == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
mlen = wmatchlen (wpat, wstrlen);
|
||||
/* itrace("wmatchlen (%ls) -> %d", wpat, mlen); */
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
@@ -4198,7 +4164,15 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
{
|
||||
if (match_pattern_wchar (wpat, wstring + n))
|
||||
{
|
||||
#if 0
|
||||
for (n1 = wstrlen; n1 >= n; n1--)
|
||||
#else
|
||||
n1 = (mlen == -1) ? wstrlen : n + mlen;
|
||||
if (n1 > wstrlen)
|
||||
break;
|
||||
|
||||
for ( ; n1 >= n; n1--)
|
||||
#endif
|
||||
{
|
||||
wc = wstring[n1]; wstring[n1] = L'\0';
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4209,6 +4183,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
wstring[n1] = wc;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4219,7 +4198,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
if (match_pattern_wchar (wpat, wstring) == 0)
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
for (n = wstrlen; n >= 0; n--)
|
||||
#else
|
||||
for (n = (mlen == -1) ? wstrlen : mlen; n >= 0; n--)
|
||||
#endif
|
||||
{
|
||||
wc = wstring[n]; wstring[n] = L'\0';
|
||||
if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG) == 0)
|
||||
@@ -4230,12 +4213,21 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
return 1;
|
||||
}
|
||||
wstring[n] = wc;
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
case MATCH_END:
|
||||
#if 0
|
||||
for (n = 0; n <= wstrlen; n++)
|
||||
#else
|
||||
for (n = wstrlen - ((mlen == -1) ? wstrlen : mlen); n <= wstrlen; n++)
|
||||
#endif
|
||||
{
|
||||
if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0)
|
||||
{
|
||||
@@ -4243,6 +4235,11 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
*ep = indices[wstrlen];
|
||||
return 1;
|
||||
}
|
||||
#if 1
|
||||
/* If MLEN != -1, we have a fixed length pattern. */
|
||||
if (mlen != -1)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -4446,9 +4443,11 @@ array_remove_pattern (var, pattern, patspec, varname, quoted)
|
||||
#endif /* ARRAY_VARS */
|
||||
|
||||
static char *
|
||||
parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted)
|
||||
char *varname, *value, *patstr;
|
||||
int rtype, quoted;
|
||||
parameter_brace_remove_pattern (varname, value, ind, patstr, rtype, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *patstr;
|
||||
int rtype, quoted, flags;
|
||||
{
|
||||
int vtype, patspec, starsub;
|
||||
char *temp1, *val, *pattern;
|
||||
@@ -4459,7 +4458,7 @@ parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -5571,20 +5570,25 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
|
||||
the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that
|
||||
NAME was found inside of a double-quoted expression. */
|
||||
static WORD_DESC *
|
||||
parameter_brace_expand_word (name, var_is_special, quoted, pflags)
|
||||
parameter_brace_expand_word (name, var_is_special, quoted, pflags, indp)
|
||||
char *name;
|
||||
int var_is_special, quoted, pflags;
|
||||
arrayind_t *indp;
|
||||
{
|
||||
WORD_DESC *ret;
|
||||
char *temp, *tt;
|
||||
intmax_t arg_index;
|
||||
SHELL_VAR *var;
|
||||
int atype, rflags;
|
||||
arrayind_t ind;
|
||||
|
||||
ret = 0;
|
||||
temp = 0;
|
||||
rflags = 0;
|
||||
|
||||
if (indp)
|
||||
*indp = INTMAX_MIN;
|
||||
|
||||
/* Handle multiple digit arguments, as in ${11}. */
|
||||
if (legal_number (name, &arg_index))
|
||||
{
|
||||
@@ -5611,11 +5615,16 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags)
|
||||
#if defined (ARRAY_VARS)
|
||||
else if (valid_array_reference (name))
|
||||
{
|
||||
temp = array_value (name, quoted, &atype, (arrayind_t *)NULL);
|
||||
temp = array_value (name, quoted, 0, &atype, &ind);
|
||||
if (atype == 0 && temp)
|
||||
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
? quote_string (temp)
|
||||
: quote_escapes (temp);
|
||||
{
|
||||
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
? quote_string (temp)
|
||||
: quote_escapes (temp);
|
||||
rflags |= W_ARRAYIND;
|
||||
if (indp)
|
||||
*indp = ind;
|
||||
}
|
||||
else if (atype == 1 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
|
||||
rflags |= W_HASQUOTEDNULL;
|
||||
}
|
||||
@@ -5666,7 +5675,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
|
||||
char *temp, *t;
|
||||
WORD_DESC *w;
|
||||
|
||||
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
|
||||
w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND, 0);
|
||||
t = w->word;
|
||||
/* Have to dequote here if necessary */
|
||||
if (t)
|
||||
@@ -5683,7 +5692,7 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
|
||||
if (t == 0)
|
||||
return (WORD_DESC *)NULL;
|
||||
|
||||
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0);
|
||||
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0, 0);
|
||||
free (t);
|
||||
|
||||
return w;
|
||||
@@ -6119,13 +6128,18 @@ verify_substring_values (v, value, substr, vtype, e1p, e2p)
|
||||
/* Return the type of variable specified by VARNAME (simple variable,
|
||||
positional param, or array variable). Also return the value specified
|
||||
by VARNAME (value of a variable or a reference to an array element).
|
||||
QUOTED is the standard description of quoting state, using Q_* defines.
|
||||
FLAGS is currently a set of flags to pass to array_value. If IND is
|
||||
non-null and not INTMAX_MIN, and FLAGS includes AV_USEIND, IND is
|
||||
passed to array_value so the array index is not computed again.
|
||||
If this returns VT_VARIABLE, the caller assumes that CTLESC and CTLNUL
|
||||
characters in the value are quoted with CTLESC and takes appropriate
|
||||
steps. For convenience, *VALP is set to the dequoted VALUE. */
|
||||
static int
|
||||
get_var_and_type (varname, value, quoted, varp, valp)
|
||||
get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
|
||||
char *varname, *value;
|
||||
int quoted;
|
||||
arrayind_t ind;
|
||||
int quoted, flags;
|
||||
SHELL_VAR **varp;
|
||||
char **valp;
|
||||
{
|
||||
@@ -6134,6 +6148,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *v;
|
||||
#endif
|
||||
arrayind_t lind;
|
||||
|
||||
/* This sets vtype to VT_VARIABLE or VT_POSPARMS */
|
||||
vtype = (varname[0] == '@' || varname[0] == '*') && varname[1] == '\0';
|
||||
@@ -6145,6 +6160,9 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
if (valid_array_reference (varname))
|
||||
{
|
||||
v = array_variable_part (varname, &temp, (int *)0);
|
||||
/* If we want to signal array_value to use an already-computed index,
|
||||
set LIND to that index */
|
||||
lind = (ind != INTMAX_MIN && (flags & AV_USEIND)) ? ind : 0;
|
||||
if (v && (array_p (v) || assoc_p (v)))
|
||||
{ /* [ */
|
||||
if (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']')
|
||||
@@ -6158,7 +6176,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
else
|
||||
{
|
||||
vtype = VT_ARRAYMEMBER;
|
||||
*valp = array_value (varname, 1, (int *)NULL, (arrayind_t *)NULL);
|
||||
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
|
||||
}
|
||||
*varp = v;
|
||||
}
|
||||
@@ -6175,7 +6193,7 @@ get_var_and_type (varname, value, quoted, varp, valp)
|
||||
{
|
||||
vtype = VT_ARRAYMEMBER;
|
||||
*varp = v;
|
||||
*valp = array_value (varname, 1, (int *)NULL, (arrayind_t *)NULL);
|
||||
*valp = array_value (varname, Q_DOUBLE_QUOTES, flags, (int *)NULL, &lind);
|
||||
}
|
||||
}
|
||||
else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && (assoc_p (v) || array_p (v)))
|
||||
@@ -6242,9 +6260,11 @@ mb_substring (string, s, e)
|
||||
VARNAME. If VARNAME is an array variable, use the array elements. */
|
||||
|
||||
static char *
|
||||
parameter_brace_substring (varname, value, substr, quoted)
|
||||
char *varname, *value, *substr;
|
||||
int quoted;
|
||||
parameter_brace_substring (varname, value, ind, substr, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *substr;
|
||||
int quoted, flags;
|
||||
{
|
||||
intmax_t e1, e2;
|
||||
int vtype, r, starsub;
|
||||
@@ -6257,7 +6277,7 @@ parameter_brace_substring (varname, value, substr, quoted)
|
||||
oname = this_command_name;
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
{
|
||||
this_command_name = oname;
|
||||
@@ -6353,20 +6373,28 @@ pat_subst (string, pat, rep, mflags)
|
||||
char *ret, *s, *e, *str, *rstr, *mstr;
|
||||
int rsize, rptr, l, replen, mtype, rxpand, rslen, mlen;
|
||||
|
||||
if (string == 0)
|
||||
return (savestring (""));
|
||||
|
||||
mtype = mflags & MATCH_TYPEMASK;
|
||||
|
||||
#if 0 /* bash-4.2 ? */
|
||||
rxpand = (rep && *rep) ? shouldexp_replacement (rep) : 0;
|
||||
#else
|
||||
rxpand = 0;
|
||||
#endif
|
||||
|
||||
/* Special cases:
|
||||
* 1. A null pattern with mtype == MATCH_BEG means to prefix STRING
|
||||
* with REP and return the result.
|
||||
* 2. A null pattern with mtype == MATCH_END means to append REP to
|
||||
* STRING and return the result.
|
||||
* These don't understand or process `&' in the replacement string.
|
||||
*/
|
||||
if ((pat == 0 || *pat == 0) && (mtype == MATCH_BEG || mtype == MATCH_END))
|
||||
{
|
||||
replen = STRLEN (rep);
|
||||
l = strlen (string);
|
||||
l = STRLEN (string);
|
||||
ret = (char *)xmalloc (replen + l + 2);
|
||||
if (replen == 0)
|
||||
strcpy (ret, string);
|
||||
@@ -6444,7 +6472,7 @@ pat_subst (string, pat, rep, mflags)
|
||||
}
|
||||
|
||||
/* Now copy the unmatched portion of the input string */
|
||||
if (*str)
|
||||
if (str && *str)
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, rptr, STRLEN(str) + 1, rsize, 64);
|
||||
strcpy (ret + rptr, str);
|
||||
@@ -6505,9 +6533,11 @@ pos_params_pat_subst (string, pat, rep, mflags)
|
||||
and the string to substitute. QUOTED is a flags word containing
|
||||
the type of quoting currently in effect. */
|
||||
static char *
|
||||
parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
char *varname, *value, *patsub;
|
||||
int quoted;
|
||||
parameter_brace_patsub (varname, value, ind, patsub, quoted, flags)
|
||||
char *varname, *value;
|
||||
int ind;
|
||||
char *patsub;
|
||||
int quoted, flags;
|
||||
{
|
||||
int vtype, mflags, starsub, delim;
|
||||
char *val, *temp, *pat, *rep, *p, *lpatsub, *tt;
|
||||
@@ -6518,7 +6548,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -6693,11 +6723,11 @@ pos_params_modcase (string, pat, modop, mflags)
|
||||
to perform. QUOTED is a flags word containing the type of quoting
|
||||
currently in effect. */
|
||||
static char *
|
||||
parameter_brace_casemod (varname, value, modspec, patspec, quoted)
|
||||
parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, flags)
|
||||
char *varname, *value;
|
||||
int modspec;
|
||||
int ind, modspec;
|
||||
char *patspec;
|
||||
int quoted;
|
||||
int quoted, flags;
|
||||
{
|
||||
int vtype, starsub, modop, mflags, x;
|
||||
char *val, *temp, *pat, *p, *lpat, *tt;
|
||||
@@ -6708,7 +6738,7 @@ parameter_brace_casemod (varname, value, modspec, patspec, quoted)
|
||||
|
||||
this_command_name = varname;
|
||||
|
||||
vtype = get_var_and_type (varname, value, quoted, &v, &val);
|
||||
vtype = get_var_and_type (varname, value, ind, quoted, flags, &v, &val);
|
||||
if (vtype == -1)
|
||||
return ((char *)NULL);
|
||||
|
||||
@@ -6859,6 +6889,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
WORD_DESC *tdesc, *ret;
|
||||
int t_index, sindex, c, tflag, modspec;
|
||||
intmax_t number;
|
||||
arrayind_t ind;
|
||||
|
||||
temp = temp1 = value = (char *)NULL;
|
||||
var_is_set = var_is_null = var_is_special = check_nullness = 0;
|
||||
@@ -6885,6 +6916,8 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
ret = 0;
|
||||
tflag = 0;
|
||||
|
||||
ind = INTMAX_MIN;
|
||||
|
||||
/* If the name really consists of a special variable, then make sure
|
||||
that we have the entire name. We don't allow indirect references
|
||||
to special variables except `#', `?', `@' and `*'. */
|
||||
@@ -7091,7 +7124,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
if (want_indir)
|
||||
tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
|
||||
else
|
||||
tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&PF_NOSPLIT2));
|
||||
tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&PF_NOSPLIT2), &ind);
|
||||
|
||||
if (tdesc)
|
||||
{
|
||||
@@ -7129,7 +7162,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
/* If this is a substring spec, process it and add the result. */
|
||||
if (want_substring)
|
||||
{
|
||||
temp1 = parameter_brace_substring (name, temp, value, quoted);
|
||||
temp1 = parameter_brace_substring (name, temp, ind, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7147,7 +7180,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
}
|
||||
else if (want_patsub)
|
||||
{
|
||||
temp1 = parameter_brace_patsub (name, temp, value, quoted);
|
||||
temp1 = parameter_brace_patsub (name, temp, ind, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7168,7 +7201,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
#if defined (CASEMOD_EXPANSIONS)
|
||||
else if (want_casemod)
|
||||
{
|
||||
temp1 = parameter_brace_casemod (name, temp, modspec, value, quoted);
|
||||
temp1 = parameter_brace_casemod (name, temp, ind, modspec, value, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
FREE (name);
|
||||
FREE (value);
|
||||
FREE (temp);
|
||||
@@ -7217,7 +7250,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
|
||||
FREE (value);
|
||||
break;
|
||||
}
|
||||
temp1 = parameter_brace_remove_pattern (name, temp, value, c, quoted);
|
||||
temp1 = parameter_brace_remove_pattern (name, temp, ind, value, c, quoted, (tflag & W_ARRAYIND) ? AV_USEIND : 0);
|
||||
free (temp);
|
||||
free (value);
|
||||
free (name);
|
||||
@@ -8281,10 +8314,12 @@ add_twochars:
|
||||
else
|
||||
temp = (char *)NULL;
|
||||
|
||||
#if 0
|
||||
/* We do not want to add quoted nulls to strings that are only
|
||||
partially quoted; we can throw them away. */
|
||||
if (temp == 0 && quoted_state == PARTIALLY_QUOTED)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
add_quoted_string:
|
||||
|
||||
|
||||
@@ -277,6 +277,7 @@ extern char *cond_expand_word __P((WORD_DESC *, int));
|
||||
#define SD_INVERT 0x02 /* look for chars NOT in passed set */
|
||||
#define SD_NOQUOTEDELIM 0x04 /* don't let single or double quotes act as delimiters */
|
||||
#define SD_NOSKIPCMD 0x08 /* don't skip over $(, <(, or >( command/process substitution */
|
||||
#define SD_EXTGLOB 0x10 /* skip over extended globbing patterns if appropriate */
|
||||
|
||||
extern int skip_to_delim __P((char *, int, char *, int));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* subst.h -- Names of externally visible functions in subst.c. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
||||
@@ -312,3 +312,32 @@ argv[3] = <
|
||||
argv[1] = <~>
|
||||
argv[2] = <^?>
|
||||
argv[3] = <€>
|
||||
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
|
||||
Monday
|
||||
Monday
|
||||
Tuesday
|
||||
Monday
|
||||
Monday
|
||||
Tuesday
|
||||
Monday
|
||||
Tuesday
|
||||
Wednesday
|
||||
Monday
|
||||
Tuesday
|
||||
Wednesday
|
||||
monday, monday, tuesday
|
||||
wednesday, wednesday, thursday
|
||||
monday, monday, tuesday
|
||||
Wednesday, Wednesday, Thursday
|
||||
nday
|
||||
esday
|
||||
dnesday
|
||||
nday
|
||||
esday
|
||||
dnesday
|
||||
onday
|
||||
uesday
|
||||
ednesday
|
||||
onday
|
||||
uesday
|
||||
ednesday
|
||||
|
||||
@@ -386,3 +386,5 @@ ${THIS_SH} ./array7.sub
|
||||
${THIS_SH} ./array8.sub
|
||||
|
||||
${THIS_SH} ./array9.sub
|
||||
|
||||
${THIS_SH} ./array10.sub
|
||||
|
||||
@@ -0,0 +1,388 @@
|
||||
# this is needed so that the bad assignments (b[]=bcde, for example) do not
|
||||
# cause fatal shell errors when in posix mode
|
||||
set +o posix
|
||||
|
||||
set +a
|
||||
# The calls to egrep -v are to filter out builtin array variables that are
|
||||
# automatically set and possibly contain values that vary.
|
||||
|
||||
# first make sure we handle the basics
|
||||
x=()
|
||||
echo ${x[@]}
|
||||
unset x
|
||||
|
||||
# this should be an error
|
||||
test=(first & second)
|
||||
echo $?
|
||||
unset test
|
||||
|
||||
# make sure declare -a converts an existing variable to an array
|
||||
unset a
|
||||
a=abcde
|
||||
declare -a a
|
||||
echo ${a[0]}
|
||||
|
||||
unset a
|
||||
a=abcde
|
||||
a[2]=bdef
|
||||
|
||||
unset b
|
||||
declare -a b[256]
|
||||
|
||||
unset c[2]
|
||||
unset c[*]
|
||||
|
||||
a[1]=
|
||||
|
||||
_ENV=/bin/true
|
||||
x=${_ENV[(_$-=0)+(_=1)-_${-%%*i*}]}
|
||||
|
||||
declare -r c[100]
|
||||
|
||||
echo ${a[0]} ${a[4]}
|
||||
echo ${a[@]}
|
||||
|
||||
echo ${a[*]}
|
||||
|
||||
# this should print out values, too
|
||||
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
|
||||
unset a[7]
|
||||
echo ${a[*]}
|
||||
|
||||
unset a[4]
|
||||
echo ${a[*]}
|
||||
|
||||
echo ${a}
|
||||
echo "${a}"
|
||||
echo $a
|
||||
|
||||
unset a[0]
|
||||
echo ${a}
|
||||
|
||||
echo ${a[@]}
|
||||
|
||||
a[5]="hello world"
|
||||
echo ${a[5]}
|
||||
echo ${#a[5]}
|
||||
|
||||
echo ${#a[@]}
|
||||
|
||||
a[4+5/2]="test expression"
|
||||
declare a["7 + 8"]="test 2"
|
||||
a[7 + 8]="test 2"
|
||||
echo ${a[@]}
|
||||
|
||||
readonly a[5]
|
||||
readonly a
|
||||
# these two lines should output `declare' commands
|
||||
readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
# this line should output `readonly' commands, even for arrays
|
||||
set -o posix
|
||||
readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
set +o posix
|
||||
|
||||
declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
|
||||
d[9]="ninth element"
|
||||
|
||||
declare -a e[10]=test # this works in post-bash-2.05 versions
|
||||
declare -a e[10]='(test)'
|
||||
|
||||
pass=/etc/passwd
|
||||
declare -a f='("${d[@]}")'
|
||||
b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass)
|
||||
|
||||
echo ${b[@]:2:3}
|
||||
|
||||
declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
|
||||
a[3]="this is a test"
|
||||
|
||||
b[]=bcde
|
||||
b[*]=aaa
|
||||
echo ${b[ ]}
|
||||
|
||||
c[-2]=4
|
||||
echo ${c[-4]}
|
||||
|
||||
d[7]=(abdedfegeee)
|
||||
|
||||
d=([]=abcde [1]="test test" [*]=last [-65]=negative )
|
||||
|
||||
unset d[12]
|
||||
unset e[*]
|
||||
|
||||
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
|
||||
ps1='hello'
|
||||
unset ps1[2]
|
||||
unset ${ps1[2]}
|
||||
|
||||
declare +a ps1
|
||||
declare +a c
|
||||
|
||||
# the prompt should not print when using a here doc
|
||||
read -p "array test: " -a rv <<!
|
||||
this is a test of read using arrays
|
||||
!
|
||||
|
||||
echo ${rv[0]} ${rv[4]}
|
||||
echo ${rv[@]}
|
||||
|
||||
# the variable should be converted to an array when `read -a' is done
|
||||
vv=1
|
||||
read -a vv <<!
|
||||
this is a test of arrays
|
||||
!
|
||||
echo ${vv[0]} ${vv[3]}
|
||||
echo ${vv[@]}
|
||||
unset vv
|
||||
|
||||
declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
|
||||
|
||||
export rv
|
||||
#set
|
||||
|
||||
x[4]=bbb
|
||||
x=abde
|
||||
echo $x
|
||||
echo ${x[0]}
|
||||
echo ${x[4]}
|
||||
echo efgh | ( read x[1] ; echo ${x[1]} )
|
||||
echo wxyz | ( declare -a x ; read x ; echo $x ; echo ${x[0]} )
|
||||
|
||||
# Make sure that arrays can be used to save the positional paramters verbatim
|
||||
set -- a 'b c' d 'e f g' h
|
||||
|
||||
ARGV=( [0]=$0 "$@" )
|
||||
|
||||
for z in "${ARGV[@]}"
|
||||
do
|
||||
echo "$z"
|
||||
done
|
||||
|
||||
echo "$0"
|
||||
for z in "$@"
|
||||
do
|
||||
echo "$z"
|
||||
done
|
||||
|
||||
# do various pattern removal and length tests
|
||||
XPATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:.:/sbin:/usr/sbin
|
||||
|
||||
xpath=( $( IFS=: ; echo $XPATH ) )
|
||||
|
||||
echo ${xpath[@]}
|
||||
echo ${xpath[@]##*/}
|
||||
echo ${xpath[0]##*/}
|
||||
echo ${xpath[@]%%[!/]*}
|
||||
echo ${xpath[0]%%[!/]*}
|
||||
recho ${xpath##*/}
|
||||
recho ${xpath%%[!/]*}
|
||||
recho ${xpath[5]##*/}
|
||||
recho ${xpath[5]%%[!/]*}
|
||||
|
||||
# let's try to make it a DOS-style path
|
||||
|
||||
zecho "${xpath[@]/\//\\}"
|
||||
zecho "${xpath[@]//\//\\}"
|
||||
zecho "${xpath[@]//[\/]/\\}"
|
||||
|
||||
# length of the first element of the array, since array without subscript
|
||||
# is equivalent to referencing first element
|
||||
echo ${#xpath} -- ${#xpath[0]}
|
||||
|
||||
# number of elements in the array
|
||||
nelem=${#xpath[@]}
|
||||
echo ${#xpath[@]} -- $nelem
|
||||
|
||||
# total length of all elements in the array, including space separators
|
||||
xx="${xpath[*]}"
|
||||
echo ${#xx}
|
||||
|
||||
# total length of all elements in the array
|
||||
xx=$( IFS='' ; echo "${xpath[*]}" )
|
||||
echo ${#xx}
|
||||
|
||||
unset xpath[nelem-1]
|
||||
|
||||
nelem=${#xpath[@]}
|
||||
echo ${#xpath[@]} -- $nelem
|
||||
|
||||
# arrays and things that look like index assignments
|
||||
array=(42 [1]=14 [2]=44)
|
||||
|
||||
array2=(grep [ 123 ] \*)
|
||||
|
||||
echo ${array[@]}
|
||||
echo "${array2[@]}"
|
||||
|
||||
# arrays and implicit arithmetic evaluation
|
||||
declare -i -a iarray
|
||||
|
||||
iarray=( 2+4 1+6 7+2 )
|
||||
echo ${iarray[@]}
|
||||
|
||||
iarray[4]=4+1
|
||||
echo ${iarray[@]}
|
||||
|
||||
# make sure assignment using the compound assignment syntax removes all
|
||||
# of the old elements from the array value
|
||||
barray=(old1 old2 old3 old4 old5)
|
||||
barray=(new1 new2 new3)
|
||||
echo "length = ${#barray[@]}"
|
||||
echo "value = ${barray[*]}"
|
||||
|
||||
# make sure the array code behaves correctly with respect to unset variables
|
||||
set -u
|
||||
( echo ${#narray[4]} )
|
||||
|
||||
${THIS_SH} ./array1.sub
|
||||
${THIS_SH} ./array2.sub
|
||||
|
||||
# some old bugs and ksh93 compatibility tests
|
||||
${THIS_SH} ./array3.sub
|
||||
|
||||
# some compound assingment parsing problems that showed up in bash-3.1-release
|
||||
${THIS_SH} ./array4.sub
|
||||
|
||||
set +u
|
||||
cd /tmp
|
||||
|
||||
touch 1=bar
|
||||
foo=([10]="bar")
|
||||
echo ${foo[0]}
|
||||
rm 1=bar
|
||||
|
||||
cd $OLDPWD
|
||||
|
||||
foo=(a b c d e f g)
|
||||
echo ${foo[@]}
|
||||
|
||||
# quoted reserved words are ok
|
||||
foo=(\for \case \if \then \else)
|
||||
echo ${foo[@]}
|
||||
|
||||
# quoted metacharacters are ok
|
||||
foo=( [1]='<>' [2]='<' [3]='>' [4]='!' )
|
||||
echo ${foo[@]}
|
||||
|
||||
# numbers are just words when not in a redirection context
|
||||
foo=( 12 14 16 18 20 )
|
||||
echo ${foo[@]}
|
||||
|
||||
foo=( 4414758999202 )
|
||||
echo ${foo[@]}
|
||||
|
||||
# this was a bug in all versions of bash 2.x up to and including bash-2.04
|
||||
declare -a ddd=(aaa
|
||||
bbb)
|
||||
echo ${ddd[@]}
|
||||
|
||||
# errors until post-bash-2.05a; now reserved words are OK
|
||||
foo=(a b c for case if then else)
|
||||
|
||||
foo=(for case if then else)
|
||||
|
||||
# errors
|
||||
metas=( <> < > ! )
|
||||
metas=( [1]=<> [2]=< [3]=> [4]=! )
|
||||
|
||||
# various expansions that didn't really work right until post-bash-2.04
|
||||
foo='abc'
|
||||
echo ${foo[0]} ${#foo[0]}
|
||||
echo ${foo[1]} ${#foo[1]}
|
||||
echo ${foo[@]} ${#foo[@]}
|
||||
echo ${foo[*]} ${#foo[*]}
|
||||
|
||||
foo=''
|
||||
echo ${foo[0]} ${#foo[0]}
|
||||
echo ${foo[1]} ${#foo[1]}
|
||||
echo ${foo[@]} ${#foo[@]}
|
||||
echo ${foo[*]} ${#foo[*]}
|
||||
|
||||
# new expansions added after bash-2.05b
|
||||
x[0]=zero
|
||||
x[1]=one
|
||||
x[4]=four
|
||||
x[10]=ten
|
||||
|
||||
recho ${!x[@]}
|
||||
recho "${!x[@]}"
|
||||
recho ${!x[*]}
|
||||
recho "${!x[*]}"
|
||||
|
||||
# sparse array tests for code fixed in bash-3.0
|
||||
unset av
|
||||
av[1]='one'
|
||||
av[2]=''
|
||||
|
||||
av[3]=three
|
||||
av[5]=five
|
||||
av[7]=seven
|
||||
|
||||
echo include null element -- expect one
|
||||
echo ${av[@]:1:2} # what happens when we include a null element?
|
||||
echo include unset element -- expect three five
|
||||
echo ${av[@]:3:2} # what happens when we include an unset element?
|
||||
echo start at unset element -- expect five seven
|
||||
echo ${av[@]:4:2} # what happens when we start at an unset element?
|
||||
|
||||
echo too many elements -- expect three five seven
|
||||
echo ${av[@]:3:5} # how about too many elements?
|
||||
|
||||
echo positive offset - expect five seven
|
||||
echo ${av[@]:5:2}
|
||||
echo negative offset to unset element - expect seven
|
||||
echo ${av[@]: -2:2}
|
||||
|
||||
echo positive offset 2 - expect seven
|
||||
echo ${av[@]: 6:2}
|
||||
echo negative offset 2 - expect seven
|
||||
echo ${av[@]: -1:2}
|
||||
|
||||
echo out-of-range offset
|
||||
echo ${av[@]:12}
|
||||
|
||||
# parsing problems and other inconsistencies not fixed until post bash-3.0
|
||||
unset x
|
||||
declare -a x=(')' $$)
|
||||
[ ${x[1]} -eq $$ ] || echo bad
|
||||
|
||||
unset x
|
||||
declare -a x=(a b c d e)
|
||||
echo ${x[4]}
|
||||
|
||||
z=([1]=one [4]=four [7]=seven [10]=ten)
|
||||
|
||||
echo ${#z[@]}
|
||||
|
||||
echo ${!z[@]}
|
||||
|
||||
unset x
|
||||
declare -a x=(a \'b c\')
|
||||
|
||||
echo "${x[1]}"
|
||||
|
||||
unset x
|
||||
declare -a x=(a 'b c')
|
||||
|
||||
echo "${x[1]}"
|
||||
|
||||
unset x
|
||||
declare -a x=($0)
|
||||
[ "${x[@]}" = $0 ] || echo double expansion of \$0
|
||||
declare -a x=(\$0)
|
||||
echo "${x[@]}"
|
||||
|
||||
# tests for bash-3.1 problems
|
||||
${THIS_SH} ./array5.sub
|
||||
|
||||
# tests for post-bash-3.2 problems, most fixed in bash-3.2 patches
|
||||
${THIS_SH} ./array6.sub
|
||||
${THIS_SH} ./array7.sub
|
||||
|
||||
${THIS_SH} ./array8.sub
|
||||
|
||||
${THIS_SH} ./array9.sub
|
||||
@@ -0,0 +1,52 @@
|
||||
days=({Mon,Tues,Wednes,Thurs,Fri,Satur,Sun}day)
|
||||
echo ${days[@]}
|
||||
|
||||
typeset -i count
|
||||
|
||||
count=0
|
||||
echo ${days[${count}]}
|
||||
echo ${days[$((count++))]}
|
||||
echo ${days[$((count++))]}
|
||||
|
||||
count=0
|
||||
echo ${days[count]}
|
||||
echo ${days[count++]}
|
||||
echo ${days[count++]}
|
||||
|
||||
count=0
|
||||
echo ${days[$((count++))]/foo/bar}
|
||||
echo ${days[$((count++))]/foo/bar}
|
||||
echo ${days[$((count++))]/foo/bar}
|
||||
|
||||
count=0
|
||||
echo ${days[count++]/foo/bar}
|
||||
echo ${days[count++]/foo/bar}
|
||||
echo ${days[count++]/foo/bar}
|
||||
|
||||
count=0
|
||||
echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
|
||||
echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
|
||||
|
||||
count=0
|
||||
echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
|
||||
echo "${days[${count}]/foo/bar}, ${days[$((count++))]/foo/bar}, ${days[$((count++))]/foo/bar}"
|
||||
|
||||
count=0
|
||||
echo ${days[$((count++))]:2}
|
||||
echo ${days[$((count++))]:2}
|
||||
echo ${days[$((count++))]:2}
|
||||
|
||||
count=0
|
||||
echo ${days[count++]:2}
|
||||
echo ${days[count++]:2}
|
||||
echo ${days[count++]:2}
|
||||
|
||||
count=0
|
||||
echo ${days[$((count++))]#?}
|
||||
echo ${days[$((count++))]#?}
|
||||
echo ${days[$((count++))]#?}
|
||||
|
||||
count=0
|
||||
echo ${days[count++]#?}
|
||||
echo ${days[count++]#?}
|
||||
echo ${days[count++]#?}
|
||||
+23
-1
File diff suppressed because one or more lines are too long
@@ -567,6 +567,8 @@ ${THIS_SH} ./new-exp6.sub
|
||||
|
||||
${THIS_SH} ./new-exp7.sub
|
||||
|
||||
${THIS_SH} ./new-exp8.sub
|
||||
|
||||
# problems with stray CTLNUL in bash-4.0-alpha
|
||||
unset a
|
||||
a=/a
|
||||
|
||||
@@ -418,8 +418,9 @@ c=${var:4}
|
||||
expect nothing
|
||||
recho $c
|
||||
# as of bash-4.2, negative LENGTH means offset from the end
|
||||
expect '<a>'
|
||||
c=${var:0:-2}
|
||||
expect '<a>'
|
||||
recho $c
|
||||
|
||||
var=abcdefghi
|
||||
c=${var:3:12}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
pat1='str'
|
||||
pat2='[^;]'
|
||||
pat3='[[:alnum:]_]'
|
||||
pat4='[[:alnum:]][[fu]b'
|
||||
pat5='?tr'
|
||||
pat6='?tr\'
|
||||
pat7='[[:alnum:]]_'
|
||||
pat8='*tr'
|
||||
|
||||
declare z="start"
|
||||
declare NUM=1000
|
||||
|
||||
#----------------------------------
|
||||
# create a long string with ';'
|
||||
#----------------------------------
|
||||
for ((i=0; i<$NUM; i++)); do
|
||||
z="$z;string$i"
|
||||
done
|
||||
|
||||
#z="$z;string;foo"
|
||||
|
||||
#------------------------------
|
||||
# delete everything except ';'
|
||||
#------------------------------
|
||||
|
||||
# try different patterns here
|
||||
x="${z//$pat1}"
|
||||
echo $x
|
||||
x="${z//$pat2}"
|
||||
echo $x
|
||||
x="${z//$pat3}"
|
||||
echo $x
|
||||
x="${z//$pat4}"
|
||||
echo $x
|
||||
x="${z//$pat5}"
|
||||
echo $x
|
||||
x="${z//$pat6}"
|
||||
echo $x
|
||||
x="${z//$pat7}"
|
||||
echo $x
|
||||
x="${z//$pat8}"
|
||||
echo $x
|
||||
|
||||
|
||||
declare z="start"
|
||||
declare NUM=1000
|
||||
|
||||
#----------------------------------
|
||||
# create a long string with ';'
|
||||
#----------------------------------
|
||||
for ((i=0; i<$NUM; i++)); do
|
||||
z="$z;string$i"
|
||||
done
|
||||
|
||||
#z="$z;string;foo"
|
||||
|
||||
#------------------------------
|
||||
# delete everything except ';'
|
||||
#------------------------------
|
||||
|
||||
# try different patterns here
|
||||
x="${z//[^;]}"
|
||||
echo $x
|
||||
x="${z/#[^;][^;]}"
|
||||
echo $x
|
||||
x="${z/%[^;][^;]}"
|
||||
echo $x
|
||||
|
||||
export LANG=C LC_ALL=C LC_CTYPE=C
|
||||
|
||||
# try different patterns here
|
||||
x="${z//$pat1}"
|
||||
echo $x
|
||||
x="${z//$pat2}"
|
||||
echo $x
|
||||
x="${z//$pat3}"
|
||||
echo $x
|
||||
x="${z//$pat4}"
|
||||
echo $x
|
||||
x="${z//$pat5}"
|
||||
echo $x
|
||||
x="${z//$pat6}"
|
||||
echo $x
|
||||
x="${z//$pat7}"
|
||||
echo $x
|
||||
x="${z//$pat8}"
|
||||
echo $x
|
||||
|
||||
# try different patterns here
|
||||
x="${z//[^;]}"
|
||||
echo $x
|
||||
x="${z/#[^;][^;]}"
|
||||
echo $x
|
||||
x="${z/%[^;][^;]}"
|
||||
echo $x
|
||||
+10
-7
@@ -387,11 +387,14 @@ initialize_shell_variables (env, privmode)
|
||||
#endif
|
||||
{
|
||||
temp_var = bind_variable (name, string, 0);
|
||||
if (legal_identifier (name))
|
||||
VSETATTR (temp_var, (att_exported | att_imported));
|
||||
else
|
||||
VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
|
||||
array_needs_making = 1;
|
||||
if (temp_var)
|
||||
{
|
||||
if (legal_identifier (name))
|
||||
VSETATTR (temp_var, (att_exported | att_imported));
|
||||
else
|
||||
VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
|
||||
array_needs_making = 1;
|
||||
}
|
||||
}
|
||||
|
||||
name[char_index] = '=';
|
||||
@@ -2389,7 +2392,7 @@ bind_int_variable (lhs, rhs)
|
||||
#endif
|
||||
v = bind_variable (lhs, rhs, 0);
|
||||
|
||||
if (isint)
|
||||
if (v && isint)
|
||||
VSETATTR (v, att_integer);
|
||||
|
||||
return (v);
|
||||
@@ -2838,7 +2841,7 @@ delete_all_variables (hashed_vars)
|
||||
if (!entry) \
|
||||
{ \
|
||||
entry = bind_variable (name, "", 0); \
|
||||
if (!no_invisible_vars) entry->attributes |= att_invisible; \
|
||||
if (!no_invisible_vars && entry) entry->attributes |= att_invisible; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
Reference in New Issue
Block a user