commit bash-20090818 snapshot

This commit is contained in:
Chet Ramey
2011-12-08 20:14:30 -05:00
parent 691aebcba3
commit 8f714a7c33
72 changed files with 11749 additions and 8952 deletions
+111
View File
@@ -8558,8 +8558,119 @@ print_cmd.c
- new function xtrace_init, sets xtrace_fd == -1 and xtrace_fp = stderr
- new function xtrace_set (fd, fp), sets xtrace_fd and xtrace_fp
to the arguments
- new function xtrace_reset, handles closing old xtrace fd/fp and
moving them back to -1/stderr
- new function xtrace_fdchck, calls xtrace_reset if the fd passed as
an argument is xtrace_fd
- change xtrace functions to fprintf to xtrace_fp instead of stderr
shell.c
- call xtrace_init() very early in main()
variables.c
- new special variable, BASH_XTRACEFD, holds file descriptor used for
set -x trace output. Inspired by suggestion from Bruce Korb
<bruce.korb@gmail.com>
doc/{bash.1,bashref.texi}
- added description of new BASH_XTRACEFD variable
redir.c
- add calls to xtrace_fdchk to the redirections that close file
descriptors, so we notice if we close BASH_XTRACEFD and compensate
accordingly (same places that call coproc_fdchk())
8/18
----
lib/readline/text.c
- change to _rl_replace_text to add error checks: start must be <=
end, and we don't call rl_insert_text if passed the empty string
config.h.in
- add define for HAVE_ICONV, already found by intl autoconf
macros
- add define for HAVE_LOCALE_CHARSET
aclocal.m4
- add check for locale_charset() to BASH_CHECK_MULTIBYTE
lib/sh/fnxform.c
- new file with two public function: fnx_tofs and fnx_fromfs.
Primarily intended for use on MacOS X, they use iconv to convert
between whatever the current locale encoding is and "UTF-8-MAC",
a special encoding on OS X in which all characters are
decomposed unicode, as the HFS+ filesystem stores them. These
functions return a pointer to a local buffer, allocated once and
resized as necessary, to avoid too many allocations; callers
should not free the return value, since it may be the string
passed
Makefile.in
- make sure LIBICONV is set by autoconf (@LIBICONV@) and added to
list of link libraries
externs.h
- new extern declarations for fnx_fromfs and fnx_tofs
lib/glob/glob.c
- convert the filename read using readdir() in glob_vector() using
fnx_fromfs and use that value in the call to strmatch. This
ensures that we're using the precomposed Unicode value of the
filename rather than the native decomposed form. Original bug
report from Len Lattanzi <llatanzi@apple.com>; fix inspired by
Guillaume Outters <guillaume.outters@free.fr>
8/19
----
lib/readline/complete.c
- new completion hook: rl_filename_rewrite_hook, can rewrite or modify
filenames read from the filesystem before they are compared to the
word to be completed
lib/readline/readline.h
- extern declaration for rl_filename_rewrite_hook
lib/readline/doc/rltech.texi
- document rl_filename_rewrite_hook
bashline.c
- new function, bash_filename_rewrite_hook, assigned to
rl_filename_rewrite_hook. Calls fnx_fromfs to convert from
filesystem format to "input" format. This makes completing
filenames with accented characters work on Mac OS X
8/20
----
lib/readline/bind.c
- new bindable variable "skip-completed-text", bound to
_rl_skip_completed_text. If enabled, it means to note when
completing before the end of a word and skipping over characters
after rl_point that match in both the completion to be inserted
and the word being completed. It means that completing
`Makefile' with the cursor after the `e' results in `Makefile'
instead of `Makefilefile'. Inspired by an idea from Jared
Yanovich <phierunner@comcast.net> from back in 2004
lib/readline/rlprivate.h
- extern declaration for _rl_skip_completed_text
lib/readline/complete.c
- implement semantics of _rl_skip_completed_text in insert_match:
skip characters in `replacement' that match chars in rl_line_buffer
from the start of the word to be completed
8/21
----
error.c
- change parser_error to set last_command_exit_value to 2 before
calling exit_shell (if set -e is enabled), so any exit or ERR
trap gets the right value of $?. Suggestion from Stefano
Lattarini <stefano.lattarini@gmail.com>
braces.c
- fix expand_seqterm so that a non-zero-prefixed term that's longer
than a zero-prefixed term determines the length of each term
in the brace-expanded sequence. This means that things like
{01..100} will have three digits in all the elements of the
expanded list. Fixes bug reported by Jeff Haemer
<jeffrey.haemer@gmail.com>
+104
View File
@@ -8558,7 +8558,111 @@ print_cmd.c
- new function xtrace_init, sets xtrace_fd == -1 and xtrace_fp = stderr
- new function xtrace_set (fd, fp), sets xtrace_fd and xtrace_fp
to the arguments
- new function xtrace_reset, handles closing old xtrace fd/fp and
moving them back to -1/stderr
- new function xtrace_fdchck, calls xtrace_reset if the fd passed as
an argument is xtrace_fd
- change xtrace functions to fprintf to xtrace_fp instead of stderr
shell.c
- call xtrace_init() very early in main()
variables.c
- new special variable, BASH_XTRACEFD, holds file descriptor used for
set -x trace output. Inspired by suggestion from Bruce Korb
<bruce.korb@gmail.com>
doc/{bash.1,bashref.texi}
- added description of new BASH_XTRACEFD variable
redir.c
- add calls to xtrace_fdchk to the redirections that close file
descriptors, so we notice if we close BASH_XTRACEFD and compensate
accordingly (same places that call coproc_fdchk())
8/18
----
lib/readline/text.c
- change to _rl_replace_text to add error checks: start must be <=
end, and we don't call rl_insert_text if passed the empty string
config.h.in
- add define for HAVE_ICONV, already found by intl autoconf
macros
- add define for HAVE_LOCALE_CHARSET
aclocal.m4
- add check for locale_charset() to BASH_CHECK_MULTIBYTE
lib/sh/fnxform.c
- new file with two public function: fnx_tofs and fnx_fromfs.
Primarily intended for use on MacOS X, they use iconv to convert
between whatever the current locale encoding is and "UTF-8-MAC",
a special encoding on OS X in which all characters are
decomposed unicode, as the HFS+ filesystem stores them. These
functions return a pointer to a local buffer, allocated once and
resized as necessary, to avoid too many allocations; callers
should not free the return value, since it may be the string
passed
Makefile.in
- make sure LIBICONV is set by autoconf (@LIBICONV@) and added to
list of link libraries
externs.h
- new extern declarations for fnx_fromfs and fnx_tofs
lib/glob/glob.c
- convert the filename read using readdir() in glob_vector() using
fnx_fromfs and use that value in the call to strmatch. This
ensures that we're using the precomposed Unicode value of the
filename rather than the native decomposed form. Original bug
report from Len Lattanzi <llatanzi@apple.com>; fix inspired by
Guillaume Outters <guillaume.outters@free.fr>
8/19
----
lib/readline/complete.c
- new completion hook: rl_filename_rewrite_hook, can rewrite or modify
filenames read from the filesystem before they are compared to the
word to be completed
lib/readline/readline.h
- extern declaration for rl_filename_rewrite_hook
lib/readline/doc/rltech.texi
- document rl_filename_rewrite_hook
bashline.c
- new function, bash_filename_rewrite_hook, assigned to
rl_filename_rewrite_hook. Calls fnx_fromfs to convert from
filesystem format to "input" format. This makes completing
filenames with accented characters work on Mac OS X
8/20
----
lib/readline/bind.c
- new bindable variable "skip-completed-text", bound to
_rl_skip_completed_text. If enabled, it means to note when
completing before the end of a word and skipping over characters
after rl_point that match in both the completion to be inserted
and the word being completed. It means that completing
`Makefile' with the cursor after the `e' results in `Makefile'
instead of `Makefilefile'. Inspired by an idea from Jared
Yanovich <phierunner@comcast.net> from back in 2004
lib/readline/rlprivate.h
- extern declaration for _rl_skip_completed_text
lib/readline/complete.c
- implement semantics of _rl_skip_completed_text in insert_match:
skip characters in `replacement' that match chars in rl_line_buffer
from the start of the word to be completed
8/21
----
error.c
- change parser_error to set last_command_exit_value to 2 before
calling exit_shell (if set -e is enabled), so any exit or ERR
trap gets the right value of $?. Suggestion from Stefano
Lattarini <stefano.lattarini@gmail.com>
+1
View File
@@ -386,6 +386,7 @@ lib/sh/fdprintf.c f
lib/sh/fmtullong.c f
lib/sh/fmtulong.c f
lib/sh/fmtumax.c f
lib/sh/fnxform.c f
lib/sh/fpurge.c f
lib/sh/getcwd.c f
lib/sh/getenv.c f
+6 -2
View File
@@ -213,7 +213,8 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/fdprintf.c \
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
${SH_LIBSRC}/fnxform.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@@ -347,6 +348,9 @@ INTL_INC = @INTL_INC@
LIBINTL_H = @LIBINTL_H@
# libiconv
LIBICONV = @LIBICONV@
# tests
LIBINTL = @LIBINTL@
LTLIBINTL = @LTLIBINTL@
@@ -394,7 +398,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/ansi_stdlib.h \
$(BASHINCDIR)/ocache.h
LIBRARIES = $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) \
$(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LOCAL_LIBS)
$(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LIBICONV) $(LOCAL_LIBS)
LIBDEP = $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) $(GLOB_DEP) \
$(TILDE_DEP) $(MALLOC_DEP)
+4 -2
View File
@@ -213,7 +213,8 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/fdprintf.c \
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
${SH_LIBSRC}/fnxform.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
@@ -943,6 +944,7 @@ hashlib.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
hashlib.o: make_cmd.h subst.h sig.h pathnames.h externs.h
input.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
input.o: command.h ${BASHINCDIR}/stdc.h general.h xmalloc.h input.h error.h externs.h
input.o: quit.h
list.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
list.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
list.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
@@ -1046,7 +1048,7 @@ variables.o: make_cmd.h subst.h sig.h pathnames.h externs.h
variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
variables.o: findcmd.h bashhist.h hashcmd.h pathexp.h
variables.o: pcomplete.h ${BASHINCDIR}/chartypes.h
variables.o: ${BASHINCDIR}/posixtime.h
variables.o: ${BASHINCDIR}/posixtime.h assoc.h
version.o: conftypes.h patchlevel.h version.h
xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
Vendored
+7
View File
@@ -1759,6 +1759,13 @@ if test $bash_cv_type_wint_t = yes; then
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_CHECK_FUNCS(locale_charset)
LIBS="$OLDLIBS"
fi
])
dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
Vendored
+1
View File
@@ -1693,6 +1693,7 @@ AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
+106
View File
@@ -18489,6 +18489,112 @@ _ACEOF
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
for ac_func in locale_charset
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if test `eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'` = yes; then
cat >>confdefs.h <<_ACEOF
@%:@define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
fi
if test "$opt_static_link" != yes; then
+49 -47
View File
@@ -171,7 +171,7 @@ m4trace:configure.in:51: -1- AC_SUBST_TRACE([host_os])
m4trace:configure.in:51: -1- m4_pattern_allow([^host_os$])
m4trace:configure.in:101: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:209: AC_HELP_STRING is expanded from...
aclocal.m4:1965: AM_PATH_LISPDIR is expanded from...
aclocal.m4:1972: AM_PATH_LISPDIR is expanded from...
configure.in:101: the top level])
m4trace:configure.in:101: -1- AC_SUBST([EMACS])
m4trace:configure.in:101: -1- AC_SUBST_TRACE([EMACS])
@@ -583,7 +583,7 @@ m4trace:configure.in:505: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is ob
You should run autoupdate.], [../../lib/autoconf/general.m4:2591: AC_TRY_RUN is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
aclocal.m4:1769: RL_LIB_READLINE_VERSION is expanded from...
aclocal.m4:1776: RL_LIB_READLINE_VERSION is expanded from...
configure.in:505: the top level])
m4trace:configure.in:505: -1- AC_DEFINE_TRACE_LITERAL([RL_READLINE_VERSION])
m4trace:configure.in:505: -1- m4_pattern_allow([^RL_READLINE_VERSION$])
@@ -766,8 +766,8 @@ m4trace:configure.in:651: -1- AC_SUBST_TRACE([MSGMERGE])
m4trace:configure.in:651: -1- m4_pattern_allow([^MSGMERGE$])
m4trace:configure.in:651: -1- _m4_warn([obsolete], [The macro `AC_OUTPUT_COMMANDS' is obsolete.
You should run autoupdate.], [../../lib/autoconf/status.m4:1021: AC_OUTPUT_COMMANDS is expanded from...
aclocal.m4:3670: AM_PO_SUBDIRS is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:3677: AM_PO_SUBDIRS is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([off_t])
m4trace:configure.in:651: -1- m4_pattern_allow([^off_t$])
@@ -827,9 +827,9 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2591: AC_TRY_RUN is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2576: gt_INTDIV0 is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2583: gt_INTDIV0 is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([INTDIV0_RAISES_SIGFPE])
m4trace:configure.in:651: -1- m4_pattern_allow([^INTDIV0_RAISES_SIGFPE$])
@@ -840,10 +840,10 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2469: AC_TRY_COMPILE
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2678: jm_AC_HEADER_INTTYPES_H is expanded from...
aclocal.m4:3979: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2685: jm_AC_HEADER_INTTYPES_H is expanded from...
aclocal.m4:3986: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H_WITH_UINTMAX])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_INTTYPES_H_WITH_UINTMAX$])
@@ -855,10 +855,10 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2469: AC_TRY_COMPILE
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:3949: jm_AC_HEADER_STDINT_H is expanded from...
aclocal.m4:3979: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:3956: jm_AC_HEADER_STDINT_H is expanded from...
aclocal.m4:3986: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDINT_H_WITH_UINTMAX])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_STDINT_H_WITH_UINTMAX$])
@@ -870,10 +870,10 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:4006: jm_AC_TYPE_UNSIGNED_LONG_LONG is expanded from...
aclocal.m4:3979: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:4013: jm_AC_TYPE_UNSIGNED_LONG_LONG is expanded from...
aclocal.m4:3986: jm_AC_TYPE_UINTMAX_T is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNSIGNED_LONG_LONG])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_UNSIGNED_LONG_LONG$])
@@ -893,9 +893,9 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2469: AC_TRY_COMPILE
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2651: gt_HEADER_INTTYPES_H is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2658: gt_HEADER_INTTYPES_H is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_INTTYPES_H$])
@@ -906,9 +906,9 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2469: AC_TRY_COMPILE
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2706: gt_INTTYPES_PRI is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2713: gt_INTTYPES_PRI is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([PRI_MACROS_BROKEN])
m4trace:configure.in:651: -1- m4_pattern_allow([^PRI_MACROS_BROKEN$])
@@ -985,20 +985,20 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2484: AM_ICONV_LINK is expanded from...
aclocal.m4:2539: AM_ICONV is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2491: AM_ICONV_LINK is expanded from...
aclocal.m4:2546: AM_ICONV is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2484: AM_ICONV_LINK is expanded from...
aclocal.m4:2539: AM_ICONV is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2491: AM_ICONV_LINK is expanded from...
aclocal.m4:2546: AM_ICONV is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ICONV])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_ICONV$])
@@ -1014,9 +1014,9 @@ m4trace:configure.in:651: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' i
You should run autoupdate.], [../../lib/autoconf/general.m4:2469: AC_TRY_COMPILE is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
aclocal.m4:2539: AM_ICONV is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2546: AM_ICONV is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([ICONV_CONST])
m4trace:configure.in:651: -1- m4_pattern_allow([^ICONV_CONST$])
@@ -1027,9 +1027,9 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2003: AM_LANGINFO_CODESET is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2010: AM_LANGINFO_CODESET is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_LANGINFO_CODESET$])
@@ -1040,9 +1040,9 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2773: AM_LC_MESSAGES is expanded from...
aclocal.m4:2362: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2780: AM_LC_MESSAGES is expanded from...
aclocal.m4:2369: AM_INTL_SUBDIR is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LC_MESSAGES])
m4trace:configure.in:651: -1- m4_pattern_allow([^HAVE_LC_MESSAGES$])
@@ -1059,21 +1059,21 @@ You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:2526: AC_TRY_LINK is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:2074: AM_GNU_GETTEXT is expanded from...
aclocal.m4:2081: AM_GNU_GETTEXT is expanded from...
configure.in:651: the top level])
m4trace:configure.in:651: -1- AC_DEFINE_TRACE_LITERAL([ENABLE_NLS])
m4trace:configure.in:651: -1- m4_pattern_allow([^ENABLE_NLS$])
@@ -1724,6 +1724,8 @@ m4trace:configure.in:804: -1- AC_DEFINE_TRACE_LITERAL([HAVE_WINT_T])
m4trace:configure.in:804: -1- m4_pattern_allow([^HAVE_WINT_T$])
m4trace:configure.in:804: -1- AH_OUTPUT([HAVE_WINT_T], [/* systems should define this type here */
#undef HAVE_WINT_T])
m4trace:configure.in:804: -1- AH_OUTPUT([HAVE_LOCALE_CHARSET], [/* Define to 1 if you have the `locale_charset\' function. */
#undef HAVE_LOCALE_CHARSET])
m4trace:configure.in:808: -1- AH_OUTPUT([HAVE_LIBDL], [/* Define to 1 if you have the `dl\' library (-ldl). */
#undef HAVE_LIBDL])
m4trace:configure.in:808: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDL])
@@ -1990,7 +1992,7 @@ m4trace:configure.in:885: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is ob
You should run autoupdate.], [../../lib/autoconf/general.m4:2591: AC_TRY_RUN is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
aclocal.m4:1883: BASH_FUNC_CTYPE_NONASCII is expanded from...
aclocal.m4:1890: BASH_FUNC_CTYPE_NONASCII is expanded from...
configure.in:885: the top level])
m4trace:configure.in:885: -1- AC_DEFINE_TRACE_LITERAL([CTYPE_NON_ASCII])
m4trace:configure.in:885: -1- m4_pattern_allow([^CTYPE_NON_ASCII$])
@@ -2348,7 +2350,7 @@ m4trace:configure.in:958: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is ob
You should run autoupdate.], [../../lib/autoconf/general.m4:2591: AC_TRY_RUN is expanded from...
../../lib/m4sugar/m4sh.m4:508: AS_IF is expanded from...
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
aclocal.m4:1927: BASH_CHECK_WCONTINUED is expanded from...
aclocal.m4:1934: BASH_CHECK_WCONTINUED is expanded from...
configure.in:958: the top level])
m4trace:configure.in:958: -1- AC_DEFINE_TRACE_LITERAL([WCONTINUED_BROKEN])
m4trace:configure.in:958: -1- m4_pattern_allow([^WCONTINUED_BROKEN$])
+17
View File
@@ -115,6 +115,7 @@ static int bash_backward_kill_shellword __P((int, int));
/* Helper functions for Readline. */
static char *restore_tilde __P((char *, char *));
static char *bash_filename_rewrite_hook __P((char *, int));
static void bash_directory_expansion __P((char **));
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
@@ -501,6 +502,8 @@ initialize_readline ()
do other expansion on directory names. */
rl_directory_completion_hook = bash_directory_completion_hook;
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
/* Tell the filename completer we want a chance to ignore some names. */
rl_ignore_some_completions_function = filename_completion_ignore;
@@ -2659,6 +2662,20 @@ bash_directory_expansion (dirname)
}
}
/* If necessary, rewrite directory entry */
static char *
bash_filename_rewrite_hook (fname, fnlen)
char *fname;
int fnlen;
{
char *conv;
conv = fnx_fromfs (fname, fnlen);
if (conv != fname)
conv = savestring (conv);
return conv;
}
/* Handle symbolic link references and other directory name
expansions while hacking completion. */
static int
+16 -1
View File
@@ -115,6 +115,7 @@ static int bash_backward_kill_shellword __P((int, int));
/* Helper functions for Readline. */
static char *restore_tilde __P((char *, char *));
static char *bash_filename_rewrite_hook __P((char *, int));
static void bash_directory_expansion __P((char **));
static int bash_directory_completion_hook __P((char **));
static int filename_completion_ignore __P((char **));
@@ -2659,6 +2660,20 @@ bash_directory_expansion (dirname)
}
}
/* If necessary, rewrite directory entry */
static char *
bash_filename_rewrite_hook (fname, fnlen)
char *fname;
int fnlen;
{
char *conv;
conv = fnx_fromfs (fname, fnlen);
if (conv != fname)
conv = savestring (conv);
return conv;
}
/* Handle symbolic link references and other directory name
expansions while hacking completion. */
static int
@@ -2795,7 +2810,7 @@ build_history_completion_array ()
{
for (i = 0; hlist[i]; i++)
;
for ( ; i > 0; i--)
for ( --i; i >= 0; i--)
{
/* Separate each token, and place into an array. */
tokens = history_tokenize (hlist[i]->line);
+5
View File
@@ -451,6 +451,11 @@ expand_seqterm (text, tlen)
width = rhs_l, lhs_t = ST_ZINT;
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
width = rhs_l, lhs_t = ST_ZINT;
if (width < lhs_l && lhs_t == ST_ZINT)
width = lhs_l;
if (width < rhs_l && lhs_t == ST_ZINT)
width = rhs_l;
}
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);
+682
View File
@@ -0,0 +1,682 @@
/* braces.c -- code for doing word expansion in curly braces. */
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
/* Stuff in curly braces gets expanded before all other shell expansions. */
#include "config.h"
#if defined (BRACE_EXPANSION)
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include "bashansi.h"
#if defined (SHELL)
# include "shell.h"
#endif /* SHELL */
#include "general.h"
#include "shmbutil.h"
#include "chartypes.h"
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
#define BRACE_SEQ_SPECIFIER ".."
extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
/* Basic idea:
Segregate the text into 3 sections: preamble (stuff before an open brace),
postamble (stuff after the matching close brace) and amble (stuff after
preamble, and before postamble). Expand amble, and then tack on the
expansions to preamble. Expand postamble, and tack on the expansions to
the result so far.
*/
/* The character which is used to separate arguments. */
static const int brace_arg_separator = ',';
#if defined (__P)
static int brace_gobbler __P((char *, size_t, int *, int));
static char **expand_amble __P((char *, size_t, int));
static char **expand_seqterm __P((char *, size_t));
static char **mkseq __P((int, int, int, int, int));
static char **array_concat __P((char **, char **));
#else
static int brace_gobbler ();
static char **expand_amble ();
static char **expand_seqterm ();
static char **mkseq();
static char **array_concat ();
#endif
#if 0
static void
dump_result (a)
char **a;
{
int i;
for (i = 0; a[i]; i++)
printf ("dump_result: a[%d] = -%s-\n", i, a[i]);
}
#endif
/* Return an array of strings; the brace expansion of TEXT. */
char **
brace_expand (text)
char *text;
{
register int start;
size_t tlen;
char *preamble, *postamble, *amble;
size_t alen;
char **tack, **result;
int i, j, c, c1;
DECLARE_MBSTATE;
/* Find the text of the preamble. */
tlen = strlen (text);
i = 0;
#if defined (CSH_BRACE_COMPAT)
c = brace_gobbler (text, tlen, &i, '{'); /* } */
#else
/* Make sure that when we exit this loop, c == 0 or text[i] begins a
valid brace expansion sequence. */
do
{
c = brace_gobbler (text, tlen, &i, '{'); /* } */
c1 = c;
/* Verify that c begins a valid brace expansion word. If it doesn't, we
go on. Loop stops when there are no more open braces in the word. */
if (c)
{
start = j = i + 1; /* { */
c = brace_gobbler (text, tlen, &j, '}');
if (c == 0) /* it's not */
{
i++;
c = c1;
continue;
}
else /* it is */
{
c = c1;
break;
}
}
else
break;
}
while (c);
#endif /* !CSH_BRACE_COMPAT */
preamble = (char *)xmalloc (i + 1);
strncpy (preamble, text, i);
preamble[i] = '\0';
result = (char **)xmalloc (2 * sizeof (char *));
result[0] = preamble;
result[1] = (char *)NULL;
/* Special case. If we never found an exciting character, then
the preamble is all of the text, so just return that. */
if (c != '{')
return (result);
/* Find the amble. This is the stuff inside this set of braces. */
start = ++i;
c = brace_gobbler (text, tlen, &i, '}');
/* What if there isn't a matching close brace? */
if (c == 0)
{
#if defined (NOTDEF)
/* Well, if we found an unquoted BRACE_ARG_SEPARATOR between START
and I, then this should be an error. Otherwise, it isn't. */
j = start;
while (j < i)
{
if (text[j] == '\\')
{
j++;
ADVANCE_CHAR (text, tlen, j);
continue;
}
if (text[j] == brace_arg_separator)
{ /* { */
strvec_dispose (result);
report_error ("no closing `%c' in %s", '}', text);
throw_to_top_level ();
}
ADVANCE_CHAR (text, tlen, j);
}
#endif
free (preamble); /* Same as result[0]; see initialization. */
result[0] = savestring (text);
return (result);
}
#if defined (SHELL)
amble = substring (text, start, i);
alen = i - start;
#else
amble = (char *)xmalloc (1 + (i - start));
strncpy (amble, &text[start], (i - start));
alen = i - start;
amble[alen] = '\0';
#endif
#if defined (SHELL)
INITIALIZE_MBSTATE;
/* If the amble does not contain an unquoted BRACE_ARG_SEPARATOR, then
just return without doing any expansion. */
j = 0;
while (amble[j])
{
if (amble[j] == '\\')
{
j++;
ADVANCE_CHAR (amble, alen, j);
continue;
}
if (amble[j] == brace_arg_separator)
break;
ADVANCE_CHAR (amble, alen, j);
}
if (amble[j] == 0)
{
tack = expand_seqterm (amble, alen);
if (tack)
goto add_tack;
else
{
free (amble);
free (preamble);
result[0] = savestring (text);
return (result);
}
}
#endif /* SHELL */
tack = expand_amble (amble, alen, 0);
add_tack:
result = array_concat (result, tack);
free (amble);
strvec_dispose (tack);
postamble = text + i + 1;
tack = brace_expand (postamble);
result = array_concat (result, tack);
strvec_dispose (tack);
return (result);
}
/* Expand the text found inside of braces. We simply try to split the
text at BRACE_ARG_SEPARATORs into separate strings. We then brace
expand each slot which needs it, until there are no more slots which
need it. */
static char **
expand_amble (text, tlen, flags)
char *text;
size_t tlen;
int flags;
{
char **result, **partial;
char *tem;
int start, i, c;
DECLARE_MBSTATE;
result = (char **)NULL;
start = i = 0;
c = 1;
while (c)
{
c = brace_gobbler (text, tlen, &i, brace_arg_separator);
#if defined (SHELL)
tem = substring (text, start, i);
#else
tem = (char *)xmalloc (1 + (i - start));
strncpy (tem, &text[start], (i - start));
tem[i- start] = '\0';
#endif
partial = brace_expand (tem);
if (!result)
result = partial;
else
{
register int lr, lp, j;
lr = strvec_len (result);
lp = strvec_len (partial);
result = strvec_resize (result, lp + lr + 1);
for (j = 0; j < lp; j++)
result[lr + j] = partial[j];
result[lr + j] = (char *)NULL;
free (partial);
}
free (tem);
ADVANCE_CHAR (text, tlen, i);
start = i;
}
return (result);
}
#define ST_BAD 0
#define ST_INT 1
#define ST_CHAR 2
#define ST_ZINT 3
static char **
mkseq (start, end, incr, type, width)
int start, end, incr, type, width;
{
int n, i;
char **result, *t;
n = abs (end - start) + 1;
result = strvec_create (n + 1);
if (incr == 0)
incr = 1;
if (start > end && incr > 0)
incr = -incr;
else if (start < end && incr < 0)
incr = -incr;
/* Make sure we go through the loop at least once, so {3..3} prints `3' */
i = 0;
n = start;
do
{
#if defined (SHELL)
QUIT; /* XXX - memory leak here */
#endif
if (type == ST_INT)
result[i++] = itos (n);
else if (type == ST_ZINT)
{
int len;
len = asprintf (&t, "%0*d", width, n);
result[i++] = t;
}
else
{
t = (char *)xmalloc (2);
t[0] = n;
t[1] = '\0';
result[i++] = t;
}
n += incr;
if ((incr < 0 && n < end) || (incr > 0 && n > end))
break;
}
while (1);
result[i] = (char *)0;
return (result);
}
static char **
expand_seqterm (text, tlen)
char *text;
size_t tlen;
{
char *t, *lhs, *rhs;
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
intmax_t tl, tr;
char **result, *ep, *oep;
t = strstr (text, BRACE_SEQ_SPECIFIER);
if (t == 0)
return ((char **)NULL);
lhs_l = t - text; /* index of start of BRACE_SEQ_SPECIFIER */
lhs = substring (text, 0, lhs_l);
rhs = substring (text, lhs_l + sizeof(BRACE_SEQ_SPECIFIER) - 1, tlen);
if (lhs[0] == 0 || rhs[0] == 0)
{
free (lhs);
free (rhs);
return ((char **)NULL);
}
/* Now figure out whether LHS and RHS are integers or letters. Both
sides have to match. */
lhs_t = (legal_number (lhs, &tl)) ? ST_INT :
((ISALPHA (lhs[0]) && lhs[1] == 0) ? ST_CHAR : ST_BAD);
/* Decide on rhs and whether or not it looks like the user specified
an increment */
ep = 0;
if (ISDIGIT (rhs[0]) || ((rhs[0] == '+' || rhs[0] == '-') && ISDIGIT (rhs[1])))
{
rhs_t = ST_INT;
tr = strtoimax (rhs, &ep, 10);
if (ep && *ep != 0 && *ep != '.')
rhs_t = ST_BAD; /* invalid */
}
else if (ISALPHA (rhs[0]) && (rhs[1] == 0 || rhs[1] == '.'))
{
rhs_t = ST_CHAR;
ep = rhs + 1;
}
else
{
rhs_t = ST_BAD;
ep = 0;
}
incr = 1;
if (rhs_t != ST_BAD)
{
oep = ep;
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
incr = strtoimax (ep + 2, &ep, 10);
if (*ep != 0)
rhs_t = ST_BAD; /* invalid incr */
tlen -= ep - oep;
}
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
{
free (lhs);
free (rhs);
return ((char **)NULL);
}
/* OK, we have something. It's either a sequence of integers, ascending
or descending, or a sequence or letters, ditto. Generate the sequence,
put it into a string vector, and return it. */
if (lhs_t == ST_CHAR)
{
lhs_v = (unsigned char)lhs[0];
rhs_v = (unsigned char)rhs[0];
width = 1;
}
else
{
lhs_v = tl; /* integer truncation */
rhs_v = tr;
/* Decide whether or not the terms need zero-padding */
rhs_l = tlen - lhs_l - sizeof (BRACE_SEQ_SPECIFIER) + 1;
width = 0;
if (lhs_l > 1 && lhs[0] == '0')
width = lhs_l, lhs_t = ST_ZINT;
if (lhs_l > 2 && lhs[0] == '-' && lhs[1] == '0')
width = lhs_l, lhs_t = ST_ZINT;
if (rhs_l > 1 && rhs[0] == '0' && width < rhs_l)
width = rhs_l, lhs_t = ST_ZINT;
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
width = rhs_l, lhs_t = ST_ZINT;
}
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);
free (lhs);
free (rhs);
return (result);
}
/* Start at INDEX, and skip characters in TEXT. Set INDEX to the
index of the character matching SATISFY. This understands about
quoting. Return the character that caused us to stop searching;
this is either the same as SATISFY, or 0. */
/* If SATISFY is `}', we are looking for a brace expression, so we
should enforce the rules that govern valid brace expansions:
1) to count as an arg separator, a comma or `..' has to be outside
an inner set of braces.
*/
static int
brace_gobbler (text, tlen, indx, satisfy)
char *text;
size_t tlen;
int *indx;
int satisfy;
{
register int i, c, quoted, level, commas, pass_next;
#if defined (SHELL)
int si;
char *t;
#endif
DECLARE_MBSTATE;
level = quoted = pass_next = 0;
#if defined (CSH_BRACE_COMPAT)
commas = 1;
#else
commas = (satisfy == '}') ? 0 : 1;
#endif
i = *indx;
while (c = text[i])
{
if (pass_next)
{
pass_next = 0;
ADVANCE_CHAR (text, tlen, i);
continue;
}
/* A backslash escapes the next character. This allows backslash to
escape the quote character in a double-quoted string. */
if (c == '\\' && (quoted == 0 || quoted == '"' || quoted == '`'))
{
pass_next = 1;
i++;
continue;
}
#if defined (SHELL)
/* If compiling for the shell, treat ${...} like \{...} */
if (c == '$' && text[i+1] == '{' && quoted != '\'') /* } */
{
pass_next = 1;
i++;
if (quoted == 0)
level++;
continue;
}
#endif
if (quoted)
{
if (c == quoted)
quoted = 0;
ADVANCE_CHAR (text, tlen, i);
continue;
}
if (c == '"' || c == '\'' || c == '`')
{
quoted = c;
i++;
continue;
}
#if defined (SHELL)
/* Pass new-style command and process substitutions through unchanged. */
if ((c == '$' || c == '<' || c == '>') && text[i+1] == '(') /* ) */
{
si = i + 2;
t = extract_command_subst (text, &si, 0);
i = si;
free (t);
i++;
continue;
}
#endif
if (c == satisfy && level == 0 && quoted == 0 && commas > 0)
{
/* We ignore an open brace surrounded by whitespace, and also
an open brace followed immediately by a close brace preceded
by whitespace. */
if (c == '{' &&
((!i || brace_whitespace (text[i - 1])) &&
(brace_whitespace (text[i + 1]) || text[i + 1] == '}')))
{
i++;
continue;
}
break;
}
if (c == '{')
level++;
else if (c == '}' && level)
level--;
#if !defined (CSH_BRACE_COMPAT)
else if (satisfy == '}' && c == brace_arg_separator && level == 0)
commas++;
else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) &&
text[i+2] != satisfy && level == 0)
commas++;
#endif
ADVANCE_CHAR (text, tlen, i);
}
*indx = i;
return (c);
}
/* Return a new array of strings which is the result of appending each
string in ARR2 to each string in ARR1. The resultant array is
len (arr1) * len (arr2) long. For convenience, ARR1 (and its contents)
are free ()'ed. ARR1 can be NULL, in that case, a new version of ARR2
is returned. */
static char **
array_concat (arr1, arr2)
char **arr1, **arr2;
{
register int i, j, len, len1, len2;
register char **result;
if (arr1 == 0)
return (strvec_copy (arr2));
if (arr2 == 0)
return (strvec_copy (arr1));
len1 = strvec_len (arr1);
len2 = strvec_len (arr2);
result = (char **)xmalloc ((1 + (len1 * len2)) * sizeof (char *));
len = 0;
for (i = 0; i < len1; i++)
{
int strlen_1 = strlen (arr1[i]);
for (j = 0; j < len2; j++)
{
result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
strcpy (result[len], arr1[i]);
strcpy (result[len] + strlen_1, arr2[j]);
len++;
}
free (arr1[i]);
}
free (arr1);
result[len] = (char *)NULL;
return (result);
}
#if defined (TEST)
#include <stdio.h>
fatal_error (format, arg1, arg2)
char *format, *arg1, *arg2;
{
report_error (format, arg1, arg2);
exit (1);
}
report_error (format, arg1, arg2)
char *format, *arg1, *arg2;
{
fprintf (stderr, format, arg1, arg2);
fprintf (stderr, "\n");
}
main ()
{
char example[256];
for (;;)
{
char **result;
int i;
fprintf (stderr, "brace_expand> ");
if ((!fgets (example, 256, stdin)) ||
(strncmp (example, "quit", 4) == 0))
break;
if (strlen (example))
example[strlen (example) - 1] = '\0';
result = brace_expand (example);
for (i = 0; result[i]; i++)
printf ("%s\n", result[i]);
free_array (result);
}
}
/*
* Local variables:
* compile-command: "gcc -g -Bstatic -DTEST -o brace_expand braces.c general.o"
* end:
*/
#endif /* TEST */
#endif /* BRACE_EXPANSION */
+8
View File
@@ -498,6 +498,8 @@
/* Define if you have the /dev/stdin device. */
#undef HAVE_DEV_STDIN
/* The type of iconv's `inbuf' argument */
#undef ICONV_CONST
/* Type and behavior of signal handling functions. */
@@ -612,6 +614,9 @@
/* Define if you have the getwd function. */
#undef HAVE_GETWD
/* Define if you have the iconv function. */
#undef HAVE_ICONV
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
@@ -657,6 +662,9 @@
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the locale_charset function. */
#undef HAVE_LOCALE_CHARSET
/* Define if you have the mbrlen function. */
#undef HAVE_MBRLEN
+9
View File
@@ -115,6 +115,10 @@
pattern matching. */
#undef EXTENDED_GLOB
/* Define EXTGLOB_DEFAULT to the value you'd like the extglob shell option
to have by default */
#undef EXTGLOB_DEFAULT
/* Define COND_COMMAND if you want the ksh-style [[...]] conditional
command. */
#undef COND_COMMAND
@@ -494,6 +498,8 @@
/* Define if you have the /dev/stdin device. */
#undef HAVE_DEV_STDIN
/* The type of iconv's `inbuf' argument */
#undef ICONV_CONST
/* Type and behavior of signal handling functions. */
@@ -608,6 +614,9 @@
/* Define if you have the getwd function. */
#undef HAVE_GETWD
/* Define if you have the iconv function. */
#undef HAVE_ICONV
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
Vendored
+106
View File
@@ -18489,6 +18489,112 @@ _ACEOF
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
for ac_func in locale_charset
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if test `eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
fi
if test "$opt_static_link" != yes; then
+10 -1
View File
@@ -299,7 +299,9 @@ if test $opt_extended_glob = yes ; then
AC_DEFINE(EXTENDED_GLOB)
fi
if test $opt_extglob_default = yes; then
AC_DEFINE(EXTGLOB_DEFAULT)
AC_DEFINE(EXTGLOB_DEFAULT, 1)
else
AC_DEFINE(EXTGLOB_DEFAULT, 0)
fi
if test $opt_cond_command = yes ; then
AC_DEFINE(COND_COMMAND)
@@ -801,6 +803,13 @@ dnl
BASH_CHECK_MULTIBYTE
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_CHECK_FUNCS(locale_charset)
LIBS="$OLDLIBS"
fi
dnl checks for the dynamic loading library functions in libc and libdl
if test "$opt_static_link" != yes; then
AC_CHECK_LIB(dl, dlopen)
+370 -344
View File
File diff suppressed because it is too large Load Diff
+24 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Fri Aug 14 18:32:52 EDT 2009
.\" Last Change: Sat Aug 22 12:02:47 EDT 2009
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2009 August 14" "GNU Bash-4.0"
.TH BASH 1 "2009 August 22" "GNU Bash-4.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1736,6 +1736,20 @@ A sample value is
.if t \f(CW".:~:/usr"\fP.
.if n ".:~:/usr".
.TP
.B BASH_XTRACEFD
If set to an integer corresponding to a valid file descriptor, \fBbash\fP
will write the trace output generated when
.if t \f(CWset -x\fP
.if n \fIset -x\fP
is enabled to that file descriptor.
The file descriptor is closed when \fBBASH_XTRACEFD\fP is unset or assigned
a new value.
Unsetting \fBBASH_XTRACEFD\fP or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting \fPBASH_XTRACEFD\fP to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
.TP
.B COLUMNS
Used by the \fBselect\fP builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a SIGWINCH.
@@ -5036,6 +5050,14 @@ possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
.TP
.B skip\-completed\-text (Off)
If set to \fBOn\fP, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled, readline
does not insert characters from the completion that match characters
after point in the word being completed, so portions of the word
following the cursor are not duplicated.
.TP
.B visible\-stats (Off)
If set to \fBOn\fP, a character denoting a file's type as reported
by \fIstat\fP(2) is appended to the filename when listing possible
+25 -3
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Thu Jul 30 09:25:13 EDT 2009
.\" Last Change: Sat Aug 22 12:02:47 EDT 2009
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2009 July 30" "GNU Bash-4.0"
.TH BASH 1 "2009 August 22" "GNU Bash-4.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1736,6 +1736,20 @@ A sample value is
.if t \f(CW".:~:/usr"\fP.
.if n ".:~:/usr".
.TP
.B BASH_XTRACEFD
If set to an integer corresponding to a valid file descriptor, \fBbash\fP
will write the trace output generated when
.if t \f(CWset -x\fP
.if n \fIset -x\fP
is enabled to that file descriptor.
The file descriptor is closed when \fBBASH_XTRACEFD\fP is unset or assigned
a new value.
Unsetting \fBBASH_XTRACEFD\fP or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting \fPBASH_XTRACEFD\fP to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
.TP
.B COLUMNS
Used by the \fBselect\fP builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a SIGWINCH.
@@ -5036,6 +5050,14 @@ possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
.TP
.B skip\-completed\-text (Off)
If set to \fBOn\fP, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled, readline
does not insert characters from the completion that match characters
after point in the word being completed, so portions of the word
following the cursor are not duplicated.
.TP
.B visible\-stats (Off)
If set to \fBOn\fP, a character denoting a file's type as reported
by \fIstat\fP(2) is appended to the filename when listing possible
@@ -5896,7 +5918,7 @@ completion function would load completions dynamically:
\f(CW_completion_loader()
.br
{
.br
.brb
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
.br
}
+109 -5
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2009 July 30<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2009 August 17<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -555,10 +555,17 @@ or allow them to be specified.
If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the <B>-p</B> option is not supplied, no startup
files are read, shell functions are not inherited from the environment, the
<FONT SIZE=-1><B>SHELLOPTS</B>
<FONT SIZE=-1><B>SHELLOPTS</B>,
</FONT>
variable, if it appears in the environment, is ignored,
<B>BASHOPTS</B>,
<B>CDPATH</B>,
and
<B>GLOBIGNORE</B>
variables, if they appear in the environment, are ignored,
and the effective user id is set to the real user id.
If the <B>-p</B> option is supplied at invocation, the startup behavior is
the same, but the effective user id is not reset.
@@ -1695,6 +1702,34 @@ The following variables are set by the shell:
Expands to the full file name used to invoke this instance of
<B>bash</B>.
<DT><B>BASHOPTS</B>
<DD>
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the
<B>-s</B>
option to the
<B>shopt</B>
builtin command (see
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
below). The options appearing in
<FONT SIZE=-1><B>BASHOPTS</B>
</FONT>
are those reported as
<I>on</I>
by <B>shopt</B>.
If this variable is in the environment when
<B>bash</B>
starts up, each shell option in the list will be enabled before
reading any startup files.
This variable is read-only.
<DT><B>BASHPID</B>
<DD>
@@ -2204,6 +2239,21 @@ command.
A sample value is
<TT>&quot;.:~:/usr&quot;</TT>.
<DT><B>BASH_XTRACEFD</B>
<DD>
If set to an integer corresponding to a valid file descriptor, <B>bash</B>
will write the trace output generated when
<TT>set -x</TT>
is enabled to that file descriptor.
The file descriptor is closed when <B>BASH_XTRACEFD</B> is unset or assigned
a new value.
Unsetting <B>BASH_XTRACEFD</B> or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting BASH_XTRACEFD to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
<DT><B>COLUMNS</B>
<DD>
@@ -7295,6 +7345,16 @@ character. A negative count searches for previous occurrences.
<DD>
A character is read and point is moved to the previous occurrence of that
character. A negative count searches for subsequent occurrences.
<DT><B>skip-csi-sequence ()</B>
<DD>
Read enough characters to consume a multi-key sequence such as those
defined for keys like Home and End. Such sequences begin with a
Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
bound to &quot;\[&quot;, keys producing such sequences will have no effect
unless explicitly bound to a readline command, instead of inserting
stray characters into the editing buffer. This is unbound by default,
but usually bound to ESC-[.
<DT><B>insert-comment (M-#)</B>
<DD>
@@ -7379,12 +7439,17 @@ below), the programmable completion facilities are invoked.
<P>
First, the command name is identified.
If the command word is the empty string (completion attempted at the
beginning of an empty line), any compspec defined with
the <B>-E</B> option to <B>complete</B> is used.
If a compspec has been defined for that command, the
compspec is used to generate the list of possible completions for the word.
If the command word is a full pathname, a compspec for the full
pathname is searched for first.
If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches to not result in a compspec, any compspec defined with
the <B>-D</B> option to <B>complete</B> is used as the default.
<P>
Once a compspec has been found, it is used to generate the list of
@@ -7544,6 +7609,43 @@ the programmable completion functions force readline to append a slash
to completed names which are symbolic links to directories, subject to
the value of the <B>mark-directories</B> readline variable, regardless
of the setting of the <B>mark-symlinked-directories</B> readline variable.
<P>
There is some support for dynamically modifying completions. This is
most useful when used in combination with a default completion specified
with <B>complete -D</B>.
It's possible for shell functions executed as completion
handlers to indicate that completion should be retried by returning an
exit status of 124. If a shell function returns 124, and changes
the compspec associated with the command on which completion is being
attempted (supplied as the first argument when the function is executed),
programmable completion restarts from the beginning, with an
attempt to find a compspec for that command. This allows a set of
completions to be built dynamically as completion is attempted, rather than
being loaded all at once.
<P>
For instance, assuming that there is a library of compspecs, each kept in a
file corresponding to the name of the command, the following default
completion function would load completions dynamically:
<P>
<TT>_completion_loader()
<BR>
{
<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>. &quot;/etc/bash_completion.d/$1.sh&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; return 124<BR>
<BR>
}
<BR>
complete -D -F _completion_loader
<BR>
</TT>
<A NAME="lbCW">&nbsp;</A>
<H3>HISTORY</H3>
@@ -10601,6 +10703,8 @@ environment, and the
<FONT SIZE=-1><B>SHELLOPTS</B>,
</FONT>
<B>BASHOPTS</B>,
<B>CDPATH</B>,
and
@@ -12109,7 +12213,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash-4.0<TH ALIGN=CENTER width=33%>2009 July 30<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash-4.0<TH ALIGN=CENTER width=33%>2009 August 17<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -12215,6 +12319,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 03 August 2009 10:10:44 EDT
Time: 17 August 2009 14:46:46 EDT
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+5846 -5743
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -182,11 +182,11 @@
@xrdef{Interactive Shells-snt}{Section@tie 6.3}
@xrdef{What is an Interactive Shell?-title}{What is an Interactive Shell?}
@xrdef{What is an Interactive Shell?-snt}{Section@tie 6.3.1}
@xrdef{Interactive Shells-pg}{74}
@xrdef{Is this Shell Interactive?-title}{Is this Shell Interactive?}
@xrdef{Is this Shell Interactive?-snt}{Section@tie 6.3.2}
@xrdef{Interactive Shell Behavior-title}{Interactive Shell Behavior}
@xrdef{Interactive Shell Behavior-snt}{Section@tie 6.3.3}
@xrdef{Interactive Shells-pg}{75}
@xrdef{What is an Interactive Shell?-pg}{75}
@xrdef{Is this Shell Interactive?-pg}{75}
@xrdef{Interactive Shell Behavior-pg}{75}
@@ -300,7 +300,7 @@
@xrdef{Programmable Completion-pg}{112}
@xrdef{Programmable Completion Builtins-title}{Programmable Completion Builtins}
@xrdef{Programmable Completion Builtins-snt}{Section@tie 8.7}
@xrdef{Programmable Completion Builtins-pg}{113}
@xrdef{Programmable Completion Builtins-pg}{114}
@xrdef{Using History Interactively-title}{Using History Interactively}
@xrdef{Using History Interactively-snt}{Chapter@tie 9}
@xrdef{Bash History Facilities-title}{Bash History Facilities}
+2 -2
View File
@@ -52,8 +52,8 @@
\entry{wait}{89}{\code {wait}}
\entry{disown}{89}{\code {disown}}
\entry{suspend}{89}{\code {suspend}}
\entry{compgen}{113}{\code {compgen}}
\entry{compgen}{114}{\code {compgen}}
\entry{complete}{114}{\code {complete}}
\entry{compopt}{116}{\code {compopt}}
\entry{compopt}{117}{\code {compopt}}
\entry{fc}{119}{\code {fc}}
\entry{history}{120}{\code {history}}
+2 -2
View File
@@ -15,9 +15,9 @@
\entry {\code {caller}}{43}
\entry {\code {cd}}{36}
\entry {\code {command}}{43}
\entry {\code {compgen}}{113}
\entry {\code {compgen}}{114}
\entry {\code {complete}}{114}
\entry {\code {compopt}}{116}
\entry {\code {compopt}}{117}
\entry {\code {continue}}{36}
\initial {D}
\entry {\code {declare}}{43}
+3 -3
View File
@@ -75,8 +75,8 @@
\entry{login shell}{73}{login shell}
\entry{interactive shell}{73}{interactive shell}
\entry{startup files}{73}{startup files}
\entry{interactive shell}{74}{interactive shell}
\entry{shell, interactive}{74}{shell, interactive}
\entry{interactive shell}{75}{interactive shell}
\entry{shell, interactive}{75}{shell, interactive}
\entry{expressions, conditional}{76}{expressions, conditional}
\entry{arithmetic, shell}{78}{arithmetic, shell}
\entry{shell arithmetic}{78}{shell arithmetic}
@@ -104,7 +104,7 @@
\entry{initialization file, readline}{94}{initialization file, readline}
\entry{variables, readline}{95}{variables, readline}
\entry{programmable completion}{112}{programmable completion}
\entry{completion builtins}{113}{completion builtins}
\entry{completion builtins}{114}{completion builtins}
\entry{History, how to use}{117}{History, how to use}
\entry{command history}{119}{command history}
\entry{history list}{119}{history list}
+3 -3
View File
@@ -28,7 +28,7 @@
\entry {commands, shell}{7}
\entry {commands, simple}{8}
\entry {comments, shell}{7}
\entry {completion builtins}{113}
\entry {completion builtins}{114}
\entry {configuration}{125}
\entry {control operator}{3}
\entry {coprocess}{13}
@@ -67,7 +67,7 @@
\entry {initialization file, readline}{94}
\entry {installation}{125}
\entry {interaction, readline}{91}
\entry {interactive shell}{73, 74}
\entry {interactive shell}{73, 75}
\entry {internationalization}{7}
\initial {J}
\entry {job}{3}
@@ -116,7 +116,7 @@
\entry {shell function}{14}
\entry {shell script}{33}
\entry {shell variable}{15}
\entry {shell, interactive}{74}
\entry {shell, interactive}{75}
\entry {signal}{4}
\entry {signal handling}{32}
\entry {special builtin}{4, 59}
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -84,11 +84,12 @@
\entry{exchange-point-and-mark (C-x C-x)}{110}{\code {exchange-point-and-mark (C-x C-x)}}
\entry{character-search (C-])}{110}{\code {character-search (C-])}}
\entry{character-search-backward (M-C-])}{110}{\code {character-search-backward (M-C-])}}
\entry{skip-csi-sequence ()}{110}{\code {skip-csi-sequence ()}}
\entry{insert-comment (M-#)}{110}{\code {insert-comment (M-#)}}
\entry{dump-functions ()}{110}{\code {dump-functions ()}}
\entry{dump-variables ()}{110}{\code {dump-variables ()}}
\entry{dump-macros ()}{110}{\code {dump-macros ()}}
\entry{glob-complete-word (M-g)}{110}{\code {glob-complete-word (M-g)}}
\entry{glob-complete-word (M-g)}{111}{\code {glob-complete-word (M-g)}}
\entry{glob-expand-word (C-x *)}{111}{\code {glob-expand-word (C-x *)}}
\entry{glob-list-expansions (C-x g)}{111}{\code {glob-list-expansions (C-x g)}}
\entry{display-shell-version (C-x C-v)}{111}{\code {display-shell-version (C-x C-v)}}
+2 -1
View File
@@ -52,7 +52,7 @@
\entry {\code {forward-search-history (C-s)}}{104}
\entry {\code {forward-word (M-f)}}{103}
\initial {G}
\entry {\code {glob-complete-word (M-g)}}{110}
\entry {\code {glob-complete-word (M-g)}}{111}
\entry {\code {glob-expand-word (C-x *)}}{111}
\entry {\code {glob-list-expansions (C-x g)}}{111}
\initial {H}
@@ -103,6 +103,7 @@
\entry {\code {shell-expand-line (M-C-e)}}{111}
\entry {\code {shell-forward-word ()}}{103}
\entry {\code {shell-kill-word ()}}{106}
\entry {\code {skip-csi-sequence ()}}{110}
\entry {\code {start-kbd-macro (C-x ()}}{109}
\initial {T}
\entry {\code {tilde-expand (M-&)}}{110}
+918 -830
View File
File diff suppressed because it is too large Load Diff
+296 -230
View File
@@ -2,9 +2,9 @@ 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.0, 17 June 2009).
the Bash shell (version 4.0, 17 August 2009).
This is Edition 4.0, last updated 17 June 2009, of `The GNU Bash
This is Edition 4.0, last updated 17 August 2009, of `The GNU Bash
Reference Manual', for `Bash', Version 4.0.
Copyright (C) 1988-2009 Free Software Foundation, Inc.
@@ -38,9 +38,9 @@ Bash Features
*************
This text is a brief description of the features that are present in
the Bash shell (version 4.0, 17 June 2009).
the Bash shell (version 4.0, 17 August 2009).
This is Edition 4.0, last updated 17 June 2009, of `The GNU Bash
This is Edition 4.0, last updated 17 August 2009, of `The GNU Bash
Reference Manual', for `Bash', Version 4.0.
Bash contains features that appear in other popular shells, and some
@@ -3575,16 +3575,16 @@ parameters, or to display the names and values of shell variables.
`-p'
Turn on privileged mode. In this mode, the `$BASH_ENV' and
`$ENV' files are not processed, shell functions are not
inherited from the environment, and the `SHELLOPTS', `CDPATH'
and `GLOBIGNORE' variables, if they appear in the
environment, are ignored. If the shell is started with the
effective user (group) id not equal to the real user (group)
id, and the `-p' option is not supplied, these actions are
taken and the effective user id is set to the real user id.
If the `-p' option is supplied at startup, the effective user
id is not reset. Turning this option off causes the
effective user and group ids to be set to the real user and
group ids.
inherited from the environment, and the `SHELLOPTS',
`BASHOPTS', `CDPATH' and `GLOBIGNORE' variables, if they
appear in the environment, are ignored. If the shell is
started with the effective user (group) id not equal to the
real user (group) id, and the `-p' option is not supplied,
these actions are taken and the effective user id is set to
the real user id. If the `-p' option is supplied at startup,
the effective user id is not reset. Turning this option off
causes the effective user and group ids to be set to the real
user and group ids.
`-t'
Exit after reading and executing one command.
@@ -4059,6 +4059,15 @@ Variables::).
`BASH'
The full pathname used to execute the current instance of Bash.
`BASHOPTS'
A colon-separated list of enabled shell options. Each word in the
list is a valid argument for the `-s' option to the `shopt'
builtin command (*note The Shopt Builtin::). The options
appearing in `BASHOPTS' are those reported as `on' by `shopt'. If
this variable is in the environment when Bash starts up, each
shell option in the list will be enabled before reading any
startup files. This variable is readonly.
`BASHPID'
Expands to the process id of the current Bash process. This
differs from `$$' under certain circumstances, such as subshells
@@ -4164,6 +4173,17 @@ Variables::).
`BASH_VERSION'
The version number of the current instance of Bash.
`BASH_XTRACEFD'
If set to an integer corresponding to a valid file descriptor, Bash
will write the trace output generated when `set -x' is enabled to
that file descriptor. This allows tracing output to be separated
from diagnostic and error messages. The file descriptor is closed
when `BASH_XTRACEFD' is unset or assigned a new value. Unsetting
`BASH_XTRACEFD' or assigning it the empty string causes the trace
output to be sent to the standard error. Note that setting
`BASH_XTRACEFD' to 2 (the standard error file descriptor) and then
unsetting it will result in the standard error being closed.
`COLUMNS'
Used by the `select' builtin command to determine the terminal
width when printing selection lists. Automatically set upon
@@ -4849,10 +4869,11 @@ Invoked with unequal effective and real UID/GIDs
If Bash is started with the effective user (group) id not equal to the
real user (group) id, and the `-p' option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the `SHELLOPTS' variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id. If the `-p'
option is supplied at invocation, the startup behavior is the same, but
the effective user id is not reset.
the `SHELLOPTS', `BASHOPTS', `CDPATH', and `GLOBIGNORE' variables, if
they appear in the environment, are ignored, and the effective user id
is set to the real user id. If the `-p' option is supplied at
invocation, the startup behavior is the same, but the effective user id
is not reset.

File: bashref.info, Node: Interactive Shells, Next: Bash Conditional Expressions, Prev: Bash Startup Files, Up: Bash Features
@@ -7327,6 +7348,15 @@ File: bashref.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up:
of that character. A negative count searches for subsequent
occurrences.
`skip-csi-sequence ()'
Read enough characters to consume a multi-key sequence such as
those defined for keys like Home and End. Such sequences begin
with a Control Sequence Indicator (CSI), usually ESC-[. If this
sequence is bound to "\e[", keys producing such sequences will
have no effect unless explicitly bound to a readline command,
instead of inserting stray characters into the editing buffer.
This is unbound by default, but usually bound to ESC-[.
`insert-comment (M-#)'
Without a numeric argument, the value of the `comment-begin'
variable is inserted at the beginning of the current line. If a
@@ -7445,10 +7475,14 @@ programmable completion facilities are invoked.
First, the command name is identified. If a compspec has been
defined for that command, the compspec is used to generate the list of
possible completions for the word. If the command word is a full
pathname, a compspec for the full pathname is searched for first. If
no compspec is found for the full pathname, an attempt is made to find
a compspec for the portion following the final slash.
possible completions for the word. If the command word is the empty
string (completion attempted at the beginning of an empty line), any
compspec defined with the `-E' option to `complete' is used. If the
command word is a full pathname, a compspec for the full pathname is
searched for first. If no compspec is found for the full pathname, an
attempt is made to find a compspec for the portion following the final
slash. If those searches do not result in a compspec, any compspec
defined with the `-D' option to `complete' is used as the default.
Once a compspec has been found, it is used to generate the list of
matching words. If a compspec is not found, the default Bash completion
@@ -7539,6 +7573,28 @@ to completed names which are symbolic links to directories, subject to
the value of the MARK-DIRECTORIES Readline variable, regardless of the
setting of the MARK-SYMLINKED-DIRECTORIES Readline variable.
There is some support for dynamically modifying completions. This is
most useful when used in combination with a default completion specified
with `-D'. It's possible for shell functions executed as completion
handlers to indicate that completion should be retried by returning an
exit status of 124. If a shell function returns 124, and changes the
compspec associated with the command on which completion is being
attempted (supplied as the first argument when the function is
executed), programmable completion restarts from the beginning, with an
attempt to find a compspec for that command. This allows a set of
completions to be built dynamically as completion is attempted, rather
than being loaded all at once.
For instance, assuming that there is a library of compspecs, each
kept in a file corresponding to the name of the command, the following
default completion function would load completions dynamically:
_completion_loader()
{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
}
complete -D -F _completion_loader

File: bashref.info, Node: Programmable Completion Builtins, Prev: Programmable Completion, Up: Command Line Editing
@@ -7587,7 +7643,7 @@ completion facilities.
The process of applying these completion specifications when word
completion is attempted is described above (*note Programmable
Completion::).
Completion::). The `-D' option takes precedence over `-E'.
Other options, if specified, have the following meanings. The
arguments to the `-G', `-W', and `-X' options (and, if necessary,
@@ -7769,6 +7825,8 @@ completion facilities.
"empty" command completion; that is, completion attempted on a
blank line.
The `-D' option takes precedence over `-E'.
The return value is true unless an invalid option is supplied, an
attempt is made to modify the options for a NAME for which no
completion specification exists, or an output error occurs.
@@ -8529,6 +8587,10 @@ does not provide the necessary support.
Include support for the extended pattern matching features
described above under *note Pattern Matching::.
`--enable-extended-glob-default'
Set the default value of the EXTGLOB shell option described above
under *note The Shopt Builtin:: to be enabled.
`--enable-help-builtin'
Include the `help' builtin, which displays help on shell builtins
and variables (*note Bash Builtins::).
@@ -9678,101 +9740,103 @@ D.3 Parameter and Variable Index
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 13)
* BASH_ALIASES: Bash Variables. (line 21)
* BASH_ARGC: Bash Variables. (line 28)
* BASH_ARGV: Bash Variables. (line 38)
* BASH_CMDS: Bash Variables. (line 48)
* BASH_COMMAND: Bash Variables. (line 55)
* BASH_ENV: Bash Variables. (line 60)
* BASH_EXECUTION_STRING: Bash Variables. (line 66)
* BASH_LINENO: Bash Variables. (line 69)
* BASH_REMATCH: Bash Variables. (line 78)
* BASH_SOURCE: Bash Variables. (line 86)
* BASH_SUBSHELL: Bash Variables. (line 90)
* BASH_VERSINFO: Bash Variables. (line 94)
* BASH_VERSION: Bash Variables. (line 118)
* BASHPID: Bash Variables. (line 16)
* BASH_ALIASES: Bash Variables. (line 30)
* BASH_ARGC: Bash Variables. (line 37)
* BASH_ARGV: Bash Variables. (line 47)
* BASH_CMDS: Bash Variables. (line 57)
* BASH_COMMAND: Bash Variables. (line 64)
* 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)
* BASHOPTS: Bash Variables. (line 16)
* BASHPID: Bash Variables. (line 25)
* bell-style: Readline Init File Syntax.
(line 38)
* bind-tty-special-chars: Readline Init File Syntax.
(line 45)
* CDPATH: Bourne Shell Variables.
(line 9)
* COLUMNS: Bash Variables. (line 121)
* COLUMNS: Bash Variables. (line 141)
* comment-begin: Readline Init File Syntax.
(line 50)
* COMP_CWORD: Bash Variables. (line 126)
* COMP_KEY: Bash Variables. (line 155)
* COMP_LINE: Bash Variables. (line 132)
* COMP_POINT: Bash Variables. (line 137)
* COMP_TYPE: Bash Variables. (line 145)
* COMP_WORDBREAKS: Bash Variables. (line 159)
* COMP_WORDS: Bash Variables. (line 165)
* 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)
* completion-prefix-display-length: Readline Init File Syntax.
(line 60)
* completion-query-items: Readline Init File Syntax.
(line 67)
* COMPREPLY: Bash Variables. (line 173)
* COMPREPLY: Bash Variables. (line 193)
* convert-meta: Readline Init File Syntax.
(line 77)
* DIRSTACK: Bash Variables. (line 178)
* DIRSTACK: Bash Variables. (line 198)
* disable-completion: Readline Init File Syntax.
(line 83)
* editing-mode: Readline Init File Syntax.
(line 88)
* EMACS: Bash Variables. (line 188)
* EMACS: Bash Variables. (line 208)
* enable-keypad: Readline Init File Syntax.
(line 94)
* EUID: Bash Variables. (line 193)
* EUID: Bash Variables. (line 213)
* expand-tilde: Readline Init File Syntax.
(line 99)
* FCEDIT: Bash Variables. (line 197)
* FIGNORE: Bash Variables. (line 201)
* FUNCNAME: Bash Variables. (line 207)
* GLOBIGNORE: Bash Variables. (line 216)
* GROUPS: Bash Variables. (line 222)
* histchars: Bash Variables. (line 228)
* HISTCMD: Bash Variables. (line 243)
* HISTCONTROL: Bash Variables. (line 248)
* HISTFILE: Bash Variables. (line 264)
* HISTFILESIZE: Bash Variables. (line 268)
* HISTIGNORE: Bash Variables. (line 276)
* FCEDIT: Bash Variables. (line 217)
* FIGNORE: Bash Variables. (line 221)
* FUNCNAME: Bash Variables. (line 227)
* GLOBIGNORE: Bash Variables. (line 236)
* GROUPS: Bash Variables. (line 242)
* histchars: Bash Variables. (line 248)
* HISTCMD: Bash Variables. (line 263)
* HISTCONTROL: Bash Variables. (line 268)
* HISTFILE: Bash Variables. (line 284)
* HISTFILESIZE: Bash Variables. (line 288)
* HISTIGNORE: Bash Variables. (line 296)
* history-preserve-point: Readline Init File Syntax.
(line 103)
* history-size: Readline Init File Syntax.
(line 109)
* HISTSIZE: Bash Variables. (line 295)
* HISTTIMEFORMAT: Bash Variables. (line 299)
* HISTSIZE: Bash Variables. (line 315)
* HISTTIMEFORMAT: Bash Variables. (line 319)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 114)
* HOSTFILE: Bash Variables. (line 308)
* HOSTNAME: Bash Variables. (line 319)
* HOSTTYPE: Bash Variables. (line 322)
* HOSTFILE: Bash Variables. (line 328)
* HOSTNAME: Bash Variables. (line 339)
* HOSTTYPE: Bash Variables. (line 342)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 325)
* IGNOREEOF: Bash Variables. (line 345)
* input-meta: Readline Init File Syntax.
(line 121)
* INPUTRC: Bash Variables. (line 335)
* INPUTRC: Bash Variables. (line 355)
* isearch-terminators: Readline Init File Syntax.
(line 128)
* keymap: Readline Init File Syntax.
(line 135)
* LANG: Bash Variables. (line 339)
* LC_ALL: Bash Variables. (line 343)
* LC_COLLATE: Bash Variables. (line 347)
* LC_CTYPE: Bash Variables. (line 354)
* LANG: Bash Variables. (line 359)
* LC_ALL: Bash Variables. (line 363)
* LC_COLLATE: Bash Variables. (line 367)
* LC_CTYPE: Bash Variables. (line 374)
* LC_MESSAGES <1>: Locale Translation. (line 11)
* LC_MESSAGES: Bash Variables. (line 359)
* LC_NUMERIC: Bash Variables. (line 363)
* LINENO: Bash Variables. (line 367)
* LINES: Bash Variables. (line 371)
* MACHTYPE: Bash Variables. (line 376)
* LC_MESSAGES: Bash Variables. (line 379)
* LC_NUMERIC: Bash Variables. (line 383)
* LINENO: Bash Variables. (line 387)
* LINES: Bash Variables. (line 391)
* MACHTYPE: Bash Variables. (line 396)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 380)
* MAILCHECK: Bash Variables. (line 400)
* MAILPATH: Bourne Shell Variables.
(line 27)
* mark-modified-lines: Readline Init File Syntax.
@@ -9783,49 +9847,49 @@ D.3 Parameter and Variable Index
(line 158)
* meta-flag: Readline Init File Syntax.
(line 121)
* OLDPWD: Bash Variables. (line 388)
* OLDPWD: Bash Variables. (line 408)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 391)
* OPTERR: Bash Variables. (line 411)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 395)
* OSTYPE: Bash Variables. (line 415)
* output-meta: Readline Init File Syntax.
(line 165)
* page-completions: Readline Init File Syntax.
(line 170)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 398)
* POSIXLY_CORRECT: Bash Variables. (line 403)
* PPID: Bash Variables. (line 412)
* PROMPT_COMMAND: Bash Variables. (line 416)
* PROMPT_DIRTRIM: Bash Variables. (line 420)
* PIPESTATUS: Bash Variables. (line 418)
* POSIXLY_CORRECT: Bash Variables. (line 423)
* PPID: Bash Variables. (line 432)
* PROMPT_COMMAND: Bash Variables. (line 436)
* PROMPT_DIRTRIM: Bash Variables. (line 440)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 426)
* PS4: Bash Variables. (line 431)
* PWD: Bash Variables. (line 437)
* RANDOM: Bash Variables. (line 440)
* REPLY: Bash Variables. (line 445)
* PS3: Bash Variables. (line 446)
* PS4: Bash Variables. (line 451)
* PWD: Bash Variables. (line 457)
* RANDOM: Bash Variables. (line 460)
* REPLY: Bash Variables. (line 465)
* revert-all-at-newline: Readline Init File Syntax.
(line 180)
* SECONDS: Bash Variables. (line 448)
* SHELL: Bash Variables. (line 454)
* SHELLOPTS: Bash Variables. (line 459)
* SHLVL: Bash Variables. (line 468)
* SECONDS: Bash Variables. (line 468)
* SHELL: Bash Variables. (line 474)
* SHELLOPTS: Bash Variables. (line 479)
* SHLVL: Bash Variables. (line 488)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 186)
* show-all-if-unmodified: Readline Init File Syntax.
(line 192)
* TEXTDOMAIN: Locale Translation. (line 11)
* TEXTDOMAINDIR: Locale Translation. (line 11)
* TIMEFORMAT: Bash Variables. (line 473)
* TMOUT: Bash Variables. (line 511)
* TMPDIR: Bash Variables. (line 523)
* UID: Bash Variables. (line 527)
* TIMEFORMAT: Bash Variables. (line 493)
* TMOUT: Bash Variables. (line 531)
* TMPDIR: Bash Variables. (line 543)
* UID: Bash Variables. (line 547)
* visible-stats: Readline Init File Syntax.
(line 201)
@@ -9869,11 +9933,11 @@ D.4 Function Index
(line 14)
* downcase-word (M-l): Commands For Text. (line 42)
* dump-functions (): Miscellaneous Commands.
(line 64)
(line 73)
* dump-macros (): Miscellaneous Commands.
(line 76)
(line 85)
* dump-variables (): Miscellaneous Commands.
(line 70)
(line 79)
* end-kbd-macro (C-x )): Keyboard Macros. (line 9)
* end-of-history (M->): Commands For History. (line 23)
* end-of-line (C-e): Commands For Moving. (line 9)
@@ -9886,7 +9950,7 @@ D.4 Function Index
* history-search-backward (): Commands For History. (line 51)
* history-search-forward (): Commands For History. (line 46)
* insert-comment (M-#): Miscellaneous Commands.
(line 51)
(line 60)
* insert-completions (M-*): Commands For Completion.
(line 18)
* kill-line (C-k): Commands For Killing. (line 6)
@@ -9918,6 +9982,8 @@ D.4 Function Index
* self-insert (a, b, A, 1, !, ...): Commands For Text. (line 24)
* set-mark (C-@): Miscellaneous Commands.
(line 32)
* skip-csi-sequence (): Miscellaneous Commands.
(line 51)
* start-kbd-macro (C-x (): Keyboard Macros. (line 6)
* transpose-chars (C-t): Commands For Text. (line 27)
* transpose-words (M-t): Commands For Text. (line 33)
@@ -10017,7 +10083,7 @@ D.5 Concept Index
* history list: Bash History Facilities.
(line 6)
* History, how to use: Programmable Completion Builtins.
(line 235)
(line 237)
* identifier: Definitions. (line 51)
* initialization file, readline: Readline Init File. (line 6)
* installation: Basic Installation. (line 6)
@@ -10094,132 +10160,132 @@ D.5 Concept Index

Tag Table:
Node: Top1338
Node: Introduction3169
Node: What is Bash?3397
Node: What is a shell?4510
Node: Definitions7050
Node: Basic Shell Features9968
Node: Shell Syntax11187
Node: Shell Operation12217
Node: Quoting13511
Node: Escape Character14814
Node: Single Quotes15299
Node: Double Quotes15647
Node: ANSI-C Quoting16772
Node: Locale Translation17728
Node: Comments18624
Node: Shell Commands19242
Node: Simple Commands20066
Node: Pipelines20697
Node: Lists22953
Node: Compound Commands24682
Node: Looping Constructs25486
Node: Conditional Constructs27941
Node: Command Grouping35947
Node: Coprocesses37426
Node: Shell Functions39070
Node: Shell Parameters43624
Node: Positional Parameters46040
Node: Special Parameters46940
Node: Shell Expansions49904
Node: Brace Expansion51829
Node: Tilde Expansion54584
Node: Shell Parameter Expansion56935
Node: Command Substitution65833
Node: Arithmetic Expansion67166
Node: Process Substitution68016
Node: Word Splitting69066
Node: Filename Expansion70689
Node: Pattern Matching72828
Node: Quote Removal76467
Node: Redirections76762
Node: Executing Commands84910
Node: Simple Command Expansion85580
Node: Command Search and Execution87510
Node: Command Execution Environment89847
Node: Environment92833
Node: Exit Status94493
Node: Signals96114
Node: Shell Scripts98082
Node: Shell Builtin Commands100600
Node: Bourne Shell Builtins102628
Node: Bash Builtins120004
Node: Modifying Shell Behavior144303
Node: The Set Builtin144648
Node: The Shopt Builtin154160
Node: Special Builtins165022
Node: Shell Variables166001
Node: Bourne Shell Variables166441
Node: Bash Variables168422
Node: Bash Features190795
Node: Invoking Bash191678
Node: Bash Startup Files197487
Node: Interactive Shells202456
Node: What is an Interactive Shell?202866
Node: Is this Shell Interactive?203515
Node: Interactive Shell Behavior204330
Node: Bash Conditional Expressions207610
Node: Shell Arithmetic211135
Node: Aliases213881
Node: Arrays216453
Node: The Directory Stack220411
Node: Directory Stack Builtins221125
Node: Printing a Prompt224017
Node: The Restricted Shell226769
Node: Bash POSIX Mode228601
Node: Job Control236454
Node: Job Control Basics236914
Node: Job Control Builtins241631
Node: Job Control Variables245995
Node: Command Line Editing247153
Node: Introduction and Notation248720
Node: Readline Interaction250342
Node: Readline Bare Essentials251533
Node: Readline Movement Commands253322
Node: Readline Killing Commands254287
Node: Readline Arguments256207
Node: Searching257251
Node: Readline Init File259437
Node: Readline Init File Syntax260584
Node: Conditional Init Constructs273818
Node: Sample Init File276351
Node: Bindable Readline Commands279468
Node: Commands For Moving280675
Node: Commands For History281819
Node: Commands For Text284974
Node: Commands For Killing287647
Node: Numeric Arguments290098
Node: Commands For Completion291237
Node: Keyboard Macros295197
Node: Miscellaneous Commands295768
Node: Readline vi Mode301079
Node: Programmable Completion301993
Node: Programmable Completion Builtins307826
Node: Using History Interactively316867
Node: Bash History Facilities317551
Node: Bash History Builtins320465
Node: History Interaction324322
Node: Event Designators327027
Node: Word Designators328042
Node: Modifiers329681
Node: Installing Bash331085
Node: Basic Installation332222
Node: Compilers and Options334914
Node: Compiling For Multiple Architectures335655
Node: Installation Names337319
Node: Specifying the System Type338137
Node: Sharing Defaults338853
Node: Operation Controls339526
Node: Optional Features340484
Node: Reporting Bugs349886
Node: Major Differences From The Bourne Shell351087
Node: GNU Free Documentation License367774
Node: Indexes392970
Node: Builtin Index393424
Node: Reserved Word Index400251
Node: Variable Index402699
Node: Function Index414505
Node: Concept Index421376
Node: Top1342
Node: Introduction3177
Node: What is Bash?3405
Node: What is a shell?4518
Node: Definitions7058
Node: Basic Shell Features9976
Node: Shell Syntax11195
Node: Shell Operation12225
Node: Quoting13519
Node: Escape Character14822
Node: Single Quotes15307
Node: Double Quotes15655
Node: ANSI-C Quoting16780
Node: Locale Translation17736
Node: Comments18632
Node: Shell Commands19250
Node: Simple Commands20074
Node: Pipelines20705
Node: Lists22961
Node: Compound Commands24690
Node: Looping Constructs25494
Node: Conditional Constructs27949
Node: Command Grouping35955
Node: Coprocesses37434
Node: Shell Functions39078
Node: Shell Parameters43632
Node: Positional Parameters46048
Node: Special Parameters46948
Node: Shell Expansions49912
Node: Brace Expansion51837
Node: Tilde Expansion54592
Node: Shell Parameter Expansion56943
Node: Command Substitution65841
Node: Arithmetic Expansion67174
Node: Process Substitution68024
Node: Word Splitting69074
Node: Filename Expansion70697
Node: Pattern Matching72836
Node: Quote Removal76475
Node: Redirections76770
Node: Executing Commands84918
Node: Simple Command Expansion85588
Node: Command Search and Execution87518
Node: Command Execution Environment89855
Node: Environment92841
Node: Exit Status94501
Node: Signals96122
Node: Shell Scripts98090
Node: Shell Builtin Commands100608
Node: Bourne Shell Builtins102636
Node: Bash Builtins120012
Node: Modifying Shell Behavior144311
Node: The Set Builtin144656
Node: The Shopt Builtin154180
Node: Special Builtins165042
Node: Shell Variables166021
Node: Bourne Shell Variables166461
Node: Bash Variables168442
Node: Bash Features191928
Node: Invoking Bash192811
Node: Bash Startup Files198620
Node: Interactive Shells203632
Node: What is an Interactive Shell?204042
Node: Is this Shell Interactive?204691
Node: Interactive Shell Behavior205506
Node: Bash Conditional Expressions208786
Node: Shell Arithmetic212311
Node: Aliases215057
Node: Arrays217629
Node: The Directory Stack221587
Node: Directory Stack Builtins222301
Node: Printing a Prompt225193
Node: The Restricted Shell227945
Node: Bash POSIX Mode229777
Node: Job Control237630
Node: Job Control Basics238090
Node: Job Control Builtins242807
Node: Job Control Variables247171
Node: Command Line Editing248329
Node: Introduction and Notation249896
Node: Readline Interaction251518
Node: Readline Bare Essentials252709
Node: Readline Movement Commands254498
Node: Readline Killing Commands255463
Node: Readline Arguments257383
Node: Searching258427
Node: Readline Init File260613
Node: Readline Init File Syntax261760
Node: Conditional Init Constructs274994
Node: Sample Init File277527
Node: Bindable Readline Commands280644
Node: Commands For Moving281851
Node: Commands For History282995
Node: Commands For Text286150
Node: Commands For Killing288823
Node: Numeric Arguments291274
Node: Commands For Completion292413
Node: Keyboard Macros296373
Node: Miscellaneous Commands296944
Node: Readline vi Mode302750
Node: Programmable Completion303664
Node: Programmable Completion Builtins310870
Node: Using History Interactively320006
Node: Bash History Facilities320690
Node: Bash History Builtins323604
Node: History Interaction327461
Node: Event Designators330166
Node: Word Designators331181
Node: Modifiers332820
Node: Installing Bash334224
Node: Basic Installation335361
Node: Compilers and Options338053
Node: Compiling For Multiple Architectures338794
Node: Installation Names340458
Node: Specifying the System Type341276
Node: Sharing Defaults341992
Node: Operation Controls342665
Node: Optional Features343623
Node: Reporting Bugs353182
Node: Major Differences From The Bourne Shell354383
Node: GNU Free Documentation License371070
Node: Indexes396266
Node: Builtin Index396720
Node: Reserved Word Index403547
Node: Variable Index405995
Node: Function Index417947
Node: Concept Index424956

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) 3 AUG 2009 10:10
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 17 AUG 2009 14:46
**/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]:
@@ -236,8 +236,8 @@ Underfull \hbox (badness 2573) in paragraph at lines 4390--4394
.etc.
[56] [57] [58] Chapter 5 [59] [60] [61] [62] [63] [64] [65] [66] [67] [68]
Chapter 6 [69] [70]
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5234--5234
[69] Chapter 6 [70]
Overfull \hbox (51.96864pt too wide) in paragraph at lines 5258--5258
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -250,7 +250,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5235--5235
Overfull \hbox (76.23077pt too wide) in paragraph at lines 5259--5259
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
@@ -264,7 +264,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 5235--5235
.etc.
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5236--5236
Overfull \hbox (34.72258pt too wide) in paragraph at lines 5260--5260
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -277,7 +277,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
[71] [72]
Underfull \hbox (badness 2245) in paragraph at lines 5410--5412
Underfull \hbox (badness 2245) in paragraph at lines 5434--5436
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
the file
@@ -290,7 +290,7 @@ the file
.etc.
[73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85]
Underfull \hbox (badness 2521) in paragraph at lines 6548--6551
Underfull \hbox (badness 2521) in paragraph at lines 6573--6576
@textrm `@texttt --enable-strict-posix-default[]@textrm '[] to @texttt configur
e[] @textrm when build-ing (see Sec-tion 10.8
@@ -332,7 +332,7 @@ gnored[]
[101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112]
[113]
Overfull \hbox (12.05716pt too wide) in paragraph at lines 1726--1726
Overfull \hbox (12.05716pt too wide) in paragraph at lines 1764--1764
[]@texttt complete [-abcdefgjksuv] [-o @textttsl comp-option@texttt ] [-DE] [-
A @textttsl ac-tion@texttt ] [-
@@ -344,8 +344,8 @@ A @textttsl ac-tion@texttt ] [-
.@texttt m
.etc.
[114]
Underfull \hbox (badness 2753) in paragraph at lines 1835--1838
[114] [115]
Underfull \hbox (badness 2753) in paragraph at lines 1874--1877
@texttt hostname[]@textrm Hostnames, as taken from the file spec-i-fied by
@hbox(7.60416+2.12917)x433.62, glue set 3.02202
@@ -356,10 +356,10 @@ Underfull \hbox (badness 2753) in paragraph at lines 1835--1838
.@texttt o
.etc.
[115] [116]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[116]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[117] [118] [119] [120] [121] [122]) Chapter 10 [123] [124] [125] [126]
[127]
Underfull \hbox (badness 2772) in paragraph at lines 7149--7153
Underfull \hbox (badness 2772) in paragraph at lines 7174--7178
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
@@ -379,10 +379,10 @@ s/large_
Here is how much of TeX's memory you used:
2078 strings out of 97980
28503 string characters out of 1221004
64631 words of memory out of 1500000
64668 words of memory out of 1500000
2894 multiletter control sequences out of 10000+50000
32127 words of font info for 112 fonts, out of 1200000 for 2000
51 hyphenation exceptions out of 8191
16i,6n,14p,315b,699s stack positions out of 5000i,500n,6000p,200000b,5000s
Output written on bashref.dvi (162 pages, 654776 bytes).
Output written on bashref.dvi (162 pages, 659752 bytes).
BIN
View File
Binary file not shown.
+1674 -1575
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -4772,6 +4772,20 @@ The value of @env{MACHTYPE}.
@item BASH_VERSION
The version number of the current instance of Bash.
@item BASH_XTRACEFD
If set to an integer corresponding to a valid file descriptor, Bash
will write the trace output generated when @samp{set -x}
is enabled to that file descriptor.
This allows tracing output to be separated from diagnostic and error
messages.
The file descriptor is closed when @code{BASH_XTRACEFD} is unset or assigned
a new value.
Unsetting @code{BASH_XTRACEFD} or assigning it the empty string causes the
trace output to be sent to the standard error.
Note that setting @code{BASH_XTRACEFD} to 2 (the standard error file
descriptor) and then unsetting it will result in the standard error
being closed.
@item COLUMNS
Used by the @code{select} builtin command to determine the terminal width
when printing selection lists. Automatically set upon receipt of a
+2 -2
View File
@@ -68,7 +68,7 @@
@numchapentry{Bash Features}{6}{Bash Features}{71}
@numsecentry{Invoking Bash}{6.1}{Invoking Bash}{71}
@numsecentry{Bash Startup Files}{6.2}{Bash Startup Files}{73}
@numsecentry{Interactive Shells}{6.3}{Interactive Shells}{74}
@numsecentry{Interactive Shells}{6.3}{Interactive Shells}{75}
@numsubsecentry{What is an Interactive Shell?}{6.3.1}{What is an Interactive Shell?}{75}
@numsubsecentry{Is this Shell Interactive?}{6.3.2}{Is this Shell Interactive?}{75}
@numsubsecentry{Interactive Shell Behavior}{6.3.3}{Interactive Shell Behavior}{75}
@@ -108,7 +108,7 @@
@numsubsecentry{Some Miscellaneous Commands}{8.4.8}{Miscellaneous Commands}{109}
@numsecentry{Readline vi Mode}{8.5}{Readline vi Mode}{111}
@numsecentry{Programmable Completion}{8.6}{Programmable Completion}{112}
@numsecentry{Programmable Completion Builtins}{8.7}{Programmable Completion Builtins}{113}
@numsecentry{Programmable Completion Builtins}{8.7}{Programmable Completion Builtins}{114}
@numchapentry{Using History Interactively}{9}{Using History Interactively}{119}
@numsecentry{Bash History Facilities}{9.1}{Bash History Facilities}{119}
@numsecentry{Bash History Builtins}{9.2}{Bash History Builtins}{119}
+22 -20
View File
@@ -21,6 +21,7 @@
\entry{PS1}{61}{\code {PS1}}
\entry{PS2}{61}{\code {PS2}}
\entry{BASH}{61}{\code {BASH}}
\entry{BASHOPTS}{62}{\code {BASHOPTS}}
\entry{BASHPID}{62}{\code {BASHPID}}
\entry{BASH_ALIASES}{62}{\code {BASH_ALIASES}}
\entry{BASH_ARGC}{62}{\code {BASH_ARGC}}
@@ -29,23 +30,24 @@
\entry{BASH_COMMAND}{62}{\code {BASH_COMMAND}}
\entry{BASH_ENV}{62}{\code {BASH_ENV}}
\entry{BASH_EXECUTION_STRING}{62}{\code {BASH_EXECUTION_STRING}}
\entry{BASH_LINENO}{62}{\code {BASH_LINENO}}
\entry{BASH_LINENO}{63}{\code {BASH_LINENO}}
\entry{BASH_REMATCH}{63}{\code {BASH_REMATCH}}
\entry{BASH_SOURCE}{63}{\code {BASH_SOURCE}}
\entry{BASH_SUBSHELL}{63}{\code {BASH_SUBSHELL}}
\entry{BASH_VERSINFO}{63}{\code {BASH_VERSINFO}}
\entry{BASH_VERSION}{63}{\code {BASH_VERSION}}
\entry{COLUMNS}{63}{\code {COLUMNS}}
\entry{COMP_CWORD}{63}{\code {COMP_CWORD}}
\entry{BASH_XTRACEFD}{63}{\code {BASH_XTRACEFD}}
\entry{COLUMNS}{64}{\code {COLUMNS}}
\entry{COMP_CWORD}{64}{\code {COMP_CWORD}}
\entry{COMP_LINE}{64}{\code {COMP_LINE}}
\entry{COMP_POINT}{64}{\code {COMP_POINT}}
\entry{COMP_TYPE}{64}{\code {COMP_TYPE}}
\entry{COMP_KEY}{64}{\code {COMP_KEY}}
\entry{COMP_WORDBREAKS}{64}{\code {COMP_WORDBREAKS}}
\entry{COMP_WORDS}{64}{\code {COMP_WORDS}}
\entry{COMPREPLY}{64}{\code {COMPREPLY}}
\entry{DIRSTACK}{64}{\code {DIRSTACK}}
\entry{EMACS}{64}{\code {EMACS}}
\entry{COMPREPLY}{65}{\code {COMPREPLY}}
\entry{DIRSTACK}{65}{\code {DIRSTACK}}
\entry{EMACS}{65}{\code {EMACS}}
\entry{EUID}{65}{\code {EUID}}
\entry{FCEDIT}{65}{\code {FCEDIT}}
\entry{FIGNORE}{65}{\code {FIGNORE}}
@@ -53,16 +55,16 @@
\entry{GLOBIGNORE}{65}{\code {GLOBIGNORE}}
\entry{GROUPS}{65}{\code {GROUPS}}
\entry{histchars}{65}{\code {histchars}}
\entry{HISTCMD}{65}{\code {HISTCMD}}
\entry{HISTCONTROL}{65}{\code {HISTCONTROL}}
\entry{HISTCMD}{66}{\code {HISTCMD}}
\entry{HISTCONTROL}{66}{\code {HISTCONTROL}}
\entry{HISTFILE}{66}{\code {HISTFILE}}
\entry{HISTFILESIZE}{66}{\code {HISTFILESIZE}}
\entry{HISTIGNORE}{66}{\code {HISTIGNORE}}
\entry{HISTSIZE}{66}{\code {HISTSIZE}}
\entry{HISTTIMEFORMAT}{66}{\code {HISTTIMEFORMAT}}
\entry{HOSTFILE}{66}{\code {HOSTFILE}}
\entry{HOSTNAME}{66}{\code {HOSTNAME}}
\entry{HOSTTYPE}{66}{\code {HOSTTYPE}}
\entry{HOSTFILE}{67}{\code {HOSTFILE}}
\entry{HOSTNAME}{67}{\code {HOSTNAME}}
\entry{HOSTTYPE}{67}{\code {HOSTTYPE}}
\entry{IGNOREEOF}{67}{\code {IGNOREEOF}}
\entry{INPUTRC}{67}{\code {INPUTRC}}
\entry{LANG}{67}{\code {LANG}}
@@ -74,10 +76,10 @@
\entry{LINENO}{67}{\code {LINENO}}
\entry{LINES}{67}{\code {LINES}}
\entry{MACHTYPE}{67}{\code {MACHTYPE}}
\entry{MAILCHECK}{67}{\code {MAILCHECK}}
\entry{OLDPWD}{67}{\code {OLDPWD}}
\entry{OPTERR}{67}{\code {OPTERR}}
\entry{OSTYPE}{67}{\code {OSTYPE}}
\entry{MAILCHECK}{68}{\code {MAILCHECK}}
\entry{OLDPWD}{68}{\code {OLDPWD}}
\entry{OPTERR}{68}{\code {OPTERR}}
\entry{OSTYPE}{68}{\code {OSTYPE}}
\entry{PIPESTATUS}{68}{\code {PIPESTATUS}}
\entry{POSIXLY_CORRECT}{68}{\code {POSIXLY_CORRECT}}
\entry{PPID}{68}{\code {PPID}}
@@ -88,14 +90,14 @@
\entry{PWD}{68}{\code {PWD}}
\entry{RANDOM}{68}{\code {RANDOM}}
\entry{REPLY}{68}{\code {REPLY}}
\entry{SECONDS}{68}{\code {SECONDS}}
\entry{SHELL}{68}{\code {SHELL}}
\entry{SHELLOPTS}{68}{\code {SHELLOPTS}}
\entry{SECONDS}{69}{\code {SECONDS}}
\entry{SHELL}{69}{\code {SHELL}}
\entry{SHELLOPTS}{69}{\code {SHELLOPTS}}
\entry{SHLVL}{69}{\code {SHLVL}}
\entry{TIMEFORMAT}{69}{\code {TIMEFORMAT}}
\entry{TMOUT}{69}{\code {TMOUT}}
\entry{TMPDIR}{69}{\code {TMPDIR}}
\entry{UID}{69}{\code {UID}}
\entry{TMPDIR}{70}{\code {TMPDIR}}
\entry{UID}{70}{\code {UID}}
\entry{auto_resume}{90}{\code {auto_resume}}
\entry{bell-style}{95}{\code {bell-style}}
\entry{bind-tty-special-chars}{95}{\code {bind-tty-special-chars}}
+22 -20
View File
@@ -27,20 +27,22 @@
\entry {\code {BASH_COMMAND}}{62}
\entry {\code {BASH_ENV}}{62}
\entry {\code {BASH_EXECUTION_STRING}}{62}
\entry {\code {BASH_LINENO}}{62}
\entry {\code {BASH_LINENO}}{63}
\entry {\code {BASH_REMATCH}}{63}
\entry {\code {BASH_SOURCE}}{63}
\entry {\code {BASH_SUBSHELL}}{63}
\entry {\code {BASH_VERSINFO}}{63}
\entry {\code {BASH_VERSION}}{63}
\entry {\code {BASH_XTRACEFD}}{63}
\entry {\code {BASHOPTS}}{62}
\entry {\code {BASHPID}}{62}
\entry {\code {bell-style}}{95}
\entry {\code {bind-tty-special-chars}}{95}
\initial {C}
\entry {\code {CDPATH}}{61}
\entry {\code {COLUMNS}}{63}
\entry {\code {COLUMNS}}{64}
\entry {\code {comment-begin}}{95}
\entry {\code {COMP_CWORD}}{63}
\entry {\code {COMP_CWORD}}{64}
\entry {\code {COMP_KEY}}{64}
\entry {\code {COMP_LINE}}{64}
\entry {\code {COMP_POINT}}{64}
@@ -49,14 +51,14 @@
\entry {\code {COMP_WORDS}}{64}
\entry {\code {completion-prefix-display-length}}{95}
\entry {\code {completion-query-items}}{95}
\entry {\code {COMPREPLY}}{64}
\entry {\code {COMPREPLY}}{65}
\entry {\code {convert-meta}}{96}
\initial {D}
\entry {\code {DIRSTACK}}{64}
\entry {\code {DIRSTACK}}{65}
\entry {\code {disable-completion}}{96}
\initial {E}
\entry {\code {editing-mode}}{96}
\entry {\code {EMACS}}{64}
\entry {\code {EMACS}}{65}
\entry {\code {enable-keypad}}{96}
\entry {\code {EUID}}{65}
\entry {\code {expand-tilde}}{96}
@@ -69,8 +71,8 @@
\entry {\code {GROUPS}}{65}
\initial {H}
\entry {\code {histchars}}{65}
\entry {\code {HISTCMD}}{65}
\entry {\code {HISTCONTROL}}{65}
\entry {\code {HISTCMD}}{66}
\entry {\code {HISTCONTROL}}{66}
\entry {\code {HISTFILE}}{66}
\entry {\code {HISTFILESIZE}}{66}
\entry {\code {HISTIGNORE}}{66}
@@ -80,9 +82,9 @@
\entry {\code {HISTTIMEFORMAT}}{66}
\entry {\code {HOME}}{61}
\entry {\code {horizontal-scroll-mode}}{96}
\entry {\code {HOSTFILE}}{66}
\entry {\code {HOSTNAME}}{66}
\entry {\code {HOSTTYPE}}{66}
\entry {\code {HOSTFILE}}{67}
\entry {\code {HOSTNAME}}{67}
\entry {\code {HOSTTYPE}}{67}
\initial {I}
\entry {\code {IFS}}{61}
\entry {\code {IGNOREEOF}}{67}
@@ -103,18 +105,18 @@
\initial {M}
\entry {\code {MACHTYPE}}{67}
\entry {\code {MAIL}}{61}
\entry {\code {MAILCHECK}}{67}
\entry {\code {MAILCHECK}}{68}
\entry {\code {MAILPATH}}{61}
\entry {\code {mark-modified-lines}}{97}
\entry {\code {mark-symlinked-directories}}{97}
\entry {\code {match-hidden-files}}{97}
\entry {\code {meta-flag}}{96}
\initial {O}
\entry {\code {OLDPWD}}{67}
\entry {\code {OLDPWD}}{68}
\entry {\code {OPTARG}}{61}
\entry {\code {OPTERR}}{67}
\entry {\code {OPTERR}}{68}
\entry {\code {OPTIND}}{61}
\entry {\code {OSTYPE}}{67}
\entry {\code {OSTYPE}}{68}
\entry {\code {output-meta}}{97}
\initial {P}
\entry {\code {page-completions}}{97}
@@ -134,9 +136,9 @@
\entry {\code {REPLY}}{68}
\entry {\code {revert-all-at-newline}}{97}
\initial {S}
\entry {\code {SECONDS}}{68}
\entry {\code {SHELL}}{68}
\entry {\code {SHELLOPTS}}{68}
\entry {\code {SECONDS}}{69}
\entry {\code {SHELL}}{69}
\entry {\code {SHELLOPTS}}{69}
\entry {\code {SHLVL}}{69}
\entry {\code {show-all-if-ambiguous}}{98}
\entry {\code {show-all-if-unmodified}}{98}
@@ -145,8 +147,8 @@
\entry {\code {TEXTDOMAINDIR}}{7}
\entry {\code {TIMEFORMAT}}{69}
\entry {\code {TMOUT}}{69}
\entry {\code {TMPDIR}}{69}
\entry {\code {TMPDIR}}{70}
\initial {U}
\entry {\code {UID}}{69}
\entry {\code {UID}}{70}
\initial {V}
\entry {\code {visible-stats}}{98}
+9 -9
View File
@@ -1058,15 +1058,15 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
--pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and
$$BBAASSHH__EENNVV files are not processed, shell functions are
not inherited from the environment, and the SSHHEELLLLOOPPTTSS,
CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they appear in the
environment, are ignored. If the shell is started with
the effective user (group) id not equal to the real user
(group) id, and the --pp option is not supplied, these
actions are taken and the effective user id is set to
the real user id. If the --pp option is supplied at
startup, the effective user id is not reset. Turning
this option off causes the effective user and group ids
to be set to the real user and group ids.
BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
appear in the environment, are ignored. If the shell is
started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not sup-
plied, these actions are taken and the effective user id
is set to the real user id. If the --pp option is sup-
plied at startup, the effective user id is not reset.
Turning this option off causes the effective user and
group ids to be set to the real user and group ids.
--tt Exit after reading and executing one command.
--uu Treat unset variables and parameters other than the spe-
cial parameters "@" and "*" as an error when performing
+17 -16
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.2
%%CreationDate: Mon Aug 3 10:10:38 2009
%%CreationDate: Mon Aug 17 14:38:17 2009
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -1871,21 +1871,22 @@ E F0(.)A F1(onecmd)184 360 Q F0(Same as)6.67 E F1<ad74>2.5 E F0(.)A F1
F2($ENV)3.572 E F0(and)3.322 E F2($B)3.572 E(ASH_ENV)-.27 E F0 1.071
(\214les are not pro-)3.322 F 1.5
(cessed, shell functions are not inherited from the en)184 570 R 1.501
(vironment, and the)-.4 F F2(SHELLOPTS)4.001 E F3(,)A F1(CDP)184 582 Q
-.95(AT)-.74 G(H).95 E F0 5.603(,a)C(nd)-5.603 E F1(GLOBIGNORE)5.603 E
F0 -.25(va)5.603 G 3.103(riables, if the).25 F 5.603(ya)-.15 G 3.103
(ppear in the en)-5.603 F 3.103(vironment, are)-.4 F 2.617(ignored. If)
184 594 R .117(the shell is started with the ef)2.617 F(fecti)-.25 E
.418 -.15(ve u)-.25 H .118(ser \(group\) id not equal to the real user)
.15 F 1.018(\(group\) id, and the)184 606 R F1<ad70>3.518 E F0 1.018
(option is not supplied, these actions are tak)3.518 F 1.018
(en and the ef)-.1 F(fecti)-.25 E -.15(ve)-.25 G .286
(user id is set to the real user id.)184 618 R .286(If the)5.286 F F1
<ad70>2.786 E F0 .287(option is supplied at startup, the ef)2.786 F
(fecti)-.25 E .587 -.15(ve u)-.25 H(ser).15 E .103(id is not reset.)184
630 R -.45(Tu)5.103 G .102(rning this option of).45 F 2.602(fc)-.25 G
.102(auses the ef)-2.602 F(fecti)-.25 E .402 -.15(ve u)-.25 H .102
(ser and group ids to be set to).15 F(the real user and group ids.)184
(vironment, and the)-.4 F F2(SHELLOPTS)4.001 E F3(,)A F1 -.3(BA)184 582
S(SHOPTS).3 E F0(,)A F1(CDP)3.186 E -.95(AT)-.74 G(H).95 E F0 3.186(,a)C
(nd)-3.186 E F1(GLOBIGNORE)3.186 E F0 -.25(va)3.186 G .686
(riables, if the).25 F 3.186(ya)-.15 G .686(ppear in the en)-3.186 F
(viron-)-.4 E .853(ment, are ignored.)184 594 R .854
(If the shell is started with the ef)5.853 F(fecti)-.25 E 1.154 -.15
(ve u)-.25 H .854(ser \(group\) id not equal to).15 F .043
(the real user \(group\) id, and the)184 606 R F1<ad70>2.543 E F0 .043
(option is not supplied, these actions are tak)2.543 F .043(en and the)
-.1 F(ef)184 618 Q(fecti)-.25 E 1.666 -.15(ve u)-.25 H 1.366
(ser id is set to the real user id.).15 F 1.367(If the)6.367 F F1<ad70>
3.867 E F0 1.367(option is supplied at startup, the)3.867 F(ef)184 630 Q
(fecti)-.25 E .709 -.15(ve u)-.25 H .409(ser id is not reset.).15 F -.45
(Tu)5.409 G .409(rning this option of).45 F 2.909(fc)-.25 G .408
(auses the ef)-2.909 F(fecti)-.25 E .708 -.15(ve u)-.25 H .408
(ser and group).15 F(ids to be set to the real user and group ids.)184
642 Q F1<ad74>144 654 Q F0(Exit after reading and e)30.97 E -.15(xe)-.15
G(cuting one command.).15 E F1<ad75>144 666 Q F0 -.35(Tr)28.74 G .043
(eat unset v).35 F .044(ariables and parameters other than the special \
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.19.2
%%CreationDate: Mon Aug 3 10:10:38 2009
%%CreationDate: Mon Aug 17 14:38:17 2009
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.19 2
+2 -2
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2009 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Aug 14 18:32:24 EDT 2009
@set LASTCHANGE Mon Aug 17 14:38:05 EDT 2009
@set EDITION 4.0
@set VERSION 4.0
@set UPDATED 14 August 2009
@set UPDATED 17 August 2009
@set UPDATED-MONTH August 2009
+2 -1
View File
@@ -53,6 +53,7 @@ extern int errno;
extern int executing_line_number __P((void));
extern int last_command_exit_value;
extern char *shell_name;
#if defined (JOB_CONTROL)
extern pid_t shell_pgrp;
@@ -331,7 +332,7 @@ parser_error (lineno, format, va_alist)
va_end (args);
if (exit_immediately_on_error)
exit_shell (2);
exit_shell (last_command_exit_value = 2);
}
#ifdef DEBUG
+454
View File
@@ -0,0 +1,454 @@
/* error.c -- Functions for handling errors. */
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "bashtypes.h"
#include <fcntl.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (PREFER_STDARG)
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#include <stdio.h>
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif /* !errno */
#include "bashansi.h"
#include "bashintl.h"
#include "shell.h"
#include "flags.h"
#include "input.h"
#if defined (HISTORY)
# include "bashhist.h"
#endif
extern int executing_line_number __P((void));
extern char *shell_name;
#if defined (JOB_CONTROL)
extern pid_t shell_pgrp;
extern int give_terminal_to __P((pid_t, int));
#endif /* JOB_CONTROL */
#if defined (ARRAY_VARS)
extern const char * const bash_badsub_errmsg;
#endif
static void error_prolog __P((int));
/* The current maintainer of the shell. You change this in the
Makefile. */
#if !defined (MAINTAINER)
#define MAINTAINER "bash-maintainers@gnu.org"
#endif
const char * const the_current_maintainer = MAINTAINER;
int gnu_error_format = 0;
static void
error_prolog (print_lineno)
int print_lineno;
{
char *ename;
int line;
ename = get_name_for_error ();
line = (print_lineno && interactive_shell == 0) ? executing_line_number () : -1;
if (line > 0)
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), line);
else
fprintf (stderr, "%s: ", ename);
}
/* Return the name of the shell or the shell script for error reporting. */
char *
get_name_for_error ()
{
char *name;
#if defined (ARRAY_VARS)
SHELL_VAR *bash_source_v;
ARRAY *bash_source_a;
#endif
name = (char *)NULL;
if (interactive_shell == 0)
{
#if defined (ARRAY_VARS)
bash_source_v = find_variable ("BASH_SOURCE");
if (bash_source_v && array_p (bash_source_v) &&
(bash_source_a = array_cell (bash_source_v)))
name = array_reference (bash_source_a, 0);
if (name == 0 || *name == '\0') /* XXX - was just name == 0 */
#endif
name = dollar_vars[0];
}
if (name == 0 && shell_name && *shell_name)
name = base_pathname (shell_name);
if (name == 0)
#if defined (PROGRAM)
name = PROGRAM;
#else
name = "bash";
#endif
return (name);
}
/* Report an error having to do with FILENAME. This does not use
sys_error so the filename is not interpreted as a printf-style
format string. */
void
file_error (filename)
const char *filename;
{
report_error ("%s: %s", filename, strerror (errno));
}
void
#if defined (PREFER_STDARG)
programming_error (const char *format, ...)
#else
programming_error (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
char *h;
#if defined (JOB_CONTROL)
give_terminal_to (shell_pgrp, 0);
#endif /* JOB_CONTROL */
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
#if defined (HISTORY)
if (remember_on_history)
{
h = last_history_line ();
fprintf (stderr, _("last command: %s\n"), h ? h : "(null)");
}
#endif
#if 0
fprintf (stderr, "Report this to %s\n", the_current_maintainer);
#endif
fprintf (stderr, _("Aborting..."));
fflush (stderr);
abort ();
}
/* Print an error message and, if `set -e' has been executed, exit the
shell. Used in this file by file_error and programming_error. Used
outside this file mostly to report substitution and expansion errors,
and for bad invocation options. */
void
#if defined (PREFER_STDARG)
report_error (const char *format, ...)
#else
report_error (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
error_prolog (1);
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
if (exit_immediately_on_error)
exit_shell (1);
}
void
#if defined (PREFER_STDARG)
fatal_error (const char *format, ...)
#else
fatal_error (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
error_prolog (0);
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
sh_exit (2);
}
void
#if defined (PREFER_STDARG)
internal_error (const char *format, ...)
#else
internal_error (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
error_prolog (1);
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
}
void
#if defined (PREFER_STDARG)
internal_warning (const char *format, ...)
#else
internal_warning (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
error_prolog (1);
fprintf (stderr, _("warning: "));
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
}
void
#if defined (PREFER_STDARG)
sys_error (const char *format, ...)
#else
sys_error (format, va_alist)
const char *format;
va_dcl
#endif
{
int e;
va_list args;
e = errno;
error_prolog (0);
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, ": %s\n", strerror (e));
va_end (args);
}
/* An error from the parser takes the general form
shell_name: input file name: line number: message
The input file name and line number are omitted if the shell is
currently interactive. If the shell is not currently interactive,
the input file name is inserted only if it is different from the
shell name. */
void
#if defined (PREFER_STDARG)
parser_error (int lineno, const char *format, ...)
#else
parser_error (lineno, format, va_alist)
int lineno;
const char *format;
va_dcl
#endif
{
va_list args;
char *ename, *iname;
ename = get_name_for_error ();
iname = yy_input_name ();
if (interactive)
fprintf (stderr, "%s: ", ename);
else if (interactive_shell)
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
else if (STREQ (ename, iname))
fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), lineno);
else
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
if (exit_immediately_on_error)
exit_shell (last_command_exit_value = 2);
}
#ifdef DEBUG
void
#if defined (PREFER_STDARG)
itrace (const char *format, ...)
#else
itrace (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
fprintf(stderr, "TRACE: pid %ld: ", (long)getpid());
SH_VA_START (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
va_end (args);
fflush(stderr);
}
/* A trace function for silent debugging -- doesn't require a control
terminal. */
void
#if defined (PREFER_STDARG)
trace (const char *format, ...)
#else
trace (format, va_alist)
const char *format;
va_dcl
#endif
{
va_list args;
static FILE *tracefp = (FILE *)NULL;
if (tracefp == NULL)
tracefp = fopen("/tmp/bash-trace.log", "a+");
if (tracefp == NULL)
tracefp = stderr;
else
fcntl (fileno (tracefp), F_SETFD, 1); /* close-on-exec */
fprintf(tracefp, "TRACE: pid %ld: ", (long)getpid());
SH_VA_START (args, format);
vfprintf (tracefp, format, args);
fprintf (tracefp, "\n");
va_end (args);
fflush(tracefp);
}
#endif /* DEBUG */
/* **************************************************************** */
/* */
/* Common error reporting */
/* */
/* **************************************************************** */
static const char * const cmd_error_table[] = {
N_("unknown command error"), /* CMDERR_DEFAULT */
N_("bad command type"), /* CMDERR_BADTYPE */
N_("bad connector"), /* CMDERR_BADCONN */
N_("bad jump"), /* CMDERR_BADJUMP */
0
};
void
command_error (func, code, e, flags)
const char *func;
int code, e, flags; /* flags currently unused */
{
if (code > CMDERR_LAST)
code = CMDERR_DEFAULT;
programming_error ("%s: %s: %d", func, _(cmd_error_table[code]), e);
}
char *
command_errstr (code)
int code;
{
if (code > CMDERR_LAST)
code = CMDERR_DEFAULT;
return (_(cmd_error_table[code]));
}
#ifdef ARRAY_VARS
void
err_badarraysub (s)
const char *s;
{
report_error ("%s: %s", s, _(bash_badsub_errmsg));
}
#endif
void
err_unboundvar (s)
const char *s;
{
report_error (_("%s: unbound variable"), s);
}
void
err_readonly (s)
const char *s;
{
report_error (_("%s: readonly variable"), s);
}
+4
View File
@@ -196,6 +196,10 @@ extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fmtumax.c */
extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fnxform.c */
extern char *fnx_fromfs __P((char *, size_t));
extern char *fnx_tofs __P((char *, size_t));
/* Declarations for functions defined in lib/sh/fpurge.c */
#if defined NEED_FPURGE_DECL
+5
View File
@@ -58,6 +58,7 @@ extern void xtrace_init __P((void));
#ifdef NEED_XTRACE_SET_DECL
extern void xtrace_set __P((int, FILE *));
#endif
extern void xtrace_reset __P((void));
extern char *indirection_level_string __P((void));
extern void xtrace_print_assignment __P((char *, char *, int, int));
extern void xtrace_print_word_list __P((WORD_LIST *, int));
@@ -195,6 +196,10 @@ extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fmtumax.c */
extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
/* Declarations for functions defined in lib/sh/fnxform.c */
extern char *fnx_fromfs __P((ICONV_CONST char *, size_t));
extern char *fnx_tofs __P((ICONV_CONST char *, size_t));
/* Declarations for functions defined in lib/sh/fpurge.c */
#if defined NEED_FPURGE_DECL
+9 -5
View File
@@ -426,13 +426,14 @@ glob_vector (pat, dir, flags)
register struct globval *nextlink;
register char *nextname, *npat, *subdir;
unsigned int count;
int lose, skip, ndirs, isdir, sdlen, add_current;
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
register char **name_vector;
register unsigned int i;
int mflags; /* Flags passed to strmatch (). */
int pflags; /* flags passed to sh_makepath () */
int nalloca;
struct globval *firstmalloc, *tmplink;
char *convfn;
lastlink = 0;
count = lose = skip = add_current = 0;
@@ -466,6 +467,8 @@ glob_vector (pat, dir, flags)
skip = 1;
}
patlen = strlen (pat);
/* If the filename pattern (PAT) does not contain any globbing characters,
we can dispense with reading the directory, and just see if there is
a filename `DIR/PAT'. If there is, and we can access it, just make the
@@ -479,8 +482,8 @@ glob_vector (pat, dir, flags)
return ((char **) &glob_error_return);
dirlen = strlen (dir);
nextname = (char *)malloc (dirlen + strlen (pat) + 2);
npat = (char *)malloc (strlen (pat) + 1);
nextname = (char *)malloc (dirlen + patlen + 2);
npat = (char *)malloc (patlen + 1);
if (nextname == 0 || npat == 0)
lose = 1;
else
@@ -633,8 +636,9 @@ glob_vector (pat, dir, flags)
++count;
continue;
}
if (strmatch (pat, dp->d_name, mflags) != FNM_NOMATCH)
convfn = fnx_fromfs (dp->d_name, D_NAMLEN (dp));
if (strmatch (pat, convfn, mflags) != FNM_NOMATCH)
{
if (nalloca < ALLOCA_MAX)
{
+12 -7
View File
@@ -426,13 +426,14 @@ glob_vector (pat, dir, flags)
register struct globval *nextlink;
register char *nextname, *npat, *subdir;
unsigned int count;
int lose, skip, ndirs, isdir, sdlen, add_current;
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
register char **name_vector;
register unsigned int i;
int mflags; /* Flags passed to strmatch (). */
int pflags; /* flags passed to sh_makepath () */
int nalloca;
struct globval *firstmalloc, *tmplink;
char *convfn;
lastlink = 0;
count = lose = skip = add_current = 0;
@@ -466,6 +467,8 @@ glob_vector (pat, dir, flags)
skip = 1;
}
patlen = strlen (pat);
/* If the filename pattern (PAT) does not contain any globbing characters,
we can dispense with reading the directory, and just see if there is
a filename `DIR/PAT'. If there is, and we can access it, just make the
@@ -479,8 +482,8 @@ glob_vector (pat, dir, flags)
return ((char **) &glob_error_return);
dirlen = strlen (dir);
nextname = (char *)malloc (dirlen + strlen (pat) + 2);
npat = (char *)malloc (strlen (pat) + 1);
nextname = (char *)malloc (dirlen + patlen + 2);
npat = (char *)malloc (patlen + 1);
if (nextname == 0 || npat == 0)
lose = 1;
else
@@ -633,8 +636,9 @@ glob_vector (pat, dir, flags)
++count;
continue;
}
if (strmatch (pat, dp->d_name, mflags) != FNM_NOMATCH)
convfn = fnxform (dp->d_name, D_NAMLEN (dp));
if (strmatch (pat, convfn, mflags) != FNM_NOMATCH)
{
if (nalloca < ALLOCA_MAX)
{
@@ -665,8 +669,9 @@ glob_vector (pat, dir, flags)
(void) closedir (d);
}
/* compat: if GX_ALLDIRS, add the passed directory also. Add an empty
directory name as a placeholder if GX_NULLDIR. */
/* compat: if GX_ADDCURDIR, add the passed directory also. Add an empty
directory name as a placeholder if GX_NULLDIR (in which case the passed
directory name is "."). */
if (add_current)
{
sdlen = strlen (dir);
+1
View File
@@ -1443,6 +1443,7 @@ static const struct {
{ "revert-all-at-newline", &_rl_revert_all_at_newline, 0 },
{ "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
{ "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
{ "skip-completed-text", &_rl_skip_completed_text, 0 },
#if defined (VISIBLE_STATS)
{ "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */
+1 -1
View File
@@ -424,7 +424,7 @@ rl_generic_bind (type, keyseq, data, map)
overridden. We use a special bindable function that does
nothing. */
if (type == ISFUNC && data == 0)
data = _rl_null_function;
data = (char *)_rl_null_function;
}
map[ic].function = KEYMAP_TO_FUNCTION (data);
+57 -14
View File
@@ -179,6 +179,12 @@ int _rl_completion_prefix_display_length = 0;
int rl_visible_stats = 0;
#endif /* VISIBLE_STATS */
/* If non-zero, when completing in the middle of a word, don't insert
characters from the match that match characters following point in
the word. This means, for instance, completing when the cursor is
after the `e' in `Makefile' won't result in `Makefilefile'. */
int _rl_skip_completed_text = 1;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
@@ -186,6 +192,17 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL;
/* Non-zero means readline completion functions perform tilde expansion. */
int rl_complete_with_tilde_expansion = 0;
@@ -1551,8 +1568,9 @@ insert_match (match, start, mtype, qc)
int start, mtype;
char *qc;
{
char *replacement;
char *replacement, *r;
char oqc;
int end;
oqc = qc ? *qc : '\0';
replacement = make_quoted_replacement (match, mtype, qc);
@@ -1569,7 +1587,21 @@ insert_match (match, start, mtype, qc)
else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
replacement[0] != oqc)
start--;
_rl_replace_text (replacement, start, rl_point - 1);
end = rl_point - 1;
if (_rl_skip_completed_text)
{
r = replacement;
while (start < rl_end && *r && rl_line_buffer[start] == *r)
{
start++;
r++;
}
if (start <= end || *r)
_rl_replace_text (r, start, end);
rl_point = start + strlen (r);
}
else
_rl_replace_text (replacement, start, end);
if (replacement != match)
free (replacement);
}
@@ -1981,8 +2013,8 @@ rl_filename_completion_function (text, state)
static char *dirname = (char *)NULL;
static char *users_dirname = (char *)NULL;
static int filename_len;
char *temp;
int dirlen;
char *temp, *dentry, *convfn;
int dirlen, dentlen, convlen;
struct dirent *entry;
/* If we don't have any state, then do some initialization. */
@@ -2086,6 +2118,15 @@ rl_filename_completion_function (text, state)
entry = (struct dirent *)NULL;
while (directory && (entry = readdir (directory)))
{
convfn = dentry = entry->d_name;
convlen = dentlen = D_NAMLEN (entry);
if (rl_filename_rewrite_hook)
{
convfn = (*rl_filename_rewrite_hook) (dentry, dentlen);
convlen = (convfn == dentry) ? dentlen : strlen (convfn);
}
/* Special case for no filename. If the user has disabled the
`match-hidden-files' variable, skip filenames beginning with `.'.
All other entries except "." and ".." match. */
@@ -2094,9 +2135,8 @@ rl_filename_completion_function (text, state)
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
continue;
if (entry->d_name[0] != '.' ||
(entry->d_name[1] &&
(entry->d_name[1] != '.' || entry->d_name[2])))
if (convfn[0] != '.' ||
(convfn[1] && (convfn[1] != '.' || convfn[2])))
break;
}
else
@@ -2105,16 +2145,16 @@ rl_filename_completion_function (text, state)
it is a match. */
if (_rl_completion_case_fold)
{
if ((_rl_to_lower (entry->d_name[0]) == _rl_to_lower (filename[0])) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(_rl_strnicmp (filename, entry->d_name, filename_len) == 0))
if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) &&
(convlen >= filename_len) &&
(_rl_strnicmp (filename, convfn, filename_len) == 0))
break;
}
else
{
if ((entry->d_name[0] == filename[0]) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(strncmp (filename, entry->d_name, filename_len) == 0))
if ((convfn[0] == filename[0]) &&
(convlen >= filename_len) &&
(strncmp (filename, convfn, filename_len) == 0))
break;
}
}
@@ -2176,7 +2216,10 @@ rl_filename_completion_function (text, state)
strcpy (temp + dirlen, entry->d_name);
}
else
temp = savestring (entry->d_name);
temp = savestring (convfn);
if (convfn != dentry)
free (convfn);
return (temp);
}
+70 -15
View File
@@ -179,6 +179,12 @@ int _rl_completion_prefix_display_length = 0;
int rl_visible_stats = 0;
#endif /* VISIBLE_STATS */
/* If non-zero, when completing in the middle of a word, don't insert
characters from the match that match characters following point in
the word. This means, for instance, completing when the cursor is
after the `e' in `Makefile' won't result in `Makefilefile'. */
int _rl_skip_completed_text = 1;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
@@ -186,6 +192,17 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL;
/* Non-zero means readline completion functions perform tilde expansion. */
int rl_complete_with_tilde_expansion = 0;
@@ -1551,8 +1568,9 @@ insert_match (match, start, mtype, qc)
int start, mtype;
char *qc;
{
char *replacement;
char *replacement, *r;
char oqc;
int end, ostart;
oqc = qc ? *qc : '\0';
replacement = make_quoted_replacement (match, mtype, qc);
@@ -1569,7 +1587,21 @@ insert_match (match, start, mtype, qc)
else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
replacement[0] != oqc)
start--;
_rl_replace_text (replacement, start, rl_point - 1);
end = rl_point - 1;
if (_rl_skip_completed_text)
{
r = replacement;
while (start < rl_end && *r && rl_line_buffer[start] == *r)
{
start++;
r++;
}
if (start <= end || *r)
_rl_replace_text (r, start, end);
rl_point = start + strlen (r);
}
else
_rl_replace_text (replacement, start, end);
if (replacement != match)
free (replacement);
}
@@ -1981,8 +2013,8 @@ rl_filename_completion_function (text, state)
static char *dirname = (char *)NULL;
static char *users_dirname = (char *)NULL;
static int filename_len;
char *temp;
int dirlen;
char *temp, *dentry, *convfn;
int dirlen, dentlen, convlen;
struct dirent *entry;
/* If we don't have any state, then do some initialization. */
@@ -2086,6 +2118,15 @@ rl_filename_completion_function (text, state)
entry = (struct dirent *)NULL;
while (directory && (entry = readdir (directory)))
{
convfn = dentry = entry->d_name;
convlen = dentlen = D_NAMLEN (entry);
if (rl_filename_rewrite_hook)
{
convfn = (*rl_filename_rewrite_hook) (dentry, dentlen);
convlen = (convfn == dentry) ? dentlen : strlen (convfn);
}
/* Special case for no filename. If the user has disabled the
`match-hidden-files' variable, skip filenames beginning with `.'.
All other entries except "." and ".." match. */
@@ -2094,9 +2135,8 @@ rl_filename_completion_function (text, state)
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
continue;
if (entry->d_name[0] != '.' ||
(entry->d_name[1] &&
(entry->d_name[1] != '.' || entry->d_name[2])))
if (convfn[0] != '.' ||
(convfn[1] && (convfn[1] != '.' || convfn[2])))
break;
}
else
@@ -2105,16 +2145,16 @@ rl_filename_completion_function (text, state)
it is a match. */
if (_rl_completion_case_fold)
{
if ((_rl_to_lower (entry->d_name[0]) == _rl_to_lower (filename[0])) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(_rl_strnicmp (filename, entry->d_name, filename_len) == 0))
if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) &&
(convlen >= filename_len) &&
(_rl_strnicmp (filename, convfn, filename_len) == 0))
break;
}
else
{
if ((entry->d_name[0] == filename[0]) &&
(((int)D_NAMLEN (entry)) >= filename_len) &&
(strncmp (filename, entry->d_name, filename_len) == 0))
if ((convfn[0] == filename[0]) &&
(convlen >= filename_len) &&
(strncmp (filename, convfn, filename_len) == 0))
break;
}
}
@@ -2176,7 +2216,10 @@ rl_filename_completion_function (text, state)
strcpy (temp + dirlen, entry->d_name);
}
else
temp = savestring (entry->d_name);
temp = savestring (convfn);
if (convfn != dentry)
free (convfn);
return (temp);
}
@@ -2261,9 +2304,12 @@ rl_old_menu_complete (count, invoking_key)
FREE (orig_text);
orig_text = (char *)0;
completion_changed_buffer = 0;
RL_UNSETSTATE(RL_STATE_COMPLETING);
return (0);
}
RL_UNSETSTATE(RL_STATE_COMPLETING);
for (match_list_size = 0; matches[match_list_size]; match_list_size++)
;
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
@@ -2327,7 +2373,7 @@ rl_menu_complete (count, ignore)
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_menu_complete || full_completion)
if ((rl_last_func != rl_menu_complete && rl_last_func != rl_backward_menu_complete) || full_completion)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
@@ -2467,3 +2513,12 @@ rl_menu_complete (count, ignore)
completion_changed_buffer = 1;
return (0);
}
int
rl_backward_menu_complete (count, key)
int count, key;
{
/* Positive arguments to backward-menu-complete translate into negative
arguments for menu-complete, and vice versa. */
return (rl_menu_complete (-count, key));
}
+10 -2
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Thu Jul 30 09:22:50 EDT 2009
.\" Last Change: Sat Aug 22 12:03:05 EDT 2009
.\"
.TH READLINE 3 "2009 Jul 30" "GNU Readline 6.0"
.TH READLINE 3 "2009 August 22" "GNU Readline 6.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -504,6 +504,14 @@ possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
.TP
.B skip\-completed\-text (Off)
If set to \fBOn\fP, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled, readline
does not insert characters from the completion that match characters
after point in the word being completed, so portions of the word
following the cursor are not duplicated.
.TP
.B visible\-stats (Off)
If set to \fBOn\fP, a character denoting a file's type as reported
by \fIstat\fP(2) is appended to the filename when listing possible
+29
View File
@@ -1728,6 +1728,35 @@ remove any quote characters from the directory name, because its result will
be passed directly to @code{opendir()}.
@end deftypevar
@ignore
@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook;
If non-zero, this is the address of a function to call when completing
a directory name. This function takes the address of the directory name
to be modified as an argument. Unlike @code{rl_directory_completion_hook},
it only modifies the directory name used in @code{opendir}, not what is
displayed when the possible completions are printed or inserted. It is
called before rl_directory_completion_hook.
I'm not happy with how this worksyet, so it's undocumented.
@end deftypevar
@end ignore
@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
If non-zero, this is the address of a function called when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
perform any necesary application or system-specific conversion on
the filename, such as converting between character sets or converting
from a filesystem format to a character input format.
The function takes two arguments: @var{fname}, the filename to be converted,
and @var{fnlen}, its length in bytes.
It must either return its first argument (if no conversion takes place)
or the converted filename in newly-allocated memory. The converted
form is used to compare against the word to be completed, and, if it
matches, is added to the list of matches. Readline will free the
allocated string.
@end deftypevar
@deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook
If non-zero, then this is the address of a function to call when
completing a word would normally display the list of possible matches.
+3 -2
View File
@@ -622,7 +622,7 @@ Readline which keymap to use.
@deftypefun Keymap rl_make_bare_keymap (void)
Returns a new, empty keymap. The space for the keymap is allocated with
@code{malloc()}; the caller should free it by calling
@code{rl_discard_keymap()} when done.
@code{rl_free_keymap()} when done.
@end deftypefun
@deftypefun Keymap rl_copy_keymap (Keymap map)
@@ -641,7 +641,8 @@ The caller should free @var{keymap}.
@end deftypefun
@deftypefun void rl_free_keymap (Keymap keymap)
Free all storage associated with @var{keymap}.
Free all storage associated with @var{keymap}. This calls
@code{rl_discard_keymap} to free subordindate keymaps and macros.
@end deftypefun
Readline has several internal keymaps. These functions allow you to
+18 -2
View File
@@ -606,6 +606,20 @@ a common prefix) cause the matches to be listed immediately instead
of ringing the bell.
The default value is @samp{off}.
@item skip-completed-text
@vindex skip-completed-text
If set to @samp{on}, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled, readline
does not insert characters from the completion that match characters
after point in the word being completed, so portions of the word
following the cursor are not duplicated.
For instance, if this is enabled, attempting completion when the cursor
is after the @samp{e} in @samp{Makefile} will result in @samp{Makefile}
rather than @samp{Makefilefile}, assuming there is a single possible
completion.
The default value is @samp{off}.
@item visible-stats
@vindex visible-stats
If set to @samp{on}, a character denoting a file's type
@@ -1716,11 +1730,13 @@ For instance, assuming that there is a library of compspecs, each kept in a
file corresponding to the name of the command, the following default
completion function would load completions dynamically:
@example
_completion_loader()
{
@{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
}
@}
complete -D -F _completion_loader
@end example
@node Programmable Completion Builtins
@section Programmable Completion Builtins
+13 -2
View File
@@ -1436,6 +1436,15 @@ A character is read and point is moved to the previous occurrence
of that character. A negative count searches for subsequent
occurrences.
@item skip-csi-sequence ()
Read enough characters to consume a multi-key sequence such as those
defined for keys like Home and End. Such sequences begin with a
Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
bound to "\e[", keys producing such sequences will have no effect
unless explicitly bound to a readline command, instead of inserting
stray characters into the editing buffer. This is unbound by default,
but usually bound to ESC-[.
@item insert-comment (M-#)
Without a numeric argument, the value of the @code{comment-begin}
variable is inserted at the beginning of the current line.
@@ -1707,11 +1716,13 @@ For instance, assuming that there is a library of compspecs, each kept in a
file corresponding to the name of the command, the following default
completion function would load completions dynamically:
@example
_completion_loader()
{
@{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
}
@}
complete -D -F _completion_loader
@end example
@node Programmable Completion Builtins
@section Programmable Completion Builtins
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2009 Free Software Foundation, Inc.
@set EDITION 6.0
@set VERSION 6.0
@set UPDATED 31 July 2009
@set UPDATED-MONTH July 2009
@set UPDATED 22 August 2009
@set UPDATED-MONTH August 2009
@set LASTCHANGE Fri Jul 31 20:18:23 EDT 2009
@set LASTCHANGE Sat Aug 22 12:02:34 EDT 2009
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2009 Free Software Foundation, Inc.
@set EDITION 6.0
@set VERSION 6.0
@set UPDATED 30 July 2009
@set UPDATED-MONTH July 2009
@set UPDATED 22 August 2009
@set UPDATED-MONTH August 2009
@set LASTCHANGE Thu Jul 30 09:23:36 EDT 2009
@set LASTCHANGE Sat Aug 22 12:02:34 EDT 2009
+11
View File
@@ -677,6 +677,17 @@ extern rl_icppfunc_t *rl_directory_completion_hook;
yet, so it's undocumented. */
extern rl_icppfunc_t *rl_directory_rewrite_hook;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
extern rl_dequote_func_t *rl_filename_rewrite_hook;
/* Backwards compatibility with previous versions of readline. */
#define rl_symbolic_link_hook rl_directory_completion_hook
+12
View File
@@ -95,6 +95,7 @@ extern int rl_forward_word PARAMS((int, int));
extern int rl_backward_word PARAMS((int, int));
extern int rl_refresh_line PARAMS((int, int));
extern int rl_clear_screen PARAMS((int, int));
extern int rl_skip_csi_sequence PARAMS((int, int));
extern int rl_arrow_keys PARAMS((int, int));
/* Bindable commands for inserting and deleting text. */
@@ -676,6 +677,17 @@ extern rl_icppfunc_t *rl_directory_completion_hook;
yet, so it's undocumented. */
extern rl_icppfunc_t *rl_directory_rewrite_hook;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
extern rl_dequote_func_t *rl_filename_rewrite_hook;
/* Backwards compatibility with previous versions of readline. */
#define rl_symbolic_link_hook rl_directory_completion_hook
+1
View File
@@ -389,6 +389,7 @@ extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
/* display.c */
extern int _rl_vis_botlin;
+1
View File
@@ -349,6 +349,7 @@ extern void _rl_trace ();
extern int _rl_tropen PARAMS((void));
extern int _rl_abort_internal PARAMS((void));
extern int _rl_null_function PARAMS((int, int));
extern char *_rl_strindex PARAMS((const char *, const char *));
extern int _rl_qsort_string_compare PARAMS((char **, char **));
extern int (_rl_uppercase_p) PARAMS((int));
+5 -2
View File
@@ -189,10 +189,13 @@ _rl_replace_text (text, start, end)
{
int n;
n = 0;
rl_begin_undo_group ();
rl_delete_text (start, end + 1);
if (start <= end)
rl_delete_text (start, end + 1);
rl_point = start;
n = rl_insert_text (text);
if (*text)
n = rl_insert_text (text);
rl_end_undo_group ();
return n;
+9 -2
View File
@@ -91,7 +91,7 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c strstr.c \
mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
casemod.c fdprintf.c input_avail.c mbscasecmp.c
casemod.c fdprintf.c input_avail.c mbscasecmp.c fnxform.c
# The header files for this library.
HSOURCES =
@@ -105,7 +105,7 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
strtrans.o snprintf.o mailstat.o fmtulong.o \
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
fdprintf.o input_avail.o mbscasecmp.o ${LIBOBJS}
fdprintf.o input_avail.o mbscasecmp.o fnxform.o ${LIBOBJS}
SUPPORT = Makefile
@@ -145,6 +145,7 @@ fdprintf.o: fdprintf.c
fmtullong.o: fmtullong.c
fmtulong.o: fmtulong.c
fmtumax.o: fmtumax.c
fnxform.o: fnxform.c
fpurge.o: fpurge.c
getcwd.o: getcwd.c
getenv.o: getenv.c
@@ -214,6 +215,7 @@ fdprintf.o: ${BUILD_DIR}/config.h
fmtullong.o: ${BUILD_DIR}/config.h
fmtulong.o: ${BUILD_DIR}/config.h
fmtumax.o: ${BUILD_DIR}/config.h
fnxform.o: ${BUILD_DIR}/config.h
fpurge.o: ${BUILD_DIR}/config.h
getcwd.o: ${BUILD_DIR}/config.h
getenv.o: ${BUILD_DIR}/config.h
@@ -532,3 +534,8 @@ input_avail.o: ${topdir}/xmalloc.h ${BASHINCDIR}/posixselect.h
mktime.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
mktime.o: ${BASHINCDIR}/stdc.h
fnxform.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
fnxform.o: ${BASHINCDIR}/stdc.h
fnxform.o: ${topdir}/bashtypes.h
fnxform.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
+193
View File
@@ -0,0 +1,193 @@
/* fnxform - use iconv(3) to transform strings to and from "filename" format */
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashansi.h"
#include <stdio.h>
#include "bashtypes.h"
#include "stdc.h"
#include "bashintl.h"
#include <xmalloc.h>
#if defined (HAVE_ICONV)
# include <iconv.h>
#endif
#if defined (HAVE_LOCALE_CHARSET)
extern const char *locale_charset __P((void));
#endif
#if defined (HAVE_ICONV)
static iconv_t conv_fromfs = (iconv_t)-1;
static iconv_t conv_tofs = (iconv_t)-1;
#define OUTLEN_MAX 4096
static char *outbuf = 0;
static size_t outlen = 0;
static char *curencoding __P((void));
static void init_tofs __P((void));
static void init_fromfs __P((void));
static char *
curencoding ()
{
char *loc;
#if defined (HAVE_LOCALE_CHARSET)
loc = (char *)locale_charset ();
return loc;
#else
char *dot, *mod;
loc = get_locale_var ("LC_CTYPE");
if (loc == 0 || *loc == 0)
return "";
dot = strchr (loc, '.');
if (dot == 0)
return loc;
mod = strchr (dot, '@');
if (mod)
*mod = '\0';
return dot;
#endif
}
static void
init_tofs ()
{
char *cur;
cur = curencoding ();
conv_tofs = iconv_open ("UTF-8-MAC", cur);
}
static void
init_fromfs ()
{
char *cur;
cur = curencoding ();
conv_fromfs = iconv_open (cur, "UTF-8-MAC");
}
char *
fnx_tofs (string, len)
char *string;
size_t len;
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
if (conv_tofs == (iconv_t)-1)
init_tofs ();
if (conv_tofs == (iconv_t)-1)
return string;
/* Free and reallocate outbuf if it's *too* big */
if (outlen >= OUTLEN_MAX && len < OUTLEN_MAX - 8)
{
free (outbuf);
outbuf = 0;
outlen = 0;
}
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
iconv (conv_tofs, NULL, NULL, NULL, NULL);
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
return string;
*tempbuf = '\0';
return outbuf;
#else
return string;
#endif
}
char *
fnx_fromfs (string, len)
char *string;
size_t len;
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
if (conv_fromfs == (iconv_t)-1)
init_fromfs ();
if (conv_fromfs == (iconv_t)-1)
return string;
/* Free and reallocate outbuf if it's *too* big */
if (outlen >= OUTLEN_MAX && len < OUTLEN_MAX - 8)
{
free (outbuf);
outbuf = 0;
outlen = 0;
}
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
iconv (conv_fromfs, NULL, NULL, NULL, NULL);
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
return string;
*tempbuf = '\0';
return outbuf;
#else
return string;
#endif
}
#else
char *
fnx_tofs (string)
char *string;
{
return string;
}
char *
fnx_fromfs (string)
char *string;
{
return string;
}
#endif
+175
View File
@@ -0,0 +1,175 @@
/* fnxform - use iconv(3) to transform strings to and from "filename" format */
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashansi.h"
#include <stdio.h>
#include "bashtypes.h"
#include "stdc.h"
#include "bashintl.h"
#include <xmalloc.h>
#if defined (HAVE_ICONV)
# include <iconv.h>
#endif
#if defined (HAVE_LOCALE_CHARSET)
extern const char *locale_charset __P((void));
#endif
#if defined (HAVE_ICONV)
static iconv_t conv_fromfs = (iconv_t)-1;
static iconv_t conv_tofs = (iconv_t)-1;
static char *outbuf = 0;
static size_t outlen = 0;
static char *curencoding __P((void));
static void init_tofs __P((void));
static void init_fromfs __P((void));
static char *
curencoding ()
{
char *loc;
#if defined (HAVE_LOCALE_CHARSET)
loc = (char *)locale_charset ();
return loc;
#else
char *dot, *mod;
loc = get_locale_var ("LC_CTYPE");
if (loc == 0 || *loc == 0)
return "";
dot = strchr (loc, '.');
if (dot == 0)
return loc;
mod = strchr (dot, '@');
if (mod)
*mod = '\0';
return dot;
#endif
}
static void
init_tofs ()
{
char *cur;
cur = curencoding ();
conv_tofs = iconv_open ("UTF-8-MAC", cur);
}
static void
init_fromfs ()
{
char *cur;
cur = curencoding ();
conv_fromfs = iconv_open (cur, "UTF-8-MAC");
}
char *
fnx_tofs (string, len)
char *string;
size_t len;
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
if (conv_tofs == (iconv_t)-1)
init_tofs ();
if (conv_tofs == (iconv_t)-1)
return string;
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
iconv (conv_tofs, NULL, NULL, NULL, NULL);
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
return string;
*tempbuf = '\0';
return outbuf;
#else
return string;
#endif
}
char *
fnx_fromfs (string, len)
char *string;
size_t len;
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
if (conv_fromfs == (iconv_t)-1)
init_fromfs ();
if (conv_fromfs == (iconv_t)-1)
return string;
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
iconv (conv_fromfs, NULL, NULL, NULL, NULL);
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
return string;
*tempbuf = '\0';
return outbuf;
#else
return string;
#endif
}
#else
char *
fnx_tofs (string)
char *string;
{
return string;
}
char *
fnx_fromfs (string)
char *string;
{
return string;
}
#endif
+18 -6
View File
@@ -360,16 +360,16 @@ xtrace_set (fd, fp)
{
if (fd >= 0 && sh_validfd (fd) == 0)
{
internal_error ("xtrace_set: %d: invalid file descriptor", fd);
internal_error (_("xtrace_set: %d: invalid file descriptor"), fd);
return;
}
if (fp == 0)
{
internal_error ("xtrace_set: NULL file pointer");
internal_error (_("xtrace_set: NULL file pointer"));
return;
}
if (fd >= 0 && fileno (fp) != fd)
internal_warning ("xtrace fd (%d) != fileno xtrace fp (%d)", fd, fileno (fp));
internal_warning (_("xtrace fd (%d) != fileno xtrace fp (%d)"), fd, fileno (fp));
xtrace_fd = fd;
xtrace_fp = fp;
@@ -384,14 +384,26 @@ xtrace_init ()
void
xtrace_reset ()
{
if (xtrace_fd >= 0)
if (xtrace_fd >= 0 && xtrace_fp)
{
fflush (xtrace_fp);
fclose (xtrace_fp);
}
else if (xtrace_fd >= 0)
close (xtrace_fd);
xtrace_fd = -1;
if (xtrace_fp)
fclose (xtrace_fp);
xtrace_fp = stderr;
}
void
xtrace_fdchk (fd)
int fd;
{
if (fd == xtrace_fd)
xtrace_reset ();
}
/* Return a string denoting what our indirection level is. */
char *
+3
View File
@@ -964,6 +964,8 @@ do_redirection_internal (redirect, flags)
/* dup-and-close redirection */
if (ri == r_move_input || ri == r_move_output)
{
xtrace_fdchk (redir_fd);
close (redir_fd);
#if defined (COPROCESS_SUPPORT)
coproc_fdchk (redir_fd); /* XXX - loses coproc fds */
@@ -981,6 +983,7 @@ do_redirection_internal (redirect, flags)
#if defined (COPROCESS_SUPPORT)
coproc_fdchk (redirector);
#endif
xtrace_fdchk (redirector);
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
+4 -2
View File
@@ -4665,9 +4665,11 @@ sv_xtracefd (name)
{
fp = fdopen (fd, "w");
if (fp == 0)
internal_error ("%s: %s: cannot open as FILE", name, value_cell (v));
internal_error (_("%s: %s: cannot open as FILE"), name, value_cell (v));
else
xtrace_set (fd, fp);
}
else
internal_error ("%s: %s: invalid value for trace file descriptor", name, value_cell (v));
internal_error (_("%s: %s: invalid value for trace file descriptor"), name, value_cell (v));
}
}