commit bash-20100722 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 22:03:26 -05:00
parent e054386f3f
commit 9ec5ed6640
69 changed files with 15989 additions and 9437 deletions
+29
View File
@@ -10219,3 +10219,32 @@ parse.y
- fix problem in parse_comsub where extra space was added to here-doc
delimiter if the first word in the comsub contained a `/'. Fixes
bug reported by Alex Khesin <alexk@google.com>
7/20
----
parse.y
- change reserved_word_acceptable to return success if the last two
tokens read were `function WORD'. Allows function definitions like
function good [[ -x foo ]];. Fixes bug reported by Linda Walsh
<bash@tlinx.org>
doc/{bash.1,bashref.texi}
- change function definition meta-syntax to make it clearer, rather
than let the text note the optional portions
7/24
----
bashhist.c
- change bash_history_inhibit_expansion() to suppress history expansion
for $! parameter expansion. Fixes debian bug #589745 submitted by
Frank Heckenbach <f.heckenbach@fh-soft.de>
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
+43
View File
@@ -10200,3 +10200,46 @@ jobs.[ch]
execute_cmd.c
- changes to lastpipe code to make `pipefail' option, $PIPESTATUS, and
$? work correctly. Uses append_process and job_exit_status
7/10
----
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
7/13
----
pcomplib.[ch]
- new member for struct compspec: lcommand. for future use
7/15
----
parse.y
- fix problem in parse_comsub where extra space was added to here-doc
delimiter if the first word in the comsub contained a `/'. Fixes
bug reported by Alex Khesin <alexk@google.com>
7/20
----
parse.y
- change reserved_word_acceptable to return success if the last two
tokens read were `function WORD'. Allows function definitions like
function good [[ -x foo ]];. Fixes bug reported by Linda Walsh
<bash@tlinx.org>
doc/{bash.1,bashref.texi}
- change function definition meta-syntax to make it clearer, rather
than let the text note the optional portions
7/24
----
bashhist.c
- change bash_history_inhibit_expansion() to suppress history expansion
for $! parameter expansion. Fixes debian bug #589745 submitted by
Frank Heckenbach <f.heckenbach@fh-soft.de>
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>
+1
View File
@@ -315,6 +315,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
+1
View File
@@ -804,6 +804,7 @@ tests/comsub-posix.tests f
tests/comsub-posix.right f
tests/comsub-posix1.sub f
tests/comsub-posix2.sub f
tests/comsub-posix3.sub f
tests/cond.tests f
tests/cond.right f
tests/cond-regexp.sub f
+3
View File
@@ -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);
+1 -1
View File
@@ -1,6 +1,6 @@
/* bashhist.c -- bash interface to the GNU history library. */
/* 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.
+44 -23
View File
@@ -265,9 +265,11 @@ SSHHEELLLL GGRRAAMMMMAARR
If the ttiimmee reserved word precedes a pipeline, the elapsed as well as
user and system time consumed by its execution are reported when the
pipeline terminates. The --pp option changes the output format to that
specified by POSIX. The TTIIMMEEFFOORRMMAATT variable may be set to a format
string that specifies how the timing information should be displayed;
see the description of TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below.
specified by POSIX. When the shell is in _p_o_s_i_x _m_o_d_e, it does not rec-
ognize ttiimmee as a reserved word if the next token begins with a `-'.
The TTIIMMEEFFOORRMMAATT variable may be set to a format string that specifies
how the timing information should be displayed; see the description of
TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below.
When the shell is in _p_o_s_i_x _m_o_d_e, ttiimmee may be followed by a newline. In
this case, the shell displays the total user and system time consumed
@@ -506,7 +508,8 @@ SSHHEELLLL GGRRAAMMMMAARR
executes a compound command with a new set of positional parameters.
Shell functions are declared as follows:
[ ffuunnccttiioonn ] _n_a_m_e () _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
_n_a_m_e () _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
ffuunnccttiioonn _n_a_m_e [()] _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
This defines a function named _n_a_m_e. The reserved word ffuunnccttiioonn
is optional. If the ffuunnccttiioonn reserved word is supplied, the
parentheses are optional. The _b_o_d_y of the function is the com-
@@ -757,22 +760,24 @@ PPAARRAAMMEETTEERRSS
The command argument to the --cc invocation option.
BBAASSHH__LLIINNEENNOO
An array variable whose members are the line numbers in source
files corresponding to each member of FFUUNNCCNNAAMMEE.
$${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file where
$${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if refer-
enced within another shell function). The corresponding source
file name is $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}}. Use LLIINNEENNOO to obtain the cur-
rent line number.
files where each corresponding member of FFUUNNCCNNAAMMEE was invoked.
$${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file
($${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}) where $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or
$${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if referenced within another shell func-
tion). Use LLIINNEENNOO to obtain the current line number.
BBAASSHH__RREEMMAATTCCHH
An array variable whose members are assigned by the ==~~ binary
operator to the [[[[ conditional command. The element with index
0 is the portion of the string matching the entire regular
expression. The element with index _n is the portion of the
An array variable whose members are assigned by the ==~~ binary
operator to the [[[[ conditional command. The element with index
0 is the portion of the string matching the entire regular
expression. The element with index _n is the portion of the
string matching the _nth parenthesized subexpression. This vari-
able is read-only.
BBAASSHH__SSOOUURRCCEE
An array variable whose members are the source filenames corre-
sponding to the elements in the FFUUNNCCNNAAMMEE array variable.
An array variable whose members are the source filenames where
the corresponding shell function names in the FFUUNNCCNNAAMMEE array
variable are defined. The shell function $${{FFUUNNCCNNAAMMEE[[_$_i]]}} is
defined in the file $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}} and called from
$${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}.
BBAASSHH__SSUUBBSSHHEELLLL
Incremented by one each time a subshell or subshell environment
is spawned. The initial value is 0.
@@ -863,10 +868,19 @@ PPAARRAAMMEETTEERRSS
An array variable containing the names of all shell functions
currently in the execution call stack. The element with index 0
is the name of any currently-executing shell function. The bot-
tom-most element is "main". This variable exists only when a
shell function is executing. Assignments to FFUUNNCCNNAAMMEE have no
effect and return an error status. If FFUUNNCCNNAAMMEE is unset, it
loses its special properties, even if it is subsequently reset.
tom-most element (the one with the highest index) is "main".
This variable exists only when a shell function is executing.
Assignments to FFUUNNCCNNAAMMEE have no effect and return an error sta-
tus. If FFUUNNCCNNAAMMEE is unset, it loses its special properties,
even if it is subsequently reset.
This variable can be used with BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE.
Each element of FFUUNNCCNNAAMMEE has corresponding elements in
BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE to describe the call stack. For
instance, $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called from the file
$${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}} at line number $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}}. The
ccaalllleerr builtin displays the current call stack using this infor-
mation.
GGRROOUUPPSS An array variable containing the list of groups of which the
current user is a member. Assignments to GGRROOUUPPSS have no effect
@@ -2087,7 +2101,9 @@ FFUUNNCCTTIIOONNSS
tically-named entries in the environment passed to the shell's chil-
dren. Care should be taken in cases where this may cause a problem.
Functions may be recursive. No limit is imposed on the number of
Functions may be recursive. The FFUUNNCCNNEESSTT variable may be used to limit
the depth of the function call stack and restrict the number of func-
tion invocations. By default, no limit is imposed on the number of
recursive calls.
AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
@@ -4157,7 +4173,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
\\aa alert (bell)
\\bb backspace
\\cc suppress further output
\\ee an escape character
\\ee
\\EE an escape character
\\ff form feed
\\nn new line
\\rr carriage return
@@ -5032,6 +5049,10 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS above). This
option is enabled by default.
llaassttppiippee
If set, and job control is not active, the shell runs
the last command of a pipeline not executed in the back-
ground in the current shell environment.
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
@@ -5433,4 +5454,4 @@ BBUUGGSS
GNU Bash-4.1 2010 June 12 BASH(1)
GNU Bash-4.2 2010 July 21 BASH(1)
+12 -5
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Fri Jul 2 17:31:49 EDT 2010
.\" Last Change: Wed Jul 21 08:47:30 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 July 21" "GNU Bash-4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -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.
@@ -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
@@ -7338,6 +7343,8 @@ backspace
suppress further output
.TP
.B \ee
.TP
.B \eE
an escape character
.TP
.B \ef
+45 -14
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 June 12<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2010 July 21<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -736,6 +736,8 @@ reserved word precedes a pipeline, the elapsed as well as user and
system time consumed by its execution are reported when the pipeline
terminates.
The <B>-p</B> option changes the output format to that specified by POSIX.
When the shell is in <I>posix mode</I>, it does not recognize
<B>time</B> as a reserved word if the next token begins with a `-'.
The
<FONT SIZE=-1><B>TIMEFORMAT</B>
@@ -1214,7 +1216,10 @@ 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:
<DL COMPACT>
<DT>[ <B>function</B> ] <I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
<DT><I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
<DT><B>function</B> <I>name</I> [()] <I>compound-command</I> [<I>redirection</I>]<DD>
This defines a function named <I>name</I>.
The reserved word <B>function</B> is optional.
If the <B>function</B> reserved word is supplied, the parentheses are optional.
@@ -1856,15 +1861,16 @@ The command argument to the <B>-c</B> invocation option.
<DD>
An array variable whose members are the line numbers in source files
corresponding to each member of
<FONT SIZE=-1><B>FUNCNAME</B>.
where each corresponding member of
<FONT SIZE=-1><B>FUNCNAME</B>
</FONT>
was invoked.
<B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
file where <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
file (<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>) where
<B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
(or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
shell function).
The corresponding source file name is <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B>.
Use
<FONT SIZE=-1><B>LINENO</B>
@@ -1883,12 +1889,16 @@ This variable is read-only.
<DT><B>BASH_SOURCE</B>
<DD>
An array variable whose members are the source filenames corresponding
to the elements in the
An array variable whose members are the source filenames
where the corresponding shell function names in the
<FONT SIZE=-1><B>FUNCNAME</B>
</FONT>
array variable.
array variable are defined.
The shell function
<B>${FUNCNAME[</B><I>$i</I><B>]}</B> is defined in the file
<B>${BASH_SOURCE[</B><I>$i</I><B>]}</B> and called from
<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>.
<DT><B>BASH_SUBSHELL</B>
<DD>
@@ -2057,7 +2067,7 @@ An array variable containing the names of all shell functions
currently in the execution call stack.
The element with index 0 is the name of any currently-executing
shell function.
The bottom-most element is
The bottom-most element (the one with the highest index) is
<TT>&quot;main&quot;</TT>.
This variable exists only when a shell function is executing.
@@ -2072,6 +2082,17 @@ If
</FONT>
is unset, it loses its special properties, even if it is
subsequently reset.
<P>
This variable can be used with <B>BASH_LINENO</B> and <B>BASH_SOURCE</B>.
Each element of <B>FUNCNAME</B> has corresponding elements in
<B>BASH_LINENO</B> and <B>BASH_SOURCE</B> to describe the call stack.
For instance, <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called from the file
<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B> at line number
<B>${BASH_LINENO[</B><I>$i</I><B>]}</B>.
The <B>caller</B> builtin displays the current call stack using this
information.
<DT><B>GROUPS</B>
<DD>
@@ -4976,8 +4997,10 @@ shell's children.
Care should be taken in cases where this may cause a problem.
<P>
Functions may be recursive. No limit is imposed on the number
of recursive calls.
Functions may be recursive.
The <B>FUNCNEST</B> variable may be used to limit the depth of the
function call stack and restrict the number of function invocations.
By default, no limit is imposed on the number of recursive calls.
<A NAME="lbBV">&nbsp;</A>
<H3>ARITHMETIC EVALUATION</H3>
@@ -9402,6 +9425,9 @@ backspace
suppress further output
<DT><B>\e</B>
<DD>
<DT><B>\E</B>
<DD>
an escape character
<DT><B>\f</B>
@@ -11585,6 +11611,11 @@ line to be ignored in an interactive shell (see
</FONT>
above). This option is enabled by default.
<DT><B>lastpipe</B>
<DD>
If set, and job control is not active, the shell runs the last command of
a pipeline not executed in the background in the current shell environment.
<DT><B>lithist</B>
<DD>
@@ -12629,7 +12660,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash-4.1<TH ALIGN=CENTER width=33%>2010 June 12<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash-4.2<TH ALIGN=CENTER width=33%>2010 July 21<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -12735,6 +12766,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 29 June 2010 14:02:49 EDT
Time: 21 July 2010 08:54:57 EDT
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+6299 -6262
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -77,16 +77,16 @@
@xrdef{Shell Parameters-snt}{Section@tie 3.4}
@xrdef{Positional Parameters-title}{Positional Parameters}
@xrdef{Positional Parameters-snt}{Section@tie 3.4.1}
@xrdef{Special Parameters-title}{Special Parameters}
@xrdef{Special Parameters-snt}{Section@tie 3.4.2}
@xrdef{Shell Parameters-pg}{17}
@xrdef{Positional Parameters-pg}{17}
@xrdef{Special Parameters-title}{Special Parameters}
@xrdef{Special Parameters-snt}{Section@tie 3.4.2}
@xrdef{Shell Expansions-title}{Shell Expansions}
@xrdef{Shell Expansions-snt}{Section@tie 3.5}
@xrdef{Special Parameters-pg}{18}
@xrdef{Shell Expansions-pg}{18}
@xrdef{Brace Expansion-title}{Brace Expansion}
@xrdef{Brace Expansion-snt}{Section@tie 3.5.1}
@xrdef{Shell Expansions-pg}{19}
@xrdef{Brace Expansion-pg}{19}
@xrdef{Tilde Expansion-title}{Tilde Expansion}
@xrdef{Tilde Expansion-snt}{Section@tie 3.5.2}
@@ -100,17 +100,17 @@
@xrdef{Arithmetic Expansion-snt}{Section@tie 3.5.5}
@xrdef{Process Substitution-title}{Process Substitution}
@xrdef{Process Substitution-snt}{Section@tie 3.5.6}
@xrdef{Word Splitting-title}{Word Splitting}
@xrdef{Word Splitting-snt}{Section@tie 3.5.7}
@xrdef{Command Substitution-pg}{24}
@xrdef{Arithmetic Expansion-pg}{24}
@xrdef{Process Substitution-pg}{24}
@xrdef{Word Splitting-title}{Word Splitting}
@xrdef{Word Splitting-snt}{Section@tie 3.5.7}
@xrdef{Filename Expansion-title}{Filename Expansion}
@xrdef{Filename Expansion-snt}{Section@tie 3.5.8}
@xrdef{Pattern Matching-title}{Pattern Matching}
@xrdef{Pattern Matching-snt}{Section@tie 3.5.8.1}
@xrdef{Word Splitting-pg}{25}
@xrdef{Filename Expansion-pg}{25}
@xrdef{Pattern Matching-title}{Pattern Matching}
@xrdef{Pattern Matching-snt}{Section@tie 3.5.8.1}
@xrdef{Pattern Matching-pg}{26}
@xrdef{Quote Removal-title}{Quote Removal}
@xrdef{Quote Removal-snt}{Section@tie 3.5.9}
@@ -123,9 +123,9 @@
@xrdef{Simple Command Expansion-title}{Simple Command Expansion}
@xrdef{Simple Command Expansion-snt}{Section@tie 3.7.1}
@xrdef{Executing Commands-pg}{30}
@xrdef{Simple Command Expansion-pg}{30}
@xrdef{Command Search and Execution-title}{Command Search and Execution}
@xrdef{Command Search and Execution-snt}{Section@tie 3.7.2}
@xrdef{Simple Command Expansion-pg}{31}
@xrdef{Command Search and Execution-pg}{31}
@xrdef{Command Execution Environment-title}{Command Execution Environment}
@xrdef{Command Execution Environment-snt}{Section@tie 3.7.3}
@@ -156,7 +156,7 @@
@xrdef{The Set Builtin-title}{The Set Builtin}
@xrdef{The Set Builtin-snt}{Section@tie 4.3.1}
@xrdef{Modifying Shell Behavior-pg}{53}
@xrdef{The Set Builtin-pg}{53}
@xrdef{The Set Builtin-pg}{54}
@xrdef{The Shopt Builtin-title}{The Shopt Builtin}
@xrdef{The Shopt Builtin-snt}{Section@tie 4.3.2}
@xrdef{The Shopt Builtin-pg}{57}
+2 -2
View File
@@ -36,11 +36,11 @@
\entry{read}{50}{\code {read}}
\entry{readarray}{51}{\code {readarray}}
\entry{source}{51}{\code {source}}
\entry{type}{51}{\code {type}}
\entry{type}{52}{\code {type}}
\entry{typeset}{52}{\code {typeset}}
\entry{ulimit}{52}{\code {ulimit}}
\entry{unalias}{53}{\code {unalias}}
\entry{set}{53}{\code {set}}
\entry{set}{54}{\code {set}}
\entry{shopt}{57}{\code {shopt}}
\entry{dirs}{83}{\code {dirs}}
\entry{popd}{84}{\code {popd}}
+2 -2
View File
@@ -60,7 +60,7 @@
\entry {\code {readonly}}{40}
\entry {\code {return}}{40}
\initial {S}
\entry {\code {set}}{53}
\entry {\code {set}}{54}
\entry {\code {shift}}{41}
\entry {\code {shopt}}{57}
\entry {\code {source}}{51}
@@ -69,7 +69,7 @@
\entry {\code {test}}{41}
\entry {\code {times}}{42}
\entry {\code {trap}}{42}
\entry {\code {type}}{51}
\entry {\code {type}}{52}
\entry {\code {typeset}}{52}
\initial {U}
\entry {\code {ulimit}}{52}
+2 -2
View File
@@ -44,7 +44,7 @@
\entry{shell variable}{17}{shell variable}
\entry{parameters, positional}{17}{parameters, positional}
\entry{parameters, special}{18}{parameters, special}
\entry{expansion}{18}{expansion}
\entry{expansion}{19}{expansion}
\entry{brace expansion}{19}{brace expansion}
\entry{expansion, brace}{19}{expansion, brace}
\entry{tilde expansion}{20}{tilde expansion}
@@ -63,7 +63,7 @@
\entry{pattern matching}{26}{pattern matching}
\entry{matching, pattern}{26}{matching, pattern}
\entry{redirection}{27}{redirection}
\entry{command expansion}{30}{command expansion}
\entry{command expansion}{31}{command expansion}
\entry{command execution}{31}{command execution}
\entry{command search}{31}{command search}
\entry{execution environment}{32}{execution environment}
+2 -2
View File
@@ -14,7 +14,7 @@
\initial {C}
\entry {command editing}{96}
\entry {command execution}{31}
\entry {command expansion}{30}
\entry {command expansion}{31}
\entry {command history}{123}
\entry {command search}{31}
\entry {command substitution}{24}
@@ -41,7 +41,7 @@
\entry {event designators}{125}
\entry {execution environment}{32}
\entry {exit status}{3, 33}
\entry {expansion}{18}
\entry {expansion}{19}
\entry {expansion, arithmetic}{24}
\entry {expansion, brace}{19}
\entry {expansion, filename}{25}
BIN
View File
Binary file not shown.
+47 -17
View File
@@ -1,6 +1,6 @@
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on June, 29 2010 by texi2html 1.64 -->
<!-- Created on July, 21 2010 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
@@ -33,12 +33,12 @@ Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
<H1>Bash Reference Manual</H1></P><P>
This text is a brief description of the features that are present in
the Bash shell (version 4.1, 12 June 2010).
the Bash shell (version 4.2, 21 July 2010).
</P><P>
This is Edition 4.1, last updated 12 June 2010,
This is Edition 4.2, last updated 21 July 2010,
of <CITE>The GNU Bash Reference Manual</CITE>,
for <CODE>Bash</CODE>, Version 4.1.
for <CODE>Bash</CODE>, Version 4.2.
</P><P>
Bash contains features that appear in other popular shells, and some
@@ -914,6 +914,9 @@ The statistics currently consist of elapsed (wall-clock) time and
user and system time consumed by the command's execution.
The <SAMP>`-p'</SAMP> option changes the output format to that specified
by POSIX.
When the shell is in POSIX mode (see section <A HREF="bashref.html#SEC91">6.11 Bash POSIX Mode</A>),
it does not recognize <CODE>time</CODE> as a reserved word if the next
token begins with a <SAMP>`-'</SAMP>.
The <CODE>TIMEFORMAT</CODE> variable may be set to a format string that
specifies how the timing information should be displayed.
See section <A HREF="bashref.html#SEC68">5.2 Bash Variables</A>, for a description of the available formats.
@@ -1137,7 +1140,7 @@ until it evaluates to zero.
Each time <VAR>expr2</VAR> evaluates to a non-zero value, <VAR>commands</VAR> are
executed and the arithmetic expression <VAR>expr3</VAR> 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</VAR>
The return value is the exit status of the last command in <VAR>commands</VAR>
that is executed, or false if any of the expressions is invalid.
</P><P>
@@ -1630,7 +1633,8 @@ shell context; no new process is created to interpret them.
Functions are declared using this syntax:
<A NAME="IDX45"></A>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>[ <CODE>function</CODE> ] <VAR>name</VAR> () <VAR>compound-command</VAR> [ <VAR>redirections</VAR> ]
<TABLE><tr><td>&nbsp;</td><td class=example><pre><VAR>name</VAR> () <VAR>compound-command</VAR> [ <VAR>redirections</VAR> ]<BR>or<BR>
<CODE>function</CODE> <VAR>name</VAR> [()] <VAR>compound-command</VAR> [ <VAR>redirections</VAR> ]
</pre></td></tr></table></P><P>
This defines a shell function named <VAR>name</VAR>. The reserved
@@ -1735,8 +1739,10 @@ shell's children.
Care should be taken in cases where this may cause a problem.
</P><P>
Functions may be recursive. No limit is placed on the number of
recursive calls.
Functions may be recursive.
The <CODE>FUNCNEST</CODE> variable may be used to limit the depth of the
function call stack and restrict the number of function invocations.
By default, no limit is placed on the number of recursive calls.
</P><P>
<A NAME="Shell Parameters"></A>
@@ -4743,6 +4749,7 @@ escape characters by default.
<DT><CODE>\c</CODE>
<DD>suppress further output
<DT><CODE>\e</CODE>
<DD><DT><CODE>\E</CODE>
<DD>escape
<DT><CODE>\f</CODE>
<DD>form feed
@@ -5914,6 +5921,11 @@ line to be ignored in an interactive shell.
This option is enabled by default.
<P>
<DT><CODE>lastpipe</CODE>
<DD>If set, and job control is not active, the shell runs the last command of
a pipeline not executed in the background in the current shell environment.
<P>
<DT><CODE>lithist</CODE>
<DD>If enabled, and the <CODE>cmdhist</CODE>
option is enabled, multi-line commands are saved to the history with
@@ -6321,11 +6333,11 @@ The command argument to the <SAMP>`-c'</SAMP> invocation option.
<DT><CODE>BASH_LINENO</CODE>
<DD><A NAME="IDX153"></A>
An array variable whose members are the line numbers in source files
corresponding to each member of <VAR>FUNCNAME</VAR>.
<CODE>${BASH_LINENO[$i]}</CODE> is the line number in the source file where
where each corresponding member of <VAR>FUNCNAME</VAR> was invoked.
<CODE>${BASH_LINENO[$i]}</CODE> is the line number in the source file
(<CODE>${BASH_SOURCE[$i+1]}</CODE>) where
<CODE>${FUNCNAME[$i]}</CODE> was called (or <CODE>${BASH_LINENO[$i-1]}</CODE> if
referenced within another shell function).
The corresponding source file name is <CODE>${BASH_SOURCE[$i]}</CODE>.
referenced within another shell function).
Use <CODE>LINENO</CODE> to obtain the current line number.
<P>
@@ -6345,8 +6357,11 @@ This variable is read-only.
<A NAME="IDX156"></A>
<DT><CODE>BASH_SOURCE</CODE>
<DD><A NAME="IDX157"></A>
An array variable whose members are the source filenames corresponding
to the elements in the <CODE>FUNCNAME</CODE> array variable.
An array variable whose members are the source filenames where the
corresponding shell function names in the <CODE>FUNCNAME</CODE> array
variable are defined.
The shell function <CODE>${FUNCNAME[$i]}</CODE> is defined in the file
<CODE>${BASH_SOURCE[$i]}</CODE> and called from <CODE>${BASH_SOURCE[$i+1]}</CODE>
<P>
<A NAME="IDX158"></A>
@@ -6573,13 +6588,23 @@ An array variable containing the names of all shell functions
currently in the execution call stack.
The element with index 0 is the name of any currently-executing
shell function.
The bottom-most element is <CODE>"main"</CODE>.
The bottom-most element (the one with the highest index)
is <CODE>"main"</CODE>.
This variable exists only when a shell function is executing.
Assignments to <CODE>FUNCNAME</CODE> have no effect and return an error status.
If <CODE>FUNCNAME</CODE> is unset, it loses its special properties, even if
it is subsequently reset.
<P>
This variable can be used with <CODE>BASH_LINENO</CODE> and <CODE>BASH_SOURCE</CODE>.
Each element of <CODE>FUNCNAME</CODE> has corresponding elements in
<CODE>BASH_LINENO</CODE> and <CODE>BASH_SOURCE</CODE> to describe the call stack.
For instance, <CODE>${FUNCNAME[$i]}</CODE> was called from the file
<CODE>${BASH_SOURCE[$i+1]}</CODE> at line number <CODE>${BASH_LINENO[$i]}</CODE>.
The <CODE>caller</CODE> builtin displays the current call stack using this
information.
</P><P>
<A NAME="IDX200"></A>
<DT><CODE>FUNCNEST</CODE>
<DD><A NAME="IDX201"></A>
@@ -8730,6 +8755,11 @@ one of those defined to perform pattern removal. In this case, they do
not have to appear as matched pairs.
<P>
<LI>
The parser does not recognize <CODE>time</CODE> as a reserved word if the next
token begins with a <SAMP>`-'</SAMP>.
<P>
<LI>
If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
@@ -16327,7 +16357,7 @@ to permit their use in free software.
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="bashref.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>About this document</H1>
This document was generated by <I>Chet Ramey</I> on <I>June, 29 2010</I>
This document was generated by <I>Chet Ramey</I> on <I>July, 21 2010</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
<P></P>
@@ -16489,7 +16519,7 @@ the following structure:
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Chet Ramey</I> on <I>June, 29 2010</I>
by <I>Chet Ramey</I> on <I>July, 21 2010</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
+277 -250
View File
@@ -2,10 +2,10 @@ This is bashref.info, produced by makeinfo version 4.13 from
/Users/chet/src/bash/src/doc/bashref.texi.
This text is a brief description of the features that are present in
the Bash shell (version 4.1, 12 June 2010).
the Bash shell (version 4.2, 21 July 2010).
This is Edition 4.1, last updated 12 June 2010, of `The GNU Bash
Reference Manual', for `Bash', Version 4.1.
This is Edition 4.2, last updated 21 July 2010, of `The GNU Bash
Reference Manual', for `Bash', Version 4.2.
Copyright (C) 1988-2010 Free Software Foundation, Inc.
@@ -38,10 +38,10 @@ Bash Features
*************
This text is a brief description of the features that are present in
the Bash shell (version 4.1, 12 June 2010).
the Bash shell (version 4.2, 21 July 2010).
This is Edition 4.1, last updated 12 June 2010, of `The GNU Bash
Reference Manual', for `Bash', Version 4.1.
This is Edition 4.2, last updated 21 July 2010, of `The GNU Bash
Reference Manual', for `Bash', Version 4.2.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -591,12 +591,14 @@ any redirections specified by the command.
the pipeline once it finishes. The statistics currently consist of
elapsed (wall-clock) time and user and system time consumed by the
command's execution. The `-p' option changes the output format to that
specified by POSIX. The `TIMEFORMAT' variable may be set to a format
string that specifies how the timing information should be displayed.
*Note Bash Variables::, for a description of the available formats.
The use of `time' as a reserved word permits the timing of shell
builtins, shell functions, and pipelines. An external `time' command
cannot time these easily.
specified by POSIX. When the shell is in POSIX mode (*note Bash POSIX
Mode::), it does not recognize `time' as a reserved word if the next
token begins with a `-'. The `TIMEFORMAT' variable may be set to a
format string that specifies how the timing information should be
displayed. *Note Bash Variables::, for a description of the available
formats. The use of `time' as a reserved word permits the timing of
shell builtins, shell functions, and pipelines. An external `time'
command cannot time these easily.
When the shell is in POSIX mode (*note Bash POSIX Mode::), `time'
may be followed by a newline. In this case, the shell displays the
@@ -738,7 +740,7 @@ syntax, it may be replaced with one or more newlines.
COMMANDS are executed and the arithmetic expression 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 LIST that is executed, or false if any of the
command in COMMANDS that is executed, or false if any of the
expressions is invalid.
@@ -1071,7 +1073,10 @@ executed. Shell functions are executed in the current shell context;
no new process is created to interpret them.
Functions are declared using this syntax:
[ `function' ] NAME () COMPOUND-COMMAND [ REDIRECTIONS ]
NAME () COMPOUND-COMMAND [ REDIRECTIONS ]
or
`function' NAME [()] COMPOUND-COMMAND [ REDIRECTIONS ]
This defines a shell function named NAME. The reserved word
`function' is optional. If the `function' reserved word is supplied,
@@ -1146,7 +1151,9 @@ variables with the same name may result in multiple identically-named
entries in the environment passed to the shell's children. Care should
be taken in cases where this may cause a problem.
Functions may be recursive. No limit is placed on the number of
Functions may be recursive. The `FUNCNEST' variable may be used to
limit the depth of the function call stack and restrict the number of
function invocations. By default, no limit is placed on the number of
recursive calls.

@@ -3116,6 +3123,7 @@ POSIX standard.
suppress further output
`\e'
`\E'
escape
`\f'
@@ -4033,6 +4041,11 @@ This builtin allows you to change additional shell optional behavior.
remaining characters on that line to be ignored in an
interactive shell. This option is enabled by default.
`lastpipe'
If set, and job control is not active, the shell runs the
last command of a pipeline not executed in the background in
the current shell environment.
`lithist'
If enabled, and the `cmdhist' option is enabled, multi-line
commands are saved to the history with embedded newlines
@@ -4284,12 +4297,11 @@ Variables::).
`BASH_LINENO'
An array variable whose members are the line numbers in source
files corresponding to each member of FUNCNAME.
`${BASH_LINENO[$i]}' is the line number in the source file where
`${FUNCNAME[$i]}' was called (or `${BASH_LINENO[$i-1]}' if
referenced within another shell function). The corresponding
source file name is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain
the current line number.
files where each corresponding member of FUNCNAME was invoked.
`${BASH_LINENO[$i]}' is the line number in the source file
(`${BASH_SOURCE[$i+1]}') where `${FUNCNAME[$i]}' was called (or
`${BASH_LINENO[$i-1]}' if referenced within another shell
function). Use `LINENO' to obtain the current line number.
`BASH_REMATCH'
An array variable whose members are assigned by the `=~' binary
@@ -4300,8 +4312,11 @@ Variables::).
parenthesized subexpression. This variable is read-only.
`BASH_SOURCE'
An array variable whose members are the source filenames
corresponding to the elements in the `FUNCNAME' array variable.
An array variable whose members are the source filenames where the
corresponding shell function names in the `FUNCNAME' array
variable are defined. The shell function `${FUNCNAME[$i]}' is
defined in the file `${BASH_SOURCE[$i]}' and called from
`${BASH_SOURCE[$i+1]}'
`BASH_SUBSHELL'
Incremented by one each time a subshell or subshell environment is
@@ -4443,10 +4458,19 @@ Variables::).
An array variable containing the names of all shell functions
currently in the execution call stack. The element with index 0
is the name of any currently-executing shell function. The
bottom-most element is `"main"'. This variable exists only when a
shell function is executing. Assignments to `FUNCNAME' have no
effect and return an error status. If `FUNCNAME' is unset, it
loses its special properties, even if it is subsequently reset.
bottom-most element (the one with the highest index) is `"main"'.
This variable exists only when a shell function is executing.
Assignments to `FUNCNAME' have no effect and return an error
status. If `FUNCNAME' is unset, it loses its special properties,
even if it is subsequently reset.
This variable can be used with `BASH_LINENO' and `BASH_SOURCE'.
Each element of `FUNCNAME' has corresponding elements in
`BASH_LINENO' and `BASH_SOURCE' to describe the call stack. For
instance, `${FUNCNAME[$i]}' was called from the file
`${BASH_SOURCE[$i+1]}' at line number `${BASH_LINENO[$i]}'. The
`caller' builtin displays the current call stack using this
information.
`FUNCNEST'
If set to a numeric value greater than 0, defines a maximum
@@ -5921,102 +5945,105 @@ startup files.
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
21. If a POSIX special builtin returns an error status, a
21. The parser does not recognize `time' as a reserved word if the next
token begins with a `-'.
22. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
22. If `CDPATH' is set, the `cd' builtin will not implicitly append
23. If `CDPATH' is set, the `cd' builtin will not implicitly append
the current directory to it. This means that `cd' will fail if no
valid directory name can be constructed from any of the entries in
`$CDPATH', even if the a directory with the same name as the name
given as an argument to `cd' exists in the current directory.
23. A non-interactive shell exits with an error status if a variable
24. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
24. A non-interactive shell exits with an error status if the iteration
25. A non-interactive shell exits with an error status if the iteration
variable in a `for' statement or the selection variable in a
`select' statement is a readonly variable.
25. Process substitution is not available.
26. Process substitution is not available.
26. Assignment statements preceding POSIX special builtins persist in
27. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
27. Assignment statements preceding shell function calls persist in the
28. Assignment statements preceding shell function calls persist in the
shell environment after the function returns, as if a POSIX
special builtin command had been executed.
28. The `export' and `readonly' builtin commands display their output
29. The `export' and `readonly' builtin commands display their output
in the format required by POSIX.
29. The `trap' builtin displays signal names without the leading `SIG'.
30. The `trap' builtin displays signal names without the leading `SIG'.
30. The `trap' builtin doesn't check the first argument for a possible
31. The `trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they
should use `-' as the first argument.
31. The `.' and `source' builtins do not search the current directory
32. The `.' and `source' builtins do not search the current directory
for the filename argument if it is not found by searching `PATH'.
32. Subshells spawned to execute command substitutions inherit the
33. Subshells spawned to execute command substitutions inherit the
value of the `-e' option from the parent shell. When not in POSIX
mode, Bash clears the `-e' option in such subshells.
33. Alias expansion is always enabled, even in non-interactive shells.
34. Alias expansion is always enabled, even in non-interactive shells.
34. When the `alias' builtin displays alias definitions, it does not
35. When the `alias' builtin displays alias definitions, it does not
display them with a leading `alias ' unless the `-p' option is
supplied.
35. When the `set' builtin is invoked without options, it does not
36. When the `set' builtin is invoked without options, it does not
display shell function names and definitions.
36. When the `set' builtin is invoked without options, it displays
37. When the `set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
37. When the `cd' builtin is invoked in LOGICAL mode, and the pathname
38. When the `cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from `$PWD' and the directory name supplied as an
argument does not refer to an existing directory, `cd' will fail
instead of falling back to PHYSICAL mode.
38. When the `pwd' builtin is supplied the `-P' option, it resets
39. When the `pwd' builtin is supplied the `-P' option, it resets
`$PWD' to a pathname containing no symlinks.
39. The `pwd' builtin verifies that the value it prints is the same as
40. The `pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the `-P' option.
40. When listing the history, the `fc' builtin does not include an
41. When listing the history, the `fc' builtin does not include an
indication of whether or not a history entry has been modified.
41. The default editor used by `fc' is `ed'.
42. The default editor used by `fc' is `ed'.
42. The `type' and `command' builtins will not report a non-executable
43. The `type' and `command' builtins will not report a non-executable
file as having been found, though the shell will attempt to
execute such a file if it is the only so-named file found in
`$PATH'.
43. The `vi' editing mode will invoke the `vi' editor directly when
44. The `vi' editing mode will invoke the `vi' editor directly when
the `v' command is run, instead of checking `$VISUAL' and
`$EDITOR'.
44. When the `xpg_echo' option is enabled, Bash does not attempt to
45. When the `xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to `echo' as options. Each argument is
displayed, after escape characters are converted.
45. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
46. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
and `-f' options.
46. The arrival of `SIGCHLD' when a trap is set on `SIGCHLD' does not
47. The arrival of `SIGCHLD' when a trap is set on `SIGCHLD' does not
interrupt the `wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
@@ -9867,7 +9894,7 @@ D.1 Index of Shell Builtin Commands
* disown: Job Control Builtins.
(line 83)
* echo: Bash Builtins. (line 226)
* enable: Bash Builtins. (line 286)
* enable: Bash Builtins. (line 287)
* eval: Bourne Shell Builtins.
(line 66)
* exec: Bourne Shell Builtins.
@@ -9884,26 +9911,26 @@ D.1 Index of Shell Builtin Commands
(line 106)
* hash: Bourne Shell Builtins.
(line 148)
* help: Bash Builtins. (line 314)
* help: Bash Builtins. (line 315)
* history: Bash History Builtins.
(line 39)
* jobs: Job Control Builtins.
(line 25)
* kill: Job Control Builtins.
(line 57)
* let: Bash Builtins. (line 334)
* local: Bash Builtins. (line 341)
* logout: Bash Builtins. (line 351)
* mapfile: Bash Builtins. (line 355)
* let: Bash Builtins. (line 335)
* local: Bash Builtins. (line 342)
* logout: Bash Builtins. (line 352)
* mapfile: Bash Builtins. (line 356)
* popd: Directory Stack Builtins.
(line 37)
* printf: Bash Builtins. (line 401)
* printf: Bash Builtins. (line 402)
* pushd: Directory Stack Builtins.
(line 58)
* pwd: Bourne Shell Builtins.
(line 167)
* read: Bash Builtins. (line 446)
* readarray: Bash Builtins. (line 526)
* read: Bash Builtins. (line 447)
* readarray: Bash Builtins. (line 527)
* readonly: Bourne Shell Builtins.
(line 176)
* return: Bourne Shell Builtins.
@@ -9912,7 +9939,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 205)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 534)
* source: Bash Builtins. (line 535)
* suspend: Job Control Builtins.
(line 94)
* test: Bourne Shell Builtins.
@@ -9921,12 +9948,12 @@ D.1 Index of Shell Builtin Commands
(line 285)
* trap: Bourne Shell Builtins.
(line 290)
* type: Bash Builtins. (line 538)
* typeset: Bash Builtins. (line 569)
* ulimit: Bash Builtins. (line 575)
* type: Bash Builtins. (line 539)
* typeset: Bash Builtins. (line 570)
* ulimit: Bash Builtins. (line 576)
* umask: Bourne Shell Builtins.
(line 336)
* unalias: Bash Builtins. (line 664)
* unalias: Bash Builtins. (line 665)
* unset: Bourne Shell Builtins.
(line 353)
* wait: Job Control Builtins.
@@ -10003,12 +10030,12 @@ D.3 Parameter and Variable Index
* BASH_ENV: Bash Variables. (line 69)
* BASH_EXECUTION_STRING: Bash Variables. (line 75)
* BASH_LINENO: Bash Variables. (line 78)
* BASH_REMATCH: Bash Variables. (line 87)
* BASH_SOURCE: Bash Variables. (line 95)
* BASH_SUBSHELL: Bash Variables. (line 99)
* BASH_VERSINFO: Bash Variables. (line 103)
* BASH_VERSION: Bash Variables. (line 127)
* BASH_XTRACEFD: Bash Variables. (line 130)
* BASH_REMATCH: Bash Variables. (line 86)
* BASH_SOURCE: Bash Variables. (line 94)
* BASH_SUBSHELL: Bash Variables. (line 101)
* BASH_VERSINFO: Bash Variables. (line 105)
* BASH_VERSION: Bash Variables. (line 129)
* BASH_XTRACEFD: Bash Variables. (line 132)
* BASHOPTS: Bash Variables. (line 16)
* BASHPID: Bash Variables. (line 25)
* bell-style: Readline Init File Syntax.
@@ -10017,16 +10044,16 @@ D.3 Parameter and Variable Index
(line 45)
* CDPATH: Bourne Shell Variables.
(line 9)
* COLUMNS: Bash Variables. (line 141)
* COLUMNS: Bash Variables. (line 143)
* comment-begin: Readline Init File Syntax.
(line 50)
* COMP_CWORD: Bash Variables. (line 146)
* COMP_KEY: Bash Variables. (line 175)
* COMP_LINE: Bash Variables. (line 152)
* COMP_POINT: Bash Variables. (line 157)
* COMP_TYPE: Bash Variables. (line 165)
* COMP_WORDBREAKS: Bash Variables. (line 179)
* COMP_WORDS: Bash Variables. (line 185)
* COMP_CWORD: Bash Variables. (line 148)
* COMP_KEY: Bash Variables. (line 177)
* COMP_LINE: Bash Variables. (line 154)
* COMP_POINT: Bash Variables. (line 159)
* COMP_TYPE: Bash Variables. (line 167)
* COMP_WORDBREAKS: Bash Variables. (line 181)
* COMP_WORDS: Bash Variables. (line 187)
* completion-display-width: Readline Init File Syntax.
(line 55)
* completion-ignore-case: Readline Init File Syntax.
@@ -10037,73 +10064,73 @@ D.3 Parameter and Variable Index
(line 73)
* completion-query-items: Readline Init File Syntax.
(line 80)
* COMPREPLY: Bash Variables. (line 193)
* COMPREPLY: Bash Variables. (line 195)
* convert-meta: Readline Init File Syntax.
(line 90)
* COPROC: Bash Variables. (line 198)
* DIRSTACK: Bash Variables. (line 202)
* COPROC: Bash Variables. (line 200)
* DIRSTACK: Bash Variables. (line 204)
* disable-completion: Readline Init File Syntax.
(line 96)
* editing-mode: Readline Init File Syntax.
(line 101)
* EMACS: Bash Variables. (line 212)
* EMACS: Bash Variables. (line 214)
* enable-keypad: Readline Init File Syntax.
(line 112)
* ENV: Bash Variables. (line 217)
* EUID: Bash Variables. (line 221)
* ENV: Bash Variables. (line 219)
* EUID: Bash Variables. (line 223)
* expand-tilde: Readline Init File Syntax.
(line 123)
* FCEDIT: Bash Variables. (line 225)
* FIGNORE: Bash Variables. (line 229)
* FUNCNAME: Bash Variables. (line 235)
* FUNCNEST: Bash Variables. (line 244)
* GLOBIGNORE: Bash Variables. (line 249)
* GROUPS: Bash Variables. (line 255)
* histchars: Bash Variables. (line 261)
* HISTCMD: Bash Variables. (line 276)
* HISTCONTROL: Bash Variables. (line 281)
* HISTFILE: Bash Variables. (line 297)
* HISTFILESIZE: Bash Variables. (line 301)
* HISTIGNORE: Bash Variables. (line 309)
* FCEDIT: Bash Variables. (line 227)
* FIGNORE: Bash Variables. (line 231)
* FUNCNAME: Bash Variables. (line 237)
* FUNCNEST: Bash Variables. (line 255)
* GLOBIGNORE: Bash Variables. (line 260)
* GROUPS: Bash Variables. (line 266)
* histchars: Bash Variables. (line 272)
* HISTCMD: Bash Variables. (line 287)
* HISTCONTROL: Bash Variables. (line 292)
* HISTFILE: Bash Variables. (line 308)
* HISTFILESIZE: Bash Variables. (line 312)
* HISTIGNORE: Bash Variables. (line 320)
* history-preserve-point: Readline Init File Syntax.
(line 127)
* history-size: Readline Init File Syntax.
(line 133)
* HISTSIZE: Bash Variables. (line 328)
* HISTTIMEFORMAT: Bash Variables. (line 332)
* HISTSIZE: Bash Variables. (line 339)
* HISTTIMEFORMAT: Bash Variables. (line 343)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 138)
* HOSTFILE: Bash Variables. (line 341)
* HOSTNAME: Bash Variables. (line 352)
* HOSTTYPE: Bash Variables. (line 355)
* HOSTFILE: Bash Variables. (line 352)
* HOSTNAME: Bash Variables. (line 363)
* HOSTTYPE: Bash Variables. (line 366)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 358)
* IGNOREEOF: Bash Variables. (line 369)
* input-meta: Readline Init File Syntax.
(line 145)
* INPUTRC: Bash Variables. (line 368)
* INPUTRC: Bash Variables. (line 379)
* isearch-terminators: Readline Init File Syntax.
(line 152)
* keymap: Readline Init File Syntax.
(line 159)
* LANG: Bash Variables. (line 372)
* LC_ALL: Bash Variables. (line 376)
* LC_COLLATE: Bash Variables. (line 380)
* LC_CTYPE: Bash Variables. (line 387)
* LANG: Bash Variables. (line 383)
* LC_ALL: Bash Variables. (line 387)
* LC_COLLATE: Bash Variables. (line 391)
* LC_CTYPE: Bash Variables. (line 398)
* LC_MESSAGES <1>: Locale Translation. (line 11)
* LC_MESSAGES: Bash Variables. (line 392)
* LC_NUMERIC: Bash Variables. (line 396)
* LINENO: Bash Variables. (line 400)
* LINES: Bash Variables. (line 404)
* MACHTYPE: Bash Variables. (line 409)
* LC_MESSAGES: Bash Variables. (line 403)
* LC_NUMERIC: Bash Variables. (line 407)
* LINENO: Bash Variables. (line 411)
* LINES: Bash Variables. (line 415)
* MACHTYPE: Bash Variables. (line 420)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 413)
* MAILCHECK: Bash Variables. (line 424)
* MAILPATH: Bourne Shell Variables.
(line 27)
* MAPFILE: Bash Variables. (line 421)
* MAPFILE: Bash Variables. (line 432)
* mark-modified-lines: Readline Init File Syntax.
(line 172)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -10112,41 +10139,41 @@ D.3 Parameter and Variable Index
(line 182)
* meta-flag: Readline Init File Syntax.
(line 145)
* OLDPWD: Bash Variables. (line 425)
* OLDPWD: Bash Variables. (line 436)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 428)
* OPTERR: Bash Variables. (line 439)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 432)
* OSTYPE: Bash Variables. (line 443)
* output-meta: Readline Init File Syntax.
(line 189)
* page-completions: Readline Init File Syntax.
(line 194)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 435)
* POSIXLY_CORRECT: Bash Variables. (line 440)
* PPID: Bash Variables. (line 449)
* PROMPT_COMMAND: Bash Variables. (line 453)
* PROMPT_DIRTRIM: Bash Variables. (line 457)
* PIPESTATUS: Bash Variables. (line 446)
* POSIXLY_CORRECT: Bash Variables. (line 451)
* PPID: Bash Variables. (line 460)
* PROMPT_COMMAND: Bash Variables. (line 464)
* PROMPT_DIRTRIM: Bash Variables. (line 468)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 463)
* PS4: Bash Variables. (line 468)
* PWD: Bash Variables. (line 474)
* RANDOM: Bash Variables. (line 477)
* READLINE_LINE: Bash Variables. (line 482)
* READLINE_POINT: Bash Variables. (line 486)
* REPLY: Bash Variables. (line 490)
* PS3: Bash Variables. (line 474)
* PS4: Bash Variables. (line 479)
* PWD: Bash Variables. (line 485)
* RANDOM: Bash Variables. (line 488)
* READLINE_LINE: Bash Variables. (line 493)
* READLINE_POINT: Bash Variables. (line 497)
* REPLY: Bash Variables. (line 501)
* revert-all-at-newline: Readline Init File Syntax.
(line 204)
* SECONDS: Bash Variables. (line 493)
* SHELL: Bash Variables. (line 499)
* SHELLOPTS: Bash Variables. (line 504)
* SHLVL: Bash Variables. (line 513)
* SECONDS: Bash Variables. (line 504)
* SHELL: Bash Variables. (line 510)
* SHELLOPTS: Bash Variables. (line 515)
* SHLVL: Bash Variables. (line 524)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 210)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -10155,10 +10182,10 @@ D.3 Parameter and Variable Index
(line 225)
* TEXTDOMAIN: Locale Translation. (line 11)
* TEXTDOMAINDIR: Locale Translation. (line 11)
* TIMEFORMAT: Bash Variables. (line 518)
* TMOUT: Bash Variables. (line 556)
* TMPDIR: Bash Variables. (line 568)
* UID: Bash Variables. (line 572)
* TIMEFORMAT: Bash Variables. (line 529)
* TMOUT: Bash Variables. (line 567)
* TMPDIR: Bash Variables. (line 579)
* UID: Bash Variables. (line 583)
* visible-stats: Readline Init File Syntax.
(line 238)
@@ -10447,115 +10474,115 @@ Node: Comments18912
Node: Shell Commands19530
Node: Simple Commands20402
Node: Pipelines21033
Node: Lists23580
Node: Compound Commands25309
Node: Looping Constructs26113
Node: Conditional Constructs28568
Node: Command Grouping36681
Node: Coprocesses38160
Node: GNU Parallel39825
Node: Shell Functions42293
Node: Shell Parameters47039
Node: Positional Parameters49455
Node: Special Parameters50355
Node: Shell Expansions53319
Node: Brace Expansion55244
Node: Tilde Expansion57999
Node: Shell Parameter Expansion60350
Node: Command Substitution69485
Node: Arithmetic Expansion70818
Node: Process Substitution71668
Node: Word Splitting72718
Node: Filename Expansion74341
Node: Pattern Matching76480
Node: Quote Removal80119
Node: Redirections80414
Node: Executing Commands88939
Node: Simple Command Expansion89609
Node: Command Search and Execution91539
Node: Command Execution Environment93876
Node: Environment96862
Node: Exit Status98522
Node: Signals100143
Node: Shell Scripts102111
Node: Shell Builtin Commands104629
Node: Bourne Shell Builtins106657
Node: Bash Builtins124335
Node: Modifying Shell Behavior150540
Node: The Set Builtin150885
Node: The Shopt Builtin160409
Node: Special Builtins172168
Node: Shell Variables173147
Node: Bourne Shell Variables173587
Node: Bash Variables175568
Node: Bash Features199906
Node: Invoking Bash200789
Node: Bash Startup Files206553
Node: Interactive Shells211565
Node: What is an Interactive Shell?211975
Node: Is this Shell Interactive?212624
Node: Interactive Shell Behavior213439
Node: Bash Conditional Expressions216719
Node: Shell Arithmetic220467
Node: Aliases223226
Node: Arrays225798
Node: The Directory Stack229913
Node: Directory Stack Builtins230627
Node: Printing a Prompt233519
Node: The Restricted Shell236271
Node: Bash POSIX Mode238103
Node: Job Control246929
Node: Job Control Basics247389
Node: Job Control Builtins252106
Node: Job Control Variables256470
Node: Command Line Editing257628
Node: Introduction and Notation259195
Node: Readline Interaction260817
Node: Readline Bare Essentials262008
Node: Readline Movement Commands263797
Node: Readline Killing Commands264762
Node: Readline Arguments266682
Node: Searching267726
Node: Readline Init File269912
Node: Readline Init File Syntax271059
Node: Conditional Init Constructs286163
Node: Sample Init File288696
Node: Bindable Readline Commands291813
Node: Commands For Moving293020
Node: Commands For History294164
Node: Commands For Text297319
Node: Commands For Killing299992
Node: Numeric Arguments302443
Node: Commands For Completion303582
Node: Keyboard Macros307774
Node: Miscellaneous Commands308345
Node: Readline vi Mode314151
Node: Programmable Completion315058
Node: Programmable Completion Builtins322268
Node: Using History Interactively331404
Node: Bash History Facilities332088
Node: Bash History Builtins335002
Node: History Interaction338859
Node: Event Designators341564
Node: Word Designators342579
Node: Modifiers344218
Node: Installing Bash345622
Node: Basic Installation346759
Node: Compilers and Options349451
Node: Compiling For Multiple Architectures350192
Node: Installation Names351856
Node: Specifying the System Type352674
Node: Sharing Defaults353390
Node: Operation Controls354063
Node: Optional Features355021
Node: Reporting Bugs364580
Node: Major Differences From The Bourne Shell365781
Node: GNU Free Documentation License382468
Node: Indexes407664
Node: Builtin Index408118
Node: Reserved Word Index414945
Node: Variable Index417393
Node: Function Index430347
Node: Concept Index437356
Node: Lists23727
Node: Compound Commands25456
Node: Looping Constructs26260
Node: Conditional Constructs28719
Node: Command Grouping36832
Node: Coprocesses38311
Node: GNU Parallel39976
Node: Shell Functions42444
Node: Shell Parameters47388
Node: Positional Parameters49804
Node: Special Parameters50704
Node: Shell Expansions53668
Node: Brace Expansion55593
Node: Tilde Expansion58348
Node: Shell Parameter Expansion60699
Node: Command Substitution69834
Node: Arithmetic Expansion71167
Node: Process Substitution72017
Node: Word Splitting73067
Node: Filename Expansion74690
Node: Pattern Matching76829
Node: Quote Removal80468
Node: Redirections80763
Node: Executing Commands89288
Node: Simple Command Expansion89958
Node: Command Search and Execution91888
Node: Command Execution Environment94225
Node: Environment97211
Node: Exit Status98871
Node: Signals100492
Node: Shell Scripts102460
Node: Shell Builtin Commands104978
Node: Bourne Shell Builtins107006
Node: Bash Builtins124684
Node: Modifying Shell Behavior150898
Node: The Set Builtin151243
Node: The Shopt Builtin160767
Node: Special Builtins172722
Node: Shell Variables173701
Node: Bourne Shell Variables174141
Node: Bash Variables176122
Node: Bash Features201046
Node: Invoking Bash201929
Node: Bash Startup Files207693
Node: Interactive Shells212705
Node: What is an Interactive Shell?213115
Node: Is this Shell Interactive?213764
Node: Interactive Shell Behavior214579
Node: Bash Conditional Expressions217859
Node: Shell Arithmetic221607
Node: Aliases224366
Node: Arrays226938
Node: The Directory Stack231053
Node: Directory Stack Builtins231767
Node: Printing a Prompt234659
Node: The Restricted Shell237411
Node: Bash POSIX Mode239243
Node: Job Control248173
Node: Job Control Basics248633
Node: Job Control Builtins253350
Node: Job Control Variables257714
Node: Command Line Editing258872
Node: Introduction and Notation260439
Node: Readline Interaction262061
Node: Readline Bare Essentials263252
Node: Readline Movement Commands265041
Node: Readline Killing Commands266006
Node: Readline Arguments267926
Node: Searching268970
Node: Readline Init File271156
Node: Readline Init File Syntax272303
Node: Conditional Init Constructs287407
Node: Sample Init File289940
Node: Bindable Readline Commands293057
Node: Commands For Moving294264
Node: Commands For History295408
Node: Commands For Text298563
Node: Commands For Killing301236
Node: Numeric Arguments303687
Node: Commands For Completion304826
Node: Keyboard Macros309018
Node: Miscellaneous Commands309589
Node: Readline vi Mode315395
Node: Programmable Completion316302
Node: Programmable Completion Builtins323512
Node: Using History Interactively332648
Node: Bash History Facilities333332
Node: Bash History Builtins336246
Node: History Interaction340103
Node: Event Designators342808
Node: Word Designators343823
Node: Modifiers345462
Node: Installing Bash346866
Node: Basic Installation348003
Node: Compilers and Options350695
Node: Compiling For Multiple Architectures351436
Node: Installation Names353100
Node: Specifying the System Type353918
Node: Sharing Defaults354634
Node: Operation Controls355307
Node: Optional Features356265
Node: Reporting Bugs365824
Node: Major Differences From The Bourne Shell367025
Node: GNU Free Documentation License383712
Node: Indexes408908
Node: Builtin Index409362
Node: Reserved Word Index416189
Node: Variable Index418637
Node: Function Index431591
Node: Concept Index438600

End Tag Table
+14 -14
View File
@@ -1,4 +1,4 @@
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 29 JUN 2010 14:02
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 21 JUL 2010 08:54
**/Users/chet/src/bash/src/doc/bashref.texi
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
Loading texinfo [version 2009-01-18.17]:
@@ -178,7 +178,7 @@ and turning on texinfo input format.) (./bashref.aux)
Chapter 2
[1] [2] [3] Chapter 3 [4] [5] [6] [7] [8] [9] [10]
Overfull \hbox (43.33539pt too wide) in paragraph at lines 869--869
Overfull \hbox (43.33539pt too wide) in paragraph at lines 872--872
[]@texttt case @textttsl word @texttt in [ [(] @textttsl pat-tern @texttt [| @
textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[][]
@@ -191,7 +191,7 @@ textttsl pat-tern@texttt ][]) @textttsl command-list @texttt ;;][] esac[][]
.etc.
[11] [12] [13] [14]
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1191--1191
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1194--1194
[]@texttt cat list | parallel "do-something1 {} config-{} ; do-something2 < {}
" | process-output[]
@@ -204,7 +204,7 @@ Overfull \hbox (89.6747pt too wide) in paragraph at lines 1191--1191
.etc.
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1206--1206
Overfull \hbox (89.6747pt too wide) in paragraph at lines 1209--1209
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
arallel traceroute[]
@@ -217,7 +217,7 @@ arallel traceroute[]
.etc.
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1212--1212
Overfull \hbox (106.92076pt too wide) in paragraph at lines 1215--1215
[]@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p
arallel -k traceroute[]
@@ -232,7 +232,7 @@ arallel -k traceroute[]
[15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29]
[30] [31] [32] [33] [34] Chapter 4 [35] [36] [37] [38] [39] [40] [41] [42]
[43]
Underfull \hbox (badness 5231) in paragraph at lines 3403--3416
Underfull \hbox (badness 5231) in paragraph at lines 3409--3422
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
@@ -245,7 +245,7 @@ m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
.etc.
[44] [45] [46] [47] [48] [49]
Overfull \hbox (172.34125pt too wide) in paragraph at lines 3860--3860
Overfull \hbox (172.34125pt too wide) in paragraph at lines 3867--3867
[]@texttt read [-ers] [-a @textttsl aname@texttt ] [-d @textttsl de-lim@texttt
] [-i @textttsl text@texttt ] [-n @textttsl nchars@texttt ] [-N @textttsl ncha
rs@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl time-
@@ -260,7 +260,7 @@ rs@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl time-
[50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] Chapter 5 [62]
[63] [64] [65] [66] [67] [68] [69] [70] [71] Chapter 6 [72]
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5460--5460
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5483--5483
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -273,7 +273,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5461--5461
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5484--5484
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
@@ -287,7 +287,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 5461--5461
.etc.
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5462--5462
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5485--5485
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -300,7 +300,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
[73] [74]
Underfull \hbox (badness 2245) in paragraph at lines 5635--5637
Underfull \hbox (badness 2245) in paragraph at lines 5658--5660
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
the file
@@ -313,7 +313,7 @@ the file
.etc.
[75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88]
Underfull \hbox (badness 2521) in paragraph at lines 6807--6810
Underfull \hbox (badness 2521) in paragraph at lines 6834--6837
@textrm `@texttt --enable-strict-posix-default[]@textrm '[] to @texttt configur
e[] @textrm when build-ing (see Sec-tion 10.8
@@ -381,7 +381,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1919--1922
[121]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[122] [123] [124] [125] [126]) Chapter 10 [127] [128] [129] [130] [131]
Underfull \hbox (badness 2772) in paragraph at lines 7408--7412
Underfull \hbox (badness 2772) in paragraph at lines 7435--7439
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
@@ -407,4 +407,4 @@ Here is how much of TeX's memory you used:
51 hyphenation exceptions out of 8191
16i,6n,14p,315b,702s stack positions out of 5000i,500n,6000p,200000b,5000s
Output written on bashref.dvi (166 pages, 677000 bytes).
Output written on bashref.dvi (166 pages, 678492 bytes).
BIN
View File
Binary file not shown.
+2403 -2368
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -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
+5 -5
View File
@@ -26,7 +26,7 @@
@numsecentry{Shell Parameters}{3.4}{Shell Parameters}{17}
@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{17}
@numsubsecentry{Special Parameters}{3.4.2}{Special Parameters}{18}
@numsecentry{Shell Expansions}{3.5}{Shell Expansions}{18}
@numsecentry{Shell Expansions}{3.5}{Shell Expansions}{19}
@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{19}
@numsubsecentry{Tilde Expansion}{3.5.2}{Tilde Expansion}{20}
@numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{21}
@@ -40,16 +40,16 @@
@numsecentry{Redirections}{3.6}{Redirections}{27}
@numsubsecentry{Redirecting Input}{3.6.1}{}{28}
@numsubsecentry{Redirecting Output}{3.6.2}{}{28}
@numsubsecentry{Appending Redirected Output}{3.6.3}{}{28}
@numsubsecentry{Appending Redirected Output}{3.6.3}{}{29}
@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{29}
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{29}
@numsubsecentry{Here Documents}{3.6.6}{}{29}
@numsubsecentry{Here Strings}{3.6.7}{}{29}
@numsubsecentry{Here Strings}{3.6.7}{}{30}
@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{30}
@numsubsecentry{Moving File Descriptors}{3.6.9}{}{30}
@numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{30}
@numsecentry{Executing Commands}{3.7}{Executing Commands}{30}
@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{30}
@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{31}
@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{31}
@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{32}
@numsubsecentry{Environment}{3.7.4}{Environment}{33}
@@ -60,7 +60,7 @@
@numsecentry{Bourne Shell Builtins}{4.1}{Bourne Shell Builtins}{37}
@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{43}
@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{53}
@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{53}
@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{54}
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{57}
@numsecentry{Special Builtins}{4.4}{Special Builtins}{62}
@numchapentry{Shell Variables}{5}{Shell Variables}{63}
+3 -3
View File
@@ -56,7 +56,7 @@
\entry{FUNCNAME}{67}{\code {FUNCNAME}}
\entry{FUNCNEST}{67}{\code {FUNCNEST}}
\entry{GLOBIGNORE}{67}{\code {GLOBIGNORE}}
\entry{GROUPS}{67}{\code {GROUPS}}
\entry{GROUPS}{68}{\code {GROUPS}}
\entry{histchars}{68}{\code {histchars}}
\entry{HISTCMD}{68}{\code {HISTCMD}}
\entry{HISTCONTROL}{68}{\code {HISTCONTROL}}
@@ -73,7 +73,7 @@
\entry{LANG}{69}{\code {LANG}}
\entry{LC_ALL}{69}{\code {LC_ALL}}
\entry{LC_COLLATE}{69}{\code {LC_COLLATE}}
\entry{LC_CTYPE}{69}{\code {LC_CTYPE}}
\entry{LC_CTYPE}{70}{\code {LC_CTYPE}}
\entry{LC_MESSAGES}{70}{\code {LC_MESSAGES}}
\entry{LC_NUMERIC}{70}{\code {LC_NUMERIC}}
\entry{LINENO}{70}{\code {LINENO}}
@@ -88,7 +88,7 @@
\entry{POSIXLY_CORRECT}{70}{\code {POSIXLY_CORRECT}}
\entry{PPID}{70}{\code {PPID}}
\entry{PROMPT_COMMAND}{70}{\code {PROMPT_COMMAND}}
\entry{PROMPT_DIRTRIM}{70}{\code {PROMPT_DIRTRIM}}
\entry{PROMPT_DIRTRIM}{71}{\code {PROMPT_DIRTRIM}}
\entry{PS3}{71}{\code {PS3}}
\entry{PS4}{71}{\code {PS4}}
\entry{PWD}{71}{\code {PWD}}
+3 -3
View File
@@ -74,7 +74,7 @@
\entry {\code {FUNCNEST}}{67}
\initial {G}
\entry {\code {GLOBIGNORE}}{67}
\entry {\code {GROUPS}}{67}
\entry {\code {GROUPS}}{68}
\initial {H}
\entry {\code {histchars}}{68}
\entry {\code {HISTCMD}}{68}
@@ -103,7 +103,7 @@
\entry {\code {LANG}}{69}
\entry {\code {LC_ALL}}{69}
\entry {\code {LC_COLLATE}}{69}
\entry {\code {LC_CTYPE}}{69}
\entry {\code {LC_CTYPE}}{70}
\entry {\code {LC_MESSAGES}}{7, 70}
\entry {\code {LC_NUMERIC}}{70}
\entry {\code {LINENO}}{70}
@@ -132,7 +132,7 @@
\entry {\code {POSIXLY_CORRECT}}{70}
\entry {\code {PPID}}{70}
\entry {\code {PROMPT_COMMAND}}{70}
\entry {\code {PROMPT_DIRTRIM}}{70}
\entry {\code {PROMPT_DIRTRIM}}{71}
\entry {\code {PS1}}{63}
\entry {\code {PS2}}{63}
\entry {\code {PS3}}{71}
+6 -1
View File
@@ -457,7 +457,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
\\aa alert (bell)
\\bb backspace
\\cc suppress further output
\\ee an escape character
\\ee
\\EE an escape character
\\ff form feed
\\nn new line
\\rr carriage return
@@ -1332,6 +1333,10 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS above). This
option is enabled by default.
llaassttppiippee
If set, and job control is not active, the shell runs
the last command of a pipeline not executed in the back-
ground in the current shell environment.
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
+347 -343
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.2
%%CreationDate: Tue Jun 29 14:02:44 2010
%%CreationDate: Wed Jul 21 08:54:49 2010
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -952,245 +952,245 @@ BP
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E
(escape sequences:)144 84 Q/F1 10/Times-Bold@0 SF(\\a)144 96 Q F0
(alert \(bell\))28.22 E F1(\\b)144 108 Q F0(backspace)27.66 E F1(\\c)144
120 Q F0(suppress further output)28.78 E F1(\\e)144 132 Q F0
(an escape character)28.78 E F1(\\f)144 144 Q F0(form feed)29.89 E F1
(\\n)144 156 Q F0(ne)27.66 E 2.5(wl)-.25 G(ine)-2.5 E F1(\\r)144 168 Q
F0(carriage return)28.78 E F1(\\t)144 180 Q F0(horizontal tab)29.89 E F1
(\\v)144 192 Q F0 -.15(ve)28.22 G(rtical tab).15 E F1(\\\\)144 204 Q F0
(backslash)30.44 E F1(\\0)144 216 Q/F2 10/Times-Italic@0 SF(nnn)A F0
120 Q F0(suppress further output)28.78 E F1(\\e)144 132 Q(\\E)144 144 Q
F0(an escape character)26.55 E F1(\\f)144 156 Q F0(form feed)29.89 E F1
(\\n)144 168 Q F0(ne)27.66 E 2.5(wl)-.25 G(ine)-2.5 E F1(\\r)144 180 Q
F0(carriage return)28.78 E F1(\\t)144 192 Q F0(horizontal tab)29.89 E F1
(\\v)144 204 Q F0 -.15(ve)28.22 G(rtical tab).15 E F1(\\\\)144 216 Q F0
(backslash)30.44 E F1(\\0)144 228 Q/F2 10/Times-Italic@0 SF(nnn)A F0
(the eight-bit character whose v)13.22 E(alue is the octal v)-.25 E
(alue)-.25 E F2(nnn)2.5 E F0(\(zero to three octal digits\))2.5 E F1
(\\x)144 228 Q F2(HH)A F0(the eight-bit character whose v)13.78 E
(\\x)144 240 Q F2(HH)A F0(the eight-bit character whose v)13.78 E
(alue is the he)-.25 E(xadecimal v)-.15 E(alue)-.25 E F2(HH)2.5 E F0
(\(one or tw)2.5 E 2.5(oh)-.1 G .3 -.15(ex d)-2.5 H(igits\)).15 E F1
(\\u)144 240 Q F2(HHHH)A F0 1.506
(the Unicode \(ISO/IEC 10646\) character whose v)180 252 R 1.507
(\\u)144 252 Q F2(HHHH)A F0 1.506
(the Unicode \(ISO/IEC 10646\) character whose v)180 264 R 1.507
(alue is the he)-.25 F 1.507(xadecimal v)-.15 F(alue)-.25 E F2(HHHH)
4.007 E F0(\(one to four he)180 264 Q 2.5(xd)-.15 G(igits\))-2.5 E F1
(\\U)144 276 Q F2(HHHHHHHH)A F0 .548
(the Unicode \(ISO/IEC 10646\) character whose v)180 288 R .547
4.007 E F0(\(one to four he)180 276 Q 2.5(xd)-.15 G(igits\))-2.5 E F1
(\\U)144 288 Q F2(HHHHHHHH)A F0 .548
(the Unicode \(ISO/IEC 10646\) character whose v)180 300 R .547
(alue is the he)-.25 F .547(xadecimal v)-.15 F(alue)-.25 E F2(HHHHH-)
3.047 E(HHH)180 300 Q F0(\(one to eight he)2.5 E 2.5(xd)-.15 G(igits\))
-2.5 E F1(enable)108 316.8 Q F0([)2.5 E F1<ad61>A F0 2.5(][)C F1
3.047 E(HHH)180 312 Q F0(\(one to eight he)2.5 E 2.5(xd)-.15 G(igits\))
-2.5 E F1(enable)108 328.8 Q F0([)2.5 E F1<ad61>A F0 2.5(][)C F1
(\255dnps)-2.5 E F0 2.5(][)C F1<ad66>-2.5 E F2(\214lename)2.5 E F0 2.5
(][)C F2(name)-2.5 E F0(...])2.5 E .277(Enable and disable b)144 328.8 R
(][)C F2(name)-2.5 E F0(...])2.5 E .277(Enable and disable b)144 340.8 R
.278(uiltin shell commands.)-.2 F .278(Disabling a b)5.278 F .278
(uiltin allo)-.2 F .278(ws a disk command which has)-.25 F .834
(the same name as a shell b)144 340.8 R .834(uiltin to be e)-.2 F -.15
(the same name as a shell b)144 352.8 R .834(uiltin to be e)-.2 F -.15
(xe)-.15 G .834(cuted without specifying a full pathname, e).15 F -.15
(ve)-.25 G 3.333(nt).15 G(hough)-3.333 E .989
(the shell normally searches for b)144 352.8 R .989
(the shell normally searches for b)144 364.8 R .989
(uiltins before disk commands.)-.2 F(If)5.989 E F1<ad6e>3.489 E F0 .99
(is used, each)3.49 F F2(name)3.49 E F0 .99(is dis-)3.49 F 1.582
(abled; otherwise,)144 364.8 R F2(names)4.082 E F0 1.582(are enabled.)
(abled; otherwise,)144 376.8 R F2(names)4.082 E F0 1.582(are enabled.)
4.082 F -.15(Fo)6.582 G 4.082(re).15 G 1.582(xample, to use the)-4.232 F
F1(test)4.082 E F0 1.582(binary found via the)4.082 F/F3 9/Times-Bold@0
SF -.666(PA)4.081 G(TH)-.189 E F0 .08(instead of the shell b)144 376.8 R
SF -.666(PA)4.081 G(TH)-.189 E F0 .08(instead of the shell b)144 388.8 R
.08(uiltin v)-.2 F .08(ersion, run)-.15 F/F4 10/Courier@0 SF .081
(enable -n test)2.58 F F0 5.081(.T)C(he)-5.081 E F1<ad66>2.581 E F0 .081
(option means to load the ne)2.581 F(w)-.25 E -.2(bu)144 388.8 S 1.525
(option means to load the ne)2.581 F(w)-.25 E -.2(bu)144 400.8 S 1.525
(iltin command).2 F F2(name)4.385 E F0 1.524(from shared object)4.204 F
F2(\214lename)4.024 E F0 4.024(,o).18 G 4.024(ns)-4.024 G 1.524
(ystems that support dynamic loading.)-4.024 F(The)144 400.8 Q F1<ad64>
(ystems that support dynamic loading.)-4.024 F(The)144 412.8 Q F1<ad64>
2.866 E F0 .366(option will delete a b)2.866 F .366(uiltin pre)-.2 F
.366(viously loaded with)-.25 F F1<ad66>2.867 E F0 5.367(.I)C 2.867(fn)
-5.367 G(o)-2.867 E F2(name)2.867 E F0(ar)2.867 E .367(guments are gi)
-.18 F -.15(ve)-.25 G .367(n, or).15 F .399(if the)144 412.8 R F1<ad70>
-.18 F -.15(ve)-.25 G .367(n, or).15 F .399(if the)144 424.8 R F1<ad70>
2.899 E F0 .399(option is supplied, a list of shell b)2.899 F .399
(uiltins is printed.)-.2 F -.4(Wi)5.399 G .399(th no other option ar).4
F .398(guments, the)-.18 F .098(list consists of all enabled shell b)144
424.8 R 2.598(uiltins. If)-.2 F F1<ad6e>2.598 E F0 .098
436.8 R 2.598(uiltins. If)-.2 F F1<ad6e>2.598 E F0 .098
(is supplied, only disabled b)2.598 F .099(uiltins are printed.)-.2 F
(If)5.099 E F1<ad61>2.599 E F0 1.917
(is supplied, the list printed includes all b)144 436.8 R 1.916
(is supplied, the list printed includes all b)144 448.8 R 1.916
(uiltins, with an indication of whether or not each is)-.2 F 2.878
(enabled. If)144 448.8 R F1<ad73>2.878 E F0 .379
(enabled. If)144 460.8 R F1<ad73>2.878 E F0 .379
(is supplied, the output is restricted to the POSIX)2.878 F F2(special)
2.879 E F0 -.2(bu)2.879 G 2.879(iltins. The).2 F .379(return v)2.879 F
(alue)-.25 E .995(is 0 unless a)144 460.8 R F2(name)3.855 E F0 .994
(alue)-.25 E .995(is 0 unless a)144 472.8 R F2(name)3.855 E F0 .994
(is not a shell b)3.675 F .994(uiltin or there is an error loading a ne)
-.2 F 3.494(wb)-.25 G .994(uiltin from a shared)-3.694 F(object.)144
472.8 Q F1 -2.3 -.15(ev a)108 489.6 T(l).15 E F0([)2.5 E F2(ar)A(g)-.37
E F0(...])2.5 E(The)144 501.6 Q F2(ar)3.17 E(g)-.37 E F0 3.17(sa)C .671
484.8 Q F1 -2.3 -.15(ev a)108 501.6 T(l).15 E F0([)2.5 E F2(ar)A(g)-.37
E F0(...])2.5 E(The)144 513.6 Q F2(ar)3.17 E(g)-.37 E F0 3.17(sa)C .671
(re read and concatenated together into a single command.)-3.17 F .671
(This command is then read)5.671 F .495(and e)144 513.6 R -.15(xe)-.15 G
(This command is then read)5.671 F .495(and e)144 525.6 R -.15(xe)-.15 G
.495(cuted by the shell, and its e).15 F .495
(xit status is returned as the v)-.15 F .495(alue of)-.25 F F1 -2.3 -.15
(ev a)2.995 H(l).15 E F0 5.495(.I)C 2.995(ft)-5.495 G .495(here are no)
-2.995 F F2(ar)2.995 E(gs)-.37 E F0(,).27 E(or only null ar)144 525.6 Q
-2.995 F F2(ar)2.995 E(gs)-.37 E F0(,).27 E(or only null ar)144 537.6 Q
(guments,)-.18 E F1 -2.3 -.15(ev a)2.5 H(l).15 E F0(returns 0.)2.5 E F1
(exec)108 542.4 Q F0([)2.5 E F1(\255cl)A F0 2.5(][)C F1<ad61>-2.5 E F2
(exec)108 554.4 Q F0([)2.5 E F1(\255cl)A F0 2.5(][)C F1<ad61>-2.5 E F2
(name)2.5 E F0 2.5(][)C F2(command)-2.5 E F0([)2.5 E F2(ar)A(guments)
-.37 E F0(]])A(If)144 554.4 Q F2(command)3.005 E F0 .305
-.37 E F0(]])A(If)144 566.4 Q F2(command)3.005 E F0 .305
(is speci\214ed, it replaces the shell.)3.575 F .305(No ne)5.305 F 2.805
(wp)-.25 G .306(rocess is created.)-2.805 F(The)5.306 E F2(ar)3.136 E
(guments)-.37 E F0(become)3.076 E .177(the ar)144 566.4 R .177
(guments)-.37 E F0(become)3.076 E .177(the ar)144 578.4 R .177
(guments to)-.18 F F2(command)2.676 E F0 5.176(.I)C 2.676(ft)-5.176 G
(he)-2.676 E F1<ad6c>2.676 E F0 .176
(option is supplied, the shell places a dash at the be)2.676 F .176
(ginning of)-.15 F .499(the zeroth ar)144 578.4 R .499(gument passed to)
(ginning of)-.15 F .499(the zeroth ar)144 590.4 R .499(gument passed to)
-.18 F F2(command)2.999 E F0 5.499(.T).77 G .499(his is what)-5.499 F F2
(lo)2.999 E(gin)-.1 E F0 .499(\(1\) does.).24 F(The)5.5 E F1<ad63>3 E F0
.5(option causes)3 F F2(com-)3.2 E(mand)144 590.4 Q F0 .639(to be e)
.5(option causes)3 F F2(com-)3.2 E(mand)144 602.4 Q F0 .639(to be e)
3.909 F -.15(xe)-.15 G .638(cuted with an empty en).15 F 3.138
(vironment. If)-.4 F F1<ad61>3.138 E F0 .638
(is supplied, the shell passes)3.138 F F2(name)3.498 E F0 .638(as the)
3.318 F 1.077(zeroth ar)144 602.4 R 1.077(gument to the e)-.18 F -.15
3.318 F 1.077(zeroth ar)144 614.4 R 1.077(gument to the e)-.18 F -.15
(xe)-.15 G 1.077(cuted command.).15 F(If)6.077 E F2(command)3.777 E F0
1.077(cannot be e)4.347 F -.15(xe)-.15 G 1.077(cuted for some reason, a)
.15 F(non-interacti)144 614.4 Q .618 -.15(ve s)-.25 H .318(hell e).15 F
.15 F(non-interacti)144 626.4 Q .618 -.15(ve s)-.25 H .318(hell e).15 F
.318(xits, unless the shell option)-.15 F F1(execfail)2.817 E F0 .317
(is enabled, in which case it returns f)2.817 F(ail-)-.1 E 2.505
(ure. An)144 626.4 R(interacti)2.505 E .305 -.15(ve s)-.25 H .005
(ure. An)144 638.4 R(interacti)2.505 E .305 -.15(ve s)-.25 H .005
(hell returns f).15 F .005(ailure if the \214le cannot be e)-.1 F -.15
(xe)-.15 G 2.505(cuted. If).15 F F2(command)2.705 E F0 .005
(is not speci\214ed,)3.275 F(an)144 638.4 Q 3.037(yr)-.15 G .537
(is not speci\214ed,)3.275 F(an)144 650.4 Q 3.037(yr)-.15 G .537
(edirections tak)-3.037 F 3.036(ee)-.1 G -.25(ff)-3.036 G .536
(ect in the current shell, and the return status is 0.).25 F .536
(If there is a redirection)5.536 F(error)144 650.4 Q 2.5(,t)-.4 G
(he return status is 1.)-2.5 E F1(exit)108 667.2 Q F0([)2.5 E F2(n)A F0
(If there is a redirection)5.536 F(error)144 662.4 Q 2.5(,t)-.4 G
(he return status is 1.)-2.5 E F1(exit)108 679.2 Q F0([)2.5 E F2(n)A F0
6.29(]C)C .095(ause the shell to e)-6.29 F .095(xit with a status of)
-.15 F F2(n)2.595 E F0 5.095(.I)C(f)-5.095 E F2(n)2.955 E F0 .096
(is omitted, the e)2.835 F .096(xit status is that of the last command)
-.15 F -.15(exe)144 679.2 S 2.5(cuted. A).15 F(trap on)2.5 E F3(EXIT)2.5
-.15 F -.15(exe)144 691.2 S 2.5(cuted. A).15 F(trap on)2.5 E F3(EXIT)2.5
E F0(is e)2.25 E -.15(xe)-.15 G(cuted before the shell terminates.).15 E
F1(export)108 696 Q F0([)2.5 E F1(\255fn)A F0 2.5(][).833 G F2(name)-2.5
E F0([=)A F2(wor)A(d)-.37 E F0(]] ...)A(GNU Bash-4.0)72 768 Q
(2004 Apr 20)148.735 E(7)203.725 E 0 Cg EP
(GNU Bash-4.0)72 768 Q(2004 Apr 20)148.735 E(7)203.725 E 0 Cg EP
%%Page: 8 8
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Times-Bold@0 SF(export \255p)108 84 Q F0 .257(The supplied)144 96 R/F2
10/Times-Italic@0 SF(names)3.117 E F0 .257(are mark)3.027 F .257
(ed for automatic e)-.1 F .257(xport to the en)-.15 F .257
(vironment of subsequently e)-.4 F -.15(xe)-.15 G(cuted).15 E 2.626
(commands. If)144 108 R(the)2.626 E F1<ad66>2.626 E F0 .127
(option is gi)2.627 F -.15(ve)-.25 G .127(n, the).15 F F2(names)2.987 E
F0 .127(refer to functions.)2.897 F .127(If no)5.127 F F2(names)2.987 E
F0 .127(are gi)2.897 F -.15(ve)-.25 G .127(n, or if the).15 F F1<ad70>
144 120 Q F0 .66(option is supplied, a list of all names that are e)3.16
F .659(xported in this shell is printed.)-.15 F(The)5.659 E F1<ad6e>
3.159 E F0(option)3.159 E 1.586(causes the e)144 132 R 1.586
/Times-Bold@0 SF(export)108 84 Q F0([)2.5 E F1(\255fn)A F0 2.5(][).833 G
/F2 10/Times-Italic@0 SF(name)-2.5 E F0([=)A F2(wor)A(d)-.37 E F0
(]] ...)A F1(export \255p)108 96 Q F0 .257(The supplied)144 108 R F2
(names)3.117 E F0 .257(are mark)3.027 F .257(ed for automatic e)-.1 F
.257(xport to the en)-.15 F .257(vironment of subsequently e)-.4 F -.15
(xe)-.15 G(cuted).15 E 2.626(commands. If)144 120 R(the)2.626 E F1<ad66>
2.626 E F0 .127(option is gi)2.627 F -.15(ve)-.25 G .127(n, the).15 F F2
(names)2.987 E F0 .127(refer to functions.)2.897 F .127(If no)5.127 F F2
(names)2.987 E F0 .127(are gi)2.897 F -.15(ve)-.25 G .127(n, or if the)
.15 F F1<ad70>144 132 Q F0 .66
(option is supplied, a list of all names that are e)3.16 F .659
(xported in this shell is printed.)-.15 F(The)5.659 E F1<ad6e>3.159 E F0
(option)3.159 E 1.586(causes the e)144 144 R 1.586
(xport property to be remo)-.15 F -.15(ve)-.15 G 4.086(df).15 G 1.586
(rom each)-4.086 F F2(name)4.086 E F0 6.586(.I)C 4.086(fav)-6.586 G
1.587(ariable name is follo)-4.336 F 1.587(wed by)-.25 F(=)144 144 Q F2
1.587(ariable name is follo)-4.336 F 1.587(wed by)-.25 F(=)144 156 Q F2
(wor)A(d)-.37 E F0 2.804(,t)C .304(he v)-2.804 F .304(alue of the v)-.25
F .304(ariable is set to)-.25 F F2(wor)2.804 E(d)-.37 E F0(.)A F1
(export)5.304 E F0 .304(returns an e)2.804 F .303
(xit status of 0 unless an in)-.15 F -.25(va)-.4 G(lid).25 E .293
(option is encountered, one of the)144 156 R F2(names)2.793 E F0 .293
(option is encountered, one of the)144 168 R F2(names)2.793 E F0 .293
(is not a v)2.793 F .293(alid shell v)-.25 F .293(ariable name, or)-.25
F F1<ad66>2.793 E F0 .294(is supplied with a)2.793 F F2(name)144.36 168
Q F0(that is not a function.)2.68 E F1(fc)108 184.8 Q F0([)2.5 E F1
F F1<ad66>2.793 E F0 .294(is supplied with a)2.793 F F2(name)144.36 180
Q F0(that is not a function.)2.68 E F1(fc)108 196.8 Q F0([)2.5 E F1
<ad65>A F2(ename)2.5 E F0 2.5(][)C F1(\255lnr)-2.5 E F0 2.5(][)C F2
<8c72>-2.5 E(st)-.1 E F0 2.5(][)C F2(last)-2.5 E F0(])A F1(fc \255s)108
196.8 Q F0([)2.5 E F2(pat)A F0(=)A F2 -.37(re)C(p).37 E F0 2.5(][)C F2
(cmd)-2.5 E F0(])A .478(Fix Command.)144 208.8 R .478
208.8 Q F0([)2.5 E F2(pat)A F0(=)A F2 -.37(re)C(p).37 E F0 2.5(][)C F2
(cmd)-2.5 E F0(])A .478(Fix Command.)144 220.8 R .478
(In the \214rst form, a range of commands from)5.478 F F2<8c72>4.888 E
(st)-.1 E F0(to)3.658 E F2(last)3.068 E F0 .477
(is selected from the his-)3.658 F .881(tory list.)144 220.8 R F2 -.45
(is selected from the his-)3.658 F .881(tory list.)144 232.8 R F2 -.45
(Fi)5.881 G -.1(rs).45 G(t).1 E F0(and)4.061 E F2(last)3.471 E F0 .882
(may be speci\214ed as a string \(to locate the last command be)4.062 F
.882(ginning with)-.15 F .797(that string\) or as a number \(an inde)144
232.8 R 3.297(xi)-.15 G .797(nto the history list, where a ne)-3.297 F
244.8 R 3.297(xi)-.15 G .797(nto the history list, where a ne)-3.297 F
-.05(ga)-.15 G(ti).05 E 1.097 -.15(ve n)-.25 H .796(umber is used as an)
.15 F(of)144 244.8 Q .276(fset from the current command number\).)-.25 F
.15 F(of)144 256.8 Q .276(fset from the current command number\).)-.25 F
(If)5.276 E F2(last)2.866 E F0 .277
(is not speci\214ed it is set to the current command)3.456 F .093
(for listing \(so that)144 256.8 R/F3 10/Courier@0 SF .092
(for listing \(so that)144 268.8 R/F3 10/Courier@0 SF .092
(fc \255l \25510)2.592 F F0 .092(prints the last 10 commands\) and to)
2.592 F F2<8c72>4.502 E(st)-.1 E F0 2.592(otherwise. If)3.272 F F2<8c72>
4.502 E(st)-.1 E F0 .092(is not)3.272 F
(speci\214ed it is set to the pre)144 268.8 Q
(vious command for editing and \25516 for listing.)-.25 E(The)144 292.8
(speci\214ed it is set to the pre)144 280.8 Q
(vious command for editing and \25516 for listing.)-.25 E(The)144 304.8
Q F1<ad6e>2.522 E F0 .022
(option suppresses the command numbers when listing.)2.522 F(The)5.022 E
F1<ad72>2.522 E F0 .022(option re)2.522 F -.15(ve)-.25 G .022
(rses the order of).15 F .438(the commands.)144 304.8 R .438(If the)
(rses the order of).15 F .438(the commands.)144 316.8 R .438(If the)
5.438 F F1<ad6c>2.938 E F0 .438(option is gi)2.938 F -.15(ve)-.25 G .438
(n, the commands are listed on standard output.).15 F(Otherwise,)5.438 E
.334(the editor gi)144 316.8 R -.15(ve)-.25 G 2.834(nb).15 G(y)-2.834 E
.334(the editor gi)144 328.8 R -.15(ve)-.25 G 2.834(nb).15 G(y)-2.834 E
F2(ename)3.024 E F0 .335(is in)3.014 F -.2(vo)-.4 G -.1(ke).2 G 2.835
(do).1 G 2.835(na\214)-2.835 G .335(le containing those commands.)-2.835
F(If)5.335 E F2(ename)3.025 E F0 .335(is not gi)3.015 F -.15(ve)-.25 G
(n,).15 E .631(the v)144 328.8 R .631(alue of the)-.25 F/F4 9
(n,).15 E .631(the v)144 340.8 R .631(alue of the)-.25 F/F4 9
/Times-Bold@0 SF(FCEDIT)3.131 E F0 -.25(va)2.881 G .631
(riable is used, and the v).25 F .631(alue of)-.25 F F4(EDIT)3.131 E(OR)
-.162 E F0(if)2.881 E F4(FCEDIT)3.13 E F0 .63(is not set.)2.88 F .63
(If nei-)5.63 F 1.884(ther v)144 340.8 R 1.884(ariable is set, is used.)
(If nei-)5.63 F 1.884(ther v)144 352.8 R 1.884(ariable is set, is used.)
-.25 F 1.884
(When editing is complete, the edited commands are echoed and)6.884 F
-.15(exe)144 352.8 S(cuted.).15 E .04(In the second form,)144 376.8 R F2
-.15(exe)144 364.8 S(cuted.).15 E .04(In the second form,)144 388.8 R F2
(command)2.54 E F0 .04(is re-e)2.54 F -.15(xe)-.15 G .039
(cuted after each instance of).15 F F2(pat)2.539 E F0 .039
(is replaced by)2.539 F F2 -.37(re)2.539 G(p).37 E F0 5.039(.A)C(useful)
-2.5 E .406(alias to use with this is)144 388.8 R F3 .406(r='fc \255s')
-2.5 E .406(alias to use with this is)144 400.8 R F3 .406(r='fc \255s')
2.906 F F0 2.906(,s)C 2.906(ot)-2.906 G .406(hat typing)-2.906 F F3
6.406(rc)2.906 G(c)-6.406 E F0 .406(runs the last command be)2.906 F
.407(ginning with)-.15 F F3(cc)144 400.8 Q F0(and typing)2.5 E F3(r)2.5
.407(ginning with)-.15 F F3(cc)144 412.8 Q F0(and typing)2.5 E F3(r)2.5
E F0(re-e)2.5 E -.15(xe)-.15 G(cutes the last command.).15 E .142
(If the \214rst form is used, the return v)144 424.8 R .142
(If the \214rst form is used, the return v)144 436.8 R .142
(alue is 0 unless an in)-.25 F -.25(va)-.4 G .142
(lid option is encountered or).25 F F2<8c72>4.552 E(st)-.1 E F0(or)3.322
E F2(last)2.732 E F0 .454(specify history lines out of range.)144 436.8
E F2(last)2.732 E F0 .454(specify history lines out of range.)144 448.8
R .454(If the)5.454 F F1<ad65>2.954 E F0 .454
(option is supplied, the return v)2.954 F .455(alue is the v)-.25 F .455
(alue of the)-.25 F .788(last command e)144 448.8 R -.15(xe)-.15 G .788
(alue of the)-.25 F .788(last command e)144 460.8 R -.15(xe)-.15 G .788
(cuted or f).15 F .787
(ailure if an error occurs with the temporary \214le of commands.)-.1 F
.787(If the)5.787 F 1.135
(second form is used, the return status is that of the command re-e)144
460.8 R -.15(xe)-.15 G 1.136(cuted, unless).15 F F2(cmd)3.836 E F0 1.136
(does not)4.406 F(specify a v)144 472.8 Q
472.8 R -.15(xe)-.15 G 1.136(cuted, unless).15 F F2(cmd)3.836 E F0 1.136
(does not)4.406 F(specify a v)144 484.8 Q
(alid history line, in which case)-.25 E F1(fc)2.5 E F0(returns f)2.5 E
(ailure.)-.1 E F1(fg)108 489.6 Q F0([)2.5 E F2(jobspec)A F0(])A(Resume)
144 501.6 Q F2(jobspec)5.654 E F0 1.413(in the fore)4.224 F 1.413
(ailure.)-.1 E F1(fg)108 501.6 Q F0([)2.5 E F2(jobspec)A F0(])A(Resume)
144 513.6 Q F2(jobspec)5.654 E F0 1.413(in the fore)4.224 F 1.413
(ground, and mak)-.15 F 3.913(ei)-.1 G 3.913(tt)-3.913 G 1.413
(he current job)-3.913 F 6.413(.I)-.4 G(f)-6.413 E F2(jobspec)5.653 E F0
1.413(is not present, the)4.223 F(shell')144 513.6 Q 3.116(sn)-.55 G
1.413(is not present, the)4.223 F(shell')144 525.6 Q 3.116(sn)-.55 G
.616(otion of the)-3.116 F F2(curr)3.116 E .616(ent job)-.37 F F0 .617
(is used.)3.116 F .617(The return v)5.617 F .617
(alue is that of the command placed into the)-.25 F(fore)144 525.6 Q
(alue is that of the command placed into the)-.25 F(fore)144 537.6 Q
.363(ground, or f)-.15 F .363
(ailure if run when job control is disabled or)-.1 F 2.862(,w)-.4 G .362
(hen run with job control enabled, if)-2.862 F F2(jobspec)145.74 537.6 Q
(hen run with job control enabled, if)-2.862 F F2(jobspec)145.74 549.6 Q
F0 .004(does not specify a v)2.814 F .004(alid job or)-.25 F F2(jobspec)
4.244 E F0 .004(speci\214es a job that w)2.814 F .004
(as started without job control.)-.1 F F1(getopts)108 554.4 Q F2
(as started without job control.)-.1 F F1(getopts)108 566.4 Q F2
(optstring name)2.5 E F0([)2.5 E F2(ar)A(gs)-.37 E F0(])A F1(getopts)144
566.4 Q F0 .793
578.4 Q F0 .793
(is used by shell procedures to parse positional parameters.)3.294 F F2
(optstring)6.023 E F0 .793(contains the option)3.513 F .149
(characters to be recognized; if a character is follo)144 578.4 R .15
(characters to be recognized; if a character is follo)144 590.4 R .15
(wed by a colon, the option is e)-.25 F .15(xpected to ha)-.15 F .45
-.15(ve a)-.2 H(n).15 E(ar)144 590.4 Q .579
-.15(ve a)-.2 H(n).15 E(ar)144 602.4 Q .579
(gument, which should be separated from it by white space.)-.18 F .578
(The colon and question mark char)5.579 F(-)-.2 E 1.665
(acters may not be used as option characters.)144 602.4 R 1.665
(acters may not be used as option characters.)144 614.4 R 1.665
(Each time it is in)6.665 F -.2(vo)-.4 G -.1(ke).2 G(d,).1 E F1(getopts)
4.165 E F0 1.665(places the ne)4.165 F(xt)-.15 E .797
(option in the shell v)144 614.4 R(ariable)-.25 E F2(name)3.297 E F0
(option in the shell v)144 626.4 R(ariable)-.25 E F2(name)3.297 E F0
3.297(,i).18 G(nitializing)-3.297 E F2(name)3.657 E F0 .797
(if it does not e)3.477 F .796(xist, and the inde)-.15 F 3.296(xo)-.15 G
3.296(ft)-3.296 G .796(he ne)-3.296 F(xt)-.15 E(ar)144 626.4 Q .085
3.296(ft)-3.296 G .796(he ne)-3.296 F(xt)-.15 E(ar)144 638.4 Q .085
(gument to be processed into the v)-.18 F(ariable)-.25 E F4(OPTIND)2.585
E/F5 9/Times-Roman@0 SF(.)A F4(OPTIND)4.585 E F0 .085
(is initialized to 1 each time the shell)2.335 F .846
(or a shell script is in)144 638.4 R -.2(vo)-.4 G -.1(ke).2 G 3.345
(or a shell script is in)144 650.4 R -.2(vo)-.4 G -.1(ke).2 G 3.345
(d. When).1 F .845(an option requires an ar)3.345 F(gument,)-.18 E F1
(getopts)3.345 E F0 .845(places that ar)3.345 F(gument)-.18 E .803
(into the v)144 650.4 R(ariable)-.25 E F4(OPT)3.303 E(ARG)-.81 E F5(.)A
(into the v)144 662.4 R(ariable)-.25 E F4(OPT)3.303 E(ARG)-.81 E F5(.)A
F0 .803(The shell does not reset)5.303 F F4(OPTIND)3.303 E F0 .804
(automatically; it must be manually)3.054 F .294
(reset between multiple calls to)144 662.4 R F1(getopts)2.793 E F0 .293
(reset between multiple calls to)144 674.4 R F1(getopts)2.793 E F0 .293
(within the same shell in)2.793 F -.2(vo)-.4 G .293(cation if a ne).2 F
2.793(ws)-.25 G .293(et of parameters)-2.793 F(is to be used.)144 674.4
Q 2.043(When the end of options is encountered,)144 698.4 R F1(getopts)
2.793(ws)-.25 G .293(et of parameters)-2.793 F(is to be used.)144 686.4
Q 2.043(When the end of options is encountered,)144 710.4 R F1(getopts)
4.543 E F0 -.15(ex)4.543 G 2.043(its with a return v).15 F 2.044
(alue greater than zero.)-.25 F F4(OPTIND)144 710.4 Q F0
(alue greater than zero.)-.25 F F4(OPTIND)144 722.4 Q F0
(is set to the inde)2.25 E 2.5(xo)-.15 G 2.5(ft)-2.5 G
(he \214rst non-option ar)-2.5 E(gument, and)-.18 E F1(name)2.5 E F0
(is set to ?.)2.5 E(GNU Bash-4.0)72 768 Q(2004 Apr 20)148.735 E(8)
@@ -2275,61 +2275,62 @@ F2(READLINE)3.88 E F0(abo)184 240 Q -.15(ve)-.15 G 2.5(\). This).15 F
(that line to be ignored in an interacti)184 300 R 1.267 -.15(ve s)-.25
H .967(hell \(see).15 F F2(COMMENTS)3.467 E F0(abo)3.217 E -.15(ve)-.15
G 3.467(\). This).15 F .967(option is)3.467 F(enabled by def)184 312 Q
(ault.)-.1 E F1(lithist)144 324 Q F0 .654(If set, and the)15.55 F F1
(cmdhist)3.154 E F0 .654(option is enabled, multi-line commands are sa)
3.154 F -.15(ve)-.2 G 3.155(dt).15 G 3.155(ot)-3.155 G .655(he history)
-3.155 F(with embedded ne)184 336 Q
(ault.)-.1 E F1(lastpipe)144 324 Q F0 1.211
(If set, and job control is not acti)6.66 F -.15(ve)-.25 G 3.712(,t).15
G 1.212(he shell runs the last command of a pipeline not)-3.712 F -.15
(exe)184 336 S(cuted in the background in the current shell en).15 E
(vironment.)-.4 E F1(lithist)144 348 Q F0 .655(If set, and the)15.55 F
F1(cmdhist)3.155 E F0 .654
(option is enabled, multi-line commands are sa)3.154 F -.15(ve)-.2 G
3.154(dt).15 G 3.154(ot)-3.154 G .654(he history)-3.154 F
(with embedded ne)184 360 Q
(wlines rather than using semicolon separators where possible.)-.25 E F1
(login_shell)144 348 Q F0 .486
(login_shell)144 372 Q F0 .486
(The shell sets this option if it is started as a login shell \(see)184
360 R F2(INV)2.986 E(OCA)-.405 E(TION)-.855 E F0(abo)2.736 E -.15(ve)
-.15 G 2.986(\). The).15 F -.25(va)184 372 S(lue may not be changed.).25
E F1(mailwar)144 384 Q(n)-.15 E F0 .814(If set, and a \214le that)184
396 R F1(bash)3.314 E F0 .815
(is checking for mail has been accessed since the last time it)3.314 F
-.1(wa)184 408 S 2.5(sc).1 G(heck)-2.5 E(ed, the message `)-.1 E
384 R F2(INV)2.987 E(OCA)-.405 E(TION)-.855 E F0(abo)2.737 E -.15(ve)
-.15 G 2.987(\). The).15 F -.25(va)184 396 S(lue may not be changed.).25
E F1(mailwar)144 408 Q(n)-.15 E F0 .815(If set, and a \214le that)184
420 R F1(bash)3.315 E F0 .814
(is checking for mail has been accessed since the last time it)3.315 F
-.1(wa)184 432 S 2.5(sc).1 G(heck)-2.5 E(ed, the message `)-.1 E
(`The mail in)-.74 E/F3 10/Times-Italic@0 SF(mail\214le)2.5 E F0
(has been read')2.5 E 2.5('i)-.74 G 2.5(sd)-2.5 G(isplayed.)-2.5 E F1
(no_empty_cmd_completion)144 420 Q F0 .325(If set, and)184 432 R F1 -.18
(re)2.825 G(adline).18 E F0 .325(is being used,)2.825 F F1(bash)2.824 E
F0 .324(will not attempt to search the)2.824 F F2 -.666(PA)2.824 G(TH)
-.189 E F0 .324(for possible)2.574 F
(completions when completion is attempted on an empty line.)184 444 Q F1
(nocaseglob)144 456 Q F0 .436(If set,)184 468 R F1(bash)2.936 E F0 .436
(matches \214lenames in a case\255insensiti)2.936 F .737 -.15(ve f)-.25
H .437(ashion when performing pathname).05 F -.15(ex)184 480 S
(no_empty_cmd_completion)144 444 Q F0 .324(If set, and)184 456 R F1 -.18
(re)2.824 G(adline).18 E F0 .324(is being used,)2.824 F F1(bash)2.824 E
F0 .324(will not attempt to search the)2.824 F F2 -.666(PA)2.825 G(TH)
-.189 E F0 .325(for possible)2.575 F
(completions when completion is attempted on an empty line.)184 468 Q F1
(nocaseglob)144 480 Q F0 .437(If set,)184 492 R F1(bash)2.937 E F0 .436
(matches \214lenames in a case\255insensiti)2.937 F .736 -.15(ve f)-.25
H .436(ashion when performing pathname).05 F -.15(ex)184 504 S
(pansion \(see).15 E F1 -.1(Pa)2.5 G(thname Expansion).1 E F0(abo)2.5 E
-.15(ve)-.15 G(\).).15 E F1(nocasematch)144 492 Q F0 1.194(If set,)184
504 R F1(bash)3.694 E F0 1.194(matches patterns in a case\255insensiti)
3.694 F 1.493 -.15(ve f)-.25 H 1.193(ashion when performing matching).05
F(while e)184 516 Q -.15(xe)-.15 G(cuting).15 E F1(case)2.5 E F0(or)2.5
E F1([[)2.5 E F0(conditional commands.)2.5 E F1(nullglob)144 528 Q F0
.854(If set,)184 540 R F1(bash)3.354 E F0(allo)3.354 E .855
(ws patterns which match no \214les \(see)-.25 F F1 -.1(Pa)3.355 G .855
(thname Expansion).1 F F0(abo)3.355 E -.15(ve)-.15 G 3.355(\)t).15 G(o)
-3.355 E -.15(ex)184 552 S(pand to a null string, rather than themselv)
.15 E(es.)-.15 E F1(pr)144 564 Q(ogcomp)-.18 E F0 .677
(If set, the programmable completion f)184 576 R .677(acilities \(see)
-.1 F F1(Pr)3.176 E .676(ogrammable Completion)-.18 F F0(abo)3.176 E
-.15(ve)-.15 G(\)).15 E(are enabled.)184 588 Q
(This option is enabled by def)5 E(ault.)-.1 E F1(pr)144 600 Q(omptv)
-.18 E(ars)-.1 E F0 1.447(If set, prompt strings under)184 612 R 1.448
(go parameter e)-.18 F 1.448(xpansion, command substitution, arithmetic)
-.15 F -.15(ex)184 624 S .171(pansion, and quote remo).15 F -.25(va)-.15
-.15(ve)-.15 G(\).).15 E F1(nocasematch)144 516 Q F0 1.193(If set,)184
528 R F1(bash)3.693 E F0 1.194(matches patterns in a case\255insensiti)
3.693 F 1.494 -.15(ve f)-.25 H 1.194(ashion when performing matching).05
F(while e)184 540 Q -.15(xe)-.15 G(cuting).15 E F1(case)2.5 E F0(or)2.5
E F1([[)2.5 E F0(conditional commands.)2.5 E F1(nullglob)144 552 Q F0
.855(If set,)184 564 R F1(bash)3.355 E F0(allo)3.355 E .855
(ws patterns which match no \214les \(see)-.25 F F1 -.1(Pa)3.354 G .854
(thname Expansion).1 F F0(abo)3.354 E -.15(ve)-.15 G 3.354(\)t).15 G(o)
-3.354 E -.15(ex)184 576 S(pand to a null string, rather than themselv)
.15 E(es.)-.15 E F1(pr)144 588 Q(ogcomp)-.18 E F0 .676
(If set, the programmable completion f)184 600 R .677(acilities \(see)
-.1 F F1(Pr)3.177 E .677(ogrammable Completion)-.18 F F0(abo)3.177 E
-.15(ve)-.15 G(\)).15 E(are enabled.)184 612 Q
(This option is enabled by def)5 E(ault.)-.1 E F1(pr)144 624 Q(omptv)
-.18 E(ars)-.1 E F0 1.448(If set, prompt strings under)184 636 R 1.448
(go parameter e)-.18 F 1.447(xpansion, command substitution, arithmetic)
-.15 F -.15(ex)184 648 S .17(pansion, and quote remo).15 F -.25(va)-.15
G 2.67(la).25 G .17(fter being e)-2.67 F .17(xpanded as described in)
-.15 F F2(PR)2.67 E(OMPTING)-.27 E F0(abo)2.42 E -.15(ve)-.15 G(.).15 E
(This option is enabled by def)184 636 Q(ault.)-.1 E F1 -.18(re)144 648
-.15 F F2(PR)2.671 E(OMPTING)-.27 E F0(abo)2.421 E -.15(ve)-.15 G(.).15
E(This option is enabled by def)184 660 Q(ault.)-.1 E F1 -.18(re)144 672
S(stricted_shell).18 E F0 1.069
(The shell sets this option if it is started in restricted mode \(see)
184 660 R F2 1.069(RESTRICTED SHELL)3.569 F F0(belo)184 672 Q 4.178
184 684 R F2 1.069(RESTRICTED SHELL)3.569 F F0(belo)184 696 Q 4.178
(w\). The)-.25 F -.25(va)4.178 G 1.678(lue may not be changed.).25 F
1.678(This is not reset when the startup \214les are)6.678 F -.15(exe)
184 684 S(cuted, allo).15 E(wing the startup \214les to disco)-.25 E
184 708 S(cuted, allo).15 E(wing the startup \214les to disco)-.25 E
-.15(ve)-.15 G 2.5(rw).15 G(hether or not a shell is restricted.)-2.5 E
F1(shift_v)144 696 Q(erbose)-.1 E F0 .501(If set, the)184 708 R F1
(shift)3.001 E F0 -.2(bu)3.001 G .501
(iltin prints an error message when the shift count e).2 F .502
(xceeds the number)-.15 F(of positional parameters.)184 720 Q
(GNU Bash-4.0)72 768 Q(2004 Apr 20)148.735 E(18)198.725 E 0 Cg EP
%%Page: 19 19
%%BeginPageSetup
@@ -2337,101 +2338,104 @@ BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Times-Bold@0 SF(sour)144 84 Q(cepath)-.18 E F0 .771(If set, the)184 96
R F1(sour)3.271 E(ce)-.18 E F0(\()3.271 E F1(.)A F0 3.271(\)b)C .771
(uiltin uses the v)-3.471 F .771(alue of)-.25 F/F2 9/Times-Bold@0 SF
-.666(PA)3.27 G(TH)-.189 E F0 .77
(to \214nd the directory containing the)3.02 F(\214le supplied as an ar)
184 108 Q 2.5(gument. This)-.18 F(option is enabled by def)2.5 E(ault.)
-.1 E F1(xpg_echo)144 120 Q F0(If set, the)184 132 Q F1(echo)2.5 E F0
-.2(bu)2.5 G(iltin e).2 E(xpands backslash-escape sequences by def)-.15
E(ault.)-.1 E F1(suspend)108 144 Q F0([)2.5 E F1<ad66>A F0(])A 1.001
(Suspend the e)144 156 R -.15(xe)-.15 G 1.001
(cution of this shell until it recei).15 F -.15(ve)-.25 G 3.501(sa).15 G
F2(SIGCONT)A F0 3.502(signal. A)3.252 F 1.002(login shell cannot be)
3.502 F .023(suspended; the)144 168 R F1<ad66>2.523 E F0 .023
(option can be used to o)2.523 F -.15(ve)-.15 G .022
(rride this and force the suspension.).15 F .022(The return status is)
5.022 F 2.5(0u)144 180 S(nless the shell is a login shell and)-2.5 E F1
/Times-Bold@0 SF(shift_v)144 84 Q(erbose)-.1 E F0 .502(If set, the)184
96 R F1(shift)3.002 E F0 -.2(bu)3.002 G .501
(iltin prints an error message when the shift count e).2 F .501
(xceeds the number)-.15 F(of positional parameters.)184 108 Q F1(sour)
144 120 Q(cepath)-.18 E F0 .77(If set, the)184 132 R F1(sour)3.27 E(ce)
-.18 E F0(\()3.27 E F1(.)A F0 3.27(\)b)C .77(uiltin uses the v)-3.47 F
.771(alue of)-.25 F/F2 9/Times-Bold@0 SF -.666(PA)3.271 G(TH)-.189 E F0
.771(to \214nd the directory containing the)3.021 F
(\214le supplied as an ar)184 144 Q 2.5(gument. This)-.18 F
(option is enabled by def)2.5 E(ault.)-.1 E F1(xpg_echo)144 156 Q F0
(If set, the)184 168 Q F1(echo)2.5 E F0 -.2(bu)2.5 G(iltin e).2 E
(xpands backslash-escape sequences by def)-.15 E(ault.)-.1 E F1(suspend)
108 180 Q F0([)2.5 E F1<ad66>A F0(])A 1.002(Suspend the e)144 192 R -.15
(xe)-.15 G 1.002(cution of this shell until it recei).15 F -.15(ve)-.25
G 3.501(sa).15 G F2(SIGCONT)A F0 3.501(signal. A)3.251 F 1.001
(login shell cannot be)3.501 F .022(suspended; the)144 204 R F1<ad66>
2.522 E F0 .022(option can be used to o)2.522 F -.15(ve)-.15 G .022
(rride this and force the suspension.).15 F .023(The return status is)
5.023 F 2.5(0u)144 216 S(nless the shell is a login shell and)-2.5 E F1
<ad66>2.5 E F0(is not supplied, or if job control is not enabled.)2.5 E
F1(test)108 192 Q/F3 10/Times-Italic@0 SF -.2(ex)2.5 G(pr).2 E F1([)108
204 Q F3 -.2(ex)2.5 G(pr).2 E F1(])2.5 E F0 1.15
F1(test)108 228 Q/F3 10/Times-Italic@0 SF -.2(ex)2.5 G(pr).2 E F1([)108
240 Q F3 -.2(ex)2.5 G(pr).2 E F1(])2.5 E F0 1.15
(Return a status of 0 or 1 depending on the e)6.77 F -.25(va)-.25 G 1.15
(luation of the conditional e).25 F(xpression)-.15 E F3 -.2(ex)3.65 G
(pr).2 E F0 6.15(.E).73 G(ach)-6.15 E 1.188
(operator and operand must be a separate ar)144 216 R 3.688
(gument. Expressions)-.18 F 1.187(are composed of the primaries)3.688 F
1.889(described abo)144 228 R 2.189 -.15(ve u)-.15 H(nder).15 E F2
(CONDITION)4.389 E 1.889(AL EXPRESSIONS)-.18 F/F4 9/Times-Roman@0 SF(.)A
F1(test)6.389 E F0 1.89(does not accept an)4.389 F 4.39(yo)-.15 G 1.89
(ptions, nor)-4.39 F(does it accept and ignore an ar)144 240 Q
(pr).2 E F0 6.15(.E).73 G(ach)-6.15 E 1.187
(operator and operand must be a separate ar)144 252 R 3.688
(gument. Expressions)-.18 F 1.188(are composed of the primaries)3.688 F
1.89(described abo)144 264 R 2.19 -.15(ve u)-.15 H(nder).15 E F2
(CONDITION)4.39 E 1.89(AL EXPRESSIONS)-.18 F/F4 9/Times-Roman@0 SF(.)A
F1(test)6.39 E F0 1.889(does not accept an)4.389 F 4.389(yo)-.15 G 1.889
(ptions, nor)-4.389 F(does it accept and ignore an ar)144 276 Q
(gument of)-.18 E F1<adad>2.5 E F0(as signifying the end of options.)2.5
E .786(Expressions may be combined using the follo)144 258 R .785
E .785(Expressions may be combined using the follo)144 294 R .786
(wing operators, listed in decreasing order of prece-)-.25 F 2.5
(dence. The)144 270 R -.25(eva)2.5 G
(dence. The)144 306 R -.25(eva)2.5 G
(luation depends on the number of ar).25 E(guments; see belo)-.18 E -.65
(w.)-.25 G F1(!)144 282 Q F3 -.2(ex)2.5 G(pr).2 E F0 -.35(Tr)12.6 G
(w.)-.25 G F1(!)144 318 Q F3 -.2(ex)2.5 G(pr).2 E F0 -.35(Tr)12.6 G
(ue if).35 E F3 -.2(ex)2.5 G(pr).2 E F0(is f)3.23 E(alse.)-.1 E F1(\()
144 294 Q F3 -.2(ex)2.5 G(pr).2 E F1(\))2.5 E F0 .26(Returns the v)6.77
144 330 Q F3 -.2(ex)2.5 G(pr).2 E F1(\))2.5 E F0 .26(Returns the v)6.77
F .26(alue of)-.25 F F3 -.2(ex)2.76 G(pr).2 E F0 5.26(.T)C .26
(his may be used to o)-5.26 F -.15(ve)-.15 G .26
(rride the normal precedence of opera-).15 F(tors.)180 306 Q F3 -.2(ex)
144 318 S(pr1).2 E F0<ad>2.5 E F1(a)A F3 -.2(ex)2.5 G(pr2).2 E F0 -.35
(Tr)180 330 S(ue if both).35 E F3 -.2(ex)2.5 G(pr1).2 E F0(and)2.5 E F3
-.2(ex)2.5 G(pr2).2 E F0(are true.)2.52 E F3 -.2(ex)144 342 S(pr1).2 E
F0<ad>2.5 E F1(o)A F3 -.2(ex)2.5 G(pr2).2 E F0 -.35(Tr)180 354 S
(rride the normal precedence of opera-).15 F(tors.)180 342 Q F3 -.2(ex)
144 354 S(pr1).2 E F0<ad>2.5 E F1(a)A F3 -.2(ex)2.5 G(pr2).2 E F0 -.35
(Tr)180 366 S(ue if both).35 E F3 -.2(ex)2.5 G(pr1).2 E F0(and)2.5 E F3
-.2(ex)2.5 G(pr2).2 E F0(are true.)2.52 E F3 -.2(ex)144 378 S(pr1).2 E
F0<ad>2.5 E F1(o)A F3 -.2(ex)2.5 G(pr2).2 E F0 -.35(Tr)180 390 S
(ue if either).35 E F3 -.2(ex)2.5 G(pr1).2 E F0(or)2.5 E F3 -.2(ex)2.5 G
(pr2).2 E F0(is true.)2.52 E F1(test)144 370.8 Q F0(and)2.5 E F1([)2.5 E
(pr2).2 E F0(is true.)2.52 E F1(test)144 406.8 Q F0(and)2.5 E F1([)2.5 E
F0 -.25(eva)2.5 G(luate conditional e).25 E
(xpressions using a set of rules based on the number of ar)-.15 E
(guments.)-.18 E 2.5(0a)144 388.8 S -.18(rg)-2.5 G(uments).18 E(The e)
180 400.8 Q(xpression is f)-.15 E(alse.)-.1 E 2.5(1a)144 412.8 S -.18
(rg)-2.5 G(ument).18 E(The e)180 424.8 Q
(guments.)-.18 E 2.5(0a)144 424.8 S -.18(rg)-2.5 G(uments).18 E(The e)
180 436.8 Q(xpression is f)-.15 E(alse.)-.1 E 2.5(1a)144 448.8 S -.18
(rg)-2.5 G(ument).18 E(The e)180 460.8 Q
(xpression is true if and only if the ar)-.15 E(gument is not null.)-.18
E 2.5(2a)144 436.8 S -.18(rg)-2.5 G(uments).18 E .37(If the \214rst ar)
180 448.8 R .37(gument is)-.18 F F1(!)2.87 E F0 2.87(,t)C .37(he e)-2.87
E 2.5(2a)144 472.8 S -.18(rg)-2.5 G(uments).18 E .37(If the \214rst ar)
180 484.8 R .37(gument is)-.18 F F1(!)2.87 E F0 2.87(,t)C .37(he e)-2.87
F .37(xpression is true if and only if the second ar)-.15 F .37
(gument is null.)-.18 F .379(If the \214rst ar)180 460.8 R .38
(gument is one of the unary conditional operators listed abo)-.18 F .68
-.15(ve u)-.15 H(nder).15 E F2(CONDI-)2.88 E(TION)180 472.8 Q .553
(gument is null.)-.18 F .38(If the \214rst ar)180 496.8 R .38
(gument is one of the unary conditional operators listed abo)-.18 F .679
-.15(ve u)-.15 H(nder).15 E F2(CONDI-)2.879 E(TION)180 508.8 Q .552
(AL EXPRESSIONS)-.18 F F4(,)A F0 .552(the e)2.802 F .552
(xpression is true if the unary test is true.)-.15 F .552
(If the \214rst ar)5.552 F(gu-)-.18 E(ment is not a v)180 484.8 Q
(If the \214rst ar)5.552 F(gu-)-.18 E(ment is not a v)180 520.8 Q
(alid unary conditional operator)-.25 E 2.5(,t)-.4 G(he e)-2.5 E
(xpression is f)-.15 E(alse.)-.1 E 2.5(3a)144 496.8 S -.18(rg)-2.5 G
(uments).18 E .023(If the second ar)180 508.8 R .023
(xpression is f)-.15 E(alse.)-.1 E 2.5(3a)144 532.8 S -.18(rg)-2.5 G
(uments).18 E .024(If the second ar)180 544.8 R .023
(gument is one of the binary conditional operators listed abo)-.18 F
.324 -.15(ve u)-.15 H(nder).15 E F2(CON-)2.524 E(DITION)180 520.8 Q
1.478(AL EXPRESSIONS)-.18 F F4(,)A F0 1.477(the result of the e)3.727 F
.323 -.15(ve u)-.15 H(nder).15 E F2(CON-)2.523 E(DITION)180 556.8 Q
1.477(AL EXPRESSIONS)-.18 F F4(,)A F0 1.477(the result of the e)3.727 F
1.477(xpression is the result of the binary test)-.15 F .513
(using the \214rst and third ar)180 532.8 R .513(guments as operands.)
(using the \214rst and third ar)180 568.8 R .513(guments as operands.)
-.18 F(The)5.513 E F1<ad61>3.013 E F0(and)3.013 E F1<ad6f>3.013 E F0
.513(operators are considered)3.013 F .972
(binary operators when there are three ar)180 544.8 R 3.472(guments. If)
.512(operators are considered)3.013 F .972
(binary operators when there are three ar)180 580.8 R 3.472(guments. If)
-.18 F .972(the \214rst ar)3.472 F .972(gument is)-.18 F F1(!)3.472 E F0
3.472(,t)C .972(he v)-3.472 F .972(alue is)-.25 F .883(the ne)180 556.8
R -.05(ga)-.15 G .883(tion of the tw).05 F(o-ar)-.1 E .884
(gument test using the second and third ar)-.18 F 3.384(guments. If)-.18
F .884(the \214rst)3.384 F(ar)180 568.8 Q .875(gument is e)-.18 F
(xactly)-.15 E F1(\()3.375 E F0 .875(and the third ar)3.375 F .875
(gument is e)-.18 F(xactly)-.15 E F1(\))3.375 E F0 3.374(,t)C .874
(he result is the one-ar)-3.374 F(gument)-.18 E(test of the second ar)
180 580.8 Q 2.5(gument. Otherwise,)-.18 F(the e)2.5 E(xpression is f)
-.15 E(alse.)-.1 E 2.5(4a)144 592.8 S -.18(rg)-2.5 G(uments).18 E .384
(If the \214rst ar)180 604.8 R .384(gument is)-.18 F F1(!)2.884 E F0
2.885(,t)C .385(he result is the ne)-2.885 F -.05(ga)-.15 G .385
(tion of the three-ar).05 F .385(gument e)-.18 F .385(xpression com-)
-.15 F 1.648(posed of the remaining ar)180 616.8 R 4.147
(guments. Otherwise,)-.18 F 1.647(the e)4.147 F 1.647
3.472(,t)C .972(he v)-3.472 F .972(alue is)-.25 F .884(the ne)180 592.8
R -.05(ga)-.15 G .884(tion of the tw).05 F(o-ar)-.1 E .884
(gument test using the second and third ar)-.18 F 3.383(guments. If)-.18
F .883(the \214rst)3.383 F(ar)180 604.8 Q .874(gument is e)-.18 F
(xactly)-.15 E F1(\()3.374 E F0 .875(and the third ar)3.374 F .875
(gument is e)-.18 F(xactly)-.15 E F1(\))3.375 E F0 3.375(,t)C .875
(he result is the one-ar)-3.375 F(gument)-.18 E(test of the second ar)
180 616.8 Q 2.5(gument. Otherwise,)-.18 F(the e)2.5 E(xpression is f)
-.15 E(alse.)-.1 E 2.5(4a)144 628.8 S -.18(rg)-2.5 G(uments).18 E .385
(If the \214rst ar)180 640.8 R .385(gument is)-.18 F F1(!)2.885 E F0
2.885(,t)C .385(he result is the ne)-2.885 F -.05(ga)-.15 G .384
(tion of the three-ar).05 F .384(gument e)-.18 F .384(xpression com-)
-.15 F 1.647(posed of the remaining ar)180 652.8 R 4.147
(guments. Otherwise,)-.18 F 1.647(the e)4.147 F 1.648
(xpression is parsed and e)-.15 F -.25(va)-.25 G(luated).25 E
(according to precedence using the rules listed abo)180 628.8 Q -.15(ve)
-.15 G(.).15 E 2.5(5o)144 640.8 S 2.5(rm)-2.5 G(ore ar)-2.5 E(guments)
-.18 E 1.635(The e)180 652.8 R 1.635(xpression is parsed and e)-.15 F
(according to precedence using the rules listed abo)180 664.8 Q -.15(ve)
-.15 G(.).15 E 2.5(5o)144 676.8 S 2.5(rm)-2.5 G(ore ar)-2.5 E(guments)
-.18 E 1.635(The e)180 688.8 R 1.635(xpression is parsed and e)-.15 F
-.25(va)-.25 G 1.635
(luated according to precedence using the rules listed).25 F(abo)180
664.8 Q -.15(ve)-.15 G(.).15 E F1(times)108 681.6 Q F0 1.229(Print the \
700.8 Q -.15(ve)-.15 G(.).15 E F1(times)108 717.6 Q F0 1.229(Print the \
accumulated user and system times for the shell and for processes run f\
rom the shell.)13.23 F(The return status is 0.)144 693.6 Q(GNU Bash-4.0)
rom the shell.)13.23 F(The return status is 0.)144 729.6 Q(GNU Bash-4.0)
72 768 Q(2004 Apr 20)148.735 E(19)198.725 E 0 Cg EP
%%Page: 20 20
%%BeginPageSetup
@@ -2441,144 +2445,144 @@ BP
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Times-Bold@0 SF(trap)108 84 Q F0([)2.5 E F1(\255lp)A F0 2.5(][)C([)-2.5
E/F2 10/Times-Italic@0 SF(ar)A(g)-.37 E F0(])A F2(sigspec)2.5 E F0(...])
2.5 E .702(The command)144 96 R F2(ar)3.532 E(g)-.37 E F0 .702
(is to be read and e)3.422 F -.15(xe)-.15 G .702
(cuted when the shell recei).15 F -.15(ve)-.25 G 3.203(ss).15 G
(ignal\(s\))-3.203 E F2(sigspec)3.203 E F0 5.703(.I).31 G(f)-5.703 E F2
(ar)3.533 E(g)-.37 E F0(is)3.423 E .609(absent \(and there is a single)
2.5 E .703(The command)144 96 R F2(ar)3.533 E(g)-.37 E F0 .703
(is to be read and e)3.423 F -.15(xe)-.15 G .702
(cuted when the shell recei).15 F -.15(ve)-.25 G 3.202(ss).15 G
(ignal\(s\))-3.202 E F2(sigspec)3.202 E F0 5.702(.I).31 G(f)-5.702 E F2
(ar)3.532 E(g)-.37 E F0(is)3.422 E .608(absent \(and there is a single)
144 108 R F2(sigspec)3.108 E F0 3.108(\)o)C(r)-3.108 E F1<ad>3.108 E F0
3.108(,e)C .608
(ach speci\214ed signal is reset to its original disposition)-3.108 F
.658(\(the v)144 120 R .658(alue it had upon entrance to the shell\).)
-.25 F(If)5.658 E F2(ar)3.488 E(g)-.37 E F0 .659
.659(\(the v)144 120 R .659(alue it had upon entrance to the shell\).)
-.25 F(If)5.658 E F2(ar)3.488 E(g)-.37 E F0 .658
(is the null string the signal speci\214ed by each)3.378 F F2(sigspec)
144.34 132 Q F0 .581(is ignored by the shell and by the commands it in)
3.391 F -.2(vo)-.4 G -.1(ke).2 G 3.08(s. If).1 F F2(ar)3.41 E(g)-.37 E
F0 .58(is not present and)3.3 F F1<ad70>3.08 E F0(has)3.08 E 1.214
144.34 132 Q F0 .58(is ignored by the shell and by the commands it in)
3.39 F -.2(vo)-.4 G -.1(ke).2 G 3.081(s. If).1 F F2(ar)3.411 E(g)-.37 E
F0 .581(is not present and)3.301 F F1<ad70>3.081 E F0(has)3.081 E 1.215
(been supplied, then the trap commands associated with each)144 144 R F2
(sigspec)4.054 E F0 1.215(are displayed.)4.024 F 1.215(If no ar)6.215 F
(sigspec)4.054 E F0 1.214(are displayed.)4.024 F 1.214(If no ar)6.214 F
(gu-)-.18 E .86(ments are supplied or if only)144 156 R F1<ad70>3.36 E
F0 .86(is gi)3.36 F -.15(ve)-.25 G(n,).15 E F1(trap)3.36 E F0 .86
(prints the list of commands associated with each)3.36 F 2.83
(signal. The)144 168 R F1<ad6c>2.83 E F0 .33(option causes the shell to\
print a list of signal names and their corresponding num-)2.83 F 4.311
(bers. Each)144 180 R F2(sigspec)4.651 E F0 1.811
(is either a signal name de\214ned in <)4.621 F F2(signal.h)A F0 1.81
(>, or a signal number)B 6.81(.S)-.55 G(ignal)-6.81 E
print a list of signal names and their corresponding num-)2.83 F 4.31
(bers. Each)144 180 R F2(sigspec)4.65 E F0 1.811
(is either a signal name de\214ned in <)4.62 F F2(signal.h)A F0 1.811
(>, or a signal number)B 6.811(.S)-.55 G(ignal)-6.811 E
(names are case insensiti)144 192 Q .3 -.15(ve a)-.25 H(nd the).15 E/F3
9/Times-Bold@0 SF(SIG)2.5 E F0(pre\214x is optional.)2.25 E 1.648(If a)
144 210 R F2(sigspec)4.488 E F0(is)4.458 E F3(EXIT)4.148 E F0 1.648
(\(0\) the command)3.898 F F2(ar)4.479 E(g)-.37 E F0 1.649(is e)4.369 F
-.15(xe)-.15 G 1.649(cuted on e).15 F 1.649(xit from the shell.)-.15 F
1.649(If a)6.649 F F2(sigspec)4.489 E F0(is)4.459 E F3(DEB)144 222 Q(UG)
-.09 E/F4 9/Times-Roman@0 SF(,)A F0 1.168(the command)3.418 F F2(ar)
3.998 E(g)-.37 E F0 1.168(is e)3.888 F -.15(xe)-.15 G 1.167
(cuted before e).15 F -.15(ve)-.25 G(ry).15 E F2 1.167(simple command)
3.667 F F0(,)A F2(for)3.667 E F0(command,)3.667 E F2(case)3.667 E F0
(com-)3.667 E(mand,)144 234 Q F2(select)2.646 E F0 .146(command, e)2.646
F -.15(ve)-.25 G .146(ry arithmetic).15 F F2(for)2.646 E F0 .147
(command, and before the \214rst command e)2.646 F -.15(xe)-.15 G .147
(cutes in a).15 F .146(shell function \(see)144 246 R F3 .146
(SHELL GRAMMAR)2.646 F F0(abo)2.396 E -.15(ve)-.15 G 2.646(\). Refer).15
F .146(to the description of the)2.646 F F1(extdeb)2.645 E(ug)-.2 E F0
.145(option to)2.645 F(the)144 258 Q F1(shopt)3.2 E F0 -.2(bu)3.2 G .7
(iltin for details of its ef).2 F .7(fect on the)-.25 F F1(DEB)3.2 E(UG)
-.1 E F0 3.2(trap. If)3.2 F(a)3.2 E F2(sigspec)3.54 E F0(is)3.51 E F3
(RETURN)3.2 E F4(,)A F0 .701(the com-)2.951 F(mand)144 270 Q F2(ar)3.474
E(g)-.37 E F0 .644(is e)3.364 F -.15(xe)-.15 G .643
9/Times-Bold@0 SF(SIG)2.5 E F0(pre\214x is optional.)2.25 E 1.649(If a)
144 210 R F2(sigspec)4.489 E F0(is)4.459 E F3(EXIT)4.149 E F0 1.649
(\(0\) the command)3.899 F F2(ar)4.479 E(g)-.37 E F0 1.649(is e)4.369 F
-.15(xe)-.15 G 1.649(cuted on e).15 F 1.648(xit from the shell.)-.15 F
1.648(If a)6.648 F F2(sigspec)4.488 E F0(is)4.458 E F3(DEB)144 222 Q(UG)
-.09 E/F4 9/Times-Roman@0 SF(,)A F0 1.167(the command)3.417 F F2(ar)
3.997 E(g)-.37 E F0 1.167(is e)3.887 F -.15(xe)-.15 G 1.167
(cuted before e).15 F -.15(ve)-.25 G(ry).15 E F2 1.168(simple command)
3.667 F F0(,)A F2(for)3.668 E F0(command,)3.668 E F2(case)3.668 E F0
(com-)3.668 E(mand,)144 234 Q F2(select)2.647 E F0 .147(command, e)2.647
F -.15(ve)-.25 G .147(ry arithmetic).15 F F2(for)2.647 E F0 .146
(command, and before the \214rst command e)2.647 F -.15(xe)-.15 G .146
(cutes in a).15 F .145(shell function \(see)144 246 R F3 .145
(SHELL GRAMMAR)2.645 F F0(abo)2.395 E -.15(ve)-.15 G 2.646(\). Refer).15
F .146(to the description of the)2.646 F F1(extdeb)2.646 E(ug)-.2 E F0
.146(option to)2.646 F(the)144 258 Q F1(shopt)3.201 E F0 -.2(bu)3.201 G
.7(iltin for details of its ef).2 F .7(fect on the)-.25 F F1(DEB)3.2 E
(UG)-.1 E F0 3.2(trap. If)3.2 F(a)3.2 E F2(sigspec)3.54 E F0(is)3.51 E
F3(RETURN)3.2 E F4(,)A F0 .7(the com-)2.95 F(mand)144 270 Q F2(ar)3.473
E(g)-.37 E F0 .643(is e)3.363 F -.15(xe)-.15 G .643
(cuted each time a shell function or a script e).15 F -.15(xe)-.15 G
.643(cuted with the).15 F F1(.)3.143 E F0(or)3.143 E F1(sour)3.143 E(ce)
-.18 E F0 -.2(bu)3.143 G(iltins).2 E(\214nishes e)144 282 Q -.15(xe)-.15
G(cuting.).15 E .928(If a)144 300 R F2(sigspec)3.768 E F0(is)3.738 E F3
.644(cuted with the).15 F F1(.)3.144 E F0(or)3.144 E F1(sour)3.144 E(ce)
-.18 E F0 -.2(bu)3.144 G(iltins).2 E(\214nishes e)144 282 Q -.15(xe)-.15
G(cuting.).15 E .929(If a)144 300 R F2(sigspec)3.769 E F0(is)3.739 E F3
(ERR)3.429 E F4(,)A F0 .929(the command)3.179 F F2(ar)3.759 E(g)-.37 E
F0 .929(is e)3.649 F -.15(xe)-.15 G .929(cuted whene).15 F -.15(ve)-.25
G 3.429(ras).15 G .929(imple command has a non\255zero)-3.429 F -.15(ex)
144 312 S 1.009(it status, subject to the follo).15 F 1.009
G 3.429(ras).15 G .928(imple command has a non\255zero)-3.429 F -.15(ex)
144 312 S 1.008(it status, subject to the follo).15 F 1.009
(wing conditions.)-.25 F(The)6.009 E F3(ERR)3.509 E F0 1.009
(trap is not e)3.259 F -.15(xe)-.15 G 1.008(cuted if the f).15 F 1.008
(trap is not e)3.259 F -.15(xe)-.15 G 1.009(cuted if the f).15 F 1.009
(ailed com-)-.1 F .324
(mand is part of the command list immediately follo)144 324 R .324
(wing a)-.25 F F1(while)2.824 E F0(or)2.824 E F1(until)2.824 E F0 -.1
(ke)2.824 G(yw)-.05 E .324(ord, part of the test)-.1 F 1.129(in an)144
(ke)2.824 G(yw)-.05 E .324(ord, part of the test)-.1 F 1.128(in an)144
336 R F2(if)3.639 E F0 1.129(statement, part of a command e)5.589 F -.15
(xe)-.15 G 1.129(cuted in a).15 F F1(&&)3.629 E F0(or)3.629 E/F5 10
/Symbol SF<efef>3.629 E F0 1.129(list, or if the command')3.629 F 3.628
(sr)-.55 G(eturn)-3.628 E -.25(va)144 348 S(lue is being in).25 E -.15
/Symbol SF<efef>3.629 E F0 1.129(list, or if the command')3.629 F 3.629
(sr)-.55 G(eturn)-3.629 E -.25(va)144 348 S(lue is being in).25 E -.15
(ve)-.4 G(rted via).15 E F1(!)2.5 E F0 5(.T)C
(hese are the same conditions obe)-5 E(yed by the)-.15 E F1(err)2.5 E
(exit)-.18 E F0(option.)2.5 E 1.095
(Signals ignored upon entry to the shell cannot be trapped or reset.)144
366 R -.35(Tr)6.095 G 1.095(apped signals that are not).35 F .662
(being ignored are reset to their original v)144 378 R .662
(alues in a subshell or subshell en)-.25 F .661(vironment when one is)
(alues in a subshell or subshell en)-.25 F .662(vironment when one is)
-.4 F 2.5(created. The)144 390 R(return status is f)2.5 E(alse if an)-.1
E(y)-.15 E F2(sigspec)2.84 E F0(is in)2.81 E -.25(va)-.4 G
(lid; otherwise).25 E F1(trap)2.5 E F0(returns true.)2.5 E F1(type)108
406.8 Q F0([)2.5 E F1(\255aftpP)A F0(])A F2(name)2.5 E F0([)2.5 E F2
(name)A F0(...])2.5 E -.4(Wi)144 418.8 S .173
(th no options, indicate ho).4 F 2.673(we)-.25 G(ach)-2.673 E F2(name)
3.033 E F0 -.1(wo)2.853 G .174
(uld be interpreted if used as a command name.).1 F .174(If the)5.174 F
F1<ad74>144 430.8 Q F0 .843(option is used,)3.343 F F1(type)3.343 E F0
(name)A F0(...])2.5 E -.4(Wi)144 418.8 S .174
(th no options, indicate ho).4 F 2.674(we)-.25 G(ach)-2.674 E F2(name)
3.034 E F0 -.1(wo)2.854 G .173
(uld be interpreted if used as a command name.).1 F .173(If the)5.173 F
F1<ad74>144 430.8 Q F0 .842(option is used,)3.342 F F1(type)3.342 E F0
.843(prints a string which is one of)3.343 F F2(alias)3.343 E F0(,).27 E
F2 -.1(ke)3.343 G(ywor)-.2 E(d)-.37 E F0(,).77 E F2(function)3.343 E F0
(,).24 E F2 -.2(bu)3.342 G(iltin).2 E F0 3.342(,o).24 G(r)-3.342 E F2
(\214le)5.252 E F0(if)3.522 E F2(name)144.36 442.8 Q F0 .086
(is an alias, shell reserv)2.766 F .086(ed w)-.15 F .086
(ord, function, b)-.1 F .087(uiltin, or disk \214le, respecti)-.2 F -.15
(ve)-.25 G(ly).15 E 5.087(.I)-.65 G 2.587(ft)-5.087 G(he)-2.587 E F2
(name)2.947 E F0 .087(is not)2.767 F .119
(,).24 E F2 -.2(bu)3.343 G(iltin).2 E F0 3.343(,o).24 G(r)-3.343 E F2
(\214le)5.253 E F0(if)3.523 E F2(name)144.36 442.8 Q F0 .087
(is an alias, shell reserv)2.767 F .087(ed w)-.15 F .087
(ord, function, b)-.1 F .086(uiltin, or disk \214le, respecti)-.2 F -.15
(ve)-.25 G(ly).15 E 5.086(.I)-.65 G 2.586(ft)-5.086 G(he)-2.586 E F2
(name)2.946 E F0 .086(is not)2.766 F .118
(found, then nothing is printed, and an e)144 454.8 R .118
(xit status of f)-.15 F .118(alse is returned.)-.1 F .118(If the)5.118 F
F1<ad70>2.618 E F0 .118(option is used,)2.618 F F1(type)2.618 E F0 .855
(xit status of f)-.15 F .118(alse is returned.)-.1 F .119(If the)5.119 F
F1<ad70>2.619 E F0 .119(option is used,)2.619 F F1(type)2.619 E F0 .855
(either returns the name of the disk \214le that w)144 466.8 R .855
(ould be e)-.1 F -.15(xe)-.15 G .855(cuted if).15 F F2(name)3.715 E F0
.855(were speci\214ed as a com-)3.535 F .641(mand name, or nothing if)
144 478.8 R/F6 10/Courier@0 SF .641(type -t name)3.141 F F0 -.1(wo)3.141
G .641(uld not return).1 F F2(\214le)3.14 E F0 5.64(.T).18 G(he)-5.64 E
F1<ad50>3.14 E F0 .64(option forces a)3.14 F F3 -.666(PA)3.14 G(TH)-.189
E F0 .112(search for each)144 490.8 R F2(name)2.612 E F0 2.612(,e)C -.15
(ve)-2.862 G 2.613(ni).15 G(f)-2.613 E F6 .113(type -t name)2.613 F F0
-.1(wo)2.613 G .113(uld not return).1 F F2(\214le)2.613 E F0 5.113(.I)
.18 G 2.613(fac)-5.113 G .113(ommand is hashed,)-2.613 F F1<ad70>2.613 E
F0(and)144 502.8 Q F1<ad50>2.945 E F0 .445(print the hashed v)2.945 F
.444(alue, not necessarily the \214le that appears \214rst in)-.25 F F3
-.666(PA)2.944 G(TH)-.189 E F4(.)A F0 .444(If the)4.944 F F1<ad61>2.944
E F0(option)2.944 E .265(is used,)144 514.8 R F1(type)2.765 E F0 .265
(prints all of the places that contain an e)2.765 F -.15(xe)-.15 G .265
(cutable named).15 F F2(name)2.765 E F0 5.265(.T).18 G .265
(his includes aliases)-5.265 F .427(and functions, if and only if the)
.855(were speci\214ed as a com-)3.535 F .64(mand name, or nothing if)144
478.8 R/F6 10/Courier@0 SF .64(type -t name)3.14 F F0 -.1(wo)3.14 G .641
(uld not return).1 F F2(\214le)3.141 E F0 5.641(.T).18 G(he)-5.641 E F1
<ad50>3.141 E F0 .641(option forces a)3.141 F F3 -.666(PA)3.141 G(TH)
-.189 E F0 .113(search for each)144 490.8 R F2(name)2.613 E F0 2.613(,e)
C -.15(ve)-2.863 G 2.613(ni).15 G(f)-2.613 E F6 .113(type -t name)2.613
F F0 -.1(wo)2.613 G .113(uld not return).1 F F2(\214le)2.613 E F0 5.113
(.I).18 G 2.613(fa)-5.113 G .112(command is hashed,)-.001 F F1<ad70>
2.612 E F0(and)144 502.8 Q F1<ad50>2.944 E F0 .444(print the hashed v)
2.944 F .444(alue, not necessarily the \214le that appears \214rst in)
-.25 F F3 -.666(PA)2.945 G(TH)-.189 E F4(.)A F0 .445(If the)4.945 F F1
<ad61>2.945 E F0(option)2.945 E .265(is used,)144 514.8 R F1(type)2.765
E F0 .265(prints all of the places that contain an e)2.765 F -.15(xe)
-.15 G .265(cutable named).15 F F2(name)2.765 E F0 5.265(.T).18 G .265
(his includes aliases)-5.265 F .426(and functions, if and only if the)
144 526.8 R F1<ad70>2.926 E F0 .426(option is not also used.)2.926 F
.426(The table of hashed commands is not)5.426 F .548
(consulted when using)144 538.8 R F1<ad61>3.048 E F0 5.548(.T)C(he)
-5.548 E F1<ad66>3.048 E F0 .549
(option suppresses shell function lookup, as with the)3.048 F F1
(command)3.049 E F0 -.2(bu)144 550.8 S(iltin.).2 E F1(type)5 E F0
.427(The table of hashed commands is not)5.426 F .549
(consulted when using)144 538.8 R F1<ad61>3.049 E F0 5.549(.T)C(he)
-5.549 E F1<ad66>3.049 E F0 .548
(option suppresses shell function lookup, as with the)3.049 F F1
(command)3.048 E F0 -.2(bu)144 550.8 S(iltin.).2 E F1(type)5 E F0
(returns true if all of the ar)2.5 E(guments are found, f)-.18 E
(alse if an)-.1 E 2.5(ya)-.15 G(re not found.)-2.5 E F1(ulimit)108 567.6
Q F0([)2.5 E F1(\255HST)A(abcde\214lmnpqrstuvx)-.92 E F0([)2.5 E F2
(limit)A F0(]])A(Pro)144 579.6 Q .244(vides control o)-.15 F -.15(ve)
-.15 G 2.744(rt).15 G .244(he resources a)-2.744 F -.25(va)-.2 G .244
(limit)A F0(]])A(Pro)144 579.6 Q .243(vides control o)-.15 F -.15(ve)
-.15 G 2.743(rt).15 G .243(he resources a)-2.743 F -.25(va)-.2 G .244
(ilable to the shell and to processes started by it, on systems).25 F
.943(that allo)144 591.6 R 3.443(ws)-.25 G .943(uch control.)-3.443 F
(The)5.943 E F1<ad48>3.443 E F0(and)3.443 E F1<ad53>3.444 E F0 .944
.944(that allo)144 591.6 R 3.444(ws)-.25 G .944(uch control.)-3.444 F
(The)5.944 E F1<ad48>3.444 E F0(and)3.444 E F1<ad53>3.444 E F0 .943
(options specify that the hard or soft limit is set for the)3.444 F(gi)
144 603.6 Q -.15(ve)-.25 G 2.709(nr).15 G 2.709(esource. A)-2.709 F .208
144 603.6 Q -.15(ve)-.25 G 2.708(nr).15 G 2.708(esource. A)-2.708 F .208
(hard limit cannot be increased by a non-root user once it is set; a so\
ft limit may)2.709 F .425(be increased up to the v)144 615.6 R .425
(alue of the hard limit.)-.25 F .426(If neither)5.425 F F1<ad48>2.926 E
F0(nor)2.926 E F1<ad53>2.926 E F0 .426
(is speci\214ed, both the soft and)2.926 F .139(hard limits are set.)144
ft limit may)2.708 F .426(be increased up to the v)144 615.6 R .426
(alue of the hard limit.)-.25 F .425(If neither)5.426 F F1<ad48>2.925 E
F0(nor)2.925 E F1<ad53>2.925 E F0 .425
(is speci\214ed, both the soft and)2.925 F .139(hard limits are set.)144
627.6 R .139(The v)5.139 F .139(alue of)-.25 F F2(limit)2.729 E F0 .139
(can be a number in the unit speci\214ed for the resource or one)3.319 F
.741(of the special v)144 639.6 R(alues)-.25 E F1(hard)3.241 E F0(,)A F1
.742(of the special v)144 639.6 R(alues)-.25 E F1(hard)3.242 E F0(,)A F1
(soft)3.241 E F0 3.241(,o)C(r)-3.241 E F1(unlimited)3.241 E F0 3.241(,w)
C .741(hich stand for the current hard limit, the current)-3.241 F .78
(soft limit, and no limit, respecti)144 651.6 R -.15(ve)-.25 G(ly).15 E
5.78(.I)-.65 G(f)-5.78 E F2(limit)3.37 E F0 .78
(is omitted, the current v)3.96 F .78(alue of the soft limit of the)-.25
F .498(resource is printed, unless the)144 663.6 R F1<ad48>2.999 E F0
.499(option is gi)2.999 F -.15(ve)-.25 G 2.999(n. When).15 F .499
F .499(resource is printed, unless the)144 663.6 R F1<ad48>2.999 E F0
.499(option is gi)2.999 F -.15(ve)-.25 G 2.999(n. When).15 F .498
(more than one resource is speci\214ed, the)2.999 F
(limit name and unit are printed before the v)144 675.6 Q 2.5
(alue. Other)-.25 F(options are interpreted as follo)2.5 E(ws:)-.25 E F1
@@ -2602,8 +2606,8 @@ E F1<ad69>144 120 Q F0(The maximum number of pending signals)27.52 E F1
(The maximum resident set size \(man)21.97 E 2.5(ys)-.15 G
(ystems do not honor this limit\))-2.5 E F1<ad6e>144 156 Q F0 .791(The \
maximum number of open \214le descriptors \(most systems do not allo)
24.74 F 3.29(wt)-.25 G .79(his v)-3.29 F .79(alue to)-.25 F(be set\))180
168 Q F1<ad70>144 180 Q F0
24.74 F 3.291(wt)-.25 G .791(his v)-3.291 F .791(alue to)-.25 F
(be set\))180 168 Q F1<ad70>144 180 Q F0
(The pipe size in 512-byte blocks \(this may not be set\))24.74 E F1
<ad71>144 192 Q F0(The maximum number of bytes in POSIX message queues)
24.74 E F1<ad72>144 204 Q F0(The maximum real-time scheduling priority)
@@ -2618,16 +2622,16 @@ Q F1<ad78>144 276 Q F0(The maximum number of \214le locks)25.3 E F1
/F2 10/Times-Italic@0 SF(limit)2.933 E F0 .343(is gi)3.523 F -.15(ve)
-.25 G .343(n, it is the ne).15 F 2.843(wv)-.25 G .343
(alue of the speci\214ed resource \(the)-3.093 F F1<ad61>2.843 E F0 .343
(option is display only\).)2.843 F .343(If no)5.343 F .175(option is gi)
144 316.8 R -.15(ve)-.25 G .175(n, then).15 F F1<ad66>2.675 E F0 .175
(is assumed.)2.675 F -1.11(Va)5.175 G .175
(lues are in 1024-byte increments, e)1.11 F .176(xcept for)-.15 F F1
<ad74>2.676 E F0 2.676(,w)C .176(hich is in)-2.676 F(seconds,)144 328.8
Q F1<ad70>2.516 E F0 2.516(,w)C .016
(hich is in units of 512-byte blocks, and)-2.516 F F1<ad54>2.516 E F0(,)
A F1<ad62>2.515 E F0(,)A F1<ad6e>2.515 E F0 2.515(,a)C(nd)-2.515 E F1
<ad75>2.515 E F0 2.515(,w)C .015(hich are unscaled v)-2.515 F(al-)-.25 E
3.787(ues. The)144 340.8 R 1.287(return status is 0 unless an in)3.787 F
(option is display only\).)2.843 F .343(If no)5.343 F .176(option is gi)
144 316.8 R -.15(ve)-.25 G .176(n, then).15 F F1<ad66>2.676 E F0 .175
(is assumed.)2.676 F -1.11(Va)5.175 G .175
(lues are in 1024-byte increments, e)1.11 F .175(xcept for)-.15 F F1
<ad74>2.675 E F0 2.675(,w)C .175(hich is in)-2.675 F(seconds,)144 328.8
Q F1<ad70>2.515 E F0 2.515(,w)C .015
(hich is in units of 512-byte blocks, and)-2.515 F F1<ad54>2.516 E F0(,)
A F1<ad62>2.516 E F0(,)A F1<ad6e>2.516 E F0 2.516(,a)C(nd)-2.516 E F1
<ad75>2.516 E F0 2.516(,w)C .016(hich are unscaled v)-2.516 F(al-)-.25 E
3.788(ues. The)144 340.8 R 1.287(return status is 0 unless an in)3.787 F
-.25(va)-.4 G 1.287(lid option or ar).25 F 1.287
(gument is supplied, or an error occurs)-.18 F(while setting a ne)144
352.8 Q 2.5(wl)-.25 G(imit.)-2.5 E F1(umask)108 369.6 Q F0([)2.5 E F1
@@ -2637,15 +2641,15 @@ A F1<ad62>2.515 E F0(,)A F1<ad6e>2.515 E F0 2.515(,a)C(nd)-2.515 E F1
(gins with a digit, it is interpreted as an octal)-.15 F .066(number; o\
therwise it is interpreted as a symbolic mode mask similar to that acce\
pted by)144 393.6 R F2 -.15(ch)2.566 G(mod).15 E F0(\(1\).).77 E(If)144
405.6 Q F2(mode)3.263 E F0 .382(is omitted, the current v)3.063 F .382
405.6 Q F2(mode)3.262 E F0 .382(is omitted, the current v)3.062 F .382
(alue of the mask is printed.)-.25 F(The)5.382 E F1<ad53>2.882 E F0 .382
(option causes the mask to be)2.882 F .547
(printed in symbolic form; the def)144 417.6 R .547
(ault output is an octal number)-.1 F 5.547(.I)-.55 G 3.047(ft)-5.547 G
(he)-3.047 E F1<ad70>3.047 E F0 .547(option is supplied, and)3.047 F F2
(mode)144.38 429.6 Q F0 .552
(is omitted, the output is in a form that may be reused as input.)3.232
F .551(The return status is 0 if the)5.551 F(mode w)144 441.6 Q
(mode)144.38 429.6 Q F0 .551
(is omitted, the output is in a form that may be reused as input.)3.231
F .552(The return status is 0 if the)5.552 F(mode w)144 441.6 Q
(as successfully changed or if no)-.1 E F2(mode)2.5 E F0(ar)2.5 E
(gument w)-.18 E(as supplied, and f)-.1 E(alse otherwise.)-.1 E F1
(unalias)108 458.4 Q F0<5bad>2.5 E F1(a)A F0 2.5(][)C F2(name)-2.5 E F0
@@ -2655,40 +2659,40 @@ F1<ad61>4.155 E F0 1.655(is supplied, all alias de\214nitions are)4.155
F(remo)144 482.4 Q -.15(ve)-.15 G 2.5(d. The).15 F(return v)2.5 E
(alue is true unless a supplied)-.25 E F2(name)2.86 E F0
(is not a de\214ned alias.)2.68 E F1(unset)108 499.2 Q F0<5bad>2.5 E F1
(fv)A F0 2.5(][)C F2(name)-2.5 E F0(...])2.5 E -.15(Fo)144 511.2 S 3.107
(re).15 G(ach)-3.107 E F2(name)3.107 E F0 3.107(,r).18 G(emo)-3.107 E
.907 -.15(ve t)-.15 H .607(he corresponding v).15 F .607
(ariable or function.)-.25 F .606(If no options are supplied, or the)
5.607 F F1<ad76>144 523.2 Q F0 .304(option is gi)2.804 F -.15(ve)-.25 G
.304(n, each).15 F F2(name)3.164 E F0 .305(refers to a shell v)2.985 F
2.805(ariable. Read-only)-.25 F -.25(va)2.805 G .305
(riables may not be unset.).25 F(If)5.305 E F1<ad66>144 535.2 Q F0 .46
(is speci\214ed, each)2.96 F F2(name)3.32 E F0 .459
(refers to a shell function, and the function de\214nition is remo)3.14
F -.15(ve)-.15 G 2.959(d. Each).15 F .902(unset v)144 547.2 R .902
(fv)A F0 2.5(][)C F2(name)-2.5 E F0(...])2.5 E -.15(Fo)144 511.2 S 3.106
(re).15 G(ach)-3.106 E F2(name)3.106 E F0 3.106(,r).18 G(emo)-3.106 E
.906 -.15(ve t)-.15 H .606(he corresponding v).15 F .607
(ariable or function.)-.25 F .607(If no options are supplied, or the)
5.607 F F1<ad76>144 523.2 Q F0 .305(option is gi)2.805 F -.15(ve)-.25 G
.305(n, each).15 F F2(name)3.165 E F0 .305(refers to a shell v)2.985 F
2.805(ariable. Read-only)-.25 F -.25(va)2.805 G .304
(riables may not be unset.).25 F(If)5.304 E F1<ad66>144 535.2 Q F0 .459
(is speci\214ed, each)2.959 F F2(name)3.319 E F0 .459
(refers to a shell function, and the function de\214nition is remo)3.139
F -.15(ve)-.15 G 2.96(d. Each).15 F .903(unset v)144 547.2 R .903
(ariable or function is remo)-.25 F -.15(ve)-.15 G 3.402(df).15 G .902
(rom the en)-3.402 F .903(vironment passed to subsequent commands.)-.4 F
(If)5.903 E(an)144 559.2 Q 6.916(yo)-.15 G(f)-6.916 E/F3 9/Times-Bold@0
SF(COMP_W)6.916 E(ORDBREAKS)-.09 E/F4 9/Times-Roman@0 SF(,)A F3(RANDOM)
(rom the en)-3.402 F .902(vironment passed to subsequent commands.)-.4 F
(If)5.902 E(an)144 559.2 Q 6.915(yo)-.15 G(f)-6.915 E/F3 9/Times-Bold@0
SF(COMP_W)6.915 E(ORDBREAKS)-.09 E/F4 9/Times-Roman@0 SF(,)A F3(RANDOM)
6.665 E F4(,)A F3(SECONDS)6.665 E F4(,)A F3(LINENO)6.665 E F4(,)A F3
(HISTCMD)6.665 E F4(,)A F3(FUNCN)6.665 E(AME)-.18 E F4(,)A F3(GR)144
571.2 Q(OUPS)-.27 E F4(,)A F0(or)2.522 E F3(DIRST)2.772 E -.495(AC)-.81
(HISTCMD)6.666 E F4(,)A F3(FUNCN)6.666 E(AME)-.18 E F4(,)A F3(GR)144
571.2 Q(OUPS)-.27 E F4(,)A F0(or)2.523 E F3(DIRST)2.773 E -.495(AC)-.81
G(K).495 E F0 .272(are unset, the)2.522 F 2.772(yl)-.15 G .272
(ose their special properties, e)-2.772 F -.15(ve)-.25 G 2.772(ni).15 G
2.772(ft)-2.772 G(he)-2.772 E 2.773(ya)-.15 G .273(re subsequently)
-2.773 F 2.5(reset. The)144 583.2 R -.15(ex)2.5 G
2.772(ft)-2.772 G(he)-2.772 E 2.772(ya)-.15 G .272(re subsequently)
-2.772 F 2.5(reset. The)144 583.2 R -.15(ex)2.5 G
(it status is true unless a).15 E F2(name)2.86 E F0(is readonly)2.68 E
(.)-.65 E F1(wait)108 600 Q F0([)2.5 E F2 2.5(n.)C(..)-2.5 E F0(])A -.8
(Wa)144 612 S .288
(it for each speci\214ed process and return its termination status.).8 F
(Each)5.288 E F2(n)3.148 E F0 .287(may be a process ID or a)3.028 F .722
(Each)5.288 E F2(n)3.148 E F0 .288(may be a process ID or a)3.028 F .722
(job speci\214cation; if a job spec is gi)144 624 R -.15(ve)-.25 G .722
(n, all processes in that job').15 F 3.222(sp)-.55 G .722(ipeline are w)
-3.222 F .722(aited for)-.1 F 5.722(.I)-.55 G(f)-5.722 E F2(n)3.583 E F0
(is)3.463 E 1.266(not gi)144 636 R -.15(ve)-.25 G 1.266
(n, all currently acti).15 F 1.566 -.15(ve c)-.25 H 1.265
(hild processes are w).15 F 1.265(aited for)-.1 F 3.765(,a)-.4 G 1.265
(nd the return status is zero.)-3.765 F(If)6.265 E F2(n)4.125 E F0 .456
-3.222 F .722(aited for)-.1 F 5.722(.I)-.55 G(f)-5.722 E F2(n)3.582 E F0
(is)3.462 E 1.265(not gi)144 636 R -.15(ve)-.25 G 1.265
(n, all currently acti).15 F 1.565 -.15(ve c)-.25 H 1.265
(hild processes are w).15 F 1.265(aited for)-.1 F 3.765(,a)-.4 G 1.266
(nd the return status is zero.)-3.765 F(If)6.266 E F2(n)4.126 E F0 .457
(speci\214es a non-e)144 648 R .457
(xistent process or job, the return status is 127.)-.15 F .457
(Otherwise, the return status is the)5.457 F -.15(ex)144 660 S
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.2
%%CreationDate: Tue Jun 29 14:02:44 2010
%%CreationDate: Wed Jul 21 08:54:50 2010
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.19 2
+4 -5
View File
@@ -2,10 +2,9 @@
Copyright (C) 1988-2010 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Jul 2 17:30:39 EDT 2010
@set LASTCHANGE Wed Jul 21 08:54:40 EDT 2010
@set EDITION 4.1
@set VERSION 4.1
@set UPDATED 2 July 2010
@set EDITION 4.2
@set VERSION 4.2
@set UPDATED 21 July 2010
@set UPDATED-MONTH July 2010
+7 -4
View File
@@ -83,7 +83,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
$(srcdir)/shell.c $(srcdir)/tilde.c $(srcdir)/savestring.c \
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
$(srcdir)/mbutil.c
$(srcdir)/mbutil.c $(srcdir)/xfree.c
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
@@ -97,7 +97,7 @@ TILDEOBJ = tilde.o
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) xmalloc.o compat.o
text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) xmalloc.o xfree.o compat.o
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
@@ -123,9 +123,9 @@ libreadline.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
libhistory.a: $(HISTOBJ) xmalloc.o
libhistory.a: $(HISTOBJ) xmalloc.o xfree.o
$(RM) $@
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o xfree.o
-test -n "$(RANLIB)" && $(RANLIB) $@
documentation: force
@@ -262,6 +262,7 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
vi_mode.o: history.h ansi_stdlib.h rlstdc.h
xmalloc.o: ${BUILD_DIR}/config.h ansi_stdlib.h
xfree.o: ${BUILD_DIR}/config.h ansi_stdlib.h
bind.o: rlshell.h
histfile.o: rlshell.h
@@ -317,6 +318,7 @@ tilde.o: xmalloc.h
undo.o: xmalloc.h
util.o: xmalloc.h
vi_mode.o: xmalloc.h
xfree.o: xmalloc.h
xmalloc.o: xmalloc.h
complete.o: rlmbutil.h
@@ -359,6 +361,7 @@ tilde.o: tilde.c
undo.o: undo.c
util.o: util.c
vi_mode.o: vi_mode.c
xfree.o: xfree.c
xmalloc.o: xmalloc.c
histexpand.o: histexpand.c
+367
View File
@@ -0,0 +1,367 @@
## -*- text -*- #############################################################
# #
# Makefile for the Bash versions of the GNU Readline and History Libraries. #
# #
#############################################################################
# Copyright (C) 1994-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/>.
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_VERSION = @PACKAGE_VERSION@
srcdir = @srcdir@
VPATH = .:@srcdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
datarootdir = @datarootdir@
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@
# Programs to make tags files.
ETAGS = etags -tw
CTAGS = ctags -tw
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
.c.o:
${RM} $@
$(CC) -c $(CCFLAGS) $<
# The name of the main library target.
LIBRARY_NAME = libreadline.a
# The C code source files for this library.
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
$(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
$(srcdir)/complete.c $(srcdir)/bind.c $(srcdir)/isearch.c \
$(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
$(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
$(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
$(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
$(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
$(srcdir)/shell.c $(srcdir)/tilde.c $(srcdir)/savestring.c \
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
$(srcdir)/mbutil.c
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
ansi_stdlib.h rlstdc.h tcap.h xmalloc.h rlprivate.h rlshell.h \
rltypedefs.h rlmbutil.h
HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o savestring.o \
mbutil.o
TILDEOBJ = tilde.o
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) xmalloc.o compat.o
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
DOCOBJECT = doc/readline.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
rlstdc.h rlconf.h rltypedefs.h
##########################################################################
all: libreadline.a libhistory.a
libreadline.a: $(OBJECTS)
$(RM) $@
$(AR) $(ARFLAGS) $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
libhistory.a: $(HISTOBJ) xmalloc.o
$(RM) $@
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
documentation: force
test -d doc || mkdir doc
-( cd doc && $(MAKE) $(MFLAGS) )
# Since tilde.c is shared between readline and bash, make sure we compile
# it with the right flags when it's built as part of readline
tilde.o: tilde.c
rm -f $@
$(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
force:
install:
@echo "This version of the readline library should not be installed."
uninstall:
@echo "This version of the readline library should not be installed."
TAGS: force
$(ETAGS) $(CSOURCES) $(HSOURCES)
tags: force
$(CTAGS) $(CSOURCES) $(HSOURCES)
clean: force
$(RM) $(OBJECTS) *.a
-( cd doc && $(MAKE) $(MFLAGS) $@ )
mostlyclean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
distclean maintainer-clean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
$(RM) Makefile
$(RM) TAGS tags
# Dependencies
bind.o: ansi_stdlib.h posixstat.h
bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
bind.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
bind.o: history.h rlstdc.h
callback.o: rlconf.h ansi_stdlib.h
callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
callback.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
compat.o: rlstdc.h
complete.o: ansi_stdlib.h posixdir.h posixstat.h
complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
complete.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
display.o: ansi_stdlib.h posixstat.h
display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
display.o: tcap.h
display.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
display.o: history.h rlstdc.h
funmap.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
funmap.o: rlconf.h ansi_stdlib.h rlstdc.h
funmap.o: ${BUILD_DIR}/config.h
histexpand.o: ansi_stdlib.h
histexpand.o: history.h histlib.h rlstdc.h
histexpand.o: ${BUILD_DIR}/config.h
histfile.o: ansi_stdlib.h
histfile.o: history.h histlib.h rlstdc.h
histfile.o: ${BUILD_DIR}/config.h
history.o: ansi_stdlib.h
history.o: history.h histlib.h rlstdc.h
history.o: ${BUILD_DIR}/config.h
histsearch.o: ansi_stdlib.h
histsearch.o: history.h histlib.h rlstdc.h
histsearch.o: ${BUILD_DIR}/config.h
input.o: ansi_stdlib.h
input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
input.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
isearch.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
isearch.o: ansi_stdlib.h history.h rlstdc.h
keymaps.o: emacs_keymap.c vi_keymap.c
keymaps.o: keymaps.h rltypedefs.h chardefs.h rlconf.h ansi_stdlib.h
keymaps.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
keymaps.o: ${BUILD_DIR}/config.h rlstdc.h
kill.o: ansi_stdlib.h
kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
kill.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
kill.o: history.h rlstdc.h
macro.o: ansi_stdlib.h
macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
macro.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
macro.o: history.h rlstdc.h
mbutil.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h rlmbutil.h
mbutil.o: readline.h keymaps.h rltypedefs.h chardefs.h rlstdc.h
misc.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
misc.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
misc.o: history.h rlstdc.h ansi_stdlib.h
nls.o: ansi_stdlib.h
nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
nls.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
nls.o: history.h rlstdc.h
parens.o: rlconf.h
parens.o: ${BUILD_DIR}/config.h
parens.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
readline.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
readline.o: history.h rlstdc.h
readline.o: posixstat.h ansi_stdlib.h posixjmp.h
rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
rltty.o: rltty.h
rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
search.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
search.o: ansi_stdlib.h history.h rlstdc.h
shell.o: ${BUILD_DIR}/config.h ansi_stdlib.h
signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
signals.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
signals.o: history.h rlstdc.h
terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
terminal.o: tcap.h
terminal.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
terminal.o: history.h rlstdc.h
text.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
text.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
text.o: history.h rlstdc.h ansi_stdlib.h
rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
tilde.o: ansi_stdlib.h
tilde.o: ${BUILD_DIR}/config.h
tilde.o: tilde.h
undo.o: ansi_stdlib.h
undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
undo.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
undo.o: history.h rlstdc.h xmalloc.h
util.o: posixjmp.h ansi_stdlib.h
util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
util.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
vi_mode.o: history.h ansi_stdlib.h rlstdc.h
xmalloc.o: ${BUILD_DIR}/config.h ansi_stdlib.h
bind.o: rlshell.h
histfile.o: rlshell.h
nls.o: rlshell.h
readline.o: rlshell.h
shell.o: rlshell.h
terminal.o: rlshell.h
histexpand.o: rlshell.h
bind.o: rlprivate.h
callback.o: rlprivate.h
complete.o: rlprivate.h
display.o: rlprivate.h
input.o: rlprivate.h
isearch.o: rlprivate.h
kill.o: rlprivate.h
macro.o: rlprivate.h
mbutil.o: rlprivate.h
misc.o: rlprivate.h
nls.o: rlprivate.h
parens.o: rlprivate.h
readline.o: rlprivate.h
rltty.o: rlprivate.h
search.o: rlprivate.h
signals.o: rlprivate.h
terminal.o: rlprivate.h
text.o: rlprivate.h
undo.o: rlprivate.h
util.o: rlprivate.h
vi_mode.o: rlprivate.h
bind.o: xmalloc.h
complete.o: xmalloc.h
display.o: xmalloc.h
funmap.o: xmalloc.h
histexpand.o: xmalloc.h
histfile.o: xmalloc.h
history.o: xmalloc.h
input.o: xmalloc.h
isearch.o: xmalloc.h
keymaps.o: xmalloc.h
kill.o: xmalloc.h
macro.o: xmalloc.h
mbutil.o: xmalloc.h
misc.o: xmalloc.h
readline.o: xmalloc.h
savestring.o: xmalloc.h
search.o: xmalloc.h
shell.o: xmalloc.h
terminal.o: xmalloc.h
text.o: xmalloc.h
tilde.o: xmalloc.h
undo.o: xmalloc.h
util.o: xmalloc.h
vi_mode.o: xmalloc.h
xmalloc.o: xmalloc.h
complete.o: rlmbutil.h
display.o: rlmbutil.h
histexpand.o: rlmbutil.h
input.o: rlmbutil.h
isearch.o: rlmbutil.h
mbutil.o: rlmbutil.h
misc.o: rlmbutil.h
readline.o: rlmbutil.h
search.o: rlmbutil.h
text.o: rlmbutil.h
vi_mode.o: rlmbutil.h
# Rules for deficient makes, like SunOS and Solaris
bind.o: bind.c
callback.o: callback.c
compat.o: compat.c
complete.o: complete.c
display.o: display.c
funmap.o: funmap.c
input.o: input.c
isearch.o: isearch.c
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c
kill.o: kill.c
macro.o: macro.c
mbutil.o: mbutil.c
misc.o: misc.c
nls.o: nls.c
parens.o: parens.c
readline.o: readline.c
rltty.o: rltty.c
savestring.o: savestring.c
search.o: search.c
shell.o: shell.c
signals.o: signals.c
terminal.o: terminal.c
text.o: text.c
tilde.o: tilde.c
undo.o: undo.c
util.o: util.c
vi_mode.o: vi_mode.c
xmalloc.o: xmalloc.c
histexpand.o: histexpand.c
histfile.o: histfile.c
history.o: history.c
histsearch.o: histsearch.c
+23 -23
View File
@@ -847,7 +847,7 @@ print_filename (to_print, full_pathname, prefix_bytes)
if (path_isdir (new_full_pathname))
extension_char = '/';
free (new_full_pathname);
xfree (new_full_pathname);
to_print[-1] = c;
}
else
@@ -862,7 +862,7 @@ print_filename (to_print, full_pathname, prefix_bytes)
extension_char = '/';
}
free (s);
xfree (s);
if (extension_char)
{
putc (extension_char, rl_outstream);
@@ -1099,7 +1099,7 @@ remove_duplicate_matches (matches)
{
if (strcmp (matches[i], matches[i + 1]) == 0)
{
free (matches[i]);
xfree (matches[i]);
matches[i] = (char *)&dead_slot;
}
else
@@ -1117,7 +1117,7 @@ remove_duplicate_matches (matches)
temp_array[j] = (char *)NULL;
if (matches[0] != (char *)&dead_slot)
free (matches[0]);
xfree (matches[0]);
/* Place the lowest common denominator back in [0]. */
temp_array[0] = lowest_common;
@@ -1127,7 +1127,7 @@ remove_duplicate_matches (matches)
insert. */
if (j == 2 && strcmp (temp_array[0], temp_array[1]) == 0)
{
free (temp_array[1]);
xfree (temp_array[1]);
temp_array[1] = (char *)NULL;
}
return (temp_array);
@@ -1306,7 +1306,7 @@ postprocess_matches (matchesp, matching_filenames)
if (rl_ignore_completion_duplicates)
{
temp_matches = remove_duplicate_matches (matches);
free (matches);
xfree (matches);
matches = temp_matches;
}
@@ -1648,7 +1648,7 @@ insert_match (match, start, mtype, qc)
else
_rl_replace_text (replacement, start, end);
if (replacement != match)
free (replacement);
xfree (replacement);
}
}
@@ -1715,7 +1715,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
if (rl_point == rl_end && temp_string_index)
rl_insert_text (temp_string);
}
free (filename);
xfree (filename);
}
else
{
@@ -1751,7 +1751,7 @@ insert_all_matches (matches, point, qc)
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[i])
free (rp);
xfree (rp);
}
}
else
@@ -1760,7 +1760,7 @@ insert_all_matches (matches, point, qc)
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[0])
free (rp);
xfree (rp);
}
rl_end_undo_group ();
}
@@ -1775,8 +1775,8 @@ _rl_free_match_list (matches)
return;
for (i = 0; matches[i]; i++)
free (matches[i]);
free (matches);
xfree (matches[i]);
xfree (matches);
}
/* Complete the word at or before point.
@@ -1831,7 +1831,7 @@ rl_complete_internal (what_to_do)
if (what_to_do == '!' || what_to_do == '@')
tlen = strlen (text);
#endif
free (text);
xfree (text);
if (matches == 0)
{
@@ -1936,7 +1936,7 @@ rl_complete_internal (what_to_do)
if (saved_line_buffer)
{
completion_changed_buffer = strcmp (rl_line_buffer, saved_line_buffer) != 0;
free (saved_line_buffer);
xfree (saved_line_buffer);
}
RL_UNSETSTATE(RL_STATE_COMPLETING);
@@ -2003,7 +2003,7 @@ rl_completion_matches (text, entry_function)
compute_lcd_of_matches (match_list, matches, text);
else /* There were no matches. */
{
free (match_list);
xfree (match_list);
match_list = (char **)NULL;
}
return (match_list);
@@ -2197,7 +2197,7 @@ rl_filename_completion_function (text, state)
if (*dirname == '~')
{
temp = tilde_expand (dirname);
free (dirname);
xfree (dirname);
dirname = temp;
}
@@ -2208,14 +2208,14 @@ rl_filename_completion_function (text, state)
dequoting. */
if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
{
free (users_dirname);
xfree (users_dirname);
users_dirname = savestring (dirname);
}
else if (rl_completion_found_quote && rl_filename_dequoting_function)
{
/* delete single and double quotes */
temp = (*rl_filename_dequoting_function) (dirname, rl_completion_quote_character);
free (dirname);
xfree (dirname);
dirname = temp;
}
directory = opendir (dirname);
@@ -2225,7 +2225,7 @@ rl_filename_completion_function (text, state)
{
/* delete single and double quotes */
temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
free (filename);
xfree (filename);
filename = temp;
}
filename_len = strlen (filename);
@@ -2281,17 +2281,17 @@ rl_filename_completion_function (text, state)
}
if (dirname)
{
free (dirname);
xfree (dirname);
dirname = (char *)NULL;
}
if (filename)
{
free (filename);
xfree (filename);
filename = (char *)NULL;
}
if (users_dirname)
{
free (users_dirname);
xfree (users_dirname);
users_dirname = (char *)NULL;
}
@@ -2331,7 +2331,7 @@ rl_filename_completion_function (text, state)
temp = savestring (convfn);
if (convfn != dentry)
free (convfn);
xfree (convfn);
return (temp);
}
+8
View File
@@ -477,6 +477,14 @@ get_y_or_n (for_pager)
{
int c;
/* For now, disable pager in callback mode, until we later convert to state
driven functions. Have to wait until next major version to add new
state definition, since it will change value of RL_STATE_DONE. */
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
return 1;
#endif
for (;;)
{
RL_SETSTATE(RL_STATE_MOREINPUT);
+32 -32
View File
@@ -245,7 +245,7 @@ get_history_event (string, caller_index, delimiting_quote)
#define FAIL_SEARCH() \
do { \
history_offset = history_length; free (temp) ; return (char *)NULL; \
history_offset = history_length; xfree (temp) ; return (char *)NULL; \
} while (0)
/* If there is no search string, try to use the previous search string,
@@ -254,7 +254,7 @@ get_history_event (string, caller_index, delimiting_quote)
{
if (search_string)
{
free (temp);
xfree (temp);
temp = savestring (search_string);
}
else
@@ -285,7 +285,7 @@ get_history_event (string, caller_index, delimiting_quote)
search_match = history_find_word (entry->line, local_index);
}
else
free (temp);
xfree (temp);
return (entry->line);
}
@@ -508,7 +508,7 @@ postproc_subst_rhs ()
}
}
new[j] = '\0';
free (subst_rhs);
xfree (subst_rhs);
subst_rhs = new;
subst_rhs_len = j;
}
@@ -585,7 +585,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (event == 0)
{
*ret_string = hist_error (string, start, i, EVENT_NOT_FOUND);
free (result);
xfree (result);
return (-1);
}
@@ -599,7 +599,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (word_spec == (char *)&error_pointer)
{
*ret_string = hist_error (string, starting_index, i, BAD_WORD_SPEC);
free (result);
xfree (result);
return (-1);
}
@@ -632,8 +632,8 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{
default:
*ret_string = hist_error (string, i+1, i+2, BAD_MODIFIER);
free (result);
free (temp);
xfree (result);
xfree (temp);
return -1;
case 'q':
@@ -658,7 +658,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{
tstr++;
t = savestring (tstr);
free (temp);
xfree (temp);
temp = t;
}
break;
@@ -683,7 +683,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (tstr)
{
t = savestring (tstr);
free (temp);
xfree (temp);
temp = t;
}
break;
@@ -759,8 +759,8 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (subst_lhs_len == 0)
{
*ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST);
free (result);
free (temp);
xfree (result);
xfree (temp);
return -1;
}
@@ -769,8 +769,8 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (subst_lhs_len > l_temp)
{
*ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
free (result);
free (temp);
xfree (result);
xfree (temp);
return (-1);
}
@@ -811,7 +811,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
temp + si + subst_lhs_len,
l_temp - (si + subst_lhs_len));
new_event[len] = '\0';
free (temp);
xfree (temp);
temp = new_event;
failed = 0;
@@ -847,8 +847,8 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
continue; /* don't want to increment i */
*ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
free (result);
free (temp);
xfree (result);
xfree (temp);
return (-1);
}
}
@@ -869,7 +869,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
else
x = savestring (temp);
free (temp);
xfree (temp);
temp = x;
}
@@ -877,7 +877,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (n >= result_len)
result = (char *)xrealloc (result, n + 2);
strcpy (result, temp);
free (temp);
xfree (temp);
*end_index_ptr = i;
*ret_string = result;
@@ -1064,7 +1064,7 @@ history_expand (hstring, output)
if (string[i] != history_expansion_char)
{
free (result);
xfree (result);
*output = savestring (string);
return (0);
}
@@ -1144,7 +1144,7 @@ history_expand (hstring, output)
strncpy (temp, string + quote, slen);
temp[slen - 1] = '\0';
ADD_STRING (temp);
free (temp);
xfree (temp);
}
else
ADD_CHAR (string[i]);
@@ -1157,7 +1157,7 @@ history_expand (hstring, output)
temp = (char *)xmalloc (l - i + 1);
strcpy (temp, string + i);
ADD_STRING (temp);
free (temp);
xfree (temp);
i = l;
}
else
@@ -1190,7 +1190,7 @@ history_expand (hstring, output)
temp = (char *)xmalloc (1 + strlen (result));
strcpy (temp, result);
ADD_STRING (temp);
free (temp);
xfree (temp);
}
i++;
break;
@@ -1201,9 +1201,9 @@ history_expand (hstring, output)
if (r < 0)
{
*output = temp;
free (result);
xfree (result);
if (string != hstring)
free (string);
xfree (string);
return -1;
}
else
@@ -1213,7 +1213,7 @@ history_expand (hstring, output)
modified++;
if (*temp)
ADD_STRING (temp);
free (temp);
xfree (temp);
}
only_printing = r == 1;
i = eindex;
@@ -1224,7 +1224,7 @@ history_expand (hstring, output)
*output = result;
if (string != hstring)
free (string);
xfree (string);
if (only_printing)
{
@@ -1405,8 +1405,8 @@ history_arg_extract (first, last, string)
}
for (i = 0; i < len; i++)
free (list[i]);
free (list);
xfree (list[i]);
xfree (list);
return (result);
}
@@ -1629,7 +1629,7 @@ freewords (words, start)
register int i;
for (i = start; words[i]; i++)
free (words[i]);
xfree (words[i]);
}
/* Find and return the word which contains the character at index IND
@@ -1653,8 +1653,8 @@ history_find_word (line, ind)
}
s = words[wind];
for (i = 0; i < wind; i++)
free (words[i]);
xfree (words[i]);
freewords (words, wind + 1);
free (words);
xfree (words);
return s;
}
+1 -1
View File
@@ -1,6 +1,6 @@
/* histexpand.c -- history expansion. */
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
+2 -2
View File
@@ -417,7 +417,7 @@ history_truncate_file (fname, lines)
FREE (buffer);
free (filename);
xfree (filename);
return rv;
}
@@ -520,7 +520,7 @@ mmap_error:
#else
if (write (file, buffer, buffer_size) < 0)
rv = errno;
free (buffer);
xfree (buffer);
#endif
}
+1 -1
View File
@@ -1,6 +1,6 @@
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
+1 -1
View File
@@ -338,7 +338,7 @@ free_history_entry (hist)
FREE (hist->line);
FREE (hist->timestamp);
x = hist->data;
free (hist);
xfree (hist);
return (x);
}
+519
View File
@@ -0,0 +1,519 @@
/* history.c -- standalone history library */
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
History 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.
History 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 History. If not, see <http://www.gnu.org/licenses/>.
*/
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <stdio.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include "history.h"
#include "histlib.h"
#include "xmalloc.h"
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
static char *hist_inittime PARAMS((void));
/* **************************************************************** */
/* */
/* History Functions */
/* */
/* **************************************************************** */
/* An array of HIST_ENTRY. This is where we store the history. */
static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
/* Non-zero means that we have enforced a limit on the amount of
history that we save. */
static int history_stifled;
/* The current number of slots allocated to the input_history. */
static int history_size;
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
entries to remember. */
int history_max_entries;
int max_input_history; /* backwards compatibility */
/* The current location of the interactive history pointer. Just makes
life easier for outside callers. */
int history_offset;
/* The number of strings currently stored in the history list. */
int history_length;
/* The logical `base' of the history array. It defaults to 1. */
int history_base = 1;
/* Return the current HISTORY_STATE of the history. */
HISTORY_STATE *
history_get_history_state ()
{
HISTORY_STATE *state;
state = (HISTORY_STATE *)xmalloc (sizeof (HISTORY_STATE));
state->entries = the_history;
state->offset = history_offset;
state->length = history_length;
state->size = history_size;
state->flags = 0;
if (history_stifled)
state->flags |= HS_STIFLED;
return (state);
}
/* Set the state of the current history array to STATE. */
void
history_set_history_state (state)
HISTORY_STATE *state;
{
the_history = state->entries;
history_offset = state->offset;
history_length = state->length;
history_size = state->size;
if (state->flags & HS_STIFLED)
history_stifled = 1;
}
/* Begin a session in which the history functions might be used. This
initializes interactive variables. */
void
using_history ()
{
history_offset = history_length;
}
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines and the associated
timestamps. */
int
history_total_bytes ()
{
register int i, result;
for (i = result = 0; the_history && the_history[i]; i++)
result += HISTENT_BYTES (the_history[i]);
return (result);
}
/* Returns the magic number which says what history element we are
looking at now. In this implementation, it returns history_offset. */
int
where_history ()
{
return (history_offset);
}
/* Make the current history item be the one at POS, an absolute index.
Returns zero if POS is out of range, else non-zero. */
int
history_set_pos (pos)
int pos;
{
if (pos > history_length || pos < 0 || !the_history)
return (0);
history_offset = pos;
return (1);
}
/* Return the current history array. The caller has to be careful, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
HIST_ENTRY **
history_list ()
{
return (the_history);
}
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
HIST_ENTRY *
current_history ()
{
return ((history_offset == history_length) || the_history == 0)
? (HIST_ENTRY *)NULL
: the_history[history_offset];
}
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry then return
a NULL pointer. */
HIST_ENTRY *
previous_history ()
{
return history_offset ? the_history[--history_offset] : (HIST_ENTRY *)NULL;
}
/* Move history_offset forward to the next history entry, and return
a pointer to that entry. If there is no next entry then return a
NULL pointer. */
HIST_ENTRY *
next_history ()
{
return (history_offset == history_length) ? (HIST_ENTRY *)NULL : the_history[++history_offset];
}
/* Return the history entry which is logically at OFFSET in the history array.
OFFSET is relative to history_base. */
HIST_ENTRY *
history_get (offset)
int offset;
{
int local_index;
local_index = offset - history_base;
return (local_index >= history_length || local_index < 0 || the_history == 0)
? (HIST_ENTRY *)NULL
: the_history[local_index];
}
HIST_ENTRY *
alloc_history_entry (string, ts)
char *string;
char *ts;
{
HIST_ENTRY *temp;
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
temp->line = string ? savestring (string) : string;
temp->data = (char *)NULL;
temp->timestamp = ts;
return temp;
}
time_t
history_get_time (hist)
HIST_ENTRY *hist;
{
char *ts;
time_t t;
if (hist == 0 || hist->timestamp == 0)
return 0;
ts = hist->timestamp;
if (ts[0] != history_comment_char)
return 0;
t = (time_t) atol (ts + 1); /* XXX - should use strtol() here */
return t;
}
static char *
hist_inittime ()
{
time_t t;
char ts[64], *ret;
t = (time_t) time ((time_t *)0);
#if defined (HAVE_VSNPRINTF) /* assume snprintf if vsnprintf exists */
snprintf (ts, sizeof (ts) - 1, "X%lu", (unsigned long) t);
#else
sprintf (ts, "X%lu", (unsigned long) t);
#endif
ret = savestring (ts);
ret[0] = history_comment_char;
return ret;
}
/* Place STRING at the end of the history list. The data field
is set to NULL. */
void
add_history (string)
const char *string;
{
HIST_ENTRY *temp;
if (history_stifled && (history_length == history_max_entries))
{
register int i;
/* If the history is stifled, and history_length is zero,
and it equals history_max_entries, we don't save items. */
if (history_length == 0)
return;
/* If there is something in the slot, then remove it. */
if (the_history[0])
(void) free_history_entry (the_history[0]);
/* Copy the rest of the entries, moving down one slot. */
for (i = 0; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_base++;
}
else
{
if (history_size == 0)
{
history_size = DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
history_length = 1;
}
else
{
if (history_length == (history_size - 1))
{
history_size += DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
history_length++;
}
}
temp = alloc_history_entry (string, hist_inittime ());
the_history[history_length] = (HIST_ENTRY *)NULL;
the_history[history_length - 1] = temp;
}
/* Change the time stamp of the most recent history entry to STRING. */
void
add_history_time (string)
const char *string;
{
HIST_ENTRY *hs;
if (string == 0)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);
hs->timestamp = savestring (string);
}
/* Free HIST and return the data so the calling application can free it
if necessary and desired. */
histdata_t
free_history_entry (hist)
HIST_ENTRY *hist;
{
histdata_t x;
if (hist == 0)
return ((histdata_t) 0);
FREE (hist->line);
FREE (hist->timestamp);
x = hist->data;
free (hist);
return (x);
}
HIST_ENTRY *
copy_history_entry (hist)
HIST_ENTRY *hist;
{
HIST_ENTRY *ret;
char *ts;
if (hist == 0)
return hist;
ret = alloc_history_entry (hist->line, (char *)NULL);
ts = hist->timestamp ? savestring (hist->timestamp) : hist->timestamp;
ret->timestamp = ts;
ret->data = hist->data;
return ret;
}
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
HIST_ENTRY *
replace_history_entry (which, line, data)
int which;
const char *line;
histdata_t data;
{
HIST_ENTRY *temp, *old_value;
if (which < 0 || which >= history_length)
return ((HIST_ENTRY *)NULL);
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
old_value = the_history[which];
temp->line = savestring (line);
temp->data = data;
temp->timestamp = savestring (old_value->timestamp);
the_history[which] = temp;
return (old_value);
}
/* Replace the DATA in the specified history entries, replacing OLD with
NEW. WHICH says which one(s) to replace: WHICH == -1 means to replace
all of the history entries where entry->data == OLD; WHICH == -2 means
to replace the `newest' history entry where entry->data == OLD; and
WHICH >= 0 means to replace that particular history entry's data, as
long as it matches OLD. */
void
replace_history_data (which,old, new)
int which;
histdata_t *old, *new;
{
HIST_ENTRY *entry;
register int i, last;
if (which < -2 || which >= history_length || history_length == 0 || the_history == 0)
return;
if (which >= 0)
{
entry = the_history[which];
if (entry && entry->data == old)
entry->data = new;
return;
}
last = -1;
for (i = 0; i < history_length; i++)
{
entry = the_history[i];
if (entry == 0)
continue;
if (entry->data == old)
{
last = i;
if (which == -1)
entry->data = new;
}
}
if (which == -2 && last >= 0)
{
entry = the_history[last];
entry->data = new; /* XXX - we don't check entry->old */
}
}
/* Remove history element WHICH from the history. The removed
element is returned to you so you can free the line, data,
and containing structure. */
HIST_ENTRY *
remove_history (which)
int which;
{
HIST_ENTRY *return_value;
register int i;
if (which < 0 || which >= history_length || history_length == 0 || the_history == 0)
return ((HIST_ENTRY *)NULL);
return_value = the_history[which];
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_length--;
return (return_value);
}
/* Stifle the history list, remembering only MAX number of lines. */
void
stifle_history (max)
int max;
{
register int i, j;
if (max < 0)
max = 0;
if (history_length > max)
{
/* This loses because we cannot free the data. */
for (i = 0, j = history_length - max; i < j; i++)
free_history_entry (the_history[i]);
history_base = i;
for (j = 0, i = history_length - max; j < max; i++, j++)
the_history[j] = the_history[i];
the_history[j] = (HIST_ENTRY *)NULL;
history_length = j;
}
history_stifled = 1;
max_input_history = history_max_entries = max;
}
/* Stop stifling the history. This returns the previous maximum
number of history entries. The value is positive if the history
was stifled, negative if it wasn't. */
int
unstifle_history ()
{
if (history_stifled)
{
history_stifled = 0;
return (history_max_entries);
}
else
return (-history_max_entries);
}
int
history_is_stifled ()
{
return (history_stifled);
}
void
clear_history ()
{
register int i;
/* This loses because we cannot free the data. */
for (i = 0; i < history_length; i++)
{
free_history_entry (the_history[i]);
the_history[i] = (HIST_ENTRY *)NULL;
}
history_offset = history_length = 0;
}
+3 -3
View File
@@ -142,11 +142,11 @@ rl_discard_keymap (map)
case ISKMAP:
rl_discard_keymap ((Keymap)map[i].function);
free ((char *)map[i].function);
xfree ((char *)map[i].function);
break;
case ISMACR:
free ((char *)map[i].function);
xfree ((char *)map[i].function);
break;
}
}
@@ -158,5 +158,5 @@ rl_free_keymap (map)
Keymap map;
{
rl_discard_keymap (map);
free ((char *)map);
xfree ((char *)map);
}
+162
View File
@@ -0,0 +1,162 @@
/* keymaps.c -- Functions and keymaps for the GNU Readline library. */
/* Copyright (C) 1988,1989-2009 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
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h> /* for FILE * definition for readline.h */
#include "readline.h"
#include "rlconf.h"
#include "emacs_keymap.c"
#if defined (VI_MODE)
#include "vi_keymap.c"
#endif
#include "xmalloc.h"
/* **************************************************************** */
/* */
/* Functions for manipulating Keymaps. */
/* */
/* **************************************************************** */
/* Return a new, empty keymap.
Free it with free() when you are done. */
Keymap
rl_make_bare_keymap ()
{
register int i;
Keymap keymap;
keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
for (i = 0; i < KEYMAP_SIZE; i++)
{
keymap[i].type = ISFUNC;
keymap[i].function = (rl_command_func_t *)NULL;
}
#if 0
for (i = 'A'; i < ('Z' + 1); i++)
{
keymap[i].type = ISFUNC;
keymap[i].function = rl_do_lowercase_version;
}
#endif
return (keymap);
}
/* Return a new keymap which is a copy of MAP. Just copies pointers, does
not copy text of macros or descend into child keymaps. */
Keymap
rl_copy_keymap (map)
Keymap map;
{
register int i;
Keymap temp;
temp = rl_make_bare_keymap ();
for (i = 0; i < KEYMAP_SIZE; i++)
{
temp[i].type = map[i].type;
temp[i].function = map[i].function;
}
return (temp);
}
/* Return a new keymap with the printing characters bound to rl_insert,
the uppercase Meta characters bound to run their lowercase equivalents,
and the Meta digits bound to produce numeric arguments. */
Keymap
rl_make_keymap ()
{
register int i;
Keymap newmap;
newmap = rl_make_bare_keymap ();
/* All ASCII printing characters are self-inserting. */
for (i = ' '; i < 127; i++)
newmap[i].function = rl_insert;
newmap[TAB].function = rl_insert;
newmap[RUBOUT].function = rl_rubout; /* RUBOUT == 127 */
newmap[CTRL('H')].function = rl_rubout;
#if KEYMAP_SIZE > 128
/* Printing characters in ISO Latin-1 and some 8-bit character sets. */
for (i = 128; i < 256; i++)
newmap[i].function = rl_insert;
#endif /* KEYMAP_SIZE > 128 */
return (newmap);
}
/* Free the storage associated with MAP. */
void
rl_discard_keymap (map)
Keymap map;
{
int i;
if (map == 0)
return;
for (i = 0; i < KEYMAP_SIZE; i++)
{
switch (map[i].type)
{
case ISFUNC:
break;
case ISKMAP:
rl_discard_keymap ((Keymap)map[i].function);
xfree ((char *)map[i].function);
break;
case ISMACR:
xfree ((char *)map[i].function);
break;
}
}
}
/* Convenience function that discards, then frees, MAP. */
void
rl_free_keymap (map)
Keymap map;
{
rl_discard_keymap (map);
free ((char *)map);
}
+2 -2
View File
@@ -147,7 +147,7 @@ _rl_copy_to_kill_ring (text, append)
strcat (new, old);
}
xfree (old);
free (text);
xfree (text);
rl_kill_ring[slot] = new;
}
else
@@ -601,7 +601,7 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
#endif /* VI_MODE */
rl_insert_text (arg);
free (arg);
xfree (arg);
rl_end_undo_group ();
return 0;
+694
View File
@@ -0,0 +1,694 @@
/* kill.c -- kill ring management. */
/* Copyright (C) 1994 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>
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
/* **************************************************************** */
/* */
/* Killing Mechanism */
/* */
/* **************************************************************** */
/* What we assume for a max number of kills. */
#define DEFAULT_MAX_KILLS 10
/* The real variable to look at to find out when to flush kills. */
static int rl_max_kills = DEFAULT_MAX_KILLS;
/* Where to store killed text. */
static char **rl_kill_ring = (char **)NULL;
/* Where we are in the kill ring. */
static int rl_kill_index;
/* How many slots we have in the kill ring. */
static int rl_kill_ring_length;
static int _rl_copy_to_kill_ring PARAMS((char *, int));
static int region_kill_internal PARAMS((int));
static int _rl_copy_word_as_kill PARAMS((int, int));
static int rl_yank_nth_arg_internal PARAMS((int, int, int));
/* How to say that you only want to save a certain amount
of kill material. */
int
rl_set_retained_kills (num)
int num;
{
return 0;
}
/* Add TEXT to the kill ring, allocating a new kill ring slot as necessary.
This uses TEXT directly, so the caller must not free it. If APPEND is
non-zero, and the last command was a kill, the text is appended to the
current kill ring slot, otherwise prepended. */
static int
_rl_copy_to_kill_ring (text, append)
char *text;
int append;
{
char *old, *new;
int slot;
/* First, find the slot to work with. */
if (_rl_last_command_was_kill == 0)
{
/* Get a new slot. */
if (rl_kill_ring == 0)
{
/* If we don't have any defined, then make one. */
rl_kill_ring = (char **)
xmalloc (((rl_kill_ring_length = 1) + 1) * sizeof (char *));
rl_kill_ring[slot = 0] = (char *)NULL;
}
else
{
/* We have to add a new slot on the end, unless we have
exceeded the max limit for remembering kills. */
slot = rl_kill_ring_length;
if (slot == rl_max_kills)
{
register int i;
xfree (rl_kill_ring[0]);
for (i = 0; i < slot; i++)
rl_kill_ring[i] = rl_kill_ring[i + 1];
}
else
{
slot = rl_kill_ring_length += 1;
rl_kill_ring = (char **)xrealloc (rl_kill_ring, slot * sizeof (char *));
}
rl_kill_ring[--slot] = (char *)NULL;
}
}
else
slot = rl_kill_ring_length - 1;
/* If the last command was a kill, prepend or append. */
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
old = rl_kill_ring[slot];
new = (char *)xmalloc (1 + strlen (old) + strlen (text));
if (append)
{
strcpy (new, old);
strcat (new, text);
}
else
{
strcpy (new, text);
strcat (new, old);
}
xfree (old);
free (text);
rl_kill_ring[slot] = new;
}
else
rl_kill_ring[slot] = text;
rl_kill_index = slot;
return 0;
}
/* The way to kill something. This appends or prepends to the last
kill, if the last command was a kill command. if FROM is less
than TO, then the text is appended, otherwise prepended. If the
last command was not a kill command, then a new slot is made for
this kill. */
int
rl_kill_text (from, to)
int from, to;
{
char *text;
/* Is there anything to kill? */
if (from == to)
{
_rl_last_command_was_kill++;
return 0;
}
text = rl_copy_text (from, to);
/* Delete the copied text from the line. */
rl_delete_text (from, to);
_rl_copy_to_kill_ring (text, from < to);
_rl_last_command_was_kill++;
return 0;
}
/* Now REMEMBER! In order to do prepending or appending correctly, kill
commands always make rl_point's original position be the FROM argument,
and rl_point's extent be the TO argument. */
/* **************************************************************** */
/* */
/* Killing Commands */
/* */
/* **************************************************************** */
/* Delete the word at point, saving the text in the kill ring. */
int
rl_kill_word (count, key)
int count, key;
{
int orig_point;
if (count < 0)
return (rl_backward_kill_word (-count, key));
else
{
orig_point = rl_point;
rl_forward_word (count, key);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* Rubout the word before point, placing it on the kill ring. */
int
rl_backward_kill_word (count, ignore)
int count, ignore;
{
int orig_point;
if (count < 0)
return (rl_kill_word (-count, ignore));
else
{
orig_point = rl_point;
rl_backward_word (count, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* Kill from here to the end of the line. If DIRECTION is negative, kill
back to the line start instead. */
int
rl_kill_line (direction, ignore)
int direction, ignore;
{
int orig_point;
if (direction < 0)
return (rl_backward_kill_line (1, ignore));
else
{
orig_point = rl_point;
rl_end_of_line (1, ignore);
if (orig_point != rl_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* Kill backwards to the start of the line. If DIRECTION is negative, kill
forwards to the line end instead. */
int
rl_backward_kill_line (direction, ignore)
int direction, ignore;
{
int orig_point;
if (direction < 0)
return (rl_kill_line (1, ignore));
else
{
if (!rl_point)
rl_ding ();
else
{
orig_point = rl_point;
rl_beg_of_line (1, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
}
return 0;
}
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line (count, ignore)
int count, ignore;
{
rl_begin_undo_group ();
rl_point = 0;
rl_kill_text (rl_point, rl_end);
rl_mark = 0;
rl_end_undo_group ();
return 0;
}
/* The next two functions mimic unix line editing behaviour, except they
save the deleted text on the kill ring. This is safer than not saving
it, and since we have a ring, nobody should get screwed. */
/* This does what C-w does in Unix. We can't prevent people from
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
int count, key;
{
int orig_point;
if (rl_point == 0)
rl_ding ();
else
{
orig_point = rl_point;
if (count <= 0)
count = 1;
while (count--)
{
while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
rl_point--;
while (rl_point && (whitespace (rl_line_buffer[rl_point - 1]) == 0))
rl_point--;
}
rl_kill_text (orig_point, rl_point);
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* This deletes one filename component in a Unix pathname. That is, it
deletes backward to directory separator (`/') or whitespace. */
int
rl_unix_filename_rubout (count, key)
int count, key;
{
int orig_point, c;
if (rl_point == 0)
rl_ding ();
else
{
orig_point = rl_point;
if (count <= 0)
count = 1;
while (count--)
{
c = rl_line_buffer[rl_point - 1];
while (rl_point && (whitespace (c) || c == '/'))
{
rl_point--;
c = rl_line_buffer[rl_point - 1];
}
while (rl_point && (whitespace (c) == 0) && c != '/')
{
rl_point--;
c = rl_line_buffer[rl_point - 1];
}
}
rl_kill_text (orig_point, rl_point);
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* Here is C-u doing what Unix does. You don't *have* to use these
key-bindings. We have a choice of killing the entire line, or
killing from where we are to the start of the line. We choose the
latter, because if you are a Unix weenie, then you haven't backspaced
into the line at all, and if you aren't, then you know what you are
doing. */
int
rl_unix_line_discard (count, key)
int count, key;
{
if (rl_point == 0)
rl_ding ();
else
{
rl_kill_text (rl_point, 0);
rl_point = 0;
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
return 0;
}
/* Copy the text in the `region' to the kill ring. If DELETE is non-zero,
delete the text from the line as well. */
static int
region_kill_internal (delete)
int delete;
{
char *text;
if (rl_mark != rl_point)
{
text = rl_copy_text (rl_point, rl_mark);
if (delete)
rl_delete_text (rl_point, rl_mark);
_rl_copy_to_kill_ring (text, rl_point < rl_mark);
}
_rl_last_command_was_kill++;
return 0;
}
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill (count, ignore)
int count, ignore;
{
return (region_kill_internal (0));
}
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
int count, ignore;
{
int r, npoint;
npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
_rl_fix_point (1);
rl_point = npoint;
return r;
}
/* Copy COUNT words to the kill ring. DIR says which direction we look
to find the words. */
static int
_rl_copy_word_as_kill (count, dir)
int count, dir;
{
int om, op, r;
om = rl_mark;
op = rl_point;
if (dir > 0)
rl_forward_word (count, 0);
else
rl_backward_word (count, 0);
rl_mark = rl_point;
if (dir > 0)
rl_backward_word (count, 0);
else
rl_forward_word (count, 0);
r = region_kill_internal (0);
rl_mark = om;
rl_point = op;
return r;
}
int
rl_copy_forward_word (count, key)
int count, key;
{
if (count < 0)
return (rl_copy_backward_word (-count, key));
return (_rl_copy_word_as_kill (count, 1));
}
int
rl_copy_backward_word (count, key)
int count, key;
{
if (count < 0)
return (rl_copy_forward_word (-count, key));
return (_rl_copy_word_as_kill (count, -1));
}
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
int count, ignore;
{
if (rl_kill_ring == 0)
{
_rl_abort_internal ();
return -1;
}
_rl_set_mark_at_pos (rl_point);
rl_insert_text (rl_kill_ring[rl_kill_index]);
return 0;
}
/* If the last command was yank, or yank_pop, and the text just
before point is identical to the current kill item, then
delete that text from the line, rotate the index down, and
yank back some other text. */
int
rl_yank_pop (count, key)
int count, key;
{
int l, n;
if (((rl_last_func != rl_yank_pop) && (rl_last_func != rl_yank)) ||
!rl_kill_ring)
{
_rl_abort_internal ();
return -1;
}
l = strlen (rl_kill_ring[rl_kill_index]);
n = rl_point - l;
if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l))
{
rl_delete_text (n, rl_point);
rl_point = n;
rl_kill_index--;
if (rl_kill_index < 0)
rl_kill_index = rl_kill_ring_length - 1;
rl_yank (1, 0);
return 0;
}
else
{
_rl_abort_internal ();
return -1;
}
}
/* Yank the COUNTh argument from the previous history line, skipping
HISTORY_SKIP lines before looking for the `previous line'. */
static int
rl_yank_nth_arg_internal (count, ignore, history_skip)
int count, ignore, history_skip;
{
register HIST_ENTRY *entry;
char *arg;
int i, pos;
pos = where_history ();
if (history_skip)
{
for (i = 0; i < history_skip; i++)
entry = previous_history ();
}
entry = previous_history ();
history_set_pos (pos);
if (entry == 0)
{
rl_ding ();
return -1;
}
arg = history_arg_extract (count, count, entry->line);
if (!arg || !*arg)
{
rl_ding ();
FREE (arg);
return -1;
}
rl_begin_undo_group ();
_rl_set_mark_at_pos (rl_point);
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
if (rl_editing_mode == vi_mode)
{
rl_vi_append_mode (1, ignore);
rl_insert_text (" ");
}
#endif /* VI_MODE */
rl_insert_text (arg);
free (arg);
rl_end_undo_group ();
return 0;
}
/* Yank the COUNTth argument from the previous history line. */
int
rl_yank_nth_arg (count, ignore)
int count, ignore;
{
return (rl_yank_nth_arg_internal (count, ignore, 0));
}
/* Yank the last argument from the previous history line. This `knows'
how rl_yank_nth_arg treats a count of `$'. With an argument, this
behaves the same as rl_yank_nth_arg. */
int
rl_yank_last_arg (count, key)
int count, key;
{
static int history_skip = 0;
static int explicit_arg_p = 0;
static int count_passed = 1;
static int direction = 1;
static int undo_needed = 0;
int retval;
if (rl_last_func != rl_yank_last_arg)
{
history_skip = 0;
explicit_arg_p = rl_explicit_arg;
count_passed = count;
direction = 1;
}
else
{
if (undo_needed)
rl_do_undo ();
if (count < 1)
direction = -direction;
history_skip += direction;
if (history_skip < 0)
history_skip = 0;
}
if (explicit_arg_p)
retval = rl_yank_nth_arg_internal (count_passed, key, history_skip);
else
retval = rl_yank_nth_arg_internal ('$', key, history_skip);
undo_needed = retval == 0;
return retval;
}
/* A special paste command for users of Cygnus's cygwin32. */
#if defined (__CYGWIN__)
#include <windows.h>
int
rl_paste_from_clipboard (count, key)
int count, key;
{
char *data, *ptr;
int len;
if (OpenClipboard (NULL) == 0)
return (0);
data = (char *)GetClipboardData (CF_TEXT);
if (data)
{
ptr = strchr (data, '\r');
if (ptr)
{
len = ptr - data;
ptr = (char *)xmalloc (len + 1);
ptr[len] = '\0';
strncpy (ptr, data, len);
}
else
ptr = data;
_rl_set_mark_at_pos (rl_point);
rl_insert_text (ptr);
if (ptr != data)
xfree (ptr);
CloseClipboard ();
}
return (0);
}
#endif /* __CYGWIN__ */
+4 -4
View File
@@ -328,7 +328,7 @@ _rl_free_history_entry (entry)
FREE (entry->line);
FREE (entry->timestamp);
free (entry);
xfree (entry);
}
/* Perhaps put back the current line if it has changed. */
@@ -342,9 +342,9 @@ rl_maybe_replace_line ()
if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
{
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
free (temp->line);
xfree (temp->line);
FREE (temp->timestamp);
free (temp);
xfree (temp);
}
return 0;
}
@@ -480,7 +480,7 @@ _rl_revert_all_lines ()
_rl_set_the_line ();
/* and clean up */
free (lbuf);
xfree (lbuf);
}
/* **************************************************************** */
+655
View File
@@ -0,0 +1,655 @@
/* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-2009 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
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
static int rl_digit_loop PARAMS((void));
static void _rl_history_set_point PARAMS((void));
/* Forward declarations used in this file */
void _rl_free_history_entry PARAMS((HIST_ENTRY *));
/* If non-zero, rl_get_previous_history and rl_get_next_history attempt
to preserve the value of rl_point from line to line. */
int _rl_history_preserve_point = 0;
_rl_arg_cxt _rl_argcxt;
/* Saved target point for when _rl_history_preserve_point is set. Special
value of -1 means that point is at the end of the line. */
int _rl_history_saved_point = -1;
/* **************************************************************** */
/* */
/* Numeric Arguments */
/* */
/* **************************************************************** */
int
_rl_arg_overflow ()
{
if (rl_numeric_arg > 1000000)
{
_rl_argcxt = 0;
rl_explicit_arg = rl_numeric_arg = 0;
rl_ding ();
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
return 1;
}
return 0;
}
void
_rl_arg_init ()
{
rl_save_prompt ();
_rl_argcxt = 0;
RL_SETSTATE(RL_STATE_NUMERICARG);
}
int
_rl_arg_getchar ()
{
int c;
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
return c;
}
/* Process C as part of the current numeric argument. Return -1 if the
argument should be aborted, 0 if we should not read any more chars, and
1 if we should continue to read chars. */
int
_rl_arg_dispatch (cxt, c)
_rl_arg_cxt cxt;
int c;
{
int key, r;
key = c;
/* If we see a key bound to `universal-argument' after seeing digits,
it ends the argument but is otherwise ignored. */
if (_rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
{
if ((cxt & NUM_SAWDIGITS) == 0)
{
rl_numeric_arg *= 4;
return 1;
}
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_argcxt |= NUM_READONE;
return 0; /* XXX */
}
else
{
RL_SETSTATE(RL_STATE_MOREINPUT);
key = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
if (key < 0)
return -1;
return (_rl_dispatch (key, _rl_keymap));
}
}
c = UNMETA (c);
if (_rl_digit_p (c))
{
r = _rl_digit_value (c);
rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + r : r;
rl_explicit_arg = 1;
_rl_argcxt |= NUM_SAWDIGITS;
}
else if (c == '-' && rl_explicit_arg == 0)
{
rl_numeric_arg = 1;
_rl_argcxt |= NUM_SAWMINUS;
rl_arg_sign = -1;
}
else
{
/* Make M-- command equivalent to M--1 command. */
if ((_rl_argcxt & NUM_SAWMINUS) && rl_numeric_arg == 1 && rl_explicit_arg == 0)
rl_explicit_arg = 1;
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
r = _rl_dispatch (key, _rl_keymap);
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
/* At worst, this will cause an extra redisplay. Otherwise,
we have to wait until the next character comes in. */
if (rl_done == 0)
(*rl_redisplay_function) ();
r = 0;
}
return r;
}
return 1;
}
/* Handle C-u style numeric args, as well as M--, and M-digits. */
static int
rl_digit_loop ()
{
int c, r;
while (1)
{
if (_rl_arg_overflow ())
return 1;
c = _rl_arg_getchar ();
if (c < 0)
{
_rl_abort_internal ();
return -1;
}
r = _rl_arg_dispatch (_rl_argcxt, c);
if (r <= 0 || (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
break;
}
return r;
}
/* Create a default argument. */
void
_rl_reset_argument ()
{
rl_numeric_arg = rl_arg_sign = 1;
rl_explicit_arg = 0;
_rl_argcxt = 0;
}
/* Start a numeric argument with initial value KEY */
int
rl_digit_argument (ignore, key)
int ignore, key;
{
_rl_arg_init ();
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_arg_dispatch (_rl_argcxt, key);
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
return 0;
}
else
{
rl_execute_next (key);
return (rl_digit_loop ());
}
}
/* C-u, universal argument. Multiply the current argument by 4.
Read a key. If the key has nothing to do with arguments, then
dispatch on it. If the key is the abort character then abort. */
int
rl_universal_argument (count, key)
int count, key;
{
_rl_arg_init ();
rl_numeric_arg *= 4;
return (RL_ISSTATE (RL_STATE_CALLBACK) ? 0 : rl_digit_loop ());
}
int
_rl_arg_callback (cxt)
_rl_arg_cxt cxt;
{
int c, r;
c = _rl_arg_getchar ();
if (_rl_argcxt & NUM_READONE)
{
_rl_argcxt &= ~NUM_READONE;
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
rl_execute_next (c);
return 0;
}
r = _rl_arg_dispatch (cxt, c);
return (r != 1);
}
/* What to do when you abort reading an argument. */
int
rl_discard_argument ()
{
rl_ding ();
rl_clear_message ();
_rl_reset_argument ();
return 0;
}
/* **************************************************************** */
/* */
/* History Utilities */
/* */
/* **************************************************************** */
/* We already have a history library, and that is what we use to control
the history features of readline. This is our local interface to
the history mechanism. */
/* While we are editing the history, this is the saved
version of the original line. */
HIST_ENTRY *_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
/* Set the history pointer back to the last entry in the history. */
void
_rl_start_using_history ()
{
using_history ();
if (_rl_saved_line_for_history)
_rl_free_history_entry (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Free the contents (and containing structure) of a HIST_ENTRY. */
void
_rl_free_history_entry (entry)
HIST_ENTRY *entry;
{
if (entry == 0)
return;
FREE (entry->line);
FREE (entry->timestamp);
free (entry);
}
/* Perhaps put back the current line if it has changed. */
int
rl_maybe_replace_line ()
{
HIST_ENTRY *temp;
temp = current_history ();
/* If the current line has changed, save the changes. */
if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
{
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
free (temp->line);
FREE (temp->timestamp);
free (temp);
}
return 0;
}
/* Restore the _rl_saved_line_for_history if there is one. */
int
rl_maybe_unsave_line ()
{
if (_rl_saved_line_for_history)
{
/* Can't call with `1' because rl_undo_list might point to an undo
list from a history entry, as in rl_replace_from_history() below. */
rl_replace_line (_rl_saved_line_for_history->line, 0);
rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data;
_rl_free_history_entry (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
rl_point = rl_end; /* rl_replace_line sets rl_end */
}
else
rl_ding ();
return 0;
}
/* Save the current line in _rl_saved_line_for_history. */
int
rl_maybe_save_line ()
{
if (_rl_saved_line_for_history == 0)
{
_rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
_rl_saved_line_for_history->line = savestring (rl_line_buffer);
_rl_saved_line_for_history->timestamp = (char *)NULL;
_rl_saved_line_for_history->data = (char *)rl_undo_list;
}
return 0;
}
int
_rl_free_saved_history_line ()
{
if (_rl_saved_line_for_history)
{
_rl_free_history_entry (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
}
return 0;
}
static void
_rl_history_set_point ()
{
rl_point = (_rl_history_preserve_point && _rl_history_saved_point != -1)
? _rl_history_saved_point
: rl_end;
if (rl_point > rl_end)
rl_point = rl_end;
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode && _rl_keymap != vi_insertion_keymap)
rl_point = 0;
#endif /* VI_MODE */
if (rl_editing_mode == emacs_mode)
rl_mark = (rl_point == rl_end ? 0 : rl_end);
}
void
rl_replace_from_history (entry, flags)
HIST_ENTRY *entry;
int flags; /* currently unused */
{
/* Can't call with `1' because rl_undo_list might point to an undo list
from a history entry, just like we're setting up here. */
rl_replace_line (entry->line, 0);
rl_undo_list = (UNDO_LIST *)entry->data;
rl_point = rl_end;
rl_mark = 0;
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
{
rl_point = 0;
rl_mark = rl_end;
}
#endif
}
/* Process and free undo lists attached to each history entry prior to the
current entry, inclusive, reverting each line to its saved state. This
is destructive, and state about the current line is lost. This is not
intended to be called while actively editing, and the current line is
not assumed to have been added to the history list. */
void
_rl_revert_all_lines ()
{
int hpos;
HIST_ENTRY *entry;
UNDO_LIST *ul, *saved_undo_list;
char *lbuf;
lbuf = savestring (rl_line_buffer);
saved_undo_list = rl_undo_list;
hpos = where_history ();
entry = (hpos == history_length) ? previous_history () : current_history ();
while (entry)
{
if (ul = (UNDO_LIST *)entry->data)
{
if (ul == saved_undo_list)
saved_undo_list = 0;
/* Set up rl_line_buffer and other variables from history entry */
rl_replace_from_history (entry, 0); /* entry->line is now current */
/* Undo all changes to this history entry */
while (rl_undo_list)
rl_do_undo ();
/* And copy the reverted line back to the history entry, preserving
the timestamp. */
FREE (entry->line);
entry->line = savestring (rl_line_buffer);
entry->data = 0;
}
entry = previous_history ();
}
/* Restore history state */
rl_undo_list = saved_undo_list; /* may have been set to null */
history_set_pos (hpos);
/* reset the line buffer */
rl_replace_line (lbuf, 0);
_rl_set_the_line ();
/* and clean up */
free (lbuf);
}
/* **************************************************************** */
/* */
/* History Commands */
/* */
/* **************************************************************** */
/* Meta-< goes to the start of the history. */
int
rl_beginning_of_history (count, key)
int count, key;
{
return (rl_get_previous_history (1 + where_history (), key));
}
/* Meta-> goes to the end of the history. (The current line). */
int
rl_end_of_history (count, key)
int count, key;
{
rl_maybe_replace_line ();
using_history ();
rl_maybe_unsave_line ();
return 0;
}
/* Move down to the next history line. */
int
rl_get_next_history (count, key)
int count, key;
{
HIST_ENTRY *temp;
if (count < 0)
return (rl_get_previous_history (-count, key));
if (count == 0)
return 0;
rl_maybe_replace_line ();
/* either not saved by rl_newline or at end of line, so set appropriately. */
if (_rl_history_saved_point == -1 && (rl_point || rl_end))
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
temp = (HIST_ENTRY *)NULL;
while (count)
{
temp = next_history ();
if (!temp)
break;
--count;
}
if (temp == 0)
rl_maybe_unsave_line ();
else
{
rl_replace_from_history (temp, 0);
_rl_history_set_point ();
}
return 0;
}
/* Get the previous item out of our interactive history, making it the current
line. If there is no previous history, just ding. */
int
rl_get_previous_history (count, key)
int count, key;
{
HIST_ENTRY *old_temp, *temp;
if (count < 0)
return (rl_get_next_history (-count, key));
if (count == 0)
return 0;
/* either not saved by rl_newline or at end of line, so set appropriately. */
if (_rl_history_saved_point == -1 && (rl_point || rl_end))
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
/* If we don't have a line saved, then save this one. */
rl_maybe_save_line ();
/* If the current line has changed, save the changes. */
rl_maybe_replace_line ();
temp = old_temp = (HIST_ENTRY *)NULL;
while (count)
{
temp = previous_history ();
if (temp == 0)
break;
old_temp = temp;
--count;
}
/* If there was a large argument, and we moved back to the start of the
history, that is not an error. So use the last value found. */
if (!temp && old_temp)
temp = old_temp;
if (temp == 0)
rl_ding ();
else
{
rl_replace_from_history (temp, 0);
_rl_history_set_point ();
}
return 0;
}
/* **************************************************************** */
/* */
/* Editing Modes */
/* */
/* **************************************************************** */
/* How to toggle back and forth between editing modes. */
int
rl_vi_editing_mode (count, key)
int count, key;
{
#if defined (VI_MODE)
_rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
rl_editing_mode = vi_mode;
rl_vi_insert_mode (1, key);
#endif /* VI_MODE */
return 0;
}
int
rl_emacs_editing_mode (count, key)
int count, key;
{
rl_editing_mode = emacs_mode;
_rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */
_rl_keymap = emacs_standard_keymap;
return 0;
}
/* Function for the rest of the library to use to set insert/overwrite mode. */
void
_rl_set_insert_mode (im, force)
int im, force;
{
#ifdef CURSOR_MODE
_rl_set_cursor (im, force);
#endif
rl_insert_mode = im;
}
/* Toggle overwrite mode. A positive explicit argument selects overwrite
mode. A negative or zero explicit argument selects insert mode. */
int
rl_overwrite_mode (count, key)
int count, key;
{
if (rl_explicit_arg == 0)
_rl_set_insert_mode (rl_insert_mode ^ 1, 0);
else if (count > 0)
_rl_set_insert_mode (RL_IM_OVERWRITE, 0);
else
_rl_set_insert_mode (RL_IM_INSERT, 0);
return 0;
}
+1 -1
View File
@@ -145,7 +145,7 @@ _rl_init_eightbit ()
_rl_output_meta_chars = 1;
break;
}
free (t);
xfree (t);
return (legal_lang_values[i] ? 1 : 0);
#endif /* !HAVE_SETLOCALE */
+252
View File
@@ -0,0 +1,252 @@
/* nls.c -- skeletal internationalization code. */
/* Copyright (C) 1996-2009 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 <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <ctype.h>
#include "rldefs.h"
#include "readline.h"
#include "rlshell.h"
#include "rlprivate.h"
#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
or LANG environment variable (using the first of those with a value),
readline eight-bit mode is enabled. */
static char *legal_lang_values[] =
{
"iso88591",
"iso88592",
"iso88593",
"iso88594",
"iso88595",
"iso88596",
"iso88597",
"iso88598",
"iso88599",
"iso885910",
"koi8r",
0
};
static char *normalize_codeset PARAMS((char *));
static char *find_codeset PARAMS((char *, size_t *));
#endif /* !HAVE_SETLOCALE */
static char *_rl_get_locale_var PARAMS((const char *));
static char *
_rl_get_locale_var (v)
const char *v;
{
char *lspec;
lspec = sh_get_env_value ("LC_ALL");
if (lspec == 0 || *lspec == 0)
lspec = sh_get_env_value (v);
if (lspec == 0 || *lspec == 0)
lspec = sh_get_env_value ("LANG");
return lspec;
}
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
to decide the defaults for 8-bit character input and output. Returns
1 if we set eight-bit mode. */
int
_rl_init_eightbit ()
{
/* If we have setlocale(3), just check the current LC_CTYPE category
value, and go into eight-bit mode if it's not C or POSIX. */
#if defined (HAVE_SETLOCALE)
char *lspec, *t;
/* Set the LC_CTYPE locale category from environment variables. */
lspec = _rl_get_locale_var ("LC_CTYPE");
/* Since _rl_get_locale_var queries the right environment variables,
we query the current locale settings with setlocale(), and, if
that doesn't return anything, we set lspec to the empty string to
force the subsequent call to setlocale() to define the `native'
environment. */
if (lspec == 0 || *lspec == 0)
lspec = setlocale (LC_CTYPE, (char *)NULL);
if (lspec == 0)
lspec = "";
t = setlocale (LC_CTYPE, lspec);
if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
{
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
return (1);
}
else
return (0);
#else /* !HAVE_SETLOCALE */
char *lspec, *t;
int i;
/* We don't have setlocale. Finesse it. Check the environment for the
appropriate variables and set eight-bit mode if they have the right
values. */
lspec = _rl_get_locale_var ("LC_CTYPE");
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
return (0);
for (i = 0; t && legal_lang_values[i]; i++)
if (STREQ (t, legal_lang_values[i]))
{
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
break;
}
free (t);
return (legal_lang_values[i] ? 1 : 0);
#endif /* !HAVE_SETLOCALE */
}
#if !defined (HAVE_SETLOCALE)
static char *
normalize_codeset (codeset)
char *codeset;
{
size_t namelen, i;
int len, all_digits;
char *wp, *retval;
codeset = find_codeset (codeset, &namelen);
if (codeset == 0)
return (codeset);
all_digits = 1;
for (len = 0, i = 0; i < namelen; i++)
{
if (ISALNUM ((unsigned char)codeset[i]))
{
len++;
all_digits &= _rl_digit_p (codeset[i]);
}
}
retval = (char *)malloc ((all_digits ? 3 : 0) + len + 1);
if (retval == 0)
return ((char *)0);
wp = retval;
/* Add `iso' to beginning of an all-digit codeset */
if (all_digits)
{
*wp++ = 'i';
*wp++ = 's';
*wp++ = 'o';
}
for (i = 0; i < namelen; i++)
if (ISALPHA ((unsigned char)codeset[i]))
*wp++ = _rl_to_lower (codeset[i]);
else if (_rl_digit_p (codeset[i]))
*wp++ = codeset[i];
*wp = '\0';
return retval;
}
/* Isolate codeset portion of locale specification. */
static char *
find_codeset (name, lenp)
char *name;
size_t *lenp;
{
char *cp, *language, *result;
cp = language = name;
result = (char *)0;
while (*cp && *cp != '_' && *cp != '@' && *cp != '+' && *cp != ',')
cp++;
/* This does not make sense: language has to be specified. As
an exception we allow the variable to contain only the codeset
name. Perhaps there are funny codeset names. */
if (language == cp)
{
*lenp = strlen (language);
result = language;
}
else
{
/* Next is the territory. */
if (*cp == '_')
do
++cp;
while (*cp && *cp != '.' && *cp != '@' && *cp != '+' && *cp != ',' && *cp != '_');
/* Now, finally, is the codeset. */
result = cp;
if (*cp == '.')
do
++cp;
while (*cp && *cp != '@');
if (cp - result > 2)
{
result++;
*lenp = cp - result;
}
else
{
*lenp = strlen (language);
result = language;
}
}
return result;
}
#endif /* !HAVE_SETLOCALE */
+3 -3
View File
@@ -382,7 +382,7 @@ readline_internal_setup ()
nprompt = _rl_strip_prompt (rl_prompt);
fprintf (_rl_out_stream, "%s", nprompt);
fflush (_rl_out_stream);
free (nprompt);
xfree (nprompt);
}
}
else
@@ -426,7 +426,7 @@ readline_internal_teardown (eof)
_rl_free_history_entry (entry);
strcpy (the_line, temp);
free (temp);
xfree (temp);
}
if (_rl_revert_all_at_newline)
@@ -629,7 +629,7 @@ void
_rl_keyseq_cxt_dispose (cxt)
_rl_keyseq_cxt *cxt;
{
free (cxt);
xfree (cxt);
}
void
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -211,7 +211,7 @@ _rl_nsearch_init (dir, pchar)
p = _rl_make_prompt_for_search (pchar ? pchar : ':');
rl_message ("%s", p, 0);
free (p);
xfree (p);
RL_SETSTATE(RL_STATE_NSEARCH);
+570
View File
@@ -0,0 +1,570 @@
/* search.c - code for non-incremental searching in emacs and vi modes. */
/* Copyright (C) 1992-2009 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 <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif
#include "rldefs.h"
#include "rlmbutil.h"
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
#ifdef abs
# undef abs
#endif
#define abs(x) (((x) >= 0) ? (x) : -(x))
_rl_search_cxt *_rl_nscxt = 0;
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Functions imported from the rest of the library. */
extern int _rl_free_history_entry PARAMS((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
static char *prev_line_found = (char *) NULL;
static int rl_history_search_len;
static int rl_history_search_pos;
static char *history_search_string;
static int history_string_size;
static void make_history_line_current PARAMS((HIST_ENTRY *));
static int noninc_search_from_pos PARAMS((char *, int, int));
static int noninc_dosearch PARAMS((char *, int));
static int noninc_search PARAMS((int, int));
static int rl_history_search_internal PARAMS((int, int));
static void rl_history_search_reinit PARAMS((void));
static _rl_search_cxt *_rl_nsearch_init PARAMS((int, int));
static int _rl_nsearch_cleanup PARAMS((_rl_search_cxt *, int));
static void _rl_nsearch_abort PARAMS((_rl_search_cxt *));
static int _rl_nsearch_dispatch PARAMS((_rl_search_cxt *, int));
/* Make the data from the history entry ENTRY be the contents of the
current line. This doesn't do anything with rl_point; the caller
must set it. */
static void
make_history_line_current (entry)
HIST_ENTRY *entry;
{
_rl_replace_text (entry->line, 0, rl_end);
_rl_fix_point (1);
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
/* POSIX.2 says that the `U' command doesn't affect the copy of any
command lines to the edit line. We're going to implement that by
making the undo list start after the matching line is copied to the
current editing buffer. */
rl_free_undo_list ();
#endif
if (_rl_saved_line_for_history)
_rl_free_history_entry (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Search the history list for STRING starting at absolute history position
POS. If STRING begins with `^', the search must match STRING at the
beginning of a history line, otherwise a full substring match is performed
for STRING. DIR < 0 means to search backwards through the history list,
DIR >= 0 means to search forward. */
static int
noninc_search_from_pos (string, pos, dir)
char *string;
int pos, dir;
{
int ret, old;
if (pos < 0)
return -1;
old = where_history ();
if (history_set_pos (pos) == 0)
return -1;
RL_SETSTATE(RL_STATE_SEARCH);
if (*string == '^')
ret = history_search_prefix (string + 1, dir);
else
ret = history_search (string, dir);
RL_UNSETSTATE(RL_STATE_SEARCH);
if (ret != -1)
ret = where_history ();
history_set_pos (old);
return (ret);
}
/* Search for a line in the history containing STRING. If DIR is < 0, the
search is backwards through previous entries, else through subsequent
entries. Returns 1 if the search was successful, 0 otherwise. */
static int
noninc_dosearch (string, dir)
char *string;
int dir;
{
int oldpos, pos;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
{
rl_ding ();
return 0;
}
pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir);
if (pos == -1)
{
/* Search failed, current history position unchanged. */
rl_maybe_unsave_line ();
rl_clear_message ();
rl_point = 0;
rl_ding ();
return 0;
}
noninc_history_pos = pos;
oldpos = where_history ();
history_set_pos (noninc_history_pos);
entry = current_history ();
#if defined (VI_MODE)
if (rl_editing_mode != vi_mode)
#endif
history_set_pos (oldpos);
make_history_line_current (entry);
rl_point = 0;
rl_mark = rl_end;
rl_clear_message ();
return 1;
}
static _rl_search_cxt *
_rl_nsearch_init (dir, pchar)
int dir, pchar;
{
_rl_search_cxt *cxt;
char *p;
cxt = _rl_scxt_alloc (RL_SEARCH_NSEARCH, 0);
if (dir < 0)
cxt->sflags |= SF_REVERSE; /* not strictly needed */
cxt->direction = dir;
cxt->history_pos = cxt->save_line;
rl_maybe_save_line ();
/* Clear the undo list, since reading the search string should create its
own undo list, and the whole list will end up being freed when we
finish reading the search string. */
rl_undo_list = 0;
/* Use the line buffer to read the search string. */
rl_line_buffer[0] = 0;
rl_end = rl_point = 0;
p = _rl_make_prompt_for_search (pchar ? pchar : ':');
rl_message ("%s", p, 0);
free (p);
RL_SETSTATE(RL_STATE_NSEARCH);
_rl_nscxt = cxt;
return cxt;
}
static int
_rl_nsearch_cleanup (cxt, r)
_rl_search_cxt *cxt;
int r;
{
_rl_scxt_dispose (cxt, 0);
_rl_nscxt = 0;
RL_UNSETSTATE(RL_STATE_NSEARCH);
return (r != 1);
}
static void
_rl_nsearch_abort (cxt)
_rl_search_cxt *cxt;
{
rl_maybe_unsave_line ();
rl_clear_message ();
rl_point = cxt->save_point;
rl_mark = cxt->save_mark;
rl_restore_prompt ();
RL_UNSETSTATE (RL_STATE_NSEARCH);
}
/* Process just-read character C according to search context CXT. Return -1
if the caller should abort the search, 0 if we should break out of the
loop, and 1 if we should continue to read characters. */
static int
_rl_nsearch_dispatch (cxt, c)
_rl_search_cxt *cxt;
int c;
{
switch (c)
{
case CTRL('W'):
rl_unix_word_rubout (1, c);
break;
case CTRL('U'):
rl_unix_line_discard (1, c);
break;
case RETURN:
case NEWLINE:
return 0;
case CTRL('H'):
case RUBOUT:
if (rl_point == 0)
{
_rl_nsearch_abort (cxt);
return -1;
}
_rl_rubout_char (1, c);
break;
case CTRL('C'):
case CTRL('G'):
rl_ding ();
_rl_nsearch_abort (cxt);
return -1;
default:
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_insert_text (cxt->mb);
else
#endif
_rl_insert_char (1, c);
break;
}
(*rl_redisplay_function) ();
return 1;
}
/* Perform one search according to CXT, using NONINC_SEARCH_STRING. Return
-1 if the search should be aborted, any other value means to clean up
using _rl_nsearch_cleanup (). Returns 1 if the search was successful,
0 otherwise. */
static int
_rl_nsearch_dosearch (cxt)
_rl_search_cxt *cxt;
{
rl_mark = cxt->save_mark;
/* If rl_point == 0, we want to re-use the previous search string and
start from the saved history position. If there's no previous search
string, punt. */
if (rl_point == 0)
{
if (noninc_search_string == 0)
{
rl_ding ();
rl_restore_prompt ();
RL_UNSETSTATE (RL_STATE_NSEARCH);
return -1;
}
}
else
{
/* We want to start the search from the current history position. */
noninc_history_pos = cxt->save_line;
FREE (noninc_search_string);
noninc_search_string = savestring (rl_line_buffer);
/* If we don't want the subsequent undo list generated by the search
matching a history line to include the contents of the search string,
we need to clear rl_line_buffer here. For now, we just clear the
undo list generated by reading the search string. (If the search
fails, the old undo list will be restored by rl_maybe_unsave_line.) */
rl_free_undo_list ();
}
rl_restore_prompt ();
return (noninc_dosearch (noninc_search_string, cxt->direction));
}
/* Search non-interactively through the history list. DIR < 0 means to
search backwards through the history of previous commands; otherwise
the search is for commands subsequent to the current position in the
history list. PCHAR is the character to use for prompting when reading
the search string; if not specified (0), it defaults to `:'. */
static int
noninc_search (dir, pchar)
int dir;
int pchar;
{
_rl_search_cxt *cxt;
int c, r;
cxt = _rl_nsearch_init (dir, pchar);
if (RL_ISSTATE (RL_STATE_CALLBACK))
return (0);
/* Read the search string. */
r = 0;
while (1)
{
c = _rl_search_getchar (cxt);
if (c == 0)
break;
r = _rl_nsearch_dispatch (cxt, c);
if (r < 0)
return 1;
else if (r == 0)
break;
}
r = _rl_nsearch_dosearch (cxt);
return ((r >= 0) ? _rl_nsearch_cleanup (cxt, r) : (r != 1));
}
/* Search forward through the history list for a string. If the vi-mode
code calls this, KEY will be `?'. */
int
rl_noninc_forward_search (count, key)
int count, key;
{
return noninc_search (1, (key == '?') ? '?' : 0);
}
/* Reverse search the history list for a string. If the vi-mode code
calls this, KEY will be `/'. */
int
rl_noninc_reverse_search (count, key)
int count, key;
{
return noninc_search (-1, (key == '/') ? '/' : 0);
}
/* Search forward through the history list for the last string searched
for. If there is no saved search string, abort. */
int
rl_noninc_forward_search_again (count, key)
int count, key;
{
int r;
if (!noninc_search_string)
{
rl_ding ();
return (-1);
}
r = noninc_dosearch (noninc_search_string, 1);
return (r != 1);
}
/* Reverse search in the history list for the last string searched
for. If there is no saved search string, abort. */
int
rl_noninc_reverse_search_again (count, key)
int count, key;
{
int r;
if (!noninc_search_string)
{
rl_ding ();
return (-1);
}
r = noninc_dosearch (noninc_search_string, -1);
return (r != 1);
}
#if defined (READLINE_CALLBACKS)
int
_rl_nsearch_callback (cxt)
_rl_search_cxt *cxt;
{
int c, r;
c = _rl_search_getchar (cxt);
r = _rl_nsearch_dispatch (cxt, c);
if (r != 0)
return 1;
r = _rl_nsearch_dosearch (cxt);
return ((r >= 0) ? _rl_nsearch_cleanup (cxt, r) : (r != 1));
}
#endif
static int
rl_history_search_internal (count, dir)
int count, dir;
{
HIST_ENTRY *temp;
int ret, oldpos;
rl_maybe_save_line ();
temp = (HIST_ENTRY *)NULL;
/* Search COUNT times through the history for a line whose prefix
matches history_search_string. When this loop finishes, TEMP,
if non-null, is the history line to copy into the line buffer. */
while (count)
{
ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
if (ret == -1)
break;
/* Get the history entry we found. */
rl_history_search_pos = ret;
oldpos = where_history ();
history_set_pos (rl_history_search_pos);
temp = current_history ();
history_set_pos (oldpos);
/* Don't find multiple instances of the same line. */
if (prev_line_found && STREQ (prev_line_found, temp->line))
continue;
prev_line_found = temp->line;
count--;
}
/* If we didn't find anything at all, return. */
if (temp == 0)
{
rl_maybe_unsave_line ();
rl_ding ();
/* If you don't want the saved history line (last match) to show up
in the line buffer after the search fails, change the #if 0 to
#if 1 */
#if 0
if (rl_point > rl_history_search_len)
{
rl_point = rl_end = rl_history_search_len;
rl_line_buffer[rl_end] = '\0';
rl_mark = 0;
}
#else
rl_point = rl_history_search_len; /* rl_maybe_unsave_line changes it */
rl_mark = rl_end;
#endif
return 1;
}
/* Copy the line we found into the current line buffer. */
make_history_line_current (temp);
rl_point = rl_history_search_len;
rl_mark = rl_end;
return 0;
}
static void
rl_history_search_reinit ()
{
rl_history_search_pos = where_history ();
rl_history_search_len = rl_point;
prev_line_found = (char *)NULL;
if (rl_point)
{
if (rl_history_search_len >= history_string_size - 2)
{
history_string_size = rl_history_search_len + 2;
history_search_string = (char *)xrealloc (history_search_string, history_string_size);
}
history_search_string[0] = '^';
strncpy (history_search_string + 1, rl_line_buffer, rl_point);
history_search_string[rl_point + 1] = '\0';
}
_rl_free_saved_history_line ();
}
/* Search forward in the history for the string of characters
from the start of the line to rl_point. This is a non-incremental
search. */
int
rl_history_search_forward (count, ignore)
int count, ignore;
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit ();
if (rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
/* Search backward through the history for the string of characters
from the start of the line to rl_point. This is a non-incremental
search. */
int
rl_history_search_backward (count, ignore)
int count, ignore;
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit ();
if (rl_history_search_len == 0)
return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}
+2 -2
View File
@@ -130,12 +130,12 @@ sh_set_lines_and_columns (lines, cols)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
free (b);
xfree (b);
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
free (b);
xfree (b);
#else /* !HAVE_SETENV */
# if defined (HAVE_PUTENV)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
+208
View File
@@ -0,0 +1,208 @@
/* shell.c -- readline utility functions that are normally provided by
bash when readline is linked as part of the shell. */
/* Copyright (C) 1997-2009 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>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
#if defined (HAVE_LIMITS_H)
# include <limits.h>
#endif
#if defined (HAVE_FCNTL_H)
#include <fcntl.h>
#endif
#if defined (HAVE_PWD_H)
#include <pwd.h>
#endif
#include <stdio.h>
#include "rlstdc.h"
#include "rlshell.h"
#include "xmalloc.h"
#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid PARAMS((uid_t));
#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */
#ifndef NULL
# define NULL 0
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
/* Nonzero if the integer type T is signed. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* Bound on length of the string representing an integer value of type T.
Subtract one for the sign bit if T is signed;
302 / 1000 is log10 (2) rounded up;
add one for integer division truncation;
add one more for a minus sign if t is signed. */
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
+ 1 + TYPE_SIGNED (t))
/* All of these functions are resolved from bash if we are linking readline
as part of bash. */
/* Does shell-like quoting using single quotes. */
char *
sh_single_quote (string)
char *string;
{
register int c;
char *result, *r, *s;
result = (char *)xmalloc (3 + (4 * strlen (string)));
r = result;
*r++ = '\'';
for (s = string; s && (c = *s); s++)
{
*r++ = c;
if (c == '\'')
{
*r++ = '\\'; /* insert escaped single quote */
*r++ = '\'';
*r++ = '\''; /* start new quoted string */
}
}
*r++ = '\'';
*r = '\0';
return (result);
}
/* Set the environment variables LINES and COLUMNS to lines and cols,
respectively. */
void
sh_set_lines_and_columns (lines, cols)
int lines, cols;
{
char *b;
#if defined (HAVE_SETENV)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
free (b);
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
free (b);
#else /* !HAVE_SETENV */
# if defined (HAVE_PUTENV)
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
sprintf (b, "LINES=%d", lines);
putenv (b);
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
sprintf (b, "COLUMNS=%d", cols);
putenv (b);
# endif /* HAVE_PUTENV */
#endif /* !HAVE_SETENV */
}
char *
sh_get_env_value (varname)
const char *varname;
{
return ((char *)getenv (varname));
}
char *
sh_get_home_dir ()
{
char *home_dir;
struct passwd *entry;
home_dir = (char *)NULL;
#if defined (HAVE_GETPWUID)
entry = getpwuid (getuid ());
if (entry)
home_dir = entry->pw_dir;
#endif
return (home_dir);
}
#if !defined (O_NDELAY)
# if defined (FNDELAY)
# define O_NDELAY FNDELAY
# endif
#endif
int
sh_unset_nodelay_mode (fd)
int fd;
{
#if defined (HAVE_FCNTL)
int flags, bflags;
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
return -1;
bflags = 0;
#ifdef O_NONBLOCK
bflags |= O_NONBLOCK;
#endif
#ifdef O_NDELAY
bflags |= O_NDELAY;
#endif
if (flags & bflags)
{
flags &= ~bflags;
return (fcntl (fd, F_SETFL, flags));
}
#endif
return 0;
}
+1 -1
View File
@@ -350,9 +350,9 @@ rl_reset_screen_size ()
void
rl_resize_terminal ()
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (_rl_echoing_p)
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (CUSTOM_REDISPLAY_FUNC ())
rl_forced_update_display ();
else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
+731
View File
@@ -0,0 +1,731 @@
/* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996-2009 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 "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
#include "rltty.h"
#include "tcap.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
#if defined (__MINGW32__)
# include <windows.h>
# include <wincon.h>
static void _win_get_screensize PARAMS((int *, int *));
#endif
#if defined (__EMX__)
static void _emx_get_screensize PARAMS((int *, int *));
#endif
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
/* If the calling application sets this to a non-zero value, readline will
use the $LINES and $COLUMNS environment variables to set its idea of the
window size before interrogating the kernel. */
int rl_prefer_env_winsize = 0;
/* **************************************************************** */
/* */
/* Terminal and Termcap */
/* */
/* **************************************************************** */
static char *term_buffer = (char *)NULL;
static char *term_string_buffer = (char *)NULL;
static int tcap_initialized;
#if !defined (__linux__)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif /* __EMX__ || NEED_EXTERN_PC */
char PC, *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
char *_rl_term_clreol;
char *_rl_term_clrpag;
char *_rl_term_cr;
char *_rl_term_backspace;
char *_rl_term_goto;
char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
int _rl_terminal_can_insert = 0;
/* How to insert characters. */
char *_rl_term_im;
char *_rl_term_ei;
char *_rl_term_ic;
char *_rl_term_ip;
char *_rl_term_IC;
/* How to delete characters. */
char *_rl_term_dc;
char *_rl_term_DC;
char *_rl_term_forward_char;
/* How to go up a line. */
char *_rl_term_up;
/* A visible bell; char if the terminal can be made to flash the screen. */
static char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap = -1;
/* Non-zero means that this terminal has a meta key. */
static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static char *_rl_term_mm;
static char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku;
static char *_rl_term_kd;
static char *_rl_term_kr;
static char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
static char *_rl_term_ks;
static char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
static char *_rl_term_kh;
static char *_rl_term_kH;
static char *_rl_term_at7; /* @7 */
/* Delete key */
static char *_rl_term_kD;
/* Insert key */
static char *_rl_term_kI;
/* Cursor control */
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
static void bind_termcap_arrow_keys PARAMS((Keymap));
/* Variables that hold the screen dimensions, used by the display code. */
int _rl_screenwidth, _rl_screenheight, _rl_screenchars;
/* Non-zero means the user wants to enable the keypad. */
int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
#if defined (__EMX__)
static void
_emx_get_screensize (swp, shp)
int *swp, *shp;
{
int sz[2];
_scrsize (sz);
if (swp)
*swp = sz[0];
if (shp)
*shp = sz[1];
}
#endif
#if defined (__MINGW32__)
static void
_win_get_screensize (swp, shp)
int *swp, *shp;
{
HANDLE hConOut;
CONSOLE_SCREEN_BUFFER_INFO scr;
hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
if (hConOut != INVALID_HANDLE_VALUE)
{
if (GetConsoleScreenBufferInfo (hConOut, &scr))
{
*swp = scr.dwSize.X;
*shp = scr.srWindow.Bottom - scr.srWindow.Top + 1;
}
}
}
#endif
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
non-null serve to check whether or not we have initialized termcap. */
void
_rl_get_screen_size (tty, ignore_env)
int tty, ignore_env;
{
char *ss;
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
int wr, wc;
wr = wc = -1;
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
_emx_get_screensize (&wc, &wr);
#elif defined (__MINGW32__)
_win_get_screensize (&wc, &wr);
#endif
if (ignore_env || rl_prefer_env_winsize == 0)
{
_rl_screenwidth = wc;
_rl_screenheight = wr;
}
else
_rl_screenwidth = _rl_screenheight = -1;
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
is unset. If we prefer the environment, check it first before
assigning the value returned by the kernel. */
if (_rl_screenwidth <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
_rl_screenwidth = atoi (ss);
if (_rl_screenwidth <= 0)
_rl_screenwidth = wc;
#if !defined (__DJGPP__)
if (_rl_screenwidth <= 0 && term_string_buffer)
_rl_screenwidth = tgetnum ("co");
#endif
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
is unset. */
if (_rl_screenheight <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("LINES")))
_rl_screenheight = atoi (ss);
if (_rl_screenheight <= 0)
_rl_screenheight = wr;
#if !defined (__DJGPP__)
if (_rl_screenheight <= 0 && term_string_buffer)
_rl_screenheight = tgetnum ("li");
#endif
}
/* If all else fails, default to 80x24 terminal. */
if (_rl_screenwidth <= 1)
_rl_screenwidth = 80;
if (_rl_screenheight <= 0)
_rl_screenheight = 24;
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
_rl_set_screen_size (rows, cols)
int rows, cols;
{
if (_rl_term_autowrap == -1)
_rl_init_terminal_io (rl_terminal_name);
if (rows > 0)
_rl_screenheight = rows;
if (cols > 0)
{
_rl_screenwidth = cols;
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
}
if (rows > 0 || cols > 0)
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
rl_set_screen_size (rows, cols)
int rows, cols;
{
_rl_set_screen_size (rows, cols);
}
void
rl_get_screen_size (rows, cols)
int *rows, *cols;
{
if (rows)
*rows = _rl_screenheight;
if (cols)
*cols = _rl_screenwidth;
}
void
rl_reset_screen_size ()
{
_rl_get_screen_size (fileno (rl_instream), 0);
}
void
rl_resize_terminal ()
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (_rl_echoing_p)
{
if (CUSTOM_REDISPLAY_FUNC ())
rl_forced_update_display ();
else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
_rl_redisplay_after_sigwinch ();
}
}
struct _tc_string {
const char * const tc_var;
char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "DC", &_rl_term_DC },
{ "IC", &_rl_term_IC },
{ "ce", &_rl_term_clreol },
{ "cl", &_rl_term_clrpag },
{ "cr", &_rl_term_cr },
{ "dc", &_rl_term_dc },
{ "ei", &_rl_term_ei },
{ "ic", &_rl_term_ic },
{ "im", &_rl_term_im },
{ "kD", &_rl_term_kD }, /* delete */
{ "kH", &_rl_term_kH }, /* home down ?? */
{ "kI", &_rl_term_kI }, /* insert */
{ "kd", &_rl_term_kd },
{ "ke", &_rl_term_ke }, /* end keypad mode */
{ "kh", &_rl_term_kh }, /* home */
{ "kl", &_rl_term_kl },
{ "kr", &_rl_term_kr },
{ "ks", &_rl_term_ks }, /* start keypad mode */
{ "ku", &_rl_term_ku },
{ "le", &_rl_term_backspace },
{ "mm", &_rl_term_mm },
{ "mo", &_rl_term_mo },
{ "nd", &_rl_term_forward_char },
{ "pc", &_rl_term_pc },
{ "up", &_rl_term_up },
{ "vb", &_rl_visible_bell },
{ "vs", &_rl_term_vs },
{ "ve", &_rl_term_ve },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
/* Read the desired terminal capability strings into BP. The capabilities
are described in the TC_STRINGS table. */
static void
get_term_capabilities (bp)
char **bp;
{
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
#endif
tcap_initialized = 1;
}
int
_rl_init_terminal_io (terminal_name)
const char *terminal_name;
{
const char *term;
char *buffer;
int tty, tgetent_ret;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = (char *)NULL;
tty = rl_instream ? fileno (rl_instream) : 0;
if (term == 0)
term = "dumb";
/* I've separated this out for later work on not calling tgetent at all
if the calling application has supplied a custom redisplay function,
(and possibly if the application has supplied a custom input function). */
if (CUSTOM_REDISPLAY_FUNC())
{
tgetent_ret = -1;
}
else
{
if (term_string_buffer == 0)
term_string_buffer = (char *)xmalloc(2032);
if (term_buffer == 0)
term_buffer = (char *)xmalloc(4080);
buffer = term_string_buffer;
tgetent_ret = tgetent (term_buffer, term);
}
if (tgetent_ret <= 0)
{
FREE (term_string_buffer);
FREE (term_buffer);
buffer = term_buffer = term_string_buffer = (char *)NULL;
_rl_term_autowrap = 0; /* used by _rl_get_screen_size */
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
#if defined (__EMX__)
_emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
_rl_screenwidth--;
#else /* !__EMX__ */
_rl_get_screen_size (tty, 0);
#endif /* !__EMX__ */
}
/* Defaults. */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
_rl_screenwidth = 79;
_rl_screenheight = 24;
}
/* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
_rl_term_cr = "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_kI = _rl_term_kD = (char *)NULL;
_rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = 0;
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC = '\0';
BC = _rl_term_backspace = "\b";
UP = _rl_term_up;
return 0;
}
get_term_capabilities (&buffer);
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = _rl_term_backspace;
UP = _rl_term_up;
if (!_rl_term_cr)
_rl_term_cr = "\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
_rl_get_screen_size (tty, 0);
/* "An application program can assume that the terminal can do
character insertion if *any one of* the capabilities `IC',
`im', `ic' or `ip' is provided." But we can't do anything if
only `ip' is provided, so... */
_rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = tgetflag ("km") != 0;
if (term_has_meta == 0)
_rl_term_mm = _rl_term_mo = (char *)NULL;
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
bind_termcap_arrow_keys (emacs_standard_keymap);
#if defined (VI_MODE)
bind_termcap_arrow_keys (vi_movement_keymap);
bind_termcap_arrow_keys (vi_insertion_keymap);
#endif /* VI_MODE */
return 0;
}
/* Bind the arrow key sequences from the termcap description in MAP. */
static void
bind_termcap_arrow_keys (map)
Keymap map;
{
Keymap xkeymap;
xkeymap = _rl_keymap;
_rl_keymap = map;
rl_bind_keyseq_if_unbound (_rl_term_ku, rl_get_previous_history);
rl_bind_keyseq_if_unbound (_rl_term_kd, rl_get_next_history);
rl_bind_keyseq_if_unbound (_rl_term_kr, rl_forward_char);
rl_bind_keyseq_if_unbound (_rl_term_kl, rl_backward_char);
rl_bind_keyseq_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */
rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */
rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
_rl_keymap = xkeymap;
}
char *
rl_get_termcap (cap)
const char *cap;
{
register int i;
if (tcap_initialized == 0)
return ((char *)NULL);
for (i = 0; i < NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);
}
return ((char *)NULL);
}
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */
int
rl_reset_terminal (terminal_name)
const char *terminal_name;
{
_rl_screenwidth = _rl_screenheight = 0;
_rl_init_terminal_io (terminal_name);
return 0;
}
/* A function for the use of tputs () */
#ifdef _MINIX
void
_rl_output_character_function (c)
int c;
{
putc (c, _rl_out_stream);
}
#else /* !_MINIX */
int
_rl_output_character_function (c)
int c;
{
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
const char *string;
int count;
{
fwrite (string, 1, count, _rl_out_stream);
}
/* Move the cursor back. */
int
_rl_backspace (count)
int count;
{
register int i;
if (_rl_term_backspace)
for (i = 0; i < count; i++)
tputs (_rl_term_backspace, 1, _rl_output_character_function);
else
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
}
/* Move to the start of the next line. */
int
rl_crlf ()
{
#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER || __MINT__ */
putc ('\n', _rl_out_stream);
return 0;
}
/* Ring the terminal bell. */
int
rl_ding ()
{
if (_rl_echoing_p)
{
switch (_rl_bell_preference)
{
case NO_BELL:
default:
break;
case VISIBLE_BELL:
if (_rl_visible_bell)
{
tputs (_rl_visible_bell, 1, _rl_output_character_function);
break;
}
/* FALLTHROUGH */
case AUDIBLE_BELL:
fprintf (stderr, "\007");
fflush (stderr);
break;
}
return (0);
}
return (-1);
}
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
/* */
/* **************************************************************** */
void
_rl_enable_meta_key ()
{
#if !defined (__DJGPP__)
if (term_has_meta && _rl_term_mm)
tputs (_rl_term_mm, 1, _rl_output_character_function);
#endif
}
void
_rl_control_keypad (on)
int on;
{
#if !defined (__DJGPP__)
if (on && _rl_term_ks)
tputs (_rl_term_ks, 1, _rl_output_character_function);
else if (!on && _rl_term_ke)
tputs (_rl_term_ke, 1, _rl_output_character_function);
#endif
}
/* **************************************************************** */
/* */
/* Controlling the Cursor */
/* */
/* **************************************************************** */
/* Set the cursor appropriately depending on IM, which is one of the
insert modes (insert or overwrite). Insert mode gets the normal
cursor. Overwrite mode gets a very visible cursor. Only does
anything if we have both capabilities. */
void
_rl_set_cursor (im, force)
int im, force;
{
if (_rl_term_ve && _rl_term_vs)
{
if (force || im != rl_insert_mode)
{
if (im == RL_IM_OVERWRITE)
tputs (_rl_term_vs, 1, _rl_output_character_function);
else
tputs (_rl_term_ve, 1, _rl_output_character_function);
}
}
}
+6 -6
View File
@@ -150,7 +150,7 @@ rl_delete_text (from, to)
if (_rl_doing_an_undo == 0)
rl_add_undo (UNDO_DELETE, from, to, text);
else
free (text);
xfree (text);
rl_end -= diff;
rl_line_buffer[rl_end] = '\0';
@@ -752,7 +752,7 @@ _rl_insert_char (count, c)
string[i] = '\0';
rl_insert_text (string);
free (string);
xfree (string);
return 0;
}
@@ -779,7 +779,7 @@ _rl_insert_char (count, c)
count -= decreaser;
}
free (string);
xfree (string);
incoming_length = 0;
stored_count = 0;
#else /* !HANDLE_MULTIBYTE */
@@ -1407,8 +1407,8 @@ rl_transpose_words (count, key)
/* I think that does it. */
rl_end_undo_group ();
free (word1);
free (word2);
xfree (word1);
xfree (word2);
return 0;
}
@@ -1467,7 +1467,7 @@ rl_transpose_chars (count, key)
rl_end_undo_group ();
#if defined (HANDLE_MULTIBYTE)
free (dummy);
xfree (dummy);
#endif
return 0;
+1 -1
View File
@@ -1,6 +1,6 @@
/* text.c -- text handling commands for readline. */
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
/* Copyright (C) 1987-2010 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.
+1 -1
View File
@@ -1011,7 +1011,7 @@ static void
_rl_mvcxt_dispose (m)
_rl_vimotion_cxt *m;
{
free (m);
xfree (m);
}
static int
+2
View File
@@ -1113,6 +1113,7 @@ rl_domove_read_callback (m)
return (0);
}
#if defined (READLINE_CALLBACKS)
/* XXX - these need to handle rl_universal_argument bindings */
/* Reading vi motion char continuing numeric argument */
else if (_rl_digit_p (c) && RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
{
@@ -1146,6 +1147,7 @@ rl_domove_read_callback (m)
else
{
RL_UNSETSTATE (RL_STATE_VIMOTION);
RL_UNSETSTATE (RL_STATE_NUMERICARG);
return (1);
}
}
+50
View File
@@ -0,0 +1,50 @@
/* xfree.c -- safe version of free that ignores attempts to free NUL */
/* Copyright (C) 1991-2010 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
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include "xmalloc.h"
/* **************************************************************** */
/* */
/* Memory Deallocation. */
/* */
/* **************************************************************** */
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
PTR_T string;
{
if (string)
free (string);
}
+89
View File
@@ -0,0 +1,89 @@
/* xmalloc.c -- safe versions of malloc and realloc */
/* Copyright (C) 1991-2009 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 <stdio.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include "xmalloc.h"
/* **************************************************************** */
/* */
/* Memory Allocation and Deallocation. */
/* */
/* **************************************************************** */
static void
memory_error_and_abort (fname)
char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
}
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
PTR_T
xmalloc (bytes)
size_t bytes;
{
PTR_T temp;
temp = malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xmalloc");
return (temp);
}
PTR_T
xrealloc (pointer, bytes)
PTR_T pointer;
size_t bytes;
{
PTR_T temp;
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xrealloc");
return (temp);
}
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
PTR_T string;
{
if (string)
free (string);
}
-10
View File
@@ -77,13 +77,3 @@ xrealloc (pointer, bytes)
memory_error_and_abort ("xrealloc");
return (temp);
}
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
PTR_T string;
{
if (string)
free (string);
}
+89
View File
@@ -0,0 +1,89 @@
/* xmalloc.c -- safe versions of malloc and realloc */
/* Copyright (C) 1991-2009 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 <stdio.h>
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include "xmalloc.h"
/* **************************************************************** */
/* */
/* Memory Allocation and Deallocation. */
/* */
/* **************************************************************** */
static void
memory_error_and_abort (fname)
char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
}
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
PTR_T
xmalloc (bytes)
size_t bytes;
{
PTR_T temp;
temp = malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xmalloc");
return (temp);
}
PTR_T
xrealloc (pointer, bytes)
PTR_T pointer;
size_t bytes;
{
PTR_T temp;
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xrealloc");
return (temp);
}
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
PTR_T string;
{
if (string)
free (string);
}
+2 -2
View File
@@ -378,7 +378,7 @@ tilde_expand_word (filename)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
xfree (username);
free (expansion);
xfree (expansion);
return (dirname);
}
}
@@ -401,7 +401,7 @@ tilde_expand_word (filename)
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
free (expansion);
xfree (expansion);
}
}
/* If we don't have a failure hook, or if the failure hook did not
+502
View File
@@ -0,0 +1,502 @@
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
/* Copyright (C) 1988-2009 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/>.
*/
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#if defined (HAVE_STRING_H)
# include <string.h>
#else /* !HAVE_STRING_H */
# include <strings.h>
#endif /* !HAVE_STRING_H */
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include <sys/types.h>
#if defined (HAVE_PWD_H)
#include <pwd.h>
#endif
#include "tilde.h"
#if defined (TEST) || defined (STATIC_MALLOC)
static void *xmalloc (), *xrealloc ();
#else
# include "xmalloc.h"
#endif /* TEST || STATIC_MALLOC */
#if !defined (HAVE_GETPW_DECLS)
# if defined (HAVE_GETPWUID)
extern struct passwd *getpwuid PARAMS((uid_t));
# endif
# if defined (HAVE_GETPWNAM)
extern struct passwd *getpwnam PARAMS((const char *));
# endif
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
#endif /* !savestring */
#if !defined (NULL)
# if defined (__STDC__)
# define NULL ((void *) 0)
# else
# define NULL 0x0
# endif /* !__STDC__ */
#endif /* !NULL */
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
extern char *sh_get_home_dir PARAMS((void));
extern char *sh_get_env_value PARAMS((const char *));
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_prefixes[] =
{ " ~", "\t~", (const char *)NULL };
/* The default value of tilde_additional_suffixes. This is set to
whitespace or newline so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_suffixes[] =
{ " ", "\n", (const char *)NULL };
/* If non-null, this contains the address of a function that the application
wants called before trying the standard tilde expansions. The function
is called with the text sans tilde, and returns a malloc()'ed string
which is the expansion, or a NULL pointer if the expansion fails. */
tilde_hook_func_t *tilde_expansion_preexpansion_hook = (tilde_hook_func_t *)NULL;
/* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
which is the expansion, or a NULL pointer if there is no expansion. */
tilde_hook_func_t *tilde_expansion_failure_hook = (tilde_hook_func_t *)NULL;
/* When non-null, this is a NULL terminated array of strings which
are duplicates for a tilde prefix. Bash uses this to expand
`=~' and `:~'. */
char **tilde_additional_prefixes = (char **)default_prefixes;
/* When non-null, this is a NULL terminated array of strings which match
the end of a username, instead of just "/". Bash sets this to
`:' and `=~'. */
char **tilde_additional_suffixes = (char **)default_suffixes;
static int tilde_find_prefix PARAMS((const char *, int *));
static int tilde_find_suffix PARAMS((const char *));
static char *isolate_tilde_prefix PARAMS((const char *, int *));
static char *glue_prefix_and_suffix PARAMS((char *, const char *, int));
/* Find the start of a tilde expansion in STRING, and return the index of
the tilde which starts the expansion. Place the length of the text
which identified this tilde starter in LEN, excluding the tilde itself. */
static int
tilde_find_prefix (string, len)
const char *string;
int *len;
{
register int i, j, string_len;
register char **prefixes;
prefixes = tilde_additional_prefixes;
string_len = strlen (string);
*len = 0;
if (*string == '\0' || *string == '~')
return (0);
if (prefixes)
{
for (i = 0; i < string_len; i++)
{
for (j = 0; prefixes[j]; j++)
{
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
{
*len = strlen (prefixes[j]) - 1;
return (i + *len);
}
}
}
}
return (string_len);
}
/* Find the end of a tilde expansion in STRING, and return the index of
the character which ends the tilde definition. */
static int
tilde_find_suffix (string)
const char *string;
{
register int i, j, string_len;
register char **suffixes;
suffixes = tilde_additional_suffixes;
string_len = strlen (string);
for (i = 0; i < string_len; i++)
{
#if defined (__MSDOS__)
if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
#else
if (string[i] == '/' /* || !string[i] */)
#endif
break;
for (j = 0; suffixes && suffixes[j]; j++)
{
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
return (i);
}
}
return (i);
}
/* Return a new string which is the result of tilde expanding STRING. */
char *
tilde_expand (string)
const char *string;
{
char *result;
int result_size, result_index;
result_index = result_size = 0;
if (result = strchr (string, '~'))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */
while (1)
{
register int start, end;
char *tilde_word, *expansion;
int len;
/* Make START point to the tilde which starts the expansion. */
start = tilde_find_prefix (string, &len);
/* Copy the skipped text into the result. */
if ((result_index + start + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
strncpy (result + result_index, string, start);
result_index += start;
/* Advance STRING to the starting tilde. */
string += start;
/* Make END be the index of one after the last character of the
username. */
end = tilde_find_suffix (string);
/* If both START and END are zero, we are all done. */
if (!start && !end)
break;
/* Expand the entire tilde word, and copy it into RESULT. */
tilde_word = (char *)xmalloc (1 + end);
strncpy (tilde_word, string, end);
tilde_word[end] = '\0';
string += end;
expansion = tilde_expand_word (tilde_word);
xfree (tilde_word);
len = strlen (expansion);
#ifdef __CYGWIN__
/* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
$HOME for `user' is /. On cygwin, // denotes a network drive. */
if (len > 1 || *expansion != '/' || *string != '/')
#endif
{
if ((result_index + len + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
strcpy (result + result_index, expansion);
result_index += len;
}
xfree (expansion);
}
result[result_index] = '\0';
return (result);
}
/* Take FNAME and return the tilde prefix we want expanded. If LENP is
non-null, the index of the end of the prefix into FNAME is returned in
the location it points to. */
static char *
isolate_tilde_prefix (fname, lenp)
const char *fname;
int *lenp;
{
char *ret;
int i;
ret = (char *)xmalloc (strlen (fname));
#if defined (__MSDOS__)
for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
#else
for (i = 1; fname[i] && fname[i] != '/'; i++)
#endif
ret[i - 1] = fname[i];
ret[i - 1] = '\0';
if (lenp)
*lenp = i;
return ret;
}
#if 0
/* Public function to scan a string (FNAME) beginning with a tilde and find
the portion of the string that should be passed to the tilde expansion
function. Right now, it just calls tilde_find_suffix and allocates new
memory, but it can be expanded to do different things later. */
char *
tilde_find_word (fname, flags, lenp)
const char *fname;
int flags, *lenp;
{
int x;
char *r;
x = tilde_find_suffix (fname);
if (x == 0)
{
r = savestring (fname);
if (lenp)
*lenp = 0;
}
else
{
r = (char *)xmalloc (1 + x);
strncpy (r, fname, x);
r[x] = '\0';
if (lenp)
*lenp = x;
}
return r;
}
#endif
/* Return a string that is PREFIX concatenated with SUFFIX starting at
SUFFIND. */
static char *
glue_prefix_and_suffix (prefix, suffix, suffind)
char *prefix;
const char *suffix;
int suffind;
{
char *ret;
int plen, slen;
plen = (prefix && *prefix) ? strlen (prefix) : 0;
slen = strlen (suffix + suffind);
ret = (char *)xmalloc (plen + slen + 1);
if (plen)
strcpy (ret, prefix);
strcpy (ret + plen, suffix + suffind);
return ret;
}
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook.
This always returns a newly-allocated string, never static storage. */
char *
tilde_expand_word (filename)
const char *filename;
{
char *dirname, *expansion, *username;
int user_len;
struct passwd *user_entry;
if (filename == 0)
return ((char *)NULL);
if (*filename != '~')
return (savestring (filename));
/* A leading `~/' or a bare `~' is *always* translated to the value of
$HOME or the home directory of the current user, regardless of any
preexpansion hook. */
if (filename[1] == '\0' || filename[1] == '/')
{
/* Prefix $HOME to the rest of the string. */
expansion = sh_get_env_value ("HOME");
/* If there is no HOME variable, look up the directory in
the password database. */
if (expansion == 0)
expansion = sh_get_home_dir ();
return (glue_prefix_and_suffix (expansion, filename, 1));
}
username = isolate_tilde_prefix (filename, &user_len);
if (tilde_expansion_preexpansion_hook)
{
expansion = (*tilde_expansion_preexpansion_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
xfree (username);
free (expansion);
return (dirname);
}
}
/* No preexpansion hook, or the preexpansion hook failed. Look in the
password database. */
dirname = (char *)NULL;
#if defined (HAVE_GETPWNAM)
user_entry = getpwnam (username);
#else
user_entry = 0;
#endif
if (user_entry == 0)
{
/* If the calling program has a special syntax for expanding tildes,
and we couldn't find a standard expansion, then let them try. */
if (tilde_expansion_failure_hook)
{
expansion = (*tilde_expansion_failure_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
free (expansion);
}
}
/* If we don't have a failure hook, or if the failure hook did not
expand the tilde, return a copy of what we were passed. */
if (dirname == 0)
dirname = savestring (filename);
}
#if defined (HAVE_GETPWENT)
else
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
#endif
xfree (username);
#if defined (HAVE_GETPWENT)
endpwent ();
#endif
return (dirname);
}
#if defined (TEST)
#undef NULL
#include <stdio.h>
main (argc, argv)
int argc;
char **argv;
{
char *result, line[512];
int done = 0;
while (!done)
{
printf ("~expand: ");
fflush (stdout);
if (!gets (line))
strcpy (line, "done");
if ((strcmp (line, "done") == 0) ||
(strcmp (line, "quit") == 0) ||
(strcmp (line, "exit") == 0))
{
done = 1;
break;
}
result = tilde_expand (line);
printf (" --> %s\n", result);
free (result);
}
exit (0);
}
static void memory_error_and_abort ();
static void *
xmalloc (bytes)
size_t bytes;
{
void *temp = (char *)malloc (bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
static void *
xrealloc (pointer, bytes)
void *pointer;
int bytes;
{
void *temp;
if (!pointer)
temp = malloc (bytes);
else
temp = realloc (pointer, bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
static void
memory_error_and_abort ()
{
fprintf (stderr, "readline: out of virtual memory\n");
abort ();
}
/*
* Local variables:
* compile-command: "gcc -g -DTEST -o tilde tilde.c"
* end:
*/
#endif /* TEST */
+2
View File
@@ -4801,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;
}
}
+1 -1
View File
@@ -120,5 +120,5 @@ var2=var1
echo ${!var2}
# Bash-2.01[.1] fails this test -- it attempts history expansion after the
# history_expansion_char
# history_comment_char
echo ok 3 # !1200
+126
View File
@@ -0,0 +1,126 @@
LC_ALL=C
LANG=C
trap 'rm /tmp/newhistory' 0
file=bax
histchars='!^#' # make sure history comment char is set correctly
unset HISTFILESIZE
history -c
HISTFILE=history.list
HISTCONTROL=ignoreboth
HISTIGNORE='&:#*:history*:fc*'
# we will end up exercising the history stifling code as a result
HISTSIZE=32
shopt -s cmdhist
set -o history
history -p '!!'
# this should result in a failed history expansion error
history -p '!!:z'
history
HISTFILE=/tmp/newhistory
history -a
history -w
history -s "echo line 2 for history"
history
history -p '!e'
history -p '!!'
set -H
!!
!e
history
echo a b c d e
!?ch?
!-2
^2^8
!2
# we're selecting /bin/sh -c ...; we want `sh'
echo !-1:0:t
# we're selecting /bin/sh -c ...; we want `/bin'
echo !-2:0:h
# we're selecting `echo a b c d e'; we want `e'
echo !?d?:5
echo a b c d e
echo !-1:2-$
echo !-2:2-4
echo !-2:3*
echo !!:*
echo !?a?:2-
echo file.c
echo !!:$:r
echo !-2:$:e
echo !-3:$:r:q
echo $file.c
echo !!:$:r
echo !-2:^:e
echo !-3:$:r:q
echo a b c d e
echo !!:1-$:x
echo !-2:1-$:q
echo foo.c foo.o foo.html foo.h
!!:s/foo/bar/
!-2:gs/foo/bar/
!!:gs/bar/x&/
!-2:g&
# make sure we can use any delimiter in the substitution, not just `/'
!!:gs+bar+whix+
!!:p
# wow
echo !?.o?:%:r:q
!!:0 !?.h?:%:q
!!:-$
!:-$
history
# make sure single quotes inhibit history expansion
echo '!!'
# make sure backslashes can quote the history expansion character
echo \!\!
# but other expansions on the line should still be processed
echo '!!' !!:*
history -c
unset HISTFILE
# make sure that the special bash cases are not history expanded
case p in
[!A-Z]) echo ok 1;;
esac
var1='ok 2'
var2=var1
echo ${!var2}
echo & echo $!; echo after
# Bash-2.01[.1] fails this test -- it attempts history expansion after the
# history_comment_char
echo ok 3 # !1200