From: Chet Ramey Date: Sat, 3 Dec 2011 18:45:44 +0000 (-0500) Subject: commit bash-20050407 snapshot X-Git-Tag: bash-3.1-alpha~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=233564d28eb109c83e0d23cd1057c30f800e4404;p=thirdparty%2Fbash.git commit bash-20050407 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index c78f8e471..aaf010dd9 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -11280,3 +11280,50 @@ lib/readline/examples/rl.c subst.c - fix mbstrlen to treat invalid multibyte sequences as sequences of single-byte characters + + 4/8 + --- +configure.in + - default SIZE to `:' if cross-compiling and an appropriate size for + the target is not found + + 4/11 + ---- +subst.c + - change match_upattern and match_wpattern to check whether or not the + supplied pattern matches anywhere in the supplied string, prefixing + and appending the pattern with `*' if necessary. If it doesn't we + can short-circuit immediately rather than waste time doing up to + N-1 unsuccessful calls to strmatch/wcsmatch (which kills for long + strings, even if the pattern is short) + + 4/12 + ---- +configure.in + - make sure the special case for MacOS X 10.4 only kicks in if the + `--with-installed-readline' option isn't supplied + +lib/readline/{callback,readline,signals}.c + - make sure rl_prep_term_function and rl_deprep_term_function aren't + dereferenced if NULL (as the documentation says) + +builtins/mkbuiltins.c + - don't bother with the special HAVE_BCOPY code; just use straight + assignments + +builtins/ulimit.def + - use _POSIX_PIPE_BUF in pipesize() if it's defined and PIPE_BUF is + not + + 4/13 + ---- +execute_cmd.c + - add cm_function_def to the list of control structures for which + child processes are forked when pipes come in or out + + 4/14 + ---- +builtins/read.def + - make sure the ^As added for internal quoting are not counted as + characters read when -n is supplied + diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index b5835bf6d..a0b07134c 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -11276,3 +11276,47 @@ lib/readline/{complete,text}.c lib/readline/examples/rl.c - include instead of posixstat.h if READLINE_LIBRARY not defined + +subst.c + - fix mbstrlen to treat invalid multibyte sequences as sequences of + single-byte characters + + 4/8 + --- +configure.in + - default SIZE to `:' if cross-compiling and an appropriate size for + the target is not found + + 4/11 + ---- +subst.c + - change match_upattern and match_wpattern to check whether or not the + supplied pattern matches anywhere in the supplied string, prefixing + and appending the pattern with `*' if necessary. If it doesn't we + can short-circuit immediately rather than waste time doing up to + N-1 unsuccessful calls to strmatch/wcsmatch (which kills for long + strings, even if the pattern is short) + + 4/12 + ---- +configure.in + - make sure the special case for MacOS X 10.4 only kicks in if the + `--with-installed-readline' option isn't supplied + +lib/readline/{callback,readline,signals}.c + - make sure rl_prep_term_function and rl_deprep_term_function aren't + dereferenced if NULL (as the documentation says) + +builtins/mkbuiltins.c + - don't bother with the special HAVE_BCOPY code; just use straight + assignments + +builtins/ulimit.def + - use _POSIX_PIPE_BUF in pipesize() if it's defined and PIPE_BUF is + not + + 4/13 + ---- +execute_cmd.c + - add cm_function_def to the list of control structures for which + child processes are forked when pipes come in or out diff --git a/Makefile.in b/Makefile.in index c68b6d530..be20d8340 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile for bash-3.0, version 2.155 +# Makefile for bash-3.1, version 2.156 # # Copyright (C) 1996-2005 Free Software Foundation, Inc. diff --git a/Makefile.in~ b/Makefile.in~ index 62d3fc3b9..c68b6d530 100644 --- a/Makefile.in~ +++ b/Makefile.in~ @@ -1,6 +1,6 @@ # Makefile for bash-3.0, version 2.155 # -# Copyright (C) 1996-2004 Free Software Foundation, Inc. +# Copyright (C) 1996-2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index cbcb39dd1..62f115353 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,5 +1,5 @@ @%:@! /bin/sh -@%:@ From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION. +@%:@ From configure.in for Bash 3.1, version 3.174, from autoconf version AC_ACVERSION. @%:@ Guess values for system-dependent variables and create Makefiles. @%:@ Generated by GNU Autoconf 2.59 for bash 3.1-devel. @%:@ @@ -4832,13 +4832,6 @@ if test $opt_readline = yes; then @%:@define READLINE 1 _ACEOF - # section for OS versions that ship readline as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; - *) READLINE_LIB=-lreadline ;; - esac if test "$opt_with_installed_readline" != "no" ; then case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; @@ -4849,9 +4842,18 @@ _ACEOF ;; esac READLINE_DEP= + READLINE_LIB=-lreadline else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' READLINE_DEP='$(READLINE_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; + *) READLINE_LIB=-lreadline ;; + esac fi else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -4870,16 +4872,10 @@ _ACEOF _ACEOF fi - # section for OS versions that ship history as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; - *) HISTORY_LIB=-lhistory ;; - esac if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= + HISTORY_LIB=-lhistory case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; *) case "$RL_INCLUDEDIR" in @@ -4891,6 +4887,14 @@ _ACEOF else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' HISTORY_DEP='$(HISTORY_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; + *) HISTORY_LIB=-lhistory ;; + esac fi else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -5193,7 +5197,7 @@ if test x$SIZE = x; then fi done if test $size_found -eq 0; then - SIZE=size + SIZE=: fi IFS=$save_IFS fi diff --git a/autom4te.cache/requests b/autom4te.cache/requests index 1de698328..94f889948 100644 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -15,101 +15,101 @@ 'configure.in' ], { - 'AC_PROG_CPP' => 1, - 'AC_CHECK_TYPES' => 1, - 'AC_STRUCT_ST_BLOCKS' => 1, - 'AC_PROG_CC' => 1, - 'AC_TYPE_UID_T' => 1, - 'AC_PROG_MAKE_SET' => 1, - 'AC_C_VOLATILE' => 1, - 'AC_HEADER_SYS_WAIT' => 1, - 'm4_sinclude' => 1, - 'AC_FUNC_CHOWN' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AC_HEADER_DIRENT' => 1, - 'AC_FUNC_REALLOC' => 1, - 'AC_PROG_YACC' => 1, - 'AC_FUNC_MALLOC' => 1, - 'AC_CHECK_FUNCS' => 1, - 'AC_TYPE_OFF_T' => 1, + 'm4_pattern_allow' => 1, + 'm4_pattern_forbid' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_STRUCT_TM' => 1, 'AC_STRUCT_TIMEZONE' => 1, 'AC_FUNC_SELECT_ARGTYPES' => 1, - 'AC_TYPE_SIGNAL' => 1, - 'AC_HEADER_STAT' => 1, - 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_LIBSOURCE' => 1, + 'AM_CONDITIONAL' => 1, + 'AM_MAINTAINER_MODE' => 1, 'AC_FUNC_GETLOADAVG' => 1, - 'AC_FUNC_MKTIME' => 1, - 'AC_STRUCT_TM' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AC_CHECK_LIB' => 1, - 'AC_HEADER_STDC' => 1, 'AC_FUNC_WAIT3' => 1, - 'AC_PROG_RANLIB' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_PROG_INSTALL' => 1, - 'AC_C_CONST' => 1, + 'AC_FUNC_STRERROR_R' => 1, 'AC_FUNC_MBRTOWC' => 1, - 'AC_FUNC_STRCOLL' => 1, - 'AC_FUNC_STRTOD' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_CHECK_FUNCS' => 1, + 'AC_HEADER_TIME' => 1, + 'AC_PROG_CPP' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'm4_include' => 1, + '_m4_warn' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_CHECK_TYPES' => 1, + 'AC_HEADER_DIRENT' => 1, + 'm4_sinclude' => 1, 'AC_CONFIG_SUBDIRS' => 1, - 'AC_PROG_LN_S' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_CHECK_LIB' => 1, + 'AH_OUTPUT' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_CONFIG_AUX_DIR' => 1, 'AC_FUNC_UTIME_NULL' => 1, - 'AC_FUNC_GETMNTENT' => 1, - 'AC_LIBSOURCE' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_C_CONST' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, 'AC_FUNC_CLOSEDIR_VOID' => 1, - 'AC_FUNC_MMAP' => 1, - 'AC_FUNC_GETPGRP' => 1, - 'AC_TYPE_MODE_T' => 1, - 'AC_FUNC_OBSTACK' => 1, - 'AC_FUNC_VPRINTF' => 1, - 'AC_C_INLINE' => 1, - 'm4_pattern_allow' => 1, - 'AH_OUTPUT' => 1, - 'AM_CONDITIONAL' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AC_PATH_X' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AC_TYPE_UID_T' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, 'AM_AUTOMAKE_VERSION' => 1, - 'AC_PROG_CXX' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_PROG_RANLIB' => 1, + 'AC_PROG_LEX' => 1, + 'sinclude' => 1, 'AC_FUNC_FORK' => 1, - 'AC_FUNC_FSEEKO' => 1, - 'AC_FUNC_MEMCMP' => 1, - 'AM_GNU_GETTEXT' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_HEADER_MAJOR' => 1, 'AC_CONFIG_HEADERS' => 1, - 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_PROG_INSTALL' => 1, 'AC_FUNC_STRNLEN' => 1, - 'AC_CANONICAL_HOST' => 1, - 'AC_INIT' => 1, - 'AC_CHECK_MEMBERS' => 1, - 'm4_pattern_forbid' => 1, - 'AC_TYPE_SIZE_T' => 1, 'AC_SUBST' => 1, - '_m4_warn' => 1, - 'AC_PROG_GCC_TRADITIONAL' => 1, - 'sinclude' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_C_INLINE' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, 'AC_CONFIG_FILES' => 1, - 'AC_TYPE_PID_T' => 1, - 'AC_FUNC_SETVBUF_REVERSED' => 1, - 'AC_REPLACE_FNMATCH' => 1, - 'AC_FUNC_GETGROUPS' => 1, - 'AM_PROG_CC_C_O' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_PROG_LN_S' => 1, 'AC_PROG_AWK' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_PROG_YACC' => 1, + 'AC_PROG_CC' => 1, + 'AC_PROG_CXX' => 1, 'AC_FUNC_STRFTIME' => 1, - 'AC_HEADER_TIME' => 1, - 'AC_FUNC_STRERROR_R' => 1, - 'AC_PATH_X' => 1, - 'AC_CONFIG_LINKS' => 1, - 'include' => 1, + 'AC_INIT' => 1, + 'AC_FUNC_REALLOC' => 1, 'AC_CANONICAL_SYSTEM' => 1, - 'AC_FUNC_SETPGRP' => 1, - 'AC_FUNC_STAT' => 1, - 'AC_CHECK_HEADERS' => 1, - 'AC_PROG_LEX' => 1, - 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, - 'm4_include' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'AC_FUNC_ALLOCA' => 1 + 'AC_FUNC_OBSTACK' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AC_TYPE_MODE_T' => 1, + 'include' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AC_CHECK_HEADERS' => 1 } ], 'Autom4te::Request' ) ); diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 index 2a57d28de..2a4b40b29 100644 --- a/autom4te.cache/traces.0 +++ b/autom4te.cache/traces.0 @@ -341,1156 +341,1156 @@ m4trace:configure.in:474: -1- AC_SUBST([RL_VERSION]) m4trace:configure.in:474: -1- AC_SUBST([RL_MAJOR]) m4trace:configure.in:474: -1- AC_SUBST([RL_MINOR]) m4trace:configure.in:486: -1- AC_DEFINE_TRACE_LITERAL([READLINE]) -m4trace:configure.in:514: -1- AC_DEFINE_TRACE_LITERAL([HISTORY]) -m4trace:configure.in:517: -1- AC_DEFINE_TRACE_LITERAL([BANG_HISTORY]) -m4trace:configure.in:545: -1- AC_SUBST([READLINE_LIB]) -m4trace:configure.in:546: -1- AC_SUBST([READLINE_DEP]) -m4trace:configure.in:547: -1- AC_SUBST([RL_LIBDIR]) -m4trace:configure.in:548: -1- AC_SUBST([RL_INCLUDEDIR]) -m4trace:configure.in:549: -1- AC_SUBST([RL_INCLUDE]) -m4trace:configure.in:550: -1- AC_SUBST([HISTORY_LIB]) -m4trace:configure.in:551: -1- AC_SUBST([HISTORY_DEP]) -m4trace:configure.in:552: -1- AC_SUBST([HIST_LIBDIR]) -m4trace:configure.in:557: -1- AC_PROG_INSTALL -m4trace:configure.in:557: -1- AC_SUBST([INSTALL_PROGRAM]) -m4trace:configure.in:557: -1- AC_SUBST([INSTALL_SCRIPT]) -m4trace:configure.in:557: -1- AC_SUBST([INSTALL_DATA]) -m4trace:configure.in:558: -1- AC_SUBST([AR]) -m4trace:configure.in:562: -1- AC_PROG_RANLIB -m4trace:configure.in:562: -1- AC_SUBST([RANLIB]) -m4trace:configure.in:562: -1- AC_SUBST([ac_ct_RANLIB]) -m4trace:configure.in:563: -1- AC_PROG_YACC -m4trace:configure.in:563: -1- AC_SUBST([YACC]) -m4trace:configure.in:564: -1- AC_PROG_MAKE_SET -m4trace:configure.in:564: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.in:570: -1- AC_SUBST([MAKE_SHELL]) -m4trace:configure.in:592: -1- AC_SUBST([SIZE]) -m4trace:configure.in:595: -1- AC_DEFINE_TRACE_LITERAL([_GNU_SOURCE]) -m4trace:configure.in:598: -1- AC_C_CONST -m4trace:configure.in:598: -1- AC_DEFINE_TRACE_LITERAL([const]) -m4trace:configure.in:598: -1- AH_OUTPUT([const], [/* Define to empty if `const\' does not conform to ANSI C. */ +m4trace:configure.in:516: -1- AC_DEFINE_TRACE_LITERAL([HISTORY]) +m4trace:configure.in:519: -1- AC_DEFINE_TRACE_LITERAL([BANG_HISTORY]) +m4trace:configure.in:549: -1- AC_SUBST([READLINE_LIB]) +m4trace:configure.in:550: -1- AC_SUBST([READLINE_DEP]) +m4trace:configure.in:551: -1- AC_SUBST([RL_LIBDIR]) +m4trace:configure.in:552: -1- AC_SUBST([RL_INCLUDEDIR]) +m4trace:configure.in:553: -1- AC_SUBST([RL_INCLUDE]) +m4trace:configure.in:554: -1- AC_SUBST([HISTORY_LIB]) +m4trace:configure.in:555: -1- AC_SUBST([HISTORY_DEP]) +m4trace:configure.in:556: -1- AC_SUBST([HIST_LIBDIR]) +m4trace:configure.in:561: -1- AC_PROG_INSTALL +m4trace:configure.in:561: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:561: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:561: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:562: -1- AC_SUBST([AR]) +m4trace:configure.in:566: -1- AC_PROG_RANLIB +m4trace:configure.in:566: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:566: -1- AC_SUBST([ac_ct_RANLIB]) +m4trace:configure.in:567: -1- AC_PROG_YACC +m4trace:configure.in:567: -1- AC_SUBST([YACC]) +m4trace:configure.in:568: -1- AC_PROG_MAKE_SET +m4trace:configure.in:568: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:574: -1- AC_SUBST([MAKE_SHELL]) +m4trace:configure.in:596: -1- AC_SUBST([SIZE]) +m4trace:configure.in:599: -1- AC_DEFINE_TRACE_LITERAL([_GNU_SOURCE]) +m4trace:configure.in:602: -1- AC_C_CONST +m4trace:configure.in:602: -1- AC_DEFINE_TRACE_LITERAL([const]) +m4trace:configure.in:602: -1- AH_OUTPUT([const], [/* Define to empty if `const\' does not conform to ANSI C. */ #undef const]) -m4trace:configure.in:599: -1- AC_C_INLINE -m4trace:configure.in:599: -1- AH_OUTPUT([inline], [/* Define to `__inline__\' or `__inline\' if that\'s what the C compiler +m4trace:configure.in:603: -1- AC_C_INLINE +m4trace:configure.in:603: -1- AH_OUTPUT([inline], [/* Define to `__inline__\' or `__inline\' if that\'s what the C compiler calls it, or to nothing if \'inline\' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif]) -m4trace:configure.in:600: -1- AC_DEFINE_TRACE_LITERAL([WORDS_BIGENDIAN]) -m4trace:configure.in:600: -1- AH_OUTPUT([WORDS_BIGENDIAN], [/* Define to 1 if your processor stores words with the most significant byte +m4trace:configure.in:604: -1- AC_DEFINE_TRACE_LITERAL([WORDS_BIGENDIAN]) +m4trace:configure.in:604: -1- AH_OUTPUT([WORDS_BIGENDIAN], [/* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN]) -m4trace:configure.in:601: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRINGIZE]) -m4trace:configure.in:601: -1- AH_OUTPUT([HAVE_STRINGIZE], [/* Define to 1 if cpp supports the ANSI @%:@ stringizing operator. */ +m4trace:configure.in:605: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRINGIZE]) +m4trace:configure.in:605: -1- AH_OUTPUT([HAVE_STRINGIZE], [/* Define to 1 if cpp supports the ANSI @%:@ stringizing operator. */ #undef HAVE_STRINGIZE]) -m4trace:configure.in:602: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LONG_DOUBLE]) -m4trace:configure.in:602: -1- AH_OUTPUT([HAVE_LONG_DOUBLE], [/* Define to 1 if long double works and has more range or precision than +m4trace:configure.in:606: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LONG_DOUBLE]) +m4trace:configure.in:606: -1- AH_OUTPUT([HAVE_LONG_DOUBLE], [/* Define to 1 if long double works and has more range or precision than double. */ #undef HAVE_LONG_DOUBLE]) -m4trace:configure.in:603: -1- AC_DEFINE_TRACE_LITERAL([PROTOTYPES]) -m4trace:configure.in:603: -1- AH_OUTPUT([PROTOTYPES], [/* Define to 1 if the C compiler supports function prototypes. */ +m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([PROTOTYPES]) +m4trace:configure.in:607: -1- AH_OUTPUT([PROTOTYPES], [/* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES]) -m4trace:configure.in:603: -1- AC_DEFINE_TRACE_LITERAL([__PROTOTYPES]) -m4trace:configure.in:603: -1- AH_OUTPUT([__PROTOTYPES], [/* Define like PROTOTYPES; this can be used by system headers. */ +m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([__PROTOTYPES]) +m4trace:configure.in:607: -1- AH_OUTPUT([__PROTOTYPES], [/* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES]) -m4trace:configure.in:604: -1- AH_OUTPUT([__CHAR_UNSIGNED__], [/* Define to 1 if type `char\' is unsigned and you are not using gcc. */ +m4trace:configure.in:608: -1- AH_OUTPUT([__CHAR_UNSIGNED__], [/* Define to 1 if type `char\' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif]) -m4trace:configure.in:604: -1- AC_DEFINE_TRACE_LITERAL([__CHAR_UNSIGNED__]) -m4trace:configure.in:607: -1- AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl]) -m4trace:configure.in:607: -1- AC_SUBST([MKINSTALLDIRS]) -m4trace:configure.in:607: -1- AC_SUBST([USE_NLS]) -m4trace:configure.in:607: -1- AC_SUBST([MSGFMT]) -m4trace:configure.in:607: -1- AC_SUBST([GMSGFMT], [$ac_cv_path_GMSGFMT]) -m4trace:configure.in:607: -1- AC_SUBST([XGETTEXT]) -m4trace:configure.in:607: -1- AC_SUBST([MSGMERGE]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_OUTPUT_COMMANDS' is obsolete. +m4trace:configure.in:608: -1- AC_DEFINE_TRACE_LITERAL([__CHAR_UNSIGNED__]) +m4trace:configure.in:611: -1- AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl]) +m4trace:configure.in:611: -1- AC_SUBST([MKINSTALLDIRS]) +m4trace:configure.in:611: -1- AC_SUBST([USE_NLS]) +m4trace:configure.in:611: -1- AC_SUBST([MSGFMT]) +m4trace:configure.in:611: -1- AC_SUBST([GMSGFMT], [$ac_cv_path_GMSGFMT]) +m4trace:configure.in:611: -1- AC_SUBST([XGETTEXT]) +m4trace:configure.in:611: -1- AC_SUBST([MSGMERGE]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_OUTPUT_COMMANDS' is obsolete. You should run autoupdate.], [autoconf/status.m4:318: AC_OUTPUT_COMMANDS is expanded from... aclocal.m4:3779: AM_PO_SUBDIRS is expanded from... -configure.in:607: AM_PO_SUBDIRS is required by... +configure.in:611: AM_PO_SUBDIRS is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -3- _m4_warn([obsolete], [The macro `_AC_OUTPUT_COMMANDS_CNT' is obsolete. +configure.in:611: the top level]) +m4trace:configure.in:611: -3- _m4_warn([obsolete], [The macro `_AC_OUTPUT_COMMANDS_CNT' is obsolete. You should run autoupdate.], [autoconf/status.m4:321: _AC_OUTPUT_COMMANDS_CNT is expanded from... autoconf/status.m4:318: AC_OUTPUT_COMMANDS is expanded from... aclocal.m4:3779: AM_PO_SUBDIRS is expanded from... -configure.in:607: AM_PO_SUBDIRS is required by... +configure.in:611: AM_PO_SUBDIRS is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_TYPE_OFF_T -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([off_t]) -m4trace:configure.in:607: -1- AH_OUTPUT([off_t], [/* Define to `long\' if does not define. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_TYPE_OFF_T +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([off_t]) +m4trace:configure.in:611: -1- AH_OUTPUT([off_t], [/* Define to `long\' if does not define. */ #undef off_t]) -m4trace:configure.in:607: -1- AC_TYPE_SIZE_T -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([size_t]) -m4trace:configure.in:607: -1- AH_OUTPUT([size_t], [/* Define to `unsigned\' if does not define. */ +m4trace:configure.in:611: -1- AC_TYPE_SIZE_T +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([size_t]) +m4trace:configure.in:611: -1- AH_OUTPUT([size_t], [/* Define to `unsigned\' if does not define. */ #undef size_t]) -m4trace:configure.in:607: -1- AC_FUNC_ALLOCA -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have and it should be used (not on Ultrix). +m4trace:configure.in:611: -1- AC_FUNC_ALLOCA +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */ +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */ #undef HAVE_ALLOCA]) -m4trace:configure.in:607: -1- AC_LIBSOURCE([alloca.c]) -m4trace:configure.in:607: -1- AC_SUBST([ALLOCA], [alloca.$ac_objext]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA]) -m4trace:configure.in:607: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */ +m4trace:configure.in:611: -1- AC_LIBSOURCE([alloca.c]) +m4trace:configure.in:611: -1- AC_SUBST([ALLOCA], [alloca.$ac_objext]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA]) +m4trace:configure.in:611: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */ #undef C_ALLOCA]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END]) -m4trace:configure.in:607: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END]) +m4trace:configure.in:611: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c\' support on those systems. */ #undef CRAY_STACKSEG_END]) -m4trace:configure.in:607: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the +m4trace:configure.in:611: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @%:@undef STACK_DIRECTION]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION]) -m4trace:configure.in:607: -1- AC_FUNC_MMAP -m4trace:configure.in:607: -1- AC_CHECK_HEADERS([stdlib.h unistd.h]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION]) +m4trace:configure.in:611: -1- AC_FUNC_MMAP +m4trace:configure.in:611: -1- AC_CHECK_HEADERS([stdlib.h unistd.h]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H]) -m4trace:configure.in:607: -1- AC_CHECK_FUNCS([getpagesize]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ +m4trace:configure.in:611: -1- AC_CHECK_FUNCS([getpagesize]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ #undef HAVE_GETPAGESIZE]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MMAP]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_MMAP], [/* Define to 1 if you have a working `mmap\' system call. */ +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MMAP]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_MMAP], [/* Define to 1 if you have a working `mmap\' system call. */ #undef HAVE_MMAP]) -m4trace:configure.in:607: -1- AC_SUBST([GLIBC21]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +m4trace:configure.in:611: -1- AC_SUBST([GLIBC21]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2572: gt_INTDIV0 is expanded from... -configure.in:607: gt_INTDIV0 is required by... +configure.in:611: gt_INTDIV0 is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([INTDIV0_RAISES_SIGFPE]) -m4trace:configure.in:607: -1- AH_OUTPUT([INTDIV0_RAISES_SIGFPE], [/* Define if integer division by zero raises signal SIGFPE. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([INTDIV0_RAISES_SIGFPE]) +m4trace:configure.in:611: -1- AH_OUTPUT([INTDIV0_RAISES_SIGFPE], [/* Define if integer division by zero raises signal SIGFPE. */ #undef INTDIV0_RAISES_SIGFPE]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2627: jm_AC_HEADER_INTTYPES_H is expanded from... -configure.in:607: jm_AC_HEADER_INTTYPES_H is required by... +configure.in:611: jm_AC_HEADER_INTTYPES_H is required by... aclocal.m4:3930: jm_AC_TYPE_UINTMAX_T is expanded from... -configure.in:607: jm_AC_TYPE_UINTMAX_T is required by... +configure.in:611: jm_AC_TYPE_UINTMAX_T is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H_WITH_UINTMAX]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_INTTYPES_H_WITH_UINTMAX], [/* Define if exists, doesn\'t clash with , and +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H_WITH_UINTMAX]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_INTTYPES_H_WITH_UINTMAX], [/* Define if exists, doesn\'t clash with , and declares uintmax_t. */ #undef HAVE_INTTYPES_H_WITH_UINTMAX]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:3898: jm_AC_HEADER_STDINT_H is expanded from... -configure.in:607: jm_AC_HEADER_STDINT_H is required by... +configure.in:611: jm_AC_HEADER_STDINT_H is required by... aclocal.m4:3930: jm_AC_TYPE_UINTMAX_T is expanded from... -configure.in:607: jm_AC_TYPE_UINTMAX_T is required by... +configure.in:611: jm_AC_TYPE_UINTMAX_T is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDINT_H_WITH_UINTMAX]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STDINT_H_WITH_UINTMAX], [/* Define if exists, doesn\'t clash with , and declares +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STDINT_H_WITH_UINTMAX]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STDINT_H_WITH_UINTMAX], [/* Define if exists, doesn\'t clash with , and declares uintmax_t. */ #undef HAVE_STDINT_H_WITH_UINTMAX]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:3953: jm_AC_TYPE_UNSIGNED_LONG_LONG is expanded from... -configure.in:607: jm_AC_TYPE_UNSIGNED_LONG_LONG is required by... +configure.in:611: jm_AC_TYPE_UNSIGNED_LONG_LONG is required by... aclocal.m4:3930: jm_AC_TYPE_UINTMAX_T is expanded from... -configure.in:607: jm_AC_TYPE_UINTMAX_T is required by... +configure.in:611: jm_AC_TYPE_UINTMAX_T is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNSIGNED_LONG_LONG]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_UNSIGNED_LONG_LONG], [/* Define if you have the unsigned long long type. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNSIGNED_LONG_LONG]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_UNSIGNED_LONG_LONG], [/* Define if you have the unsigned long long type. */ #undef HAVE_UNSIGNED_LONG_LONG]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([uintmax_t]) -m4trace:configure.in:607: -1- AH_OUTPUT([uintmax_t], [/* Define to unsigned long or unsigned long long if and +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([uintmax_t]) +m4trace:configure.in:611: -1- AH_OUTPUT([uintmax_t], [/* Define to unsigned long or unsigned long long if and don\'t define. */ #undef uintmax_t]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UINTMAX_T]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_UINTMAX_T], [/* Define if you have the \'uintmax_t\' type in or . */ +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UINTMAX_T]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_UINTMAX_T], [/* Define if you have the \'uintmax_t\' type in or . */ #undef HAVE_UINTMAX_T]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2599: gt_HEADER_INTTYPES_H is expanded from... -configure.in:607: gt_HEADER_INTTYPES_H is required by... +configure.in:611: gt_HEADER_INTTYPES_H is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define if exists and doesn\'t clash with . */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INTTYPES_H]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define if exists and doesn\'t clash with . */ #undef HAVE_INTTYPES_H]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2659: gt_INTTYPES_PRI is expanded from... -configure.in:607: gt_INTTYPES_PRI is required by... +configure.in:611: gt_INTTYPES_PRI is required by... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([PRI_MACROS_BROKEN]) -m4trace:configure.in:607: -1- AH_OUTPUT([PRI_MACROS_BROKEN], [/* Define if exists and defines unusable PRI* macros. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([PRI_MACROS_BROKEN]) +m4trace:configure.in:611: -1- AH_OUTPUT([PRI_MACROS_BROKEN], [/* Define if exists and defines unusable PRI* macros. */ #undef PRI_MACROS_BROKEN]) -m4trace:configure.in:607: -1- AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +m4trace:configure.in:611: -1- AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_ARGZ_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_ARGZ_H], [/* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_LOCALE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_LOCALE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_NL_TYPES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_NL_TYPES_H], [/* Define to 1 if you have the header file. */ #undef HAVE_NL_TYPES_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STDDEF_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STDDEF_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STRING_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H]) -m4trace:configure.in:607: -1- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +m4trace:configure.in:611: -1- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ __fsetlocking]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_FEOF_UNLOCKED], [/* Define to 1 if you have the `feof_unlocked\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_FEOF_UNLOCKED], [/* Define to 1 if you have the `feof_unlocked\' function. */ #undef HAVE_FEOF_UNLOCKED]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_FGETS_UNLOCKED], [/* Define to 1 if you have the `fgets_unlocked\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_FGETS_UNLOCKED], [/* Define to 1 if you have the `fgets_unlocked\' function. */ #undef HAVE_FGETS_UNLOCKED]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETC_UNLOCKED], [/* Define to 1 if you have the `getc_unlocked\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETC_UNLOCKED], [/* Define to 1 if you have the `getc_unlocked\' function. */ #undef HAVE_GETC_UNLOCKED]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETCWD], [/* Define to 1 if you have the `getcwd\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETCWD], [/* Define to 1 if you have the `getcwd\' function. */ #undef HAVE_GETCWD]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETEGID], [/* Define to 1 if you have the `getegid\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETEGID], [/* Define to 1 if you have the `getegid\' function. */ #undef HAVE_GETEGID]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETEUID], [/* Define to 1 if you have the `geteuid\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETEUID], [/* Define to 1 if you have the `geteuid\' function. */ #undef HAVE_GETEUID]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETGID], [/* Define to 1 if you have the `getgid\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETGID], [/* Define to 1 if you have the `getgid\' function. */ #undef HAVE_GETGID]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETUID], [/* Define to 1 if you have the `getuid\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETUID], [/* Define to 1 if you have the `getuid\' function. */ #undef HAVE_GETUID]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_MEMPCPY], [/* Define to 1 if you have the `mempcpy\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_MEMPCPY], [/* Define to 1 if you have the `mempcpy\' function. */ #undef HAVE_MEMPCPY]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_MUNMAP], [/* Define to 1 if you have the `munmap\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_MUNMAP], [/* Define to 1 if you have the `munmap\' function. */ #undef HAVE_MUNMAP]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_PUTENV], [/* Define to 1 if you have the `putenv\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_PUTENV], [/* Define to 1 if you have the `putenv\' function. */ #undef HAVE_PUTENV]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_SETENV], [/* Define to 1 if you have the `setenv\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_SETENV], [/* Define to 1 if you have the `setenv\' function. */ #undef HAVE_SETENV]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_SETLOCALE], [/* Define to 1 if you have the `setlocale\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_SETLOCALE], [/* Define to 1 if you have the `setlocale\' function. */ #undef HAVE_SETLOCALE]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STPCPY], [/* Define to 1 if you have the `stpcpy\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STPCPY], [/* Define to 1 if you have the `stpcpy\' function. */ #undef HAVE_STPCPY]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */ #undef HAVE_STRCASECMP]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */ #undef HAVE_STRDUP]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_STRTOUL], [/* Define to 1 if you have the `strtoul\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_STRTOUL], [/* Define to 1 if you have the `strtoul\' function. */ #undef HAVE_STRTOUL]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_TSEARCH], [/* Define to 1 if you have the `tsearch\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_TSEARCH], [/* Define to 1 if you have the `tsearch\' function. */ #undef HAVE_TSEARCH]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE___ARGZ_COUNT], [/* Define to 1 if you have the `__argz_count\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE___ARGZ_COUNT], [/* Define to 1 if you have the `__argz_count\' function. */ #undef HAVE___ARGZ_COUNT]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE___ARGZ_STRINGIFY], [/* Define to 1 if you have the `__argz_stringify\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE___ARGZ_STRINGIFY], [/* Define to 1 if you have the `__argz_stringify\' function. */ #undef HAVE___ARGZ_STRINGIFY]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE___ARGZ_NEXT], [/* Define to 1 if you have the `__argz_next\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE___ARGZ_NEXT], [/* Define to 1 if you have the `__argz_next\' function. */ #undef HAVE___ARGZ_NEXT]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE___FSETLOCKING], [/* Define to 1 if you have the `__fsetlocking\' function. */ +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE___FSETLOCKING], [/* Define to 1 if you have the `__fsetlocking\' function. */ #undef HAVE___FSETLOCKING]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2472: AM_ICONV_LINK is expanded from... aclocal.m4:2500: AM_ICONV is expanded from... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:611: the top level]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2472: AM_ICONV_LINK is expanded from... aclocal.m4:2500: AM_ICONV is expanded from... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ICONV]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_ICONV], [/* Define if you have the iconv() function. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ICONV]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_ICONV], [/* Define if you have the iconv() function. */ #undef HAVE_ICONV]) -m4trace:configure.in:607: -1- AC_SUBST([LIBICONV]) -m4trace:configure.in:607: -1- AC_SUBST([LTLIBICONV]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:611: -1- AC_SUBST([LIBICONV]) +m4trace:configure.in:611: -1- AC_SUBST([LTLIBICONV]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:2500: AM_ICONV is expanded from... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([ICONV_CONST]) -m4trace:configure.in:607: -1- AH_OUTPUT([ICONV_CONST], [/* Define as const if the declaration of iconv() needs const. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([ICONV_CONST]) +m4trace:configure.in:611: -1- AH_OUTPUT([ICONV_CONST], [/* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:1950: AM_LANGINFO_CODESET is expanded from... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_LANGINFO_CODESET], [/* Define if you have and nl_langinfo(CODESET). */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_LANGINFO_CODESET], [/* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2717: AM_LC_MESSAGES is expanded from... aclocal.m4:2361: AM_INTL_SUBDIR is expanded from... -configure.in:607: AM_INTL_SUBDIR is required by... +configure.in:611: AM_INTL_SUBDIR is required by... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LC_MESSAGES]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_LC_MESSAGES], [/* Define if your file defines LC_MESSAGES. */ +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LC_MESSAGES]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_LC_MESSAGES], [/* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES]) -m4trace:configure.in:607: -1- AC_SUBST([INTLBISON]) -m4trace:configure.in:607: -1- AC_SUBST([USE_NLS]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:611: -1- AC_SUBST([INTLBISON]) +m4trace:configure.in:611: -1- AC_SUBST([USE_NLS]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:611: the top level]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:611: the top level]) +m4trace:configure.in:611: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:2291: AM_GNU_GETTEXT is expanded from... -configure.in:607: the top level]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([ENABLE_NLS]) -m4trace:configure.in:607: -1- AH_OUTPUT([ENABLE_NLS], [/* Define to 1 if translation of program messages to the user\'s native +configure.in:611: the top level]) +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([ENABLE_NLS]) +m4trace:configure.in:611: -1- AH_OUTPUT([ENABLE_NLS], [/* Define to 1 if translation of program messages to the user\'s native language is requested. */ #undef ENABLE_NLS]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETTEXT]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_GETTEXT], [/* Define if the GNU gettext() function is already present or preinstalled. */ +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETTEXT]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_GETTEXT], [/* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT]) -m4trace:configure.in:607: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DCGETTEXT]) -m4trace:configure.in:607: -1- AH_OUTPUT([HAVE_DCGETTEXT], [/* Define if the GNU dcgettext() function is already present or preinstalled. +m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DCGETTEXT]) +m4trace:configure.in:611: -1- AH_OUTPUT([HAVE_DCGETTEXT], [/* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT]) -m4trace:configure.in:607: -1- AC_SUBST([BUILD_INCLUDED_LIBINTL]) -m4trace:configure.in:607: -1- AC_SUBST([USE_INCLUDED_LIBINTL]) -m4trace:configure.in:607: -1- AC_SUBST([CATOBJEXT]) -m4trace:configure.in:607: -1- AC_SUBST([DATADIRNAME]) -m4trace:configure.in:607: -1- AC_SUBST([INSTOBJEXT]) -m4trace:configure.in:607: -1- AC_SUBST([GENCAT]) -m4trace:configure.in:607: -1- AC_SUBST([INTLOBJS]) -m4trace:configure.in:607: -1- AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) -m4trace:configure.in:607: -1- AC_SUBST([INTLLIBS]) -m4trace:configure.in:607: -1- AC_SUBST([LIBINTL]) -m4trace:configure.in:607: -1- AC_SUBST([LTLIBINTL]) -m4trace:configure.in:607: -1- AC_SUBST([POSUB]) -m4trace:configure.in:610: -1- AC_HEADER_DIRENT -m4trace:configure.in:610: -1- AH_OUTPUT([HAVE_DIRENT_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. +m4trace:configure.in:611: -1- AC_SUBST([BUILD_INCLUDED_LIBINTL]) +m4trace:configure.in:611: -1- AC_SUBST([USE_INCLUDED_LIBINTL]) +m4trace:configure.in:611: -1- AC_SUBST([CATOBJEXT]) +m4trace:configure.in:611: -1- AC_SUBST([DATADIRNAME]) +m4trace:configure.in:611: -1- AC_SUBST([INSTOBJEXT]) +m4trace:configure.in:611: -1- AC_SUBST([GENCAT]) +m4trace:configure.in:611: -1- AC_SUBST([INTLOBJS]) +m4trace:configure.in:611: -1- AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) +m4trace:configure.in:611: -1- AC_SUBST([INTLLIBS]) +m4trace:configure.in:611: -1- AC_SUBST([LIBINTL]) +m4trace:configure.in:611: -1- AC_SUBST([LTLIBINTL]) +m4trace:configure.in:611: -1- AC_SUBST([POSUB]) +m4trace:configure.in:614: -1- AC_HEADER_DIRENT +m4trace:configure.in:614: -1- AH_OUTPUT([HAVE_DIRENT_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. */ #undef HAVE_DIRENT_H]) -m4trace:configure.in:610: -1- AH_OUTPUT([HAVE_SYS_NDIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. +m4trace:configure.in:614: -1- AH_OUTPUT([HAVE_SYS_NDIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. */ #undef HAVE_SYS_NDIR_H]) -m4trace:configure.in:610: -1- AH_OUTPUT([HAVE_SYS_DIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. +m4trace:configure.in:614: -1- AH_OUTPUT([HAVE_SYS_DIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. */ #undef HAVE_SYS_DIR_H]) -m4trace:configure.in:610: -1- AH_OUTPUT([HAVE_NDIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. */ +m4trace:configure.in:614: -1- AH_OUTPUT([HAVE_NDIR_H], [/* Define to 1 if you have the header file, and it defines `DIR\'. */ #undef HAVE_NDIR_H]) -m4trace:configure.in:611: -1- AC_HEADER_TIME -m4trace:configure.in:611: -1- AC_DEFINE_TRACE_LITERAL([TIME_WITH_SYS_TIME]) -m4trace:configure.in:611: -1- AH_OUTPUT([TIME_WITH_SYS_TIME], [/* Define to 1 if you can safely include both and . */ +m4trace:configure.in:615: -1- AC_HEADER_TIME +m4trace:configure.in:615: -1- AC_DEFINE_TRACE_LITERAL([TIME_WITH_SYS_TIME]) +m4trace:configure.in:615: -1- AH_OUTPUT([TIME_WITH_SYS_TIME], [/* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME]) -m4trace:configure.in:613: -1- AC_CHECK_HEADERS([inttypes.h]) -m4trace:configure.in:613: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:617: -1- AC_CHECK_HEADERS([inttypes.h]) +m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H]) -m4trace:configure.in:617: -1- AC_CHECK_HEADERS([unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ +m4trace:configure.in:621: -1- AC_CHECK_HEADERS([unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ memory.h locale.h termcap.h termio.h termios.h dlfcn.h \ stddef.h stdint.h netdb.h grp.h strings.h regex.h]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STDARG_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STDARG_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_VARARGS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_VARARGS_H], [/* Define to 1 if you have the header file. */ #undef HAVE_VARARGS_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_LIMITS_H], [/* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STRING_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_LOCALE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_LOCALE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_TERMCAP_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_TERMCAP_H], [/* Define to 1 if you have the header file. */ #undef HAVE_TERMCAP_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_TERMIO_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_TERMIO_H], [/* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_TERMIOS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_TERMIOS_H], [/* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STDDEF_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STDDEF_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_NETDB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_NETDB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_GRP_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_GRP_H], [/* Define to 1 if you have the header file. */ #undef HAVE_GRP_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H]) -m4trace:configure.in:617: -1- AH_OUTPUT([HAVE_REGEX_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_REGEX_H], [/* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H]) -m4trace:configure.in:620: -1- AC_CHECK_HEADERS([sys/pte.h sys/stream.h sys/select.h sys/file.h \ +m4trace:configure.in:624: -1- AC_CHECK_HEADERS([sys/pte.h sys/stream.h sys/select.h sys/file.h \ sys/resource.h sys/param.h sys/socket.h sys/stat.h \ sys/time.h sys/times.h sys/types.h sys/wait.h]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_PTE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_PTE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PTE_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_STREAM_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_STREAM_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STREAM_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_SELECT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_SELECT_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_FILE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_FILE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_RESOURCE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_RESOURCE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_PARAM_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_TIMES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_TIMES_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H]) -m4trace:configure.in:620: -1- AH_OUTPUT([HAVE_SYS_WAIT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:624: -1- AH_OUTPUT([HAVE_SYS_WAIT_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H]) -m4trace:configure.in:621: -1- AC_CHECK_HEADERS([netinet/in.h arpa/inet.h]) -m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:625: -1- AC_CHECK_HEADERS([netinet/in.h arpa/inet.h]) +m4trace:configure.in:625: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H]) -m4trace:configure.in:621: -1- AH_OUTPUT([HAVE_ARPA_INET_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:625: -1- AH_OUTPUT([HAVE_ARPA_INET_H], [/* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H]) -m4trace:configure.in:632: -1- AC_FUNC_ALLOCA -m4trace:configure.in:632: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H]) -m4trace:configure.in:632: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have and it should be used (not on Ultrix). +m4trace:configure.in:636: -1- AC_FUNC_ALLOCA +m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA_H]) +m4trace:configure.in:636: -1- AH_OUTPUT([HAVE_ALLOCA_H], [/* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H]) -m4trace:configure.in:632: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA]) -m4trace:configure.in:632: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */ +m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([HAVE_ALLOCA]) +m4trace:configure.in:636: -1- AH_OUTPUT([HAVE_ALLOCA], [/* Define to 1 if you have `alloca\', as a function or macro. */ #undef HAVE_ALLOCA]) -m4trace:configure.in:632: -1- AC_LIBSOURCE([alloca.c]) -m4trace:configure.in:632: -1- AC_SUBST([ALLOCA], [alloca.$ac_objext]) -m4trace:configure.in:632: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA]) -m4trace:configure.in:632: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */ +m4trace:configure.in:636: -1- AC_LIBSOURCE([alloca.c]) +m4trace:configure.in:636: -1- AC_SUBST([ALLOCA], [alloca.$ac_objext]) +m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([C_ALLOCA]) +m4trace:configure.in:636: -1- AH_OUTPUT([C_ALLOCA], [/* Define to 1 if using `alloca.c\'. */ #undef C_ALLOCA]) -m4trace:configure.in:632: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END]) -m4trace:configure.in:632: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP +m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([CRAY_STACKSEG_END]) +m4trace:configure.in:636: -1- AH_OUTPUT([CRAY_STACKSEG_END], [/* Define to one of `_getb67\', `GETB67\', `getb67\' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c\' support on those systems. */ #undef CRAY_STACKSEG_END]) -m4trace:configure.in:632: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the +m4trace:configure.in:636: -1- AH_OUTPUT([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @%:@undef STACK_DIRECTION]) -m4trace:configure.in:632: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION]) -m4trace:configure.in:633: -1- AC_FUNC_GETPGRP -m4trace:configure.in:633: -1- AC_DEFINE_TRACE_LITERAL([GETPGRP_VOID]) -m4trace:configure.in:633: -1- AH_OUTPUT([GETPGRP_VOID], [/* Define to 1 if the `getpgrp\' function requires zero arguments. */ +m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([STACK_DIRECTION]) +m4trace:configure.in:637: -1- AC_FUNC_GETPGRP +m4trace:configure.in:637: -1- AC_DEFINE_TRACE_LITERAL([GETPGRP_VOID]) +m4trace:configure.in:637: -1- AH_OUTPUT([GETPGRP_VOID], [/* Define to 1 if the `getpgrp\' function requires zero arguments. */ #undef GETPGRP_VOID]) -m4trace:configure.in:634: -1- AC_FUNC_SETVBUF_REVERSED -m4trace:configure.in:634: -1- AC_DEFINE_TRACE_LITERAL([SETVBUF_REVERSED]) -m4trace:configure.in:634: -1- AH_OUTPUT([SETVBUF_REVERSED], [/* Define to 1 if the `setvbuf\' function takes the buffering type as its +m4trace:configure.in:638: -1- AC_FUNC_SETVBUF_REVERSED +m4trace:configure.in:638: -1- AC_DEFINE_TRACE_LITERAL([SETVBUF_REVERSED]) +m4trace:configure.in:638: -1- AH_OUTPUT([SETVBUF_REVERSED], [/* Define to 1 if the `setvbuf\' function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ #undef SETVBUF_REVERSED]) -m4trace:configure.in:635: -1- AC_FUNC_VPRINTF -m4trace:configure.in:635: -1- AC_CHECK_FUNCS([vprintf], [ +m4trace:configure.in:639: -1- AC_FUNC_VPRINTF +m4trace:configure.in:639: -1- AC_CHECK_FUNCS([vprintf], [ AC_CHECK_FUNC(_doprnt, [AC_DEFINE(HAVE_DOPRNT, 1, [Define to 1 if you don't have `vprintf' but do have `_doprnt.'])])]) -m4trace:configure.in:635: -1- AH_OUTPUT([HAVE_VPRINTF], [/* Define to 1 if you have the `vprintf\' function. */ +m4trace:configure.in:639: -1- AH_OUTPUT([HAVE_VPRINTF], [/* Define to 1 if you have the `vprintf\' function. */ #undef HAVE_VPRINTF]) -m4trace:configure.in:635: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DOPRNT]) -m4trace:configure.in:635: -1- AH_OUTPUT([HAVE_DOPRNT], [/* Define to 1 if you don\'t have `vprintf\' but do have `_doprnt.\' */ +m4trace:configure.in:639: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DOPRNT]) +m4trace:configure.in:639: -1- AH_OUTPUT([HAVE_DOPRNT], [/* Define to 1 if you don\'t have `vprintf\' but do have `_doprnt.\' */ #undef HAVE_DOPRNT]) -m4trace:configure.in:636: -1- AC_FUNC_STRCOLL -m4trace:configure.in:636: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRCOLL]) -m4trace:configure.in:636: -1- AH_OUTPUT([HAVE_STRCOLL], [/* Define to 1 if you have the `strcoll\' function and it is properly defined. +m4trace:configure.in:640: -1- AC_FUNC_STRCOLL +m4trace:configure.in:640: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRCOLL]) +m4trace:configure.in:640: -1- AH_OUTPUT([HAVE_STRCOLL], [/* Define to 1 if you have the `strcoll\' function and it is properly defined. */ #undef HAVE_STRCOLL]) -m4trace:configure.in:657: -1- AC_DEFINE_TRACE_LITERAL([HAVE_VPRINTF]) -m4trace:configure.in:662: -1- AC_LIBSOURCE([vprint.c]) -m4trace:configure.in:662: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:666: -1- AC_TYPE_SIGNAL -m4trace:configure.in:666: -1- AC_DEFINE_TRACE_LITERAL([RETSIGTYPE]) -m4trace:configure.in:666: -1- AH_OUTPUT([RETSIGTYPE], [/* Define as the return type of signal handlers (`int\' or `void\'). */ +m4trace:configure.in:661: -1- AC_DEFINE_TRACE_LITERAL([HAVE_VPRINTF]) +m4trace:configure.in:666: -1- AC_LIBSOURCE([vprint.c]) +m4trace:configure.in:666: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:670: -1- AC_TYPE_SIGNAL +m4trace:configure.in:670: -1- AC_DEFINE_TRACE_LITERAL([RETSIGTYPE]) +m4trace:configure.in:670: -1- AH_OUTPUT([RETSIGTYPE], [/* Define as the return type of signal handlers (`int\' or `void\'). */ #undef RETSIGTYPE]) -m4trace:configure.in:669: -2- AC_DEFINE_TRACE_LITERAL([HAVE_SETOSTYPE]) -m4trace:configure.in:670: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WAIT3]) -m4trace:configure.in:671: -2- AC_DEFINE_TRACE_LITERAL([HAVE_ISINF_IN_LIBC]) -m4trace:configure.in:674: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MKFIFO]) -m4trace:configure.in:674: -2- AC_DEFINE_TRACE_LITERAL([MKFIFO_MISSING]) -m4trace:configure.in:680: -1- AC_CHECK_FUNCS([dup2 select getdtablesize getgroups gethostname \ +m4trace:configure.in:673: -2- AC_DEFINE_TRACE_LITERAL([HAVE_SETOSTYPE]) +m4trace:configure.in:674: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WAIT3]) +m4trace:configure.in:675: -2- AC_DEFINE_TRACE_LITERAL([HAVE_ISINF_IN_LIBC]) +m4trace:configure.in:678: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MKFIFO]) +m4trace:configure.in:678: -2- AC_DEFINE_TRACE_LITERAL([MKFIFO_MISSING]) +m4trace:configure.in:684: -1- AC_CHECK_FUNCS([dup2 select getdtablesize getgroups gethostname \ setdtablesize getpagesize killpg lstat getpeername sbrk \ getrlimit getrusage gettimeofday waitpid tcgetpgrp \ readlink]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_DUP2], [/* Define to 1 if you have the `dup2\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_DUP2], [/* Define to 1 if you have the `dup2\' function. */ #undef HAVE_DUP2]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the `select\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the `select\' function. */ #undef HAVE_SELECT]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETDTABLESIZE], [/* Define to 1 if you have the `getdtablesize\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETDTABLESIZE], [/* Define to 1 if you have the `getdtablesize\' function. */ #undef HAVE_GETDTABLESIZE]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETGROUPS], [/* Define to 1 if you have the `getgroups\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETGROUPS], [/* Define to 1 if you have the `getgroups\' function. */ #undef HAVE_GETGROUPS]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETHOSTNAME], [/* Define to 1 if you have the `gethostname\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETHOSTNAME], [/* Define to 1 if you have the `gethostname\' function. */ #undef HAVE_GETHOSTNAME]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_SETDTABLESIZE], [/* Define to 1 if you have the `setdtablesize\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_SETDTABLESIZE], [/* Define to 1 if you have the `setdtablesize\' function. */ #undef HAVE_SETDTABLESIZE]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ #undef HAVE_GETPAGESIZE]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_KILLPG], [/* Define to 1 if you have the `killpg\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_KILLPG], [/* Define to 1 if you have the `killpg\' function. */ #undef HAVE_KILLPG]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_LSTAT], [/* Define to 1 if you have the `lstat\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_LSTAT], [/* Define to 1 if you have the `lstat\' function. */ #undef HAVE_LSTAT]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETPEERNAME], [/* Define to 1 if you have the `getpeername\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETPEERNAME], [/* Define to 1 if you have the `getpeername\' function. */ #undef HAVE_GETPEERNAME]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_SBRK], [/* Define to 1 if you have the `sbrk\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_SBRK], [/* Define to 1 if you have the `sbrk\' function. */ #undef HAVE_SBRK]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETRLIMIT], [/* Define to 1 if you have the `getrlimit\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETRLIMIT], [/* Define to 1 if you have the `getrlimit\' function. */ #undef HAVE_GETRLIMIT]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETRUSAGE], [/* Define to 1 if you have the `getrusage\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETRUSAGE], [/* Define to 1 if you have the `getrusage\' function. */ #undef HAVE_GETRUSAGE]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the `gettimeofday\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the `gettimeofday\' function. */ #undef HAVE_GETTIMEOFDAY]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_WAITPID], [/* Define to 1 if you have the `waitpid\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_WAITPID], [/* Define to 1 if you have the `waitpid\' function. */ #undef HAVE_WAITPID]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_TCGETPGRP], [/* Define to 1 if you have the `tcgetpgrp\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_TCGETPGRP], [/* Define to 1 if you have the `tcgetpgrp\' function. */ #undef HAVE_TCGETPGRP]) -m4trace:configure.in:680: -1- AH_OUTPUT([HAVE_READLINK], [/* Define to 1 if you have the `readlink\' function. */ +m4trace:configure.in:684: -1- AH_OUTPUT([HAVE_READLINK], [/* Define to 1 if you have the `readlink\' function. */ #undef HAVE_READLINK]) -m4trace:configure.in:681: -1- AC_LIBSOURCE([rename.c]) -m4trace:configure.in:681: -1- AC_CHECK_FUNCS([rename], [], [_AC_LIBOBJ($ac_func)]) -m4trace:configure.in:681: -1- AH_OUTPUT([HAVE_RENAME], [/* Define to 1 if you have the `rename\' function. */ +m4trace:configure.in:685: -1- AC_LIBSOURCE([rename.c]) +m4trace:configure.in:685: -1- AC_CHECK_FUNCS([rename], [], [_AC_LIBOBJ($ac_func)]) +m4trace:configure.in:685: -1- AH_OUTPUT([HAVE_RENAME], [/* Define to 1 if you have the `rename\' function. */ #undef HAVE_RENAME]) -m4trace:configure.in:681: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:688: -1- AC_CHECK_FUNCS([bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \ +m4trace:configure.in:685: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:692: -1- AC_CHECK_FUNCS([bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \ setlinebuf setvbuf setlocale strchr tcgetattr uname \ ulimit tzset siginterrupt memmove ttyname times raise \ getaddrinfo gethostbyname getservbyname getservent inet_aton \ vsnprintf snprintf vasprintf asprintf fnmatch regcomp regexec]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_BCOPY], [/* Define to 1 if you have the `bcopy\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_BCOPY], [/* Define to 1 if you have the `bcopy\' function. */ #undef HAVE_BCOPY]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_BZERO], [/* Define to 1 if you have the `bzero\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_BZERO], [/* Define to 1 if you have the `bzero\' function. */ #undef HAVE_BZERO]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_CONFSTR], [/* Define to 1 if you have the `confstr\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_CONFSTR], [/* Define to 1 if you have the `confstr\' function. */ #undef HAVE_CONFSTR]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SYSCONF], [/* Define to 1 if you have the `sysconf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SYSCONF], [/* Define to 1 if you have the `sysconf\' function. */ #undef HAVE_SYSCONF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_PATHCONF], [/* Define to 1 if you have the `pathconf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_PATHCONF], [/* Define to 1 if you have the `pathconf\' function. */ #undef HAVE_PATHCONF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SETENV], [/* Define to 1 if you have the `setenv\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SETENV], [/* Define to 1 if you have the `setenv\' function. */ #undef HAVE_SETENV]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_PUTENV], [/* Define to 1 if you have the `putenv\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_PUTENV], [/* Define to 1 if you have the `putenv\' function. */ #undef HAVE_PUTENV]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_UNSETENV], [/* Define to 1 if you have the `unsetenv\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_UNSETENV], [/* Define to 1 if you have the `unsetenv\' function. */ #undef HAVE_UNSETENV]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SETLINEBUF], [/* Define to 1 if you have the `setlinebuf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SETLINEBUF], [/* Define to 1 if you have the `setlinebuf\' function. */ #undef HAVE_SETLINEBUF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SETVBUF], [/* Define to 1 if you have the `setvbuf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SETVBUF], [/* Define to 1 if you have the `setvbuf\' function. */ #undef HAVE_SETVBUF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SETLOCALE], [/* Define to 1 if you have the `setlocale\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SETLOCALE], [/* Define to 1 if you have the `setlocale\' function. */ #undef HAVE_SETLOCALE]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_STRCHR], [/* Define to 1 if you have the `strchr\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_STRCHR], [/* Define to 1 if you have the `strchr\' function. */ #undef HAVE_STRCHR]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_TCGETATTR], [/* Define to 1 if you have the `tcgetattr\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_TCGETATTR], [/* Define to 1 if you have the `tcgetattr\' function. */ #undef HAVE_TCGETATTR]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_UNAME], [/* Define to 1 if you have the `uname\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_UNAME], [/* Define to 1 if you have the `uname\' function. */ #undef HAVE_UNAME]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_ULIMIT], [/* Define to 1 if you have the `ulimit\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_ULIMIT], [/* Define to 1 if you have the `ulimit\' function. */ #undef HAVE_ULIMIT]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_TZSET], [/* Define to 1 if you have the `tzset\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_TZSET], [/* Define to 1 if you have the `tzset\' function. */ #undef HAVE_TZSET]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SIGINTERRUPT], [/* Define to 1 if you have the `siginterrupt\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SIGINTERRUPT], [/* Define to 1 if you have the `siginterrupt\' function. */ #undef HAVE_SIGINTERRUPT]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_MEMMOVE], [/* Define to 1 if you have the `memmove\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_MEMMOVE], [/* Define to 1 if you have the `memmove\' function. */ #undef HAVE_MEMMOVE]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_TTYNAME], [/* Define to 1 if you have the `ttyname\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_TTYNAME], [/* Define to 1 if you have the `ttyname\' function. */ #undef HAVE_TTYNAME]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_TIMES], [/* Define to 1 if you have the `times\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_TIMES], [/* Define to 1 if you have the `times\' function. */ #undef HAVE_TIMES]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_RAISE], [/* Define to 1 if you have the `raise\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_RAISE], [/* Define to 1 if you have the `raise\' function. */ #undef HAVE_RAISE]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_GETADDRINFO], [/* Define to 1 if you have the `getaddrinfo\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_GETADDRINFO], [/* Define to 1 if you have the `getaddrinfo\' function. */ #undef HAVE_GETADDRINFO]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_GETHOSTBYNAME], [/* Define to 1 if you have the `gethostbyname\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_GETHOSTBYNAME], [/* Define to 1 if you have the `gethostbyname\' function. */ #undef HAVE_GETHOSTBYNAME]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_GETSERVBYNAME], [/* Define to 1 if you have the `getservbyname\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_GETSERVBYNAME], [/* Define to 1 if you have the `getservbyname\' function. */ #undef HAVE_GETSERVBYNAME]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_GETSERVENT], [/* Define to 1 if you have the `getservent\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_GETSERVENT], [/* Define to 1 if you have the `getservent\' function. */ #undef HAVE_GETSERVENT]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_INET_ATON], [/* Define to 1 if you have the `inet_aton\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_INET_ATON], [/* Define to 1 if you have the `inet_aton\' function. */ #undef HAVE_INET_ATON]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define to 1 if you have the `vsnprintf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_VSNPRINTF], [/* Define to 1 if you have the `vsnprintf\' function. */ #undef HAVE_VSNPRINTF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define to 1 if you have the `snprintf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_SNPRINTF], [/* Define to 1 if you have the `snprintf\' function. */ #undef HAVE_SNPRINTF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_VASPRINTF], [/* Define to 1 if you have the `vasprintf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_VASPRINTF], [/* Define to 1 if you have the `vasprintf\' function. */ #undef HAVE_VASPRINTF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_ASPRINTF], [/* Define to 1 if you have the `asprintf\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_ASPRINTF], [/* Define to 1 if you have the `asprintf\' function. */ #undef HAVE_ASPRINTF]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_FNMATCH], [/* Define to 1 if you have the `fnmatch\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_FNMATCH], [/* Define to 1 if you have the `fnmatch\' function. */ #undef HAVE_FNMATCH]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_REGCOMP], [/* Define to 1 if you have the `regcomp\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_REGCOMP], [/* Define to 1 if you have the `regcomp\' function. */ #undef HAVE_REGCOMP]) -m4trace:configure.in:688: -1- AH_OUTPUT([HAVE_REGEXEC], [/* Define to 1 if you have the `regexec\' function. */ +m4trace:configure.in:692: -1- AH_OUTPUT([HAVE_REGEXEC], [/* Define to 1 if you have the `regexec\' function. */ #undef HAVE_REGEXEC]) -m4trace:configure.in:689: -1- AC_CHECK_FUNCS([isascii isblank isgraph isprint isspace isxdigit]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISASCII], [/* Define to 1 if you have the `isascii\' function. */ +m4trace:configure.in:693: -1- AC_CHECK_FUNCS([isascii isblank isgraph isprint isspace isxdigit]) +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISASCII], [/* Define to 1 if you have the `isascii\' function. */ #undef HAVE_ISASCII]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISBLANK], [/* Define to 1 if you have the `isblank\' function. */ +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISBLANK], [/* Define to 1 if you have the `isblank\' function. */ #undef HAVE_ISBLANK]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISGRAPH], [/* Define to 1 if you have the `isgraph\' function. */ +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISGRAPH], [/* Define to 1 if you have the `isgraph\' function. */ #undef HAVE_ISGRAPH]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISPRINT], [/* Define to 1 if you have the `isprint\' function. */ +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISPRINT], [/* Define to 1 if you have the `isprint\' function. */ #undef HAVE_ISPRINT]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISSPACE], [/* Define to 1 if you have the `isspace\' function. */ +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISSPACE], [/* Define to 1 if you have the `isspace\' function. */ #undef HAVE_ISSPACE]) -m4trace:configure.in:689: -1- AH_OUTPUT([HAVE_ISXDIGIT], [/* Define to 1 if you have the `isxdigit\' function. */ +m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_ISXDIGIT], [/* Define to 1 if you have the `isxdigit\' function. */ #undef HAVE_ISXDIGIT]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([getcwd.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strcasecmp.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strerror.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strftime.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strpbrk.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([memset.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strstr.c]) -m4trace:configure.in:690: -1- AC_LIBSOURCE([strnlen.c]) -m4trace:configure.in:690: -1- AC_CHECK_FUNCS([getcwd strcasecmp strerror strftime strpbrk memset strstr strnlen], [], [_AC_LIBOBJ($ac_func)]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_GETCWD], [/* Define to 1 if you have the `getcwd\' function. */ +m4trace:configure.in:694: -1- AC_LIBSOURCE([getcwd.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strcasecmp.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strerror.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strftime.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strpbrk.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([memset.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strstr.c]) +m4trace:configure.in:694: -1- AC_LIBSOURCE([strnlen.c]) +m4trace:configure.in:694: -1- AC_CHECK_FUNCS([getcwd strcasecmp strerror strftime strpbrk memset strstr strnlen], [], [_AC_LIBOBJ($ac_func)]) +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_GETCWD], [/* Define to 1 if you have the `getcwd\' function. */ #undef HAVE_GETCWD]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRCASECMP], [/* Define to 1 if you have the `strcasecmp\' function. */ #undef HAVE_STRCASECMP]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRERROR], [/* Define to 1 if you have the `strerror\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRERROR], [/* Define to 1 if you have the `strerror\' function. */ #undef HAVE_STRERROR]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRFTIME], [/* Define to 1 if you have the `strftime\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRFTIME], [/* Define to 1 if you have the `strftime\' function. */ #undef HAVE_STRFTIME]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRPBRK], [/* Define to 1 if you have the `strpbrk\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRPBRK], [/* Define to 1 if you have the `strpbrk\' function. */ #undef HAVE_STRPBRK]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */ #undef HAVE_MEMSET]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRSTR], [/* Define to 1 if you have the `strstr\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRSTR], [/* Define to 1 if you have the `strstr\' function. */ #undef HAVE_STRSTR]) -m4trace:configure.in:690: -1- AH_OUTPUT([HAVE_STRNLEN], [/* Define to 1 if you have the `strnlen\' function. */ +m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_STRNLEN], [/* Define to 1 if you have the `strnlen\' function. */ #undef HAVE_STRNLEN]) -m4trace:configure.in:690: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtod.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtol.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtoul.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtoll.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtoull.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtoimax.c]) -m4trace:configure.in:691: -1- AC_LIBSOURCE([strtoumax.c]) -m4trace:configure.in:691: -1- AC_CHECK_FUNCS([strtod strtol strtoul strtoll strtoull strtoimax strtoumax], [], [_AC_LIBOBJ($ac_func)]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOD], [/* Define to 1 if you have the `strtod\' function. */ +m4trace:configure.in:694: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtod.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtol.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtoul.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtoll.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtoull.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtoimax.c]) +m4trace:configure.in:695: -1- AC_LIBSOURCE([strtoumax.c]) +m4trace:configure.in:695: -1- AC_CHECK_FUNCS([strtod strtol strtoul strtoll strtoull strtoimax strtoumax], [], [_AC_LIBOBJ($ac_func)]) +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOD], [/* Define to 1 if you have the `strtod\' function. */ #undef HAVE_STRTOD]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOL], [/* Define to 1 if you have the `strtol\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOL], [/* Define to 1 if you have the `strtol\' function. */ #undef HAVE_STRTOL]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOUL], [/* Define to 1 if you have the `strtoul\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOUL], [/* Define to 1 if you have the `strtoul\' function. */ #undef HAVE_STRTOUL]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOLL], [/* Define to 1 if you have the `strtoll\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOLL], [/* Define to 1 if you have the `strtoll\' function. */ #undef HAVE_STRTOLL]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOULL], [/* Define to 1 if you have the `strtoull\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOULL], [/* Define to 1 if you have the `strtoull\' function. */ #undef HAVE_STRTOULL]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOIMAX], [/* Define to 1 if you have the `strtoimax\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOIMAX], [/* Define to 1 if you have the `strtoimax\' function. */ #undef HAVE_STRTOIMAX]) -m4trace:configure.in:691: -1- AH_OUTPUT([HAVE_STRTOUMAX], [/* Define to 1 if you have the `strtoumax\' function. */ +m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_STRTOUMAX], [/* Define to 1 if you have the `strtoumax\' function. */ #undef HAVE_STRTOUMAX]) -m4trace:configure.in:691: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:693: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_CONFSTR]) -m4trace:configure.in:693: -1- AH_OUTPUT([HAVE_DECL_CONFSTR], [/* Define to 1 if you have the declaration of `confstr\', and to 0 if you +m4trace:configure.in:695: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:697: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_CONFSTR]) +m4trace:configure.in:697: -1- AH_OUTPUT([HAVE_DECL_CONFSTR], [/* Define to 1 if you have the declaration of `confstr\', and to 0 if you don\'t. */ #undef HAVE_DECL_CONFSTR]) -m4trace:configure.in:693: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_CONFSTR]) -m4trace:configure.in:694: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PRINTF]) -m4trace:configure.in:694: -1- AH_OUTPUT([HAVE_DECL_PRINTF], [/* Define to 1 if you have the declaration of `printf\', and to 0 if you don\'t. +m4trace:configure.in:697: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_CONFSTR]) +m4trace:configure.in:698: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PRINTF]) +m4trace:configure.in:698: -1- AH_OUTPUT([HAVE_DECL_PRINTF], [/* Define to 1 if you have the declaration of `printf\', and to 0 if you don\'t. */ #undef HAVE_DECL_PRINTF]) -m4trace:configure.in:694: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PRINTF]) -m4trace:configure.in:695: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SBRK]) -m4trace:configure.in:695: -1- AH_OUTPUT([HAVE_DECL_SBRK], [/* Define to 1 if you have the declaration of `sbrk\', and to 0 if you don\'t. +m4trace:configure.in:698: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_PRINTF]) +m4trace:configure.in:699: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SBRK]) +m4trace:configure.in:699: -1- AH_OUTPUT([HAVE_DECL_SBRK], [/* Define to 1 if you have the declaration of `sbrk\', and to 0 if you don\'t. */ #undef HAVE_DECL_SBRK]) -m4trace:configure.in:695: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SBRK]) -m4trace:configure.in:696: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRCPY]) -m4trace:configure.in:696: -1- AH_OUTPUT([HAVE_DECL_STRCPY], [/* Define to 1 if you have the declaration of `strcpy\', and to 0 if you don\'t. +m4trace:configure.in:699: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SBRK]) +m4trace:configure.in:700: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRCPY]) +m4trace:configure.in:700: -1- AH_OUTPUT([HAVE_DECL_STRCPY], [/* Define to 1 if you have the declaration of `strcpy\', and to 0 if you don\'t. */ #undef HAVE_DECL_STRCPY]) -m4trace:configure.in:696: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRCPY]) -m4trace:configure.in:697: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRSIGNAL]) -m4trace:configure.in:697: -1- AH_OUTPUT([HAVE_DECL_STRSIGNAL], [/* Define to 1 if you have the declaration of `strsignal\', and to 0 if you +m4trace:configure.in:700: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRCPY]) +m4trace:configure.in:701: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRSIGNAL]) +m4trace:configure.in:701: -1- AH_OUTPUT([HAVE_DECL_STRSIGNAL], [/* Define to 1 if you have the declaration of `strsignal\', and to 0 if you don\'t. */ #undef HAVE_DECL_STRSIGNAL]) -m4trace:configure.in:697: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRSIGNAL]) -m4trace:configure.in:714: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRTOLD]) -m4trace:configure.in:714: -1- AH_OUTPUT([HAVE_DECL_STRTOLD], [/* Define to 1 if you have the declaration of `strtold\', and to 0 if you +m4trace:configure.in:701: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRSIGNAL]) +m4trace:configure.in:718: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRTOLD]) +m4trace:configure.in:718: -1- AH_OUTPUT([HAVE_DECL_STRTOLD], [/* Define to 1 if you have the declaration of `strtold\', and to 0 if you don\'t. */ #undef HAVE_DECL_STRTOLD]) -m4trace:configure.in:714: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:718: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:2352: AC_CHECK_DECL is expanded from... autoconf/general.m4:2372: AC_CHECK_DECLS is expanded from... -configure.in:714: the top level]) -m4trace:configure.in:714: -1- AC_DEFINE_TRACE_LITERAL([STRTOLD_BROKEN]) -m4trace:configure.in:714: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRTOLD]) -m4trace:configure.in:717: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:718: the top level]) +m4trace:configure.in:718: -1- AC_DEFINE_TRACE_LITERAL([STRTOLD_BROKEN]) +m4trace:configure.in:718: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_STRTOLD]) +m4trace:configure.in:721: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:717: the top level]) -m4trace:configure.in:718: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:721: the top level]) +m4trace:configure.in:722: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:718: the top level]) -m4trace:configure.in:719: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:722: the top level]) +m4trace:configure.in:723: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:719: the top level]) -m4trace:configure.in:720: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:723: the top level]) +m4trace:configure.in:724: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:720: the top level]) -m4trace:configure.in:721: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:724: the top level]) +m4trace:configure.in:725: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:721: the top level]) -m4trace:configure.in:722: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:725: the top level]) +m4trace:configure.in:726: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:122: BASH_CHECK_DECL is expanded from... -configure.in:722: the top level]) -m4trace:configure.in:724: -1- AC_FUNC_MKTIME -m4trace:configure.in:724: -1- AC_CHECK_HEADERS([stdlib.h sys/time.h unistd.h]) -m4trace:configure.in:724: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +configure.in:726: the top level]) +m4trace:configure.in:728: -1- AC_FUNC_MKTIME +m4trace:configure.in:728: -1- AC_CHECK_HEADERS([stdlib.h sys/time.h unistd.h]) +m4trace:configure.in:728: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H]) -m4trace:configure.in:724: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:728: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H]) -m4trace:configure.in:724: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:728: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H]) -m4trace:configure.in:724: -1- AC_CHECK_FUNCS([alarm]) -m4trace:configure.in:724: -1- AH_OUTPUT([HAVE_ALARM], [/* Define to 1 if you have the `alarm\' function. */ +m4trace:configure.in:728: -1- AC_CHECK_FUNCS([alarm]) +m4trace:configure.in:728: -1- AH_OUTPUT([HAVE_ALARM], [/* Define to 1 if you have the `alarm\' function. */ #undef HAVE_ALARM]) -m4trace:configure.in:724: -1- AC_LIBSOURCE([mktime.c]) -m4trace:configure.in:724: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:731: -1- AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h]) -m4trace:configure.in:731: -1- AH_OUTPUT([HAVE_ARGZ_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:728: -1- AC_LIBSOURCE([mktime.c]) +m4trace:configure.in:728: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:735: -1- AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h]) +m4trace:configure.in:735: -1- AH_OUTPUT([HAVE_ARGZ_H], [/* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H]) -m4trace:configure.in:731: -1- AH_OUTPUT([HAVE_ERRNO_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:735: -1- AH_OUTPUT([HAVE_ERRNO_H], [/* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H]) -m4trace:configure.in:731: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:735: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H]) -m4trace:configure.in:731: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:735: -1- AH_OUTPUT([HAVE_MALLOC_H], [/* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H]) -m4trace:configure.in:731: -1- AH_OUTPUT([HAVE_STDIO_EXT_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:735: -1- AH_OUTPUT([HAVE_STDIO_EXT_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDIO_EXT_H]) -m4trace:configure.in:734: -1- AC_FUNC_MMAP -m4trace:configure.in:734: -1- AC_CHECK_HEADERS([stdlib.h unistd.h]) -m4trace:configure.in:734: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:738: -1- AC_FUNC_MMAP +m4trace:configure.in:738: -1- AC_CHECK_HEADERS([stdlib.h unistd.h]) +m4trace:configure.in:738: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H]) -m4trace:configure.in:734: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:738: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H]) -m4trace:configure.in:734: -1- AC_CHECK_FUNCS([getpagesize]) -m4trace:configure.in:734: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ +m4trace:configure.in:738: -1- AC_CHECK_FUNCS([getpagesize]) +m4trace:configure.in:738: -1- AH_OUTPUT([HAVE_GETPAGESIZE], [/* Define to 1 if you have the `getpagesize\' function. */ #undef HAVE_GETPAGESIZE]) -m4trace:configure.in:734: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MMAP]) -m4trace:configure.in:734: -1- AH_OUTPUT([HAVE_MMAP], [/* Define to 1 if you have a working `mmap\' system call. */ +m4trace:configure.in:738: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MMAP]) +m4trace:configure.in:738: -1- AH_OUTPUT([HAVE_MMAP], [/* Define to 1 if you have a working `mmap\' system call. */ #undef HAVE_MMAP]) -m4trace:configure.in:736: -1- AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \ +m4trace:configure.in:740: -1- AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \ munmap stpcpy strcspn strdup]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE___ARGZ_COUNT], [/* Define to 1 if you have the `__argz_count\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE___ARGZ_COUNT], [/* Define to 1 if you have the `__argz_count\' function. */ #undef HAVE___ARGZ_COUNT]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE___ARGZ_NEXT], [/* Define to 1 if you have the `__argz_next\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE___ARGZ_NEXT], [/* Define to 1 if you have the `__argz_next\' function. */ #undef HAVE___ARGZ_NEXT]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE___ARGZ_STRINGIFY], [/* Define to 1 if you have the `__argz_stringify\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE___ARGZ_STRINGIFY], [/* Define to 1 if you have the `__argz_stringify\' function. */ #undef HAVE___ARGZ_STRINGIFY]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_DCGETTEXT], [/* Define to 1 if you have the `dcgettext\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_DCGETTEXT], [/* Define to 1 if you have the `dcgettext\' function. */ #undef HAVE_DCGETTEXT]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_MEMPCPY], [/* Define to 1 if you have the `mempcpy\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_MEMPCPY], [/* Define to 1 if you have the `mempcpy\' function. */ #undef HAVE_MEMPCPY]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_MUNMAP], [/* Define to 1 if you have the `munmap\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_MUNMAP], [/* Define to 1 if you have the `munmap\' function. */ #undef HAVE_MUNMAP]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_STPCPY], [/* Define to 1 if you have the `stpcpy\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_STPCPY], [/* Define to 1 if you have the `stpcpy\' function. */ #undef HAVE_STPCPY]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_STRCSPN], [/* Define to 1 if you have the `strcspn\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_STRCSPN], [/* Define to 1 if you have the `strcspn\' function. */ #undef HAVE_STRCSPN]) -m4trace:configure.in:736: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */ +m4trace:configure.in:740: -1- AH_OUTPUT([HAVE_STRDUP], [/* Define to 1 if you have the `strdup\' function. */ #undef HAVE_STRDUP]) -m4trace:configure.in:744: -1- AC_SUBST([INTL_DEP]) -m4trace:configure.in:745: -1- AC_SUBST([INTL_INC]) -m4trace:configure.in:746: -1- AC_SUBST([LIBINTL_H]) -m4trace:configure.in:752: -1- AC_CHECK_HEADERS([wctype.h]) -m4trace:configure.in:752: -1- AH_OUTPUT([HAVE_WCTYPE_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:748: -1- AC_SUBST([INTL_DEP]) +m4trace:configure.in:749: -1- AC_SUBST([INTL_INC]) +m4trace:configure.in:750: -1- AC_SUBST([LIBINTL_H]) +m4trace:configure.in:756: -1- AC_CHECK_HEADERS([wctype.h]) +m4trace:configure.in:756: -1- AH_OUTPUT([HAVE_WCTYPE_H], [/* Define to 1 if you have the header file. */ #undef HAVE_WCTYPE_H]) -m4trace:configure.in:752: -1- AC_CHECK_HEADERS([wchar.h]) -m4trace:configure.in:752: -1- AH_OUTPUT([HAVE_WCHAR_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:756: -1- AC_CHECK_HEADERS([wchar.h]) +m4trace:configure.in:756: -1- AH_OUTPUT([HAVE_WCHAR_H], [/* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H]) -m4trace:configure.in:752: -1- AC_CHECK_HEADERS([langinfo.h]) -m4trace:configure.in:752: -1- AH_OUTPUT([HAVE_LANGINFO_H], [/* Define to 1 if you have the header file. */ +m4trace:configure.in:756: -1- AC_CHECK_HEADERS([langinfo.h]) +m4trace:configure.in:756: -1- AH_OUTPUT([HAVE_LANGINFO_H], [/* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBSRTOWCS]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRTOWC]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRLEN]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCTOMB]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCWIDTH]) -m4trace:configure.in:752: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCSDUP]) -m4trace:configure.in:752: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBSRTOWCS]) +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRTOWC]) +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRLEN]) +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCTOMB]) +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCWIDTH]) +m4trace:configure.in:756: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCSDUP]) +m4trace:configure.in:756: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:1703: BASH_CHECK_MULTIBYTE is expanded from... -configure.in:752: the top level]) -m4trace:configure.in:752: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MBSTATE_T]) -m4trace:configure.in:752: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:756: the top level]) +m4trace:configure.in:756: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MBSTATE_T]) +m4trace:configure.in:756: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:1703: BASH_CHECK_MULTIBYTE is expanded from... -configure.in:752: the top level]) -m4trace:configure.in:752: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET]) -m4trace:configure.in:756: -1- AC_CHECK_LIB([dl], [dlopen]) -m4trace:configure.in:756: -1- AH_OUTPUT([HAVE_LIBDL], [/* Define to 1 if you have the `dl\' library (-ldl). */ +configure.in:756: the top level]) +m4trace:configure.in:756: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET]) +m4trace:configure.in:760: -1- AC_CHECK_LIB([dl], [dlopen]) +m4trace:configure.in:760: -1- AH_OUTPUT([HAVE_LIBDL], [/* Define to 1 if you have the `dl\' library (-ldl). */ #undef HAVE_LIBDL]) -m4trace:configure.in:756: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDL]) -m4trace:configure.in:757: -1- AC_CHECK_FUNCS([dlopen dlclose dlsym]) -m4trace:configure.in:757: -1- AH_OUTPUT([HAVE_DLOPEN], [/* Define to 1 if you have the `dlopen\' function. */ +m4trace:configure.in:760: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDL]) +m4trace:configure.in:761: -1- AC_CHECK_FUNCS([dlopen dlclose dlsym]) +m4trace:configure.in:761: -1- AH_OUTPUT([HAVE_DLOPEN], [/* Define to 1 if you have the `dlopen\' function. */ #undef HAVE_DLOPEN]) -m4trace:configure.in:757: -1- AH_OUTPUT([HAVE_DLCLOSE], [/* Define to 1 if you have the `dlclose\' function. */ +m4trace:configure.in:761: -1- AH_OUTPUT([HAVE_DLCLOSE], [/* Define to 1 if you have the `dlclose\' function. */ #undef HAVE_DLCLOSE]) -m4trace:configure.in:757: -1- AH_OUTPUT([HAVE_DLSYM], [/* Define to 1 if you have the `dlsym\' function. */ +m4trace:configure.in:761: -1- AH_OUTPUT([HAVE_DLSYM], [/* Define to 1 if you have the `dlsym\' function. */ #undef HAVE_DLSYM]) -m4trace:configure.in:761: -1- AC_DECL_SYS_SIGLIST -m4trace:configure.in:761: -1- _m4_warn([obsolete], [The macro `AC_DECL_SYS_SIGLIST' is obsolete. +m4trace:configure.in:765: -1- AC_DECL_SYS_SIGLIST +m4trace:configure.in:765: -1- _m4_warn([obsolete], [The macro `AC_DECL_SYS_SIGLIST' is obsolete. You should run autoupdate.], [autoconf/specific.m4:70: AC_DECL_SYS_SIGLIST is expanded from... -configure.in:761: the top level]) -m4trace:configure.in:761: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SYS_SIGLIST]) -m4trace:configure.in:761: -1- AH_OUTPUT([HAVE_DECL_SYS_SIGLIST], [/* Define to 1 if you have the declaration of `sys_siglist\', and to 0 if you +configure.in:765: the top level]) +m4trace:configure.in:765: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SYS_SIGLIST]) +m4trace:configure.in:765: -1- AH_OUTPUT([HAVE_DECL_SYS_SIGLIST], [/* Define to 1 if you have the declaration of `sys_siglist\', and to 0 if you don\'t. */ #undef HAVE_DECL_SYS_SIGLIST]) -m4trace:configure.in:761: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SYS_SIGLIST]) -m4trace:configure.in:765: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:765: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DECL_SYS_SIGLIST]) +m4trace:configure.in:769: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:562: BASH_FUNC_INET_ATON is expanded from... -configure.in:765: the top level]) -m4trace:configure.in:765: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INET_ATON]) -m4trace:configure.in:765: -1- AC_LIBSOURCE([inet_aton.c]) -m4trace:configure.in:765: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:771: -1- AC_CHECK_LIB([sun], [getpwent]) -m4trace:configure.in:771: -1- AH_OUTPUT([HAVE_LIBSUN], [/* Define to 1 if you have the `sun\' library (-lsun). */ +configure.in:769: the top level]) +m4trace:configure.in:769: -1- AC_DEFINE_TRACE_LITERAL([HAVE_INET_ATON]) +m4trace:configure.in:769: -1- AC_LIBSOURCE([inet_aton.c]) +m4trace:configure.in:769: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:775: -1- AC_CHECK_LIB([sun], [getpwent]) +m4trace:configure.in:775: -1- AH_OUTPUT([HAVE_LIBSUN], [/* Define to 1 if you have the `sun\' library (-lsun). */ #undef HAVE_LIBSUN]) -m4trace:configure.in:771: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSUN]) -m4trace:configure.in:776: -1- AC_CHECK_LIB([socket], [getpeername], [bash_cv_have_socklib=yes], [bash_cv_have_socklib=no], [-lnsl]) -m4trace:configure.in:776: -1- AC_CHECK_LIB([nsl], [t_open], [bash_cv_have_libnsl=yes], [bash_cv_have_libnsl=no]) -m4trace:configure.in:776: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSOCKET]) -m4trace:configure.in:776: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPEERNAME]) -m4trace:configure.in:780: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:775: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSUN]) +m4trace:configure.in:780: -1- AC_CHECK_LIB([socket], [getpeername], [bash_cv_have_socklib=yes], [bash_cv_have_socklib=no], [-lnsl]) +m4trace:configure.in:780: -1- AC_CHECK_LIB([nsl], [t_open], [bash_cv_have_libnsl=yes], [bash_cv_have_libnsl=no]) +m4trace:configure.in:780: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSOCKET]) +m4trace:configure.in:780: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPEERNAME]) +m4trace:configure.in:784: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:737: BASH_FUNC_GETHOSTBYNAME is expanded from... -configure.in:780: the top level]) -m4trace:configure.in:780: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETHOSTBYNAME]) -m4trace:configure.in:784: -1- AC_TYPE_UID_T -m4trace:configure.in:784: -1- AC_DEFINE_TRACE_LITERAL([uid_t]) -m4trace:configure.in:784: -1- AH_OUTPUT([uid_t], [/* Define to `int\' if doesn\'t define. */ +configure.in:784: the top level]) +m4trace:configure.in:784: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETHOSTBYNAME]) +m4trace:configure.in:788: -1- AC_TYPE_UID_T +m4trace:configure.in:788: -1- AC_DEFINE_TRACE_LITERAL([uid_t]) +m4trace:configure.in:788: -1- AH_OUTPUT([uid_t], [/* Define to `int\' if doesn\'t define. */ #undef uid_t]) -m4trace:configure.in:784: -1- AC_DEFINE_TRACE_LITERAL([gid_t]) -m4trace:configure.in:784: -1- AH_OUTPUT([gid_t], [/* Define to `int\' if doesn\'t define. */ +m4trace:configure.in:788: -1- AC_DEFINE_TRACE_LITERAL([gid_t]) +m4trace:configure.in:788: -1- AH_OUTPUT([gid_t], [/* Define to `int\' if doesn\'t define. */ #undef gid_t]) -m4trace:configure.in:784: -1- AC_DEFINE_TRACE_LITERAL([GETGROUPS_T]) -m4trace:configure.in:784: -1- AH_OUTPUT([GETGROUPS_T], [/* Define to the type of elements in the array set by `getgroups\'. Usually +m4trace:configure.in:788: -1- AC_DEFINE_TRACE_LITERAL([GETGROUPS_T]) +m4trace:configure.in:788: -1- AH_OUTPUT([GETGROUPS_T], [/* Define to the type of elements in the array set by `getgroups\'. Usually this is either `int\' or `gid_t\'. */ #undef GETGROUPS_T]) -m4trace:configure.in:785: -1- AC_TYPE_OFF_T -m4trace:configure.in:785: -1- AC_DEFINE_TRACE_LITERAL([off_t]) -m4trace:configure.in:785: -1- AH_OUTPUT([off_t], [/* Define to `long\' if does not define. */ +m4trace:configure.in:789: -1- AC_TYPE_OFF_T +m4trace:configure.in:789: -1- AC_DEFINE_TRACE_LITERAL([off_t]) +m4trace:configure.in:789: -1- AH_OUTPUT([off_t], [/* Define to `long\' if does not define. */ #undef off_t]) -m4trace:configure.in:786: -1- AC_TYPE_MODE_T -m4trace:configure.in:786: -1- AC_DEFINE_TRACE_LITERAL([mode_t]) -m4trace:configure.in:786: -1- AH_OUTPUT([mode_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:790: -1- AC_TYPE_MODE_T +m4trace:configure.in:790: -1- AC_DEFINE_TRACE_LITERAL([mode_t]) +m4trace:configure.in:790: -1- AH_OUTPUT([mode_t], [/* Define to `int\' if does not define. */ #undef mode_t]) -m4trace:configure.in:787: -1- AC_TYPE_UID_T -m4trace:configure.in:787: -1- AC_DEFINE_TRACE_LITERAL([uid_t]) -m4trace:configure.in:787: -1- AH_OUTPUT([uid_t], [/* Define to `int\' if doesn\'t define. */ +m4trace:configure.in:791: -1- AC_TYPE_UID_T +m4trace:configure.in:791: -1- AC_DEFINE_TRACE_LITERAL([uid_t]) +m4trace:configure.in:791: -1- AH_OUTPUT([uid_t], [/* Define to `int\' if doesn\'t define. */ #undef uid_t]) -m4trace:configure.in:787: -1- AC_DEFINE_TRACE_LITERAL([gid_t]) -m4trace:configure.in:787: -1- AH_OUTPUT([gid_t], [/* Define to `int\' if doesn\'t define. */ +m4trace:configure.in:791: -1- AC_DEFINE_TRACE_LITERAL([gid_t]) +m4trace:configure.in:791: -1- AH_OUTPUT([gid_t], [/* Define to `int\' if doesn\'t define. */ #undef gid_t]) -m4trace:configure.in:788: -1- AC_TYPE_PID_T -m4trace:configure.in:788: -1- AC_DEFINE_TRACE_LITERAL([pid_t]) -m4trace:configure.in:788: -1- AH_OUTPUT([pid_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:792: -1- AC_TYPE_PID_T +m4trace:configure.in:792: -1- AC_DEFINE_TRACE_LITERAL([pid_t]) +m4trace:configure.in:792: -1- AH_OUTPUT([pid_t], [/* Define to `int\' if does not define. */ #undef pid_t]) -m4trace:configure.in:789: -1- AC_TYPE_SIZE_T -m4trace:configure.in:789: -1- AC_DEFINE_TRACE_LITERAL([size_t]) -m4trace:configure.in:789: -1- AH_OUTPUT([size_t], [/* Define to `unsigned\' if does not define. */ +m4trace:configure.in:793: -1- AC_TYPE_SIZE_T +m4trace:configure.in:793: -1- AC_DEFINE_TRACE_LITERAL([size_t]) +m4trace:configure.in:793: -1- AH_OUTPUT([size_t], [/* Define to `unsigned\' if does not define. */ #undef size_t]) -m4trace:configure.in:790: -1- AC_DEFINE_TRACE_LITERAL([ssize_t]) -m4trace:configure.in:790: -1- AH_OUTPUT([ssize_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:794: -1- AC_DEFINE_TRACE_LITERAL([ssize_t]) +m4trace:configure.in:794: -1- AH_OUTPUT([ssize_t], [/* Define to `int\' if does not define. */ #undef ssize_t]) -m4trace:configure.in:791: -1- AC_DEFINE_TRACE_LITERAL([time_t]) -m4trace:configure.in:791: -1- AH_OUTPUT([time_t], [/* Define to `long\' if does not define. */ +m4trace:configure.in:795: -1- AC_DEFINE_TRACE_LITERAL([time_t]) +m4trace:configure.in:795: -1- AH_OUTPUT([time_t], [/* Define to `long\' if does not define. */ #undef time_t]) -m4trace:configure.in:793: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:797: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:481: BASH_TYPE_LONG_LONG is expanded from... -configure.in:793: the top level]) -m4trace:configure.in:793: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LONG_LONG]) -m4trace:configure.in:794: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:797: the top level]) +m4trace:configure.in:797: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LONG_LONG]) +m4trace:configure.in:798: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:496: BASH_TYPE_UNSIGNED_LONG_LONG is expanded from... -configure.in:794: the top level]) -m4trace:configure.in:794: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNSIGNED_LONG_LONG]) -m4trace:configure.in:796: -1- AC_TYPE_SIGNAL -m4trace:configure.in:796: -1- AC_DEFINE_TRACE_LITERAL([RETSIGTYPE]) -m4trace:configure.in:796: -1- AH_OUTPUT([RETSIGTYPE], [/* Define as the return type of signal handlers (`int\' or `void\'). */ +configure.in:798: the top level]) +m4trace:configure.in:798: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNSIGNED_LONG_LONG]) +m4trace:configure.in:800: -1- AC_TYPE_SIGNAL +m4trace:configure.in:800: -1- AC_DEFINE_TRACE_LITERAL([RETSIGTYPE]) +m4trace:configure.in:800: -1- AH_OUTPUT([RETSIGTYPE], [/* Define as the return type of signal handlers (`int\' or `void\'). */ #undef RETSIGTYPE]) -m4trace:configure.in:798: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:802: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:798: the top level]) -m4trace:configure.in:798: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_CHAR]) -m4trace:configure.in:798: -1- AH_OUTPUT([SIZEOF_CHAR], [/* The size of a `char\', as computed by sizeof. */ +configure.in:802: the top level]) +m4trace:configure.in:802: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_CHAR]) +m4trace:configure.in:802: -1- AH_OUTPUT([SIZEOF_CHAR], [/* The size of a `char\', as computed by sizeof. */ #undef SIZEOF_CHAR]) -m4trace:configure.in:799: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:803: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:799: the top level]) -m4trace:configure.in:799: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_SHORT]) -m4trace:configure.in:799: -1- AH_OUTPUT([SIZEOF_SHORT], [/* The size of a `short\', as computed by sizeof. */ +configure.in:803: the top level]) +m4trace:configure.in:803: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_SHORT]) +m4trace:configure.in:803: -1- AH_OUTPUT([SIZEOF_SHORT], [/* The size of a `short\', as computed by sizeof. */ #undef SIZEOF_SHORT]) -m4trace:configure.in:800: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:804: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:800: the top level]) -m4trace:configure.in:800: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_INT]) -m4trace:configure.in:800: -1- AH_OUTPUT([SIZEOF_INT], [/* The size of a `int\', as computed by sizeof. */ +configure.in:804: the top level]) +m4trace:configure.in:804: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_INT]) +m4trace:configure.in:804: -1- AH_OUTPUT([SIZEOF_INT], [/* The size of a `int\', as computed by sizeof. */ #undef SIZEOF_INT]) -m4trace:configure.in:801: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:805: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:801: the top level]) -m4trace:configure.in:801: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG]) -m4trace:configure.in:801: -1- AH_OUTPUT([SIZEOF_LONG], [/* The size of a `long\', as computed by sizeof. */ +configure.in:805: the top level]) +m4trace:configure.in:805: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG]) +m4trace:configure.in:805: -1- AH_OUTPUT([SIZEOF_LONG], [/* The size of a `long\', as computed by sizeof. */ #undef SIZEOF_LONG]) -m4trace:configure.in:802: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:806: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:802: the top level]) -m4trace:configure.in:802: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_CHAR_P]) -m4trace:configure.in:802: -1- AH_OUTPUT([SIZEOF_CHAR_P], [/* The size of a `char *\', as computed by sizeof. */ +configure.in:806: the top level]) +m4trace:configure.in:806: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_CHAR_P]) +m4trace:configure.in:806: -1- AH_OUTPUT([SIZEOF_CHAR_P], [/* The size of a `char *\', as computed by sizeof. */ #undef SIZEOF_CHAR_P]) -m4trace:configure.in:803: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:807: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:803: the top level]) -m4trace:configure.in:803: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_DOUBLE]) -m4trace:configure.in:803: -1- AH_OUTPUT([SIZEOF_DOUBLE], [/* The size of a `double\', as computed by sizeof. */ +configure.in:807: the top level]) +m4trace:configure.in:807: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_DOUBLE]) +m4trace:configure.in:807: -1- AH_OUTPUT([SIZEOF_DOUBLE], [/* The size of a `double\', as computed by sizeof. */ #undef SIZEOF_DOUBLE]) -m4trace:configure.in:804: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... +m4trace:configure.in:808: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [autoconf/general.m4:2281: AC_RUN_IFELSE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... autoconf/types.m4:405: AC_CHECK_SIZEOF is expanded from... -configure.in:804: the top level]) -m4trace:configure.in:804: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG_LONG]) -m4trace:configure.in:804: -1- AH_OUTPUT([SIZEOF_LONG_LONG], [/* The size of a `long long\', as computed by sizeof. */ +configure.in:808: the top level]) +m4trace:configure.in:808: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG_LONG]) +m4trace:configure.in:808: -1- AH_OUTPUT([SIZEOF_LONG_LONG], [/* The size of a `long long\', as computed by sizeof. */ #undef SIZEOF_LONG_LONG]) -m4trace:configure.in:806: -1- AC_DEFINE_TRACE_LITERAL([u_int]) -m4trace:configure.in:806: -1- AH_OUTPUT([u_int], [/* Define to `unsigned int\' if does not define. */ +m4trace:configure.in:810: -1- AC_DEFINE_TRACE_LITERAL([u_int]) +m4trace:configure.in:810: -1- AH_OUTPUT([u_int], [/* Define to `unsigned int\' if does not define. */ #undef u_int]) -m4trace:configure.in:807: -1- AC_DEFINE_TRACE_LITERAL([u_long]) -m4trace:configure.in:807: -1- AH_OUTPUT([u_long], [/* Define to `unsigned long\' if does not define. */ +m4trace:configure.in:811: -1- AC_DEFINE_TRACE_LITERAL([u_long]) +m4trace:configure.in:811: -1- AH_OUTPUT([u_long], [/* Define to `unsigned long\' if does not define. */ #undef u_long]) -m4trace:configure.in:809: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) -m4trace:configure.in:809: -1- AH_OUTPUT([bits16_t], [/* Define to `short\' if does not define. */ +m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) +m4trace:configure.in:813: -1- AH_OUTPUT([bits16_t], [/* Define to `short\' if does not define. */ #undef bits16_t]) -m4trace:configure.in:809: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) -m4trace:configure.in:809: -1- AH_OUTPUT([bits16_t], [/* Define to `char\' if does not define. */ +m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) +m4trace:configure.in:813: -1- AH_OUTPUT([bits16_t], [/* Define to `char\' if does not define. */ #undef bits16_t]) -m4trace:configure.in:809: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) -m4trace:configure.in:809: -1- AH_OUTPUT([bits16_t], [/* Define to `short\' if does not define. */ +m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits16_t]) +m4trace:configure.in:813: -1- AH_OUTPUT([bits16_t], [/* Define to `short\' if does not define. */ #undef bits16_t]) -m4trace:configure.in:810: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) -m4trace:configure.in:810: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned short\' if does not define. */ +m4trace:configure.in:814: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) +m4trace:configure.in:814: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned short\' if does not define. */ #undef u_bits16_t]) -m4trace:configure.in:810: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) -m4trace:configure.in:810: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned char\' if does not define. */ +m4trace:configure.in:814: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) +m4trace:configure.in:814: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned char\' if does not define. */ #undef u_bits16_t]) -m4trace:configure.in:810: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) -m4trace:configure.in:810: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned short\' if does not define. */ +m4trace:configure.in:814: -1- AC_DEFINE_TRACE_LITERAL([u_bits16_t]) +m4trace:configure.in:814: -1- AH_OUTPUT([u_bits16_t], [/* Define to `unsigned short\' if does not define. */ #undef u_bits16_t]) -m4trace:configure.in:811: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) -m4trace:configure.in:811: -1- AH_OUTPUT([bits32_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) +m4trace:configure.in:815: -1- AH_OUTPUT([bits32_t], [/* Define to `int\' if does not define. */ #undef bits32_t]) -m4trace:configure.in:811: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) -m4trace:configure.in:811: -1- AH_OUTPUT([bits32_t], [/* Define to `long\' if does not define. */ +m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) +m4trace:configure.in:815: -1- AH_OUTPUT([bits32_t], [/* Define to `long\' if does not define. */ #undef bits32_t]) -m4trace:configure.in:811: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) -m4trace:configure.in:811: -1- AH_OUTPUT([bits32_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([bits32_t]) +m4trace:configure.in:815: -1- AH_OUTPUT([bits32_t], [/* Define to `int\' if does not define. */ #undef bits32_t]) -m4trace:configure.in:812: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) -m4trace:configure.in:812: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned int\' if does not define. */ +m4trace:configure.in:816: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) +m4trace:configure.in:816: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned int\' if does not define. */ #undef u_bits32_t]) -m4trace:configure.in:812: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) -m4trace:configure.in:812: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned long\' if does not define. */ +m4trace:configure.in:816: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) +m4trace:configure.in:816: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned long\' if does not define. */ #undef u_bits32_t]) -m4trace:configure.in:812: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) -m4trace:configure.in:812: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned int\' if does not define. */ +m4trace:configure.in:816: -1- AC_DEFINE_TRACE_LITERAL([u_bits32_t]) +m4trace:configure.in:816: -1- AH_OUTPUT([u_bits32_t], [/* Define to `unsigned int\' if does not define. */ #undef u_bits32_t]) -m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) -m4trace:configure.in:813: -1- AH_OUTPUT([bits64_t], [/* Define to `char *\' if does not define. */ +m4trace:configure.in:817: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) +m4trace:configure.in:817: -1- AH_OUTPUT([bits64_t], [/* Define to `char *\' if does not define. */ #undef bits64_t]) -m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) -m4trace:configure.in:813: -1- AH_OUTPUT([bits64_t], [/* Define to `double\' if does not define. */ +m4trace:configure.in:817: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) +m4trace:configure.in:817: -1- AH_OUTPUT([bits64_t], [/* Define to `double\' if does not define. */ #undef bits64_t]) -m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) -m4trace:configure.in:813: -1- AH_OUTPUT([bits64_t], [/* Define to `long long\' if does not define. */ +m4trace:configure.in:817: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) +m4trace:configure.in:817: -1- AH_OUTPUT([bits64_t], [/* Define to `long long\' if does not define. */ #undef bits64_t]) -m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) -m4trace:configure.in:813: -1- AH_OUTPUT([bits64_t], [/* Define to `long\' if does not define. */ +m4trace:configure.in:817: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) +m4trace:configure.in:817: -1- AH_OUTPUT([bits64_t], [/* Define to `long\' if does not define. */ #undef bits64_t]) -m4trace:configure.in:813: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) -m4trace:configure.in:813: -1- AH_OUTPUT([bits64_t], [/* Define to `double\' if does not define. */ +m4trace:configure.in:817: -1- AC_DEFINE_TRACE_LITERAL([bits64_t]) +m4trace:configure.in:817: -1- AH_OUTPUT([bits64_t], [/* Define to `double\' if does not define. */ #undef bits64_t]) -m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) -m4trace:configure.in:815: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:819: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) +m4trace:configure.in:819: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `int\' if does not define. */ #undef ptrdiff_t]) -m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) -m4trace:configure.in:815: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `long\' if does not define. */ +m4trace:configure.in:819: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) +m4trace:configure.in:819: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `long\' if does not define. */ #undef ptrdiff_t]) -m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) -m4trace:configure.in:815: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `long long\' if does not define. */ +m4trace:configure.in:819: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) +m4trace:configure.in:819: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `long long\' if does not define. */ #undef ptrdiff_t]) -m4trace:configure.in:815: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) -m4trace:configure.in:815: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `int\' if does not define. */ +m4trace:configure.in:819: -1- AC_DEFINE_TRACE_LITERAL([ptrdiff_t]) +m4trace:configure.in:819: -1- AH_OUTPUT([ptrdiff_t], [/* Define to `int\' if does not define. */ #undef ptrdiff_t]) -m4trace:configure.in:818: -1- AC_HEADER_STAT -m4trace:configure.in:818: -1- AC_DEFINE_TRACE_LITERAL([STAT_MACROS_BROKEN]) -m4trace:configure.in:818: -1- AH_OUTPUT([STAT_MACROS_BROKEN], [/* Define to 1 if the `S_IS*\' macros in do not work properly. */ +m4trace:configure.in:822: -1- AC_HEADER_STAT +m4trace:configure.in:822: -1- AC_DEFINE_TRACE_LITERAL([STAT_MACROS_BROKEN]) +m4trace:configure.in:822: -1- AH_OUTPUT([STAT_MACROS_BROKEN], [/* Define to 1 if the `S_IS*\' macros in do not work properly. */ #undef STAT_MACROS_BROKEN]) -m4trace:configure.in:823: -1- AC_DEFINE_TRACE_LITERAL([HAVE_HASH_BANG_EXEC]) -m4trace:configure.in:828: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:827: -1- AC_DEFINE_TRACE_LITERAL([HAVE_HASH_BANG_EXEC]) +m4trace:configure.in:832: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:546: BASH_FUNC_LSTAT is expanded from... -configure.in:828: the top level]) -m4trace:configure.in:828: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LSTAT]) -m4trace:configure.in:832: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:832: the top level]) +m4trace:configure.in:832: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LSTAT]) +m4trace:configure.in:836: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1860: BASH_FUNC_CTYPE_NONASCII is expanded from... -configure.in:832: the top level]) -m4trace:configure.in:832: -1- AC_DEFINE_TRACE_LITERAL([CTYPE_NON_ASCII]) -m4trace:configure.in:833: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:836: the top level]) +m4trace:configure.in:836: -1- AC_DEFINE_TRACE_LITERAL([CTYPE_NON_ASCII]) +m4trace:configure.in:837: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:294: BASH_FUNC_DUP2_CLOEXEC_CHECK is expanded from... -configure.in:833: the top level]) -m4trace:configure.in:833: -1- AC_DEFINE_TRACE_LITERAL([DUP2_BROKEN]) -m4trace:configure.in:834: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:837: the top level]) +m4trace:configure.in:837: -1- AC_DEFINE_TRACE_LITERAL([DUP2_BROKEN]) +m4trace:configure.in:838: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1280: BASH_SYS_PGRP_SYNC is expanded from... -configure.in:834: the top level]) -m4trace:configure.in:834: -1- AC_DEFINE_TRACE_LITERAL([PGRP_PIPE]) -m4trace:configure.in:835: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:838: the top level]) +m4trace:configure.in:838: -1- AC_DEFINE_TRACE_LITERAL([PGRP_PIPE]) +m4trace:configure.in:839: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1217: BASH_SYS_SIGNAL_VINTAGE is expanded from... -configure.in:835: the top level]) -m4trace:configure.in:835: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:839: the top level]) +m4trace:configure.in:839: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:2215: AC_LINK_IFELSE is expanded from... autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1217: BASH_SYS_SIGNAL_VINTAGE is expanded from... -configure.in:835: the top level]) -m4trace:configure.in:835: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:839: the top level]) +m4trace:configure.in:839: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:2215: AC_LINK_IFELSE is expanded from... autoconf/general.m4:2223: AC_TRY_LINK is expanded from... @@ -1498,310 +1498,310 @@ autoconf/general.m4:2215: AC_LINK_IFELSE is expanded from... autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1217: BASH_SYS_SIGNAL_VINTAGE is expanded from... -configure.in:835: the top level]) -m4trace:configure.in:835: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGNALS]) -m4trace:configure.in:835: -1- AC_DEFINE_TRACE_LITERAL([HAVE_BSD_SIGNALS]) -m4trace:configure.in:835: -1- AC_DEFINE_TRACE_LITERAL([HAVE_USG_SIGHOLD]) -m4trace:configure.in:838: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:839: the top level]) +m4trace:configure.in:839: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGNALS]) +m4trace:configure.in:839: -1- AC_DEFINE_TRACE_LITERAL([HAVE_BSD_SIGNALS]) +m4trace:configure.in:839: -1- AC_DEFINE_TRACE_LITERAL([HAVE_USG_SIGHOLD]) +m4trace:configure.in:842: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:262: BASH_SYS_ERRLIST is expanded from... -configure.in:838: the top level]) -m4trace:configure.in:838: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYS_ERRLIST]) -m4trace:configure.in:839: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:842: the top level]) +m4trace:configure.in:842: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYS_ERRLIST]) +m4trace:configure.in:843: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:233: BASH_SYS_SIGLIST is expanded from... -configure.in:839: the top level]) -m4trace:configure.in:839: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYS_SIGLIST]) -m4trace:configure.in:840: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:843: the top level]) +m4trace:configure.in:843: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYS_SIGLIST]) +m4trace:configure.in:844: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:179: BASH_DECL_UNDER_SYS_SIGLIST is expanded from... -configure.in:840: BASH_DECL_UNDER_SYS_SIGLIST is required by... +configure.in:844: BASH_DECL_UNDER_SYS_SIGLIST is required by... aclocal.m4:206: BASH_UNDER_SYS_SIGLIST is expanded from... -configure.in:840: the top level]) -m4trace:configure.in:840: -1- AC_DEFINE_TRACE_LITERAL([UNDER_SYS_SIGLIST_DECLARED]) -m4trace:configure.in:840: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:844: the top level]) +m4trace:configure.in:844: -1- AC_DEFINE_TRACE_LITERAL([UNDER_SYS_SIGLIST_DECLARED]) +m4trace:configure.in:844: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:206: BASH_UNDER_SYS_SIGLIST is expanded from... -configure.in:840: the top level]) -m4trace:configure.in:840: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNDER_SYS_SIGLIST]) -m4trace:configure.in:843: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:844: the top level]) +m4trace:configure.in:844: -1- AC_DEFINE_TRACE_LITERAL([HAVE_UNDER_SYS_SIGLIST]) +m4trace:configure.in:847: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:380: BASH_TYPE_SIGHANDLER is expanded from... -configure.in:843: the top level]) -m4trace:configure.in:843: -1- AC_DEFINE_TRACE_LITERAL([VOID_SIGHANDLER]) -m4trace:configure.in:844: -1- AC_DEFINE_TRACE_LITERAL([clock_t]) -m4trace:configure.in:845: -1- AC_DEFINE_TRACE_LITERAL([sigset_t]) -m4trace:configure.in:846: -1- AC_DEFINE_TRACE_LITERAL([HAVE_QUAD_T]) -m4trace:configure.in:846: -1- AC_DEFINE_TRACE_LITERAL([quad_t]) -m4trace:configure.in:847: -1- AC_DEFINE_TRACE_LITERAL([intmax_t]) -m4trace:configure.in:848: -1- AC_DEFINE_TRACE_LITERAL([uintmax_t]) -m4trace:configure.in:850: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOCKLEN_T]) -m4trace:configure.in:850: -1- AC_DEFINE_TRACE_LITERAL([socklen_t]) -m4trace:configure.in:852: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:847: the top level]) +m4trace:configure.in:847: -1- AC_DEFINE_TRACE_LITERAL([VOID_SIGHANDLER]) +m4trace:configure.in:848: -1- AC_DEFINE_TRACE_LITERAL([clock_t]) +m4trace:configure.in:849: -1- AC_DEFINE_TRACE_LITERAL([sigset_t]) +m4trace:configure.in:850: -1- AC_DEFINE_TRACE_LITERAL([HAVE_QUAD_T]) +m4trace:configure.in:850: -1- AC_DEFINE_TRACE_LITERAL([quad_t]) +m4trace:configure.in:851: -1- AC_DEFINE_TRACE_LITERAL([intmax_t]) +m4trace:configure.in:852: -1- AC_DEFINE_TRACE_LITERAL([uintmax_t]) +m4trace:configure.in:854: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOCKLEN_T]) +m4trace:configure.in:854: -1- AC_DEFINE_TRACE_LITERAL([socklen_t]) +m4trace:configure.in:856: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:532: BASH_TYPE_RLIMIT is expanded from... -configure.in:852: the top level]) -m4trace:configure.in:852: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:856: the top level]) +m4trace:configure.in:856: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:2173: AC_COMPILE_IFELSE is expanded from... autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:532: BASH_TYPE_RLIMIT is expanded from... -configure.in:852: the top level]) -m4trace:configure.in:852: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE]) -m4trace:configure.in:852: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE]) -m4trace:configure.in:855: -2- AC_DEFINE_TRACE_LITERAL([TERMIOS_LDISC]) -m4trace:configure.in:856: -2- AC_DEFINE_TRACE_LITERAL([TERMIO_LDISC]) -m4trace:configure.in:857: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:856: the top level]) +m4trace:configure.in:856: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE]) +m4trace:configure.in:856: -1- AC_DEFINE_TRACE_LITERAL([RLIMTYPE]) +m4trace:configure.in:859: -2- AC_DEFINE_TRACE_LITERAL([TERMIOS_LDISC]) +m4trace:configure.in:860: -2- AC_DEFINE_TRACE_LITERAL([TERMIO_LDISC]) +m4trace:configure.in:861: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1058: BASH_STRUCT_DIRENT_D_INO is expanded from... -configure.in:857: the top level]) -m4trace:configure.in:857: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_INO]) -m4trace:configure.in:858: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:861: the top level]) +m4trace:configure.in:861: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_INO]) +m4trace:configure.in:862: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1091: BASH_STRUCT_DIRENT_D_FILENO is expanded from... -configure.in:858: the top level]) -m4trace:configure.in:858: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_FILENO]) -m4trace:configure.in:859: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:862: the top level]) +m4trace:configure.in:862: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_FILENO]) +m4trace:configure.in:863: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1124: BASH_STRUCT_DIRENT_D_NAMLEN is expanded from... -configure.in:859: the top level]) -m4trace:configure.in:859: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_NAMLEN]) -m4trace:configure.in:860: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:863: the top level]) +m4trace:configure.in:863: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_DIRENT_D_NAMLEN]) +m4trace:configure.in:864: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1177: BASH_STRUCT_WINSIZE is expanded from... -configure.in:860: the top level]) -m4trace:configure.in:860: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:864: the top level]) +m4trace:configure.in:864: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:2173: AC_COMPILE_IFELSE is expanded from... autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1177: BASH_STRUCT_WINSIZE is expanded from... -configure.in:860: the top level]) -m4trace:configure.in:860: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_SYS_IOCTL]) -m4trace:configure.in:860: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_TERMIOS]) -m4trace:configure.in:861: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TIMEVAL]) -m4trace:configure.in:862: -1- AC_CHECK_MEMBERS([struct stat.st_blocks]) -m4trace:configure.in:862: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_STAT_ST_BLOCKS]) -m4trace:configure.in:862: -1- AH_OUTPUT([HAVE_STRUCT_STAT_ST_BLOCKS], [/* Define to 1 if `st_blocks\' is member of `struct stat\'. */ +configure.in:864: the top level]) +m4trace:configure.in:864: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_SYS_IOCTL]) +m4trace:configure.in:864: -1- AC_DEFINE_TRACE_LITERAL([STRUCT_WINSIZE_IN_TERMIOS]) +m4trace:configure.in:865: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TIMEVAL]) +m4trace:configure.in:866: -1- AC_CHECK_MEMBERS([struct stat.st_blocks]) +m4trace:configure.in:866: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_STAT_ST_BLOCKS]) +m4trace:configure.in:866: -1- AH_OUTPUT([HAVE_STRUCT_STAT_ST_BLOCKS], [/* Define to 1 if `st_blocks\' is member of `struct stat\'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS]) -m4trace:configure.in:863: -1- AC_STRUCT_TM -m4trace:configure.in:863: -1- AC_DEFINE_TRACE_LITERAL([TM_IN_SYS_TIME]) -m4trace:configure.in:863: -1- AH_OUTPUT([TM_IN_SYS_TIME], [/* Define to 1 if your declares `struct tm\'. */ +m4trace:configure.in:867: -1- AC_STRUCT_TM +m4trace:configure.in:867: -1- AC_DEFINE_TRACE_LITERAL([TM_IN_SYS_TIME]) +m4trace:configure.in:867: -1- AH_OUTPUT([TM_IN_SYS_TIME], [/* Define to 1 if your declares `struct tm\'. */ #undef TM_IN_SYS_TIME]) -m4trace:configure.in:864: -1- AC_STRUCT_TIMEZONE -m4trace:configure.in:864: -1- AC_CHECK_MEMBERS([struct tm.tm_zone], [], [], [#include +m4trace:configure.in:868: -1- AC_STRUCT_TIMEZONE +m4trace:configure.in:868: -1- AC_CHECK_MEMBERS([struct tm.tm_zone], [], [], [#include #include <$ac_cv_struct_tm> ]) -m4trace:configure.in:864: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TM_TM_ZONE]) -m4trace:configure.in:864: -1- AH_OUTPUT([HAVE_STRUCT_TM_TM_ZONE], [/* Define to 1 if `tm_zone\' is member of `struct tm\'. */ +m4trace:configure.in:868: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TM_TM_ZONE]) +m4trace:configure.in:868: -1- AH_OUTPUT([HAVE_STRUCT_TM_TM_ZONE], [/* Define to 1 if `tm_zone\' is member of `struct tm\'. */ #undef HAVE_STRUCT_TM_TM_ZONE]) -m4trace:configure.in:864: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TM_ZONE]) -m4trace:configure.in:864: -1- AH_OUTPUT([HAVE_TM_ZONE], [/* Define to 1 if your `struct tm\' has `tm_zone\'. Deprecated, use +m4trace:configure.in:868: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TM_ZONE]) +m4trace:configure.in:868: -1- AH_OUTPUT([HAVE_TM_ZONE], [/* Define to 1 if your `struct tm\' has `tm_zone\'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE\' instead. */ #undef HAVE_TM_ZONE]) -m4trace:configure.in:864: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TZNAME]) -m4trace:configure.in:864: -1- AH_OUTPUT([HAVE_TZNAME], [/* Define to 1 if you don\'t have `tm_zone\' but do have the external array +m4trace:configure.in:868: -1- AC_DEFINE_TRACE_LITERAL([HAVE_TZNAME]) +m4trace:configure.in:868: -1- AH_OUTPUT([HAVE_TZNAME], [/* Define to 1 if you don\'t have `tm_zone\' but do have the external array `tzname\'. */ #undef HAVE_TZNAME]) -m4trace:configure.in:865: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TIMEZONE]) -m4trace:configure.in:868: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +m4trace:configure.in:869: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRUCT_TIMEZONE]) +m4trace:configure.in:872: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:307: BASH_FUNC_STRSIGNAL is expanded from... -configure.in:868: the top level]) -m4trace:configure.in:868: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRSIGNAL]) -m4trace:configure.in:869: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:872: the top level]) +m4trace:configure.in:872: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STRSIGNAL]) +m4trace:configure.in:873: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:360: BASH_FUNC_OPENDIR_CHECK is expanded from... -configure.in:869: the top level]) -m4trace:configure.in:869: -1- AC_DEFINE_TRACE_LITERAL([OPENDIR_NOT_ROBUST]) -m4trace:configure.in:870: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:873: the top level]) +m4trace:configure.in:873: -1- AC_DEFINE_TRACE_LITERAL([OPENDIR_NOT_ROBUST]) +m4trace:configure.in:874: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:685: BASH_FUNC_ULIMIT_MAXFDS is expanded from... -configure.in:870: the top level]) -m4trace:configure.in:870: -1- AC_DEFINE_TRACE_LITERAL([ULIMIT_MAXFDS]) -m4trace:configure.in:871: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:874: the top level]) +m4trace:configure.in:874: -1- AC_DEFINE_TRACE_LITERAL([ULIMIT_MAXFDS]) +m4trace:configure.in:875: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:606: BASH_FUNC_GETENV is expanded from... -configure.in:871: the top level]) -m4trace:configure.in:871: -1- AC_DEFINE_TRACE_LITERAL([CAN_REDEFINE_GETENV]) -m4trace:configure.in:873: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:875: the top level]) +m4trace:configure.in:875: -1- AC_DEFINE_TRACE_LITERAL([CAN_REDEFINE_GETENV]) +m4trace:configure.in:877: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:711: BASH_FUNC_GETCWD is expanded from... -configure.in:873: the top level]) -m4trace:configure.in:873: -1- AC_DEFINE_TRACE_LITERAL([GETCWD_BROKEN]) -m4trace:configure.in:873: -1- AC_LIBSOURCE([getcwd.c]) -m4trace:configure.in:873: -1- AC_SUBST([LIB@&t@OBJS]) -m4trace:configure.in:875: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:877: the top level]) +m4trace:configure.in:877: -1- AC_DEFINE_TRACE_LITERAL([GETCWD_BROKEN]) +m4trace:configure.in:877: -1- AC_LIBSOURCE([getcwd.c]) +m4trace:configure.in:877: -1- AC_SUBST([LIB@&t@OBJS]) +m4trace:configure.in:879: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:812: BASH_FUNC_POSIX_SETJMP is expanded from... -configure.in:875: the top level]) -m4trace:configure.in:875: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGSETJMP]) -m4trace:configure.in:876: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:879: the top level]) +m4trace:configure.in:879: -1- AC_DEFINE_TRACE_LITERAL([HAVE_POSIX_SIGSETJMP]) +m4trace:configure.in:880: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:861: BASH_FUNC_STRCOLL is expanded from... -configure.in:876: the top level]) -m4trace:configure.in:876: -1- AC_DEFINE_TRACE_LITERAL([STRCOLL_BROKEN]) -m4trace:configure.in:882: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:880: the top level]) +m4trace:configure.in:880: -1- AC_DEFINE_TRACE_LITERAL([STRCOLL_BROKEN]) +m4trace:configure.in:886: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:636: BASH_FUNC_STD_PUTENV is expanded from... -configure.in:882: the top level]) -m4trace:configure.in:882: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV]) -m4trace:configure.in:884: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV]) -m4trace:configure.in:887: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +configure.in:886: the top level]) +m4trace:configure.in:886: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV]) +m4trace:configure.in:888: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_PUTENV]) +m4trace:configure.in:891: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... aclocal.m4:666: BASH_FUNC_STD_UNSETENV is expanded from... -configure.in:887: the top level]) -m4trace:configure.in:887: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV]) -m4trace:configure.in:889: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV]) -m4trace:configure.in:892: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:891: the top level]) +m4trace:configure.in:891: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV]) +m4trace:configure.in:893: -1- AC_DEFINE_TRACE_LITERAL([HAVE_STD_UNSETENV]) +m4trace:configure.in:896: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:887: BASH_FUNC_PRINTF_A_FORMAT is expanded from... -configure.in:892: the top level]) -m4trace:configure.in:892: -1- AC_DEFINE_TRACE_LITERAL([HAVE_PRINTF_A_FORMAT]) -m4trace:configure.in:895: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:896: the top level]) +m4trace:configure.in:896: -1- AC_DEFINE_TRACE_LITERAL([HAVE_PRINTF_A_FORMAT]) +m4trace:configure.in:899: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1338: BASH_SYS_REINSTALL_SIGHANDLERS is expanded from... -configure.in:895: the top level]) -m4trace:configure.in:895: -1- AC_DEFINE_TRACE_LITERAL([MUST_REINSTALL_SIGHANDLERS]) -m4trace:configure.in:896: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:899: the top level]) +m4trace:configure.in:899: -1- AC_DEFINE_TRACE_LITERAL([MUST_REINSTALL_SIGHANDLERS]) +m4trace:configure.in:900: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1396: BASH_SYS_JOB_CONTROL_MISSING is expanded from... -configure.in:896: the top level]) -m4trace:configure.in:896: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL_MISSING]) -m4trace:configure.in:897: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:900: the top level]) +m4trace:configure.in:900: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL_MISSING]) +m4trace:configure.in:901: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1448: BASH_SYS_NAMED_PIPES is expanded from... -configure.in:897: the top level]) -m4trace:configure.in:897: -1- AC_DEFINE_TRACE_LITERAL([NAMED_PIPES_MISSING]) -m4trace:configure.in:900: -1- AC_DEFINE_TRACE_LITERAL([GWINSZ_IN_SYS_IOCTL]) -m4trace:configure.in:900: -1- AH_OUTPUT([GWINSZ_IN_SYS_IOCTL], [/* Define to 1 if `TIOCGWINSZ\' requires . */ +configure.in:901: the top level]) +m4trace:configure.in:901: -1- AC_DEFINE_TRACE_LITERAL([NAMED_PIPES_MISSING]) +m4trace:configure.in:904: -1- AC_DEFINE_TRACE_LITERAL([GWINSZ_IN_SYS_IOCTL]) +m4trace:configure.in:904: -1- AH_OUTPUT([GWINSZ_IN_SYS_IOCTL], [/* Define to 1 if `TIOCGWINSZ\' requires . */ #undef GWINSZ_IN_SYS_IOCTL]) -m4trace:configure.in:901: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +m4trace:configure.in:905: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1491: BASH_HAVE_TIOCSTAT is expanded from... -configure.in:901: the top level]) -m4trace:configure.in:901: -1- AC_DEFINE_TRACE_LITERAL([TIOCSTAT_IN_SYS_IOCTL]) -m4trace:configure.in:902: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:905: the top level]) +m4trace:configure.in:905: -1- AC_DEFINE_TRACE_LITERAL([TIOCSTAT_IN_SYS_IOCTL]) +m4trace:configure.in:906: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1503: BASH_HAVE_FIONREAD is expanded from... -configure.in:902: the top level]) -m4trace:configure.in:902: -1- AC_DEFINE_TRACE_LITERAL([FIONREAD_IN_SYS_IOCTL]) -m4trace:configure.in:904: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:906: the top level]) +m4trace:configure.in:906: -1- AC_DEFINE_TRACE_LITERAL([FIONREAD_IN_SYS_IOCTL]) +m4trace:configure.in:908: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1893: BASH_CHECK_WCONTINUED is expanded from... -configure.in:904: the top level]) -m4trace:configure.in:904: -1- AC_DEFINE_TRACE_LITERAL([WCONTINUED_BROKEN]) -m4trace:configure.in:907: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:908: the top level]) +m4trace:configure.in:908: -1- AC_DEFINE_TRACE_LITERAL([WCONTINUED_BROKEN]) +m4trace:configure.in:911: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1520: BASH_CHECK_SPEED_T is expanded from... -configure.in:907: the top level]) -m4trace:configure.in:907: -1- AC_DEFINE_TRACE_LITERAL([SPEED_T_IN_SYS_TYPES]) -m4trace:configure.in:908: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_DECLS]) -m4trace:configure.in:909: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. +configure.in:911: the top level]) +m4trace:configure.in:911: -1- AC_DEFINE_TRACE_LITERAL([SPEED_T_IN_SYS_TYPES]) +m4trace:configure.in:912: -1- AC_DEFINE_TRACE_LITERAL([HAVE_GETPW_DECLS]) +m4trace:configure.in:913: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [autoconf/general.m4:2289: AC_TRY_RUN is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1665: BASH_CHECK_RTSIGS is expanded from... -configure.in:909: the top level]) -m4trace:configure.in:909: -1- AC_DEFINE_TRACE_LITERAL([UNUSABLE_RT_SIGNALS]) -m4trace:configure.in:910: -1- AC_SUBST([SIGLIST_O]) -m4trace:configure.in:914: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:913: the top level]) +m4trace:configure.in:913: -1- AC_DEFINE_TRACE_LITERAL([UNUSABLE_RT_SIGNALS]) +m4trace:configure.in:914: -1- AC_SUBST([SIGLIST_O]) +m4trace:configure.in:918: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1614: BASH_CHECK_KERNEL_RLIMIT is expanded from... -configure.in:914: the top level]) -m4trace:configure.in:914: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +configure.in:918: the top level]) +m4trace:configure.in:918: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. You should run autoupdate.], [autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:2173: AC_COMPILE_IFELSE is expanded from... autoconf/general.m4:2180: AC_TRY_COMPILE is expanded from... autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... aclocal.m4:1614: BASH_CHECK_KERNEL_RLIMIT is expanded from... -configure.in:914: the top level]) -m4trace:configure.in:914: -1- AC_DEFINE_TRACE_LITERAL([RLIMIT_NEEDS_KERNEL]) -m4trace:configure.in:922: -1- AC_CHECK_LIB([termcap], [tgetent], [bash_cv_termcap_lib=libtermcap], [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, +configure.in:918: the top level]) +m4trace:configure.in:918: -1- AC_DEFINE_TRACE_LITERAL([RLIMIT_NEEDS_KERNEL]) +m4trace:configure.in:926: -1- AC_CHECK_LIB([termcap], [tgetent], [bash_cv_termcap_lib=libtermcap], [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])])]) -m4trace:configure.in:922: -1- AC_CHECK_LIB([tinfo], [tgetent], [bash_cv_termcap_lib=libtinfo], [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, +m4trace:configure.in:926: -1- AC_CHECK_LIB([tinfo], [tgetent], [bash_cv_termcap_lib=libtinfo], [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])]) -m4trace:configure.in:922: -1- AC_CHECK_LIB([curses], [tgetent], [bash_cv_termcap_lib=libcurses], [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, +m4trace:configure.in:926: -1- AC_CHECK_LIB([curses], [tgetent], [bash_cv_termcap_lib=libcurses], [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)]) -m4trace:configure.in:922: -1- AC_CHECK_LIB([ncurses], [tgetent], [bash_cv_termcap_lib=libncurses], [bash_cv_termcap_lib=gnutermcap]) -m4trace:configure.in:924: -1- AC_SUBST([TERMCAP_LIB]) -m4trace:configure.in:925: -1- AC_SUBST([TERMCAP_DEP]) -m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD]) -m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX]) -m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD]) -m4trace:configure.in:927: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX]) -m4trace:configure.in:928: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_STDIN]) -m4trace:configure.in:929: -1- AC_DEFINE_TRACE_LITERAL([DEFAULT_MAIL_DIRECTORY]) -m4trace:configure.in:936: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL]) -m4trace:configure.in:942: -1- AC_SUBST([JOBS_O]) -m4trace:configure.in:955: -1- AC_DEFINE_TRACE_LITERAL([SVR4_2]) -m4trace:configure.in:956: -1- AC_DEFINE_TRACE_LITERAL([SVR4]) -m4trace:configure.in:957: -1- AC_DEFINE_TRACE_LITERAL([SVR4]) -m4trace:configure.in:958: -1- AC_DEFINE_TRACE_LITERAL([SVR5]) -m4trace:configure.in:1015: -1- AC_SUBST([SHOBJ_CC]) -m4trace:configure.in:1016: -1- AC_SUBST([SHOBJ_CFLAGS]) -m4trace:configure.in:1017: -1- AC_SUBST([SHOBJ_LD]) -m4trace:configure.in:1018: -1- AC_SUBST([SHOBJ_LDFLAGS]) -m4trace:configure.in:1019: -1- AC_SUBST([SHOBJ_XLDFLAGS]) -m4trace:configure.in:1020: -1- AC_SUBST([SHOBJ_LIBS]) -m4trace:configure.in:1021: -1- AC_SUBST([SHOBJ_STATUS]) -m4trace:configure.in:1046: -1- AC_SUBST([PROFILE_FLAGS]) -m4trace:configure.in:1048: -1- AC_SUBST([incdir]) -m4trace:configure.in:1049: -1- AC_SUBST([BUILD_DIR]) -m4trace:configure.in:1051: -1- AC_SUBST([YACC]) -m4trace:configure.in:1052: -1- AC_SUBST([AR]) -m4trace:configure.in:1053: -1- AC_SUBST([ARFLAGS]) -m4trace:configure.in:1055: -1- AC_SUBST([BASHVERS]) -m4trace:configure.in:1056: -1- AC_SUBST([RELSTATUS]) -m4trace:configure.in:1057: -1- AC_SUBST([DEBUG]) -m4trace:configure.in:1058: -1- AC_SUBST([MALLOC_DEBUG]) -m4trace:configure.in:1060: -1- AC_SUBST([host_cpu]) -m4trace:configure.in:1061: -1- AC_SUBST([host_vendor]) -m4trace:configure.in:1062: -1- AC_SUBST([host_os]) -m4trace:configure.in:1064: -1- AC_SUBST([LOCAL_LIBS]) -m4trace:configure.in:1065: -1- AC_SUBST([LOCAL_CFLAGS]) -m4trace:configure.in:1066: -1- AC_SUBST([LOCAL_LDFLAGS]) -m4trace:configure.in:1067: -1- AC_SUBST([LOCAL_DEFS]) -m4trace:configure.in:1081: -1- AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \ +m4trace:configure.in:926: -1- AC_CHECK_LIB([ncurses], [tgetent], [bash_cv_termcap_lib=libncurses], [bash_cv_termcap_lib=gnutermcap]) +m4trace:configure.in:928: -1- AC_SUBST([TERMCAP_LIB]) +m4trace:configure.in:929: -1- AC_SUBST([TERMCAP_DEP]) +m4trace:configure.in:931: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD]) +m4trace:configure.in:931: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX]) +m4trace:configure.in:931: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_FD]) +m4trace:configure.in:931: -1- AC_DEFINE_TRACE_LITERAL([DEV_FD_PREFIX]) +m4trace:configure.in:932: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DEV_STDIN]) +m4trace:configure.in:933: -1- AC_DEFINE_TRACE_LITERAL([DEFAULT_MAIL_DIRECTORY]) +m4trace:configure.in:940: -1- AC_DEFINE_TRACE_LITERAL([JOB_CONTROL]) +m4trace:configure.in:946: -1- AC_SUBST([JOBS_O]) +m4trace:configure.in:959: -1- AC_DEFINE_TRACE_LITERAL([SVR4_2]) +m4trace:configure.in:960: -1- AC_DEFINE_TRACE_LITERAL([SVR4]) +m4trace:configure.in:961: -1- AC_DEFINE_TRACE_LITERAL([SVR4]) +m4trace:configure.in:962: -1- AC_DEFINE_TRACE_LITERAL([SVR5]) +m4trace:configure.in:1019: -1- AC_SUBST([SHOBJ_CC]) +m4trace:configure.in:1020: -1- AC_SUBST([SHOBJ_CFLAGS]) +m4trace:configure.in:1021: -1- AC_SUBST([SHOBJ_LD]) +m4trace:configure.in:1022: -1- AC_SUBST([SHOBJ_LDFLAGS]) +m4trace:configure.in:1023: -1- AC_SUBST([SHOBJ_XLDFLAGS]) +m4trace:configure.in:1024: -1- AC_SUBST([SHOBJ_LIBS]) +m4trace:configure.in:1025: -1- AC_SUBST([SHOBJ_STATUS]) +m4trace:configure.in:1050: -1- AC_SUBST([PROFILE_FLAGS]) +m4trace:configure.in:1052: -1- AC_SUBST([incdir]) +m4trace:configure.in:1053: -1- AC_SUBST([BUILD_DIR]) +m4trace:configure.in:1055: -1- AC_SUBST([YACC]) +m4trace:configure.in:1056: -1- AC_SUBST([AR]) +m4trace:configure.in:1057: -1- AC_SUBST([ARFLAGS]) +m4trace:configure.in:1059: -1- AC_SUBST([BASHVERS]) +m4trace:configure.in:1060: -1- AC_SUBST([RELSTATUS]) +m4trace:configure.in:1061: -1- AC_SUBST([DEBUG]) +m4trace:configure.in:1062: -1- AC_SUBST([MALLOC_DEBUG]) +m4trace:configure.in:1064: -1- AC_SUBST([host_cpu]) +m4trace:configure.in:1065: -1- AC_SUBST([host_vendor]) +m4trace:configure.in:1066: -1- AC_SUBST([host_os]) +m4trace:configure.in:1068: -1- AC_SUBST([LOCAL_LIBS]) +m4trace:configure.in:1069: -1- AC_SUBST([LOCAL_CFLAGS]) +m4trace:configure.in:1070: -1- AC_SUBST([LOCAL_LDFLAGS]) +m4trace:configure.in:1071: -1- AC_SUBST([LOCAL_DEFS]) +m4trace:configure.in:1085: -1- AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \ lib/intl/Makefile \ lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \ lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \ examples/loadables/Makefile examples/loadables/perl/Makefile \ pathnames.h]) -m4trace:configure.in:1081: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +m4trace:configure.in:1085: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. You should run autoupdate.], []) -m4trace:configure.in:1081: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) -m4trace:configure.in:1081: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:1085: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:1085: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c index ae2893ca1..363869a5e 100644 --- a/builtins/mkbuiltins.c +++ b/builtins/mkbuiltins.c @@ -381,14 +381,8 @@ array_add (element, array) array->array = (char **)xrealloc (array->array, (array->size += array->growth_rate) * array->width); -#if defined (HAVE_BCOPY) - bcopy (&element, (char *) &(array->array[array->sindex]), array->width); - array->sindex++; - bzero ((char *) &(array->array[array->sindex]), array->width); -#else array->array[array->sindex++] = element; array->array[array->sindex] = (char *)NULL; -#endif /* !HAVE_BCOPY */ } /* Free an allocated array and data pointer. */ diff --git a/builtins/mkbuiltins.c~ b/builtins/mkbuiltins.c~ new file mode 100644 index 000000000..ae2893ca1 --- /dev/null +++ b/builtins/mkbuiltins.c~ @@ -0,0 +1,1562 @@ +/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from + a single source file called builtins.def. */ + +/* Copyright (C) 1987-2002 Free Software Foundation, Inc. + +This file is part of GNU Bash, the Bourne Again SHell. + +Bash is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Bash is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with Bash; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +#include + +#if defined (HAVE_UNISTD_H) +# ifdef _MINIX +# include +# endif +# include +#endif + +#ifndef _MINIX +# include "../bashtypes.h" +# if defined (HAVE_SYS_FILE_H) +# include +# endif +#endif + +#include "posixstat.h" +#include "filecntl.h" + +#include "../bashansi.h" +#include +#include + +#include "stdc.h" + +#define DOCFILE "builtins.texi" + +#ifndef errno +extern int errno; +#endif + +static char *xmalloc (), *xrealloc (); + +#if !defined (__STDC__) && !defined (strcpy) +extern char *strcpy (); +#endif /* !__STDC__ && !strcpy */ + +#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x)) +#define whitespace(c) (((c) == ' ') || ((c) == '\t')) + +/* Flag values that builtins can have. */ +#define BUILTIN_FLAG_SPECIAL 0x01 +#define BUILTIN_FLAG_ASSIGNMENT 0x02 + +#define BASE_INDENT 4 + +/* If this stream descriptor is non-zero, then write + texinfo documentation to it. */ +FILE *documentation_file = (FILE *)NULL; + +/* Non-zero means to only produce documentation. */ +int only_documentation = 0; + +/* Non-zero means to not do any productions. */ +int inhibit_production = 0; + +/* Non-zero means to produce separate help files for each builtin, named by + the builtin name, in `./helpfiles'. */ +int separate_helpfiles = 0; + +/* Non-zero means to create single C strings for each `longdoc', with + embedded newlines, for ease of translation. */ +int single_longdoc_strings = 1; + +/* The name of a directory into which the separate external help files will + eventually be installed. */ +char *helpfile_directory; + +/* The name of a directory to precede the filename when reporting + errors. */ +char *error_directory = (char *)NULL; + +/* The name of the structure file. */ +char *struct_filename = (char *)NULL; + +/* The name of the external declaration file. */ +char *extern_filename = (char *)NULL; + +/* Here is a structure for manipulating arrays of data. */ +typedef struct { + int size; /* Number of slots allocated to array. */ + int sindex; /* Current location in array. */ + int width; /* Size of each element. */ + int growth_rate; /* How fast to grow. */ + char **array; /* The array itself. */ +} ARRAY; + +/* Here is a structure defining a single BUILTIN. */ +typedef struct { + char *name; /* The name of this builtin. */ + char *function; /* The name of the function to call. */ + char *shortdoc; /* The short documentation for this builtin. */ + char *docname; /* Possible name for documentation string. */ + ARRAY *longdoc; /* The long documentation for this builtin. */ + ARRAY *dependencies; /* Null terminated array of #define names. */ + int flags; /* Flags for this builtin. */ +} BUILTIN_DESC; + +/* Here is a structure which defines a DEF file. */ +typedef struct { + char *filename; /* The name of the input def file. */ + ARRAY *lines; /* The contents of the file. */ + int line_number; /* The current line number. */ + char *production; /* The name of the production file. */ + FILE *output; /* Open file stream for PRODUCTION. */ + ARRAY *builtins; /* Null terminated array of BUILTIN_DESC *. */ +} DEF_FILE; + +/* The array of all builtins encountered during execution of this code. */ +ARRAY *saved_builtins = (ARRAY *)NULL; + +/* The Posix.2 so-called `special' builtins. */ +char *special_builtins[] = +{ + ":", ".", "source", "break", "continue", "eval", "exec", "exit", + "export", "readonly", "return", "set", "shift", "times", "trap", "unset", + (char *)NULL +}; + +/* The builtin commands that take assignment statements as arguments. */ +char *assignment_builtins[] = +{ + "alias", "declare", "export", "local", "readonly", "typeset", + (char *)NULL +}; + +/* Forward declarations. */ +static int is_special_builtin (); +static int is_assignment_builtin (); + +#if !defined (HAVE_RENAME) +static int rename (); +#endif + +void extract_info (); + +void file_error (); +void line_error (); + +void write_file_headers (); +void write_file_footers (); +void write_ifdefs (); +void write_endifs (); +void write_documentation (); +void write_longdocs (); +void write_builtins (); + +int write_helpfiles (); + +void free_defs (); +void add_documentation (); + +void must_be_building (); +void remove_trailing_whitespace (); + +#define document_name(b) ((b)->docname ? (b)->docname : (b)->name) + + +/* For each file mentioned on the command line, process it and + write the information to STRUCTFILE and EXTERNFILE, while + creating the production file if neccessary. */ +int +main (argc, argv) + int argc; + char **argv; +{ + int arg_index = 1; + FILE *structfile, *externfile; + char *documentation_filename, *temp_struct_filename; + + structfile = externfile = (FILE *)NULL; + documentation_filename = DOCFILE; + temp_struct_filename = (char *)NULL; + + while (arg_index < argc && argv[arg_index][0] == '-') + { + char *arg = argv[arg_index++]; + + if (strcmp (arg, "-externfile") == 0) + extern_filename = argv[arg_index++]; + else if (strcmp (arg, "-structfile") == 0) + struct_filename = argv[arg_index++]; + else if (strcmp (arg, "-noproduction") == 0) + inhibit_production = 1; + else if (strcmp (arg, "-document") == 0) + documentation_file = fopen (documentation_filename, "w"); + else if (strcmp (arg, "-D") == 0) + { + int len; + + if (error_directory) + free (error_directory); + + error_directory = xmalloc (2 + strlen (argv[arg_index])); + strcpy (error_directory, argv[arg_index]); + len = strlen (error_directory); + + if (len && error_directory[len - 1] != '/') + strcat (error_directory, "/"); + + arg_index++; + } + else if (strcmp (arg, "-documentonly") == 0) + { + only_documentation = 1; + documentation_file = fopen (documentation_filename, "w"); + } + else if (strcmp (arg, "-H") == 0) + { + separate_helpfiles = 1; + helpfile_directory = argv[arg_index++]; + } + else if (strcmp (arg, "-S") == 0) + single_longdoc_strings = 0; + else + { + fprintf (stderr, "%s: Unknown flag %s.\n", argv[0], arg); + exit (2); + } + } + + /* If there are no files to process, just quit now. */ + if (arg_index == argc) + exit (0); + + if (!only_documentation) + { + /* Open the files. */ + if (struct_filename) + { + temp_struct_filename = xmalloc (15); + sprintf (temp_struct_filename, "mk-%ld", (long) getpid ()); + structfile = fopen (temp_struct_filename, "w"); + + if (!structfile) + file_error (temp_struct_filename); + } + + if (extern_filename) + { + externfile = fopen (extern_filename, "w"); + + if (!externfile) + file_error (extern_filename); + } + + /* Write out the headers. */ + write_file_headers (structfile, externfile); + } + + if (documentation_file) + { + fprintf (documentation_file, "@c Table of builtins created with %s.\n", + argv[0]); + fprintf (documentation_file, "@ftable @asis\n"); + } + + /* Process the .def files. */ + while (arg_index < argc) + { + register char *arg; + + arg = argv[arg_index++]; + + extract_info (arg, structfile, externfile); + } + + /* Close the files. */ + if (!only_documentation) + { + /* Write the footers. */ + write_file_footers (structfile, externfile); + + if (structfile) + { + write_longdocs (structfile, saved_builtins); + fclose (structfile); + rename (temp_struct_filename, struct_filename); + } + + if (externfile) + fclose (externfile); + } + + if (separate_helpfiles) + { + write_helpfiles (saved_builtins); + } + + if (documentation_file) + { + fprintf (documentation_file, "@end ftable\n"); + fclose (documentation_file); + } + + exit (0); +} + +/* **************************************************************** */ +/* */ +/* Array Functions and Manipulators */ +/* */ +/* **************************************************************** */ + +/* Make a new array, and return a pointer to it. The array will + contain elements of size WIDTH, and is initialized to no elements. */ +ARRAY * +array_create (width) + int width; +{ + ARRAY *array; + + array = (ARRAY *)xmalloc (sizeof (ARRAY)); + array->size = 0; + array->sindex = 0; + array->width = width; + + /* Default to increasing size in units of 20. */ + array->growth_rate = 20; + + array->array = (char **)NULL; + + return (array); +} + +/* Copy the array of strings in ARRAY. */ +ARRAY * +copy_string_array (array) + ARRAY *array; +{ + register int i; + ARRAY *copy; + + if (!array) + return (ARRAY *)NULL; + + copy = array_create (sizeof (char *)); + + copy->size = array->size; + copy->sindex = array->sindex; + copy->width = array->width; + + copy->array = (char **)xmalloc ((1 + array->sindex) * sizeof (char *)); + + for (i = 0; i < array->sindex; i++) + copy->array[i] = savestring (array->array[i]); + + copy->array[i] = (char *)NULL; + + return (copy); +} + +/* Add ELEMENT to ARRAY, growing the array if neccessary. */ +void +array_add (element, array) + char *element; + ARRAY *array; +{ + if (array->sindex + 2 > array->size) + array->array = (char **)xrealloc + (array->array, (array->size += array->growth_rate) * array->width); + +#if defined (HAVE_BCOPY) + bcopy (&element, (char *) &(array->array[array->sindex]), array->width); + array->sindex++; + bzero ((char *) &(array->array[array->sindex]), array->width); +#else + array->array[array->sindex++] = element; + array->array[array->sindex] = (char *)NULL; +#endif /* !HAVE_BCOPY */ +} + +/* Free an allocated array and data pointer. */ +void +array_free (array) + ARRAY *array; +{ + if (array->array) + free (array->array); + + free (array); +} + +/* **************************************************************** */ +/* */ +/* Processing a DEF File */ +/* */ +/* **************************************************************** */ + +/* The definition of a function. */ +typedef int Function (); +typedef int mk_handler_func_t __P((char *, DEF_FILE *, char *)); + +/* Structure handles processor directives. */ +typedef struct { + char *directive; + mk_handler_func_t *function; +} HANDLER_ENTRY; + +extern int builtin_handler __P((char *, DEF_FILE *, char *)); +extern int function_handler __P((char *, DEF_FILE *, char *)); +extern int short_doc_handler __P((char *, DEF_FILE *, char *)); +extern int comment_handler __P((char *, DEF_FILE *, char *)); +extern int depends_on_handler __P((char *, DEF_FILE *, char *)); +extern int produces_handler __P((char *, DEF_FILE *, char *)); +extern int end_handler __P((char *, DEF_FILE *, char *)); +extern int docname_handler __P((char *, DEF_FILE *, char *)); + +HANDLER_ENTRY handlers[] = { + { "BUILTIN", builtin_handler }, + { "DOCNAME", docname_handler }, + { "FUNCTION", function_handler }, + { "SHORT_DOC", short_doc_handler }, + { "$", comment_handler }, + { "COMMENT", comment_handler }, + { "DEPENDS_ON", depends_on_handler }, + { "PRODUCES", produces_handler }, + { "END", end_handler }, + { (char *)NULL, (mk_handler_func_t *)NULL } +}; + +/* Return the entry in the table of handlers for NAME. */ +HANDLER_ENTRY * +find_directive (directive) + char *directive; +{ + register int i; + + for (i = 0; handlers[i].directive; i++) + if (strcmp (handlers[i].directive, directive) == 0) + return (&handlers[i]); + + return ((HANDLER_ENTRY *)NULL); +} + +/* Non-zero indicates that a $BUILTIN has been seen, but not + the corresponding $END. */ +static int building_builtin = 0; + +/* Non-zero means to output cpp line and file information before + printing the current line to the production file. */ +int output_cpp_line_info = 0; + +/* The main function of this program. Read FILENAME and act on what is + found. Lines not starting with a dollar sign are copied to the + $PRODUCES target, if one is present. Lines starting with a dollar sign + are directives to this program, specifying the name of the builtin, the + function to call, the short documentation and the long documentation + strings. FILENAME can contain multiple $BUILTINs, but only one $PRODUCES + target. After the file has been processed, write out the names of + builtins found in each $BUILTIN. Plain text found before the $PRODUCES + is ignored, as is "$$ comment text". */ +void +extract_info (filename, structfile, externfile) + char *filename; + FILE *structfile, *externfile; +{ + register int i; + DEF_FILE *defs; + struct stat finfo; + size_t file_size; + char *buffer, *line; + int fd, nr; + + if (stat (filename, &finfo) == -1) + file_error (filename); + + fd = open (filename, O_RDONLY, 0666); + + if (fd == -1) + file_error (filename); + + file_size = (size_t)finfo.st_size; + buffer = xmalloc (1 + file_size); + + if ((nr = read (fd, buffer, file_size)) < 0) + file_error (filename); + + /* This is needed on WIN32, and does not hurt on Unix. */ + if (nr < file_size) + file_size = nr; + + close (fd); + + if (nr == 0) + { + fprintf (stderr, "mkbuiltins: %s: skipping zero-length file\n", filename); + return; + } + + /* Create and fill in the initial structure describing this file. */ + defs = (DEF_FILE *)xmalloc (sizeof (DEF_FILE)); + defs->filename = filename; + defs->lines = array_create (sizeof (char *)); + defs->line_number = 0; + defs->production = (char *)NULL; + defs->output = (FILE *)NULL; + defs->builtins = (ARRAY *)NULL; + + /* Build the array of lines. */ + i = 0; + while (i < file_size) + { + array_add (&buffer[i], defs->lines); + + while (buffer[i] != '\n' && i < file_size) + i++; + buffer[i++] = '\0'; + } + + /* Begin processing the input file. We don't write any output + until we have a file to write output to. */ + output_cpp_line_info = 1; + + /* Process each line in the array. */ + for (i = 0; line = defs->lines->array[i]; i++) + { + defs->line_number = i; + + if (*line == '$') + { + register int j; + char *directive; + HANDLER_ENTRY *handler; + + /* Isolate the directive. */ + for (j = 0; line[j] && !whitespace (line[j]); j++); + + directive = xmalloc (j); + strncpy (directive, line + 1, j - 1); + directive[j -1] = '\0'; + + /* Get the function handler and call it. */ + handler = find_directive (directive); + + if (!handler) + { + line_error (defs, "Unknown directive `%s'", directive); + free (directive); + continue; + } + else + { + /* Advance to the first non-whitespace character. */ + while (whitespace (line[j])) + j++; + + /* Call the directive handler with the FILE, and ARGS. */ + (*(handler->function)) (directive, defs, line + j); + } + free (directive); + } + else + { + if (building_builtin) + add_documentation (defs, line); + else if (defs->output) + { + if (output_cpp_line_info) + { + /* If we're handed an absolute pathname, don't prepend + the directory name. */ + if (defs->filename[0] == '/') + fprintf (defs->output, "#line %d \"%s\"\n", + defs->line_number + 1, defs->filename); + else + fprintf (defs->output, "#line %d \"%s%s\"\n", + defs->line_number + 1, + error_directory ? error_directory : "./", + defs->filename); + output_cpp_line_info = 0; + } + + fprintf (defs->output, "%s\n", line); + } + } + } + + /* Close the production file. */ + if (defs->output) + fclose (defs->output); + + /* The file has been processed. Write the accumulated builtins to + the builtins.c file, and write the extern definitions to the + builtext.h file. */ + write_builtins (defs, structfile, externfile); + + free (buffer); + free_defs (defs); +} + +#define free_safely(x) if (x) free (x) + +static void +free_builtin (builtin) + BUILTIN_DESC *builtin; +{ + register int i; + + free_safely (builtin->name); + free_safely (builtin->function); + free_safely (builtin->shortdoc); + free_safely (builtin->docname); + + if (builtin->longdoc) + array_free (builtin->longdoc); + + if (builtin->dependencies) + { + for (i = 0; builtin->dependencies->array[i]; i++) + free (builtin->dependencies->array[i]); + array_free (builtin->dependencies); + } +} + +/* Free all of the memory allocated to a DEF_FILE. */ +void +free_defs (defs) + DEF_FILE *defs; +{ + register int i; + register BUILTIN_DESC *builtin; + + if (defs->production) + free (defs->production); + + if (defs->lines) + array_free (defs->lines); + + if (defs->builtins) + { + for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++) + { + free_builtin (builtin); + free (builtin); + } + array_free (defs->builtins); + } + free (defs); +} + +/* **************************************************************** */ +/* */ +/* The Handler Functions Themselves */ +/* */ +/* **************************************************************** */ + +/* Strip surrounding whitespace from STRING, and + return a pointer to the start of it. */ +char * +strip_whitespace (string) + char *string; +{ + while (whitespace (*string)) + string++; + + remove_trailing_whitespace (string); + return (string); +} + +/* Remove only the trailing whitespace from STRING. */ +void +remove_trailing_whitespace (string) + char *string; +{ + register int i; + + i = strlen (string) - 1; + + while (i > 0 && whitespace (string[i])) + i--; + + string[++i] = '\0'; +} + +/* Ensure that there is a argument in STRING and return it. + FOR_WHOM is the name of the directive which needs the argument. + DEFS is the DEF_FILE in which the directive is found. + If there is no argument, produce an error. */ +char * +get_arg (for_whom, defs, string) + char *for_whom, *string; + DEF_FILE *defs; +{ + char *new; + + new = strip_whitespace (string); + + if (!*new) + line_error (defs, "%s requires an argument", for_whom); + + return (savestring (new)); +} + +/* Error if not building a builtin. */ +void +must_be_building (directive, defs) + char *directive; + DEF_FILE *defs; +{ + if (!building_builtin) + line_error (defs, "%s must be inside of a $BUILTIN block", directive); +} + +/* Return the current builtin. */ +BUILTIN_DESC * +current_builtin (directive, defs) + char *directive; + DEF_FILE *defs; +{ + must_be_building (directive, defs); + if (defs->builtins) + return ((BUILTIN_DESC *)defs->builtins->array[defs->builtins->sindex - 1]); + else + return ((BUILTIN_DESC *)NULL); +} + +/* Add LINE to the long documentation for the current builtin. + Ignore blank lines until the first non-blank line has been seen. */ +void +add_documentation (defs, line) + DEF_FILE *defs; + char *line; +{ + register BUILTIN_DESC *builtin; + + builtin = current_builtin ("(implied LONGDOC)", defs); + + remove_trailing_whitespace (line); + + if (!*line && !builtin->longdoc) + return; + + if (!builtin->longdoc) + builtin->longdoc = array_create (sizeof (char *)); + + array_add (line, builtin->longdoc); +} + +/* How to handle the $BUILTIN directive. */ +int +builtin_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + BUILTIN_DESC *new; + char *name; + + /* If we are already building a builtin, we cannot start a new one. */ + if (building_builtin) + { + line_error (defs, "%s found before $END", self); + return (-1); + } + + output_cpp_line_info++; + + /* Get the name of this builtin, and stick it in the array. */ + name = get_arg (self, defs, arg); + + /* If this is the first builtin, create the array to hold them. */ + if (!defs->builtins) + defs->builtins = array_create (sizeof (BUILTIN_DESC *)); + + new = (BUILTIN_DESC *)xmalloc (sizeof (BUILTIN_DESC)); + new->name = name; + new->function = (char *)NULL; + new->shortdoc = (char *)NULL; + new->docname = (char *)NULL; + new->longdoc = (ARRAY *)NULL; + new->dependencies = (ARRAY *)NULL; + new->flags = 0; + + if (is_special_builtin (name)) + new->flags |= BUILTIN_FLAG_SPECIAL; + if (is_assignment_builtin (name)) + new->flags |= BUILTIN_FLAG_ASSIGNMENT; + + array_add ((char *)new, defs->builtins); + building_builtin = 1; + + return (0); +} + +/* How to handle the $FUNCTION directive. */ +int +function_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + register BUILTIN_DESC *builtin; + + builtin = current_builtin (self, defs); + + if (builtin == 0) + { + line_error (defs, "syntax error: no current builtin for $FUNCTION directive"); + exit (1); + } + if (builtin->function) + line_error (defs, "%s already has a function (%s)", + builtin->name, builtin->function); + else + builtin->function = get_arg (self, defs, arg); + + return (0); +} + +/* How to handle the $DOCNAME directive. */ +int +docname_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + register BUILTIN_DESC *builtin; + + builtin = current_builtin (self, defs); + + if (builtin->docname) + line_error (defs, "%s already had a docname (%s)", + builtin->name, builtin->docname); + else + builtin->docname = get_arg (self, defs, arg); + + return (0); +} + +/* How to handle the $SHORT_DOC directive. */ +int +short_doc_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + register BUILTIN_DESC *builtin; + + builtin = current_builtin (self, defs); + + if (builtin->shortdoc) + line_error (defs, "%s already has short documentation (%s)", + builtin->name, builtin->shortdoc); + else + builtin->shortdoc = get_arg (self, defs, arg); + + return (0); +} + +/* How to handle the $COMMENT directive. */ +int +comment_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + return (0); +} + +/* How to handle the $DEPENDS_ON directive. */ +int +depends_on_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + register BUILTIN_DESC *builtin; + char *dependent; + + builtin = current_builtin (self, defs); + dependent = get_arg (self, defs, arg); + + if (!builtin->dependencies) + builtin->dependencies = array_create (sizeof (char *)); + + array_add (dependent, builtin->dependencies); + + return (0); +} + +/* How to handle the $PRODUCES directive. */ +int +produces_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + /* If just hacking documentation, don't change any of the production + files. */ + if (only_documentation) + return (0); + + output_cpp_line_info++; + + if (defs->production) + line_error (defs, "%s already has a %s definition", defs->filename, self); + else + { + defs->production = get_arg (self, defs, arg); + + if (inhibit_production) + return (0); + + defs->output = fopen (defs->production, "w"); + + if (!defs->output) + file_error (defs->production); + + fprintf (defs->output, "/* %s, created from %s. */\n", + defs->production, defs->filename); + } + return (0); +} + +/* How to handle the $END directive. */ +int +end_handler (self, defs, arg) + char *self; + DEF_FILE *defs; + char *arg; +{ + must_be_building (self, defs); + building_builtin = 0; + return (0); +} + +/* **************************************************************** */ +/* */ +/* Error Handling Functions */ +/* */ +/* **************************************************************** */ + +/* Produce an error for DEFS with FORMAT and ARGS. */ +void +line_error (defs, format, arg1, arg2) + DEF_FILE *defs; + char *format, *arg1, *arg2; +{ + if (defs->filename[0] != '/') + fprintf (stderr, "%s", error_directory ? error_directory : "./"); + fprintf (stderr, "%s:%d:", defs->filename, defs->line_number + 1); + fprintf (stderr, format, arg1, arg2); + fprintf (stderr, "\n"); + fflush (stderr); +} + +/* Print error message for FILENAME. */ +void +file_error (filename) + char *filename; +{ + perror (filename); + exit (2); +} + +/* **************************************************************** */ +/* */ +/* xmalloc and xrealloc () */ +/* */ +/* **************************************************************** */ + +static void memory_error_and_abort (); + +static char * +xmalloc (bytes) + int bytes; +{ + char *temp = (char *)malloc (bytes); + + if (!temp) + memory_error_and_abort (); + return (temp); +} + +static char * +xrealloc (pointer, bytes) + char *pointer; + int bytes; +{ + char *temp; + + if (!pointer) + temp = (char *)malloc (bytes); + else + temp = (char *)realloc (pointer, bytes); + + if (!temp) + memory_error_and_abort (); + + return (temp); +} + +static void +memory_error_and_abort () +{ + fprintf (stderr, "mkbuiltins: out of virtual memory\n"); + abort (); +} + +/* **************************************************************** */ +/* */ +/* Creating the Struct and Extern Files */ +/* */ +/* **************************************************************** */ + +/* Return a pointer to a newly allocated builtin which is + an exact copy of BUILTIN. */ +BUILTIN_DESC * +copy_builtin (builtin) + BUILTIN_DESC *builtin; +{ + BUILTIN_DESC *new; + + new = (BUILTIN_DESC *)xmalloc (sizeof (BUILTIN_DESC)); + + new->name = savestring (builtin->name); + new->shortdoc = savestring (builtin->shortdoc); + new->longdoc = copy_string_array (builtin->longdoc); + new->dependencies = copy_string_array (builtin->dependencies); + + new->function = + builtin->function ? savestring (builtin->function) : (char *)NULL; + new->docname = + builtin->docname ? savestring (builtin->docname) : (char *)NULL; + + return (new); +} + +/* How to save away a builtin. */ +void +save_builtin (builtin) + BUILTIN_DESC *builtin; +{ + BUILTIN_DESC *newbuiltin; + + newbuiltin = copy_builtin (builtin); + + /* If this is the first builtin to be saved, create the array + to hold it. */ + if (!saved_builtins) + saved_builtins = array_create (sizeof (BUILTIN_DESC *)); + + array_add ((char *)newbuiltin, saved_builtins); +} + +/* Flags that mean something to write_documentation (). */ +#define STRING_ARRAY 0x01 +#define TEXINFO 0x02 +#define PLAINTEXT 0x04 +#define HELPFILE 0x08 + +char *structfile_header[] = { + "/* builtins.c -- the built in shell commands. */", + "", + "/* This file is manufactured by ./mkbuiltins, and should not be", + " edited by hand. See the source to mkbuiltins for details. */", + "", + "/* Copyright (C) 1987-2002 Free Software Foundation, Inc.", + "", + " This file is part of GNU Bash, the Bourne Again SHell.", + "", + " Bash is free software; you can redistribute it and/or modify it", + " under the terms of the GNU General Public License as published by", + " the Free Software Foundation; either version 2, or (at your option)", + " any later version.", + "", + " Bash is distributed in the hope that it will be useful, but WITHOUT", + " ANY WARRANTY; without even the implied warranty of MERCHANTABILITY", + " or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public", + " License for more details.", + "", + " You should have received a copy of the GNU General Public License", + " along with Bash; see the file COPYING. If not, write to the Free", + " Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */", + "", + "/* The list of shell builtins. Each element is name, function, flags,", + " long-doc, short-doc. The long-doc field contains a pointer to an array", + " of help lines. The function takes a WORD_LIST *; the first word in the", + " list is the first arg to the command. The list has already had word", + " expansion performed.", + "", + " Functions which need to look at only the simple commands (e.g.", + " the enable_builtin ()), should ignore entries where", + " (array[i].function == (sh_builtin_func_t *)NULL). Such entries are for", + " the list of shell reserved control structures, like `if' and `while'.", + " The end of the list is denoted with a NULL name field. */", + "", + "#include \"../builtins.h\"", + (char *)NULL + }; + +char *structfile_footer[] = { + " { (char *)0x0, (sh_builtin_func_t *)0x0, 0, (char **)0x0, (char *)0x0 }", + "};", + "", + "struct builtin *shell_builtins = static_shell_builtins;", + "struct builtin *current_builtin;", + "", + "int num_shell_builtins =", + "\tsizeof (static_shell_builtins) / sizeof (struct builtin) - 1;", + (char *)NULL +}; + +/* Write out any neccessary opening information for + STRUCTFILE and EXTERNFILE. */ +void +write_file_headers (structfile, externfile) + FILE *structfile, *externfile; +{ + register int i; + + if (structfile) + { + for (i = 0; structfile_header[i]; i++) + fprintf (structfile, "%s\n", structfile_header[i]); + + fprintf (structfile, "#include \"%s\"\n", + extern_filename ? extern_filename : "builtext.h"); + + fprintf (structfile, "#include \"bashintl.h\"\n"); + + fprintf (structfile, "\nstruct builtin static_shell_builtins[] = {\n"); + } + + if (externfile) + fprintf (externfile, + "/* %s - The list of builtins found in libbuiltins.a. */\n", + extern_filename ? extern_filename : "builtext.h"); +} + +/* Write out any necessary closing information for + STRUCTFILE and EXTERNFILE. */ +void +write_file_footers (structfile, externfile) + FILE *structfile, *externfile; +{ + register int i; + + /* Write out the footers. */ + if (structfile) + { + for (i = 0; structfile_footer[i]; i++) + fprintf (structfile, "%s\n", structfile_footer[i]); + } +} + +/* Write out the information accumulated in DEFS to + STRUCTFILE and EXTERNFILE. */ +void +write_builtins (defs, structfile, externfile) + DEF_FILE *defs; + FILE *structfile, *externfile; +{ + register int i; + + /* Write out the information. */ + if (defs->builtins) + { + register BUILTIN_DESC *builtin; + + for (i = 0; i < defs->builtins->sindex; i++) + { + builtin = (BUILTIN_DESC *)defs->builtins->array[i]; + + /* Write out any #ifdefs that may be there. */ + if (!only_documentation) + { + if (builtin->dependencies) + { + write_ifdefs (externfile, builtin->dependencies->array); + write_ifdefs (structfile, builtin->dependencies->array); + } + + /* Write the extern definition. */ + if (externfile) + { + if (builtin->function) + fprintf (externfile, "extern int %s __P((WORD_LIST *));\n", + builtin->function); + + fprintf (externfile, "extern char * const %s_doc[];\n", + document_name (builtin)); + } + + /* Write the structure definition. */ + if (structfile) + { + fprintf (structfile, " { \"%s\", ", builtin->name); + + if (builtin->function) + fprintf (structfile, "%s, ", builtin->function); + else + fprintf (structfile, "(sh_builtin_func_t *)0x0, "); + + fprintf (structfile, "%s%s%s, %s_doc,\n", + "BUILTIN_ENABLED | STATIC_BUILTIN", + (builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "", + (builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "", + document_name (builtin)); + + fprintf + (structfile, " \"%s\", (char *)NULL },\n", + builtin->shortdoc ? builtin->shortdoc : builtin->name); + + } + + if (structfile || separate_helpfiles) + /* Save away this builtin for later writing of the + long documentation strings. */ + save_builtin (builtin); + + /* Write out the matching #endif, if neccessary. */ + if (builtin->dependencies) + { + if (externfile) + write_endifs (externfile, builtin->dependencies->array); + + if (structfile) + write_endifs (structfile, builtin->dependencies->array); + } + } + + if (documentation_file) + { + fprintf (documentation_file, "@item %s\n", builtin->name); + write_documentation + (documentation_file, builtin->longdoc->array, 0, TEXINFO); + } + } + } +} + +/* Write out the long documentation strings in BUILTINS to STREAM. */ +void +write_longdocs (stream, builtins) + FILE *stream; + ARRAY *builtins; +{ + register int i; + register BUILTIN_DESC *builtin; + char *dname; + char *sarray[2]; + + for (i = 0; i < builtins->sindex; i++) + { + builtin = (BUILTIN_DESC *)builtins->array[i]; + + if (builtin->dependencies) + write_ifdefs (stream, builtin->dependencies->array); + + /* Write the long documentation strings. */ + dname = document_name (builtin); + fprintf (stream, "char * const %s_doc[] =", dname); + + if (separate_helpfiles) + { + int l = strlen (helpfile_directory) + strlen (dname) + 1; + sarray[0] = (char *)xmalloc (l + 1); + sprintf (sarray[0], "%s/%s", helpfile_directory, dname); + sarray[1] = (char *)NULL; + write_documentation (stream, sarray, 0, STRING_ARRAY|HELPFILE); + free (sarray[0]); + } + else + write_documentation (stream, builtin->longdoc->array, 0, STRING_ARRAY); + + if (builtin->dependencies) + write_endifs (stream, builtin->dependencies->array); + + } +} + +/* Write an #ifdef string saying what needs to be defined (or not defined) + in order to allow compilation of the code that will follow. + STREAM is the stream to write the information to, + DEFINES is a null terminated array of define names. + If a define is preceded by an `!', then the sense of the test is + reversed. */ +void +write_ifdefs (stream, defines) + FILE *stream; + char **defines; +{ + register int i; + + if (!stream) + return; + + fprintf (stream, "#if "); + + for (i = 0; defines[i]; i++) + { + char *def = defines[i]; + + if (*def == '!') + fprintf (stream, "!defined (%s)", def + 1); + else + fprintf (stream, "defined (%s)", def); + + if (defines[i + 1]) + fprintf (stream, " && "); + } + fprintf (stream, "\n"); +} + +/* Write an #endif string saying what defines controlled the compilation + of the immediately preceding code. + STREAM is the stream to write the information to. + DEFINES is a null terminated array of define names. */ +void +write_endifs (stream, defines) + FILE *stream; + char **defines; +{ + register int i; + + if (!stream) + return; + + fprintf (stream, "#endif /* "); + + for (i = 0; defines[i]; i++) + { + fprintf (stream, "%s", defines[i]); + + if (defines[i + 1]) + fprintf (stream, " && "); + } + + fprintf (stream, " */\n"); +} + +/* Write DOCUMENTATION to STREAM, perhaps surrounding it with double-quotes + and quoting special characters in the string. Handle special things for + internationalization (gettext) and the single-string vs. multiple-strings + issues. */ +void +write_documentation (stream, documentation, indentation, flags) + FILE *stream; + char **documentation; + int indentation, flags; +{ + register int i, j; + register char *line; + int string_array, texinfo, base_indent, last_cpp, filename_p; + + if (!stream) + return; + + string_array = flags & STRING_ARRAY; + filename_p = flags & HELPFILE; + + if (string_array) + { + fprintf (stream, " {\n#if defined (HELP_BUILTIN)\n"); /* } */ + if (single_longdoc_strings) + { + if (filename_p == 0) + fprintf (stream, "N_(\""); + else + fprintf (stream, "\""); + } + } + + base_indent = (string_array && single_longdoc_strings && filename_p == 0) ? BASE_INDENT : 0; + + for (i = last_cpp = 0, texinfo = (flags & TEXINFO); line = documentation[i]; i++) + { + /* Allow #ifdef's to be written out verbatim, but don't put them into + separate help files. */ + if (*line == '#') + { + if (string_array && filename_p == 0 && single_longdoc_strings == 0) + fprintf (stream, "%s\n", line); + last_cpp = 1; + continue; + } + else + last_cpp = 0; + + /* prefix with N_( for gettext */ + if (string_array && single_longdoc_strings == 0) + { + if (filename_p == 0) + fprintf (stream, " N_(\""); + else + fprintf (stream, " \""); + } + + if (indentation) + for (j = 0; j < indentation; j++) + fprintf (stream, " "); + + /* Don't indent the first line, because of how the help builtin works. */ + if (i == 0) + indentation += base_indent; + + if (string_array) + { + for (j = 0; line[j]; j++) + { + switch (line[j]) + { + case '\\': + case '"': + fprintf (stream, "\\%c", line[j]); + break; + + default: + fprintf (stream, "%c", line[j]); + } + } + + /* closing right paren for gettext */ + if (single_longdoc_strings == 0) + { + if (filename_p == 0) + fprintf (stream, "\"),\n"); + else + fprintf (stream, "\",\n"); + } + else if (documentation[i+1]) + /* don't add extra newline after last line */ + fprintf (stream, "\\n\\\n"); + } + else if (texinfo) + { + for (j = 0; line[j]; j++) + { + switch (line[j]) + { + case '@': + case '{': + case '}': + fprintf (stream, "@%c", line[j]); + break; + + default: + fprintf (stream, "%c", line[j]); + } + } + fprintf (stream, "\n"); + } + else + fprintf (stream, "%s\n", line); + } + + /* closing right paren for gettext */ + if (string_array && single_longdoc_strings) + { + if (filename_p == 0) + fprintf (stream, "\"),\n"); + else + fprintf (stream, "\",\n"); + } + + if (string_array) + fprintf (stream, "#endif /* HELP_BUILTIN */\n (char *)NULL\n};\n"); +} + +int +write_helpfiles (builtins) + ARRAY *builtins; +{ + char *helpfile, *bname; + FILE *helpfp; + int i, hdlen; + BUILTIN_DESC *builtin; + + i = mkdir ("helpfiles", 0777); + if (i < 0 && errno != EEXIST) + { + fprintf (stderr, "write_helpfiles: helpfiles: cannot create directory\n"); + return -1; + } + + hdlen = strlen ("helpfiles/"); + for (i = 0; i < builtins->sindex; i++) + { + builtin = (BUILTIN_DESC *)builtins->array[i]; + + bname = document_name (builtin); + helpfile = (char *)xmalloc (hdlen + strlen (bname) + 1); + sprintf (helpfile, "helpfiles/%s", bname); + + helpfp = fopen (helpfile, "w"); + if (helpfp == 0) + { + fprintf (stderr, "write_helpfiles: cannot open %s\n", helpfile); + free (helpfile); + continue; + } + + write_documentation (helpfp, builtin->longdoc->array, 4, PLAINTEXT); + + fflush (helpfp); + fclose (helpfp); + free (helpfile); + } + return 0; +} + +static int +_find_in_table (name, name_table) + char *name, *name_table[]; +{ + register int i; + + for (i = 0; name_table[i]; i++) + if (strcmp (name, name_table[i]) == 0) + return 1; + return 0; +} + +static int +is_special_builtin (name) + char *name; +{ + return (_find_in_table (name, special_builtins)); +} + +static int +is_assignment_builtin (name) + char *name; +{ + return (_find_in_table (name, assignment_builtins)); +} + +#if !defined (HAVE_RENAME) +static int +rename (from, to) + char *from, *to; +{ + unlink (to); + if (link (from, to) < 0) + return (-1); + unlink (from); + return (0); +} +#endif /* !HAVE_RENAME */ diff --git a/builtins/read.def b/builtins/read.def index c5f658e94..dd8a7727d 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -124,7 +124,7 @@ read_builtin (list) WORD_LIST *list; { register char *varname; - int size, i, pass_next, saw_escape, eof, opt, retval, code; + int size, i, nr, pass_next, saw_escape, eof, opt, retval, code; int input_is_tty, input_is_pipe, unbuffered_read; int raw, edit, nchars, silent, have_timeout, fd; unsigned int tmout; @@ -173,7 +173,7 @@ read_builtin (list) #endif tmout = 0; /* no timeout */ - nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0; + nr = nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0; delim = '\n'; /* read until newline */ reset_internal_getopt (); @@ -451,8 +451,9 @@ read_builtin (list) } input_string[i++] = c; + nr++; - if (nchars > 0 && i >= nchars) + if (nchars > 0 && nr >= nchars) break; } input_string[i] = '\0'; diff --git a/builtins/read.def~ b/builtins/read.def~ index ce9c99d6a..c5f658e94 100644 --- a/builtins/read.def~ +++ b/builtins/read.def~ @@ -131,7 +131,7 @@ read_builtin (list) intmax_t intval; char c; char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname; - char *e, *t, *t1, *savei; + char *e, *t, *t1; struct stat tsb; SHELL_VAR *var; #if defined (ARRAY_VARS) @@ -276,7 +276,7 @@ read_builtin (list) input_is_tty = isatty (fd); if (input_is_tty == 0) #ifndef __CYGWIN__ - input_is_pipe = (lseek (0, 0L, SEEK_CUR) < 0) && (errno == ESPIPE); + input_is_pipe = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE); #else input_is_pipe = 1; #endif @@ -637,12 +637,12 @@ read_builtin (list) number of variables. */ if (*input_string) { - savei = input_string; + t1 = input_string; t = get_word_from_string (&input_string, ifs_chars, &e); if (*input_string == 0) input_string = t; else - input_string = strip_trailing_ifs_whitespace (savei, ifs_chars, saw_escape); + input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape); } #endif diff --git a/builtins/ulimit.def b/builtins/ulimit.def index 1d2532dd3..3706dd3a6 100644 --- a/builtins/ulimit.def +++ b/builtins/ulimit.def @@ -617,14 +617,19 @@ pipesize (valuep) *valuep = (RLIMTYPE) PIPE_BUF; return 0; #else -# if defined (PIPESIZE) +# if defined (_POSIX_PIPE_BUF) + *valuep = (RLIMTYPE) _POSIX_PIPE_BUF; + return 0; +# else +# if defined (PIPESIZE) /* This is defined by running a program from the Makefile. */ *valuep = (RLIMTYPE) PIPESIZE; return 0; -# else +# else errno = EINVAL; return -1; -# endif /* PIPESIZE */ +# endif /* PIPESIZE */ +# endif /* _POSIX_PIPE_BUF */ #endif /* PIPE_BUF */ } diff --git a/builtins/ulimit.def~ b/builtins/ulimit.def~ index 932a6ea4d..1d2532dd3 100644 --- a/builtins/ulimit.def~ +++ b/builtins/ulimit.def~ @@ -35,14 +35,17 @@ option is given, it is interpreted as follows: -c the maximum size of core files created -d the maximum size of a process's data segment -f the maximum size of files created by the shell + -i the maximum number of pending signals -l the maximum size a process may lock into memory -m the maximum resident set size -n the maximum number of open file descriptors -p the pipe buffer size + -q the maximum number of bytes in POSIX message queues -s the maximum stack size -t the maximum amount of cpu time in seconds -u the maximum number of user processes - -v the size of virtual memory + -v the size of virtual memory + -x the maximum number of file locks If LIMIT is given, it is the new value of the specified resource; the special LIMIT values `soft', `hard', and `unlimited' stand for @@ -200,6 +203,9 @@ static RESOURCE_LIMITS limits[] = { { 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" }, #endif { 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" }, +#ifdef RLIMIT_SIGPENDING + { 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL }, +#endif #ifdef RLIMIT_MEMLOCK { 'l', RLIMIT_MEMLOCK, 1024, "max locked memory", "kbytes" }, #endif @@ -208,6 +214,9 @@ static RESOURCE_LIMITS limits[] = { #endif /* RLIMIT_RSS */ { 'n', RLIMIT_OPENFILES, 1, "open files", (char *)NULL}, { 'p', RLIMIT_PIPESIZE, 512, "pipe size", "512 bytes" }, +#ifdef RLIMIT_MSGQUEUE + { 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" }, +#endif #ifdef RLIMIT_STACK { 's', RLIMIT_STACK, 1024, "stack size", "kbytes" }, #endif @@ -220,6 +229,9 @@ static RESOURCE_LIMITS limits[] = { #endif #ifdef RLIMIT_SWAP { 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" }, +#endif +#ifdef RLIMIT_LOCKS + { 'w', RLIMIT_LOCKS, 1, "file locks", (char *)NULL }, #endif { -1, -1, -1, (char *)NULL, (char *)NULL } }; @@ -647,11 +659,11 @@ print_all_limits (mode) for (i = 0; limits[i].option > 0; i++) { - if (get_limit (i, &softlim, &hardlim) < 0) + if (get_limit (i, &softlim, &hardlim) == 0) + printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1); + else if (errno != EINVAL) builtin_error ("%s: cannot get limit: %s", limits[i].description, strerror (errno)); - else - printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1); } } @@ -670,7 +682,7 @@ printone (limind, curlim, pdesc) else sprintf (unitstr, "(-%c) ", limits[limind].option); - printf ("%-18s %16s", limits[limind].description, unitstr); + printf ("%-20s %16s", limits[limind].description, unitstr); } if (curlim == RLIM_INFINITY) puts ("unlimited"); diff --git a/configure b/configure index 453c54674..e1686b07f 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION. +# From configure.in for Bash 3.1, version 3.174, from autoconf version AC_ACVERSION. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for bash 3.1-devel. # @@ -4832,13 +4832,6 @@ if test $opt_readline = yes; then #define READLINE 1 _ACEOF - # section for OS versions that ship readline as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; - *) READLINE_LIB=-lreadline ;; - esac if test "$opt_with_installed_readline" != "no" ; then case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; @@ -4849,9 +4842,18 @@ _ACEOF ;; esac READLINE_DEP= + READLINE_LIB=-lreadline else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' READLINE_DEP='$(READLINE_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; + *) READLINE_LIB=-lreadline ;; + esac fi else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -4870,16 +4872,10 @@ _ACEOF _ACEOF fi - # section for OS versions that ship history as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; - *) HISTORY_LIB=-lhistory ;; - esac if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= + HISTORY_LIB=-lhistory case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; *) case "$RL_INCLUDEDIR" in @@ -4891,6 +4887,14 @@ _ACEOF else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' HISTORY_DEP='$(HISTORY_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; + *) HISTORY_LIB=-lhistory ;; + esac fi else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -5193,7 +5197,7 @@ if test x$SIZE = x; then fi done if test $size_found -eq 0; then - SIZE=size + SIZE=: fi IFS=$save_IFS fi diff --git a/configure.in b/configure.in index 7f5c7288e..26b08799e 100644 --- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl +AC_REVISION([for Bash 3.1, version 3.174, from autoconf version] AC_ACVERSION)dnl define(bashvers, 3.1) define(relstatus, devel) @@ -484,13 +484,6 @@ fi if test $opt_readline = yes; then AC_DEFINE(READLINE) - # section for OS versions that ship readline as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; - *) READLINE_LIB=-lreadline ;; - esac if test "$opt_with_installed_readline" != "no" ; then case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; @@ -501,9 +494,18 @@ if test $opt_readline = yes; then ;; esac READLINE_DEP= + READLINE_LIB=-lreadline else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' READLINE_DEP='$(READLINE_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; + *) READLINE_LIB=-lreadline ;; + esac fi else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -516,16 +518,10 @@ if test $opt_history = yes || test $opt_bang_history = yes; then if test $opt_bang_history = yes; then AC_DEFINE(BANG_HISTORY) fi - # section for OS versions that ship history as a standard dynamic - # library and don't allow a static version specified as -llibname - # to override the dynamic version - case "${host_os}" in - darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; - *) HISTORY_LIB=-lhistory ;; - esac if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= + HISTORY_LIB=-lhistory case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; *) case "$RL_INCLUDEDIR" in @@ -537,6 +533,14 @@ if test $opt_history = yes || test $opt_bang_history = yes; then else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' HISTORY_DEP='$(HISTORY_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; + *) HISTORY_LIB=-lhistory ;; + esac fi else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -584,7 +588,7 @@ if test x$SIZE = x; then fi done if test $size_found -eq 0; then - SIZE=size + SIZE=: fi IFS=$save_IFS fi diff --git a/configure.in~ b/configure.in~ index 184d0c2c8..000fb0508 100644 --- a/configure.in~ +++ b/configure.in~ @@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl +AC_REVISION([for Bash 3.1, version 3.174, from autoconf version] AC_ACVERSION)dnl define(bashvers, 3.1) define(relstatus, devel) @@ -484,7 +484,6 @@ fi if test $opt_readline = yes; then AC_DEFINE(READLINE) - READLINE_LIB=-lreadline if test "$opt_with_installed_readline" != "no" ; then case "$opt_with_installed_readline" in yes) RL_INCLUDE= ;; @@ -498,6 +497,14 @@ if test $opt_readline = yes; then else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' READLINE_DEP='$(READLINE_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; + *) READLINE_LIB=-lreadline ;; + esac fi else RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -510,7 +517,6 @@ if test $opt_history = yes || test $opt_bang_history = yes; then if test $opt_bang_history = yes; then AC_DEFINE(BANG_HISTORY) fi - HISTORY_LIB=-lhistory if test "$opt_with_installed_readline" != "no"; then HIST_LIBDIR=$RL_LIBDIR HISTORY_DEP= @@ -525,6 +531,14 @@ if test $opt_history = yes || test $opt_bang_history = yes; then else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' HISTORY_DEP='$(HISTORY_LIBRARY)' + # section for OS versions that ship an older version of + # readline as a standard dynamic library and don't allow a + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in + darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; + *) HISTORY_LIB=-lhistory ;; + esac fi else HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline' @@ -572,11 +586,12 @@ if test x$SIZE = x; then fi done if test $size_found -eq 0; then - SIZE=size + SIZE=: fi IFS=$save_IFS fi fi +AC_SUBST(SIZE) dnl Turn on any extensions available in the GNU C library. AC_DEFINE(_GNU_SOURCE, 1) @@ -959,7 +974,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;; powerux*) LOCAL_LIBS="-lgen" ;; cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; -opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;; +opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE" ;; esac dnl Stanza for OS/compiler pair-specific flags diff --git a/execute_cmd.c b/execute_cmd.c index 2de0d28e6..b17d4073b 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -369,7 +369,6 @@ shell_control_structure (type) { switch (type) { - case cm_for: #if defined (ARITH_FOR_COMMAND) case cm_arith_for: #endif @@ -386,7 +385,9 @@ shell_control_structure (type) case cm_while: case cm_until: case cm_if: + case cm_for: case cm_group: + case cm_function_def: return (1); default: diff --git a/execute_cmd.c~ b/execute_cmd.c~ index dde56184c..2de0d28e6 100644 --- a/execute_cmd.c~ +++ b/execute_cmd.c~ @@ -245,6 +245,9 @@ int subshell_level = 0; /* Currently-executing shell function. */ SHELL_VAR *this_shell_function; +/* If non-zero, matches in case and [[ ... ]] are case-insensitive */ +int match_ignore_case = 0; + struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL; #define FD_BITMAP_DEFAULT_SIZE 32 @@ -2223,7 +2226,7 @@ execute_case_command (case_command) /* Since the pattern does not undergo quote removal (as per Posix.2, section 3.9.4.3), the strmatch () call must be able to recognize backslashes as escape characters. */ - match = strmatch (pattern, word, FNMATCH_EXTFLAG) != FNM_NOMATCH; + match = strmatch (pattern, word, FNMATCH_EXTFLAG|FNMATCH_IGNCASE) != FNM_NOMATCH; free (pattern); dispose_words (es); diff --git a/lib/readline/callback.c b/lib/readline/callback.c index 5b05ea5c5..93b7dcde3 100644 --- a/lib/readline/callback.c +++ b/lib/readline/callback.c @@ -1,6 +1,6 @@ /* callback.c -- functions to use readline as an X `callback' mechanism. */ -/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of the GNU Readline Library, a library for reading lines of text with interactive input and history editing. @@ -72,7 +72,8 @@ _rl_callback_newline () { in_handler = 1; - (*rl_prep_term_function) (_rl_meta_flag); + if (rl_prep_term_function) + (*rl_prep_term_function) (_rl_meta_flag); #if defined (HANDLE_SIGNALS) rl_set_signals (); @@ -115,7 +116,8 @@ rl_callback_read_char () { line = readline_internal_teardown (eof); - (*rl_deprep_term_function) (); + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); #if defined (HANDLE_SIGNALS) rl_clear_signals (); #endif @@ -146,7 +148,8 @@ rl_callback_handler_remove () if (in_handler) { in_handler = 0; - (*rl_deprep_term_function) (); + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); #if defined (HANDLE_SIGNALS) rl_clear_signals (); #endif diff --git a/lib/readline/callback.c~ b/lib/readline/callback.c~ new file mode 100644 index 000000000..5b05ea5c5 --- /dev/null +++ b/lib/readline/callback.c~ @@ -0,0 +1,156 @@ +/* callback.c -- functions to use readline as an X `callback' mechanism. */ + +/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + The GNU Readline Library 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. + + The GNU General Public License is often shipped with GNU software, and + is generally kept in a file called COPYING or LICENSE. If you do not + have a copy of the license, write to the Free Software Foundation, + 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include +#endif + +#include "rlconf.h" + +#if defined (READLINE_CALLBACKS) + +#include + +#ifdef HAVE_STDLIB_H +# include +#else +# include "ansi_stdlib.h" +#endif + +#include + +/* System-specific feature definitions and include files. */ +#include "rldefs.h" +#include "readline.h" +#include "rlprivate.h" + +/* **************************************************************** */ +/* */ +/* Callback Readline Functions */ +/* */ +/* **************************************************************** */ + +/* Allow using readline in situations where a program may have multiple + things to handle at once, and dispatches them via select(). Call + rl_callback_handler_install() with the prompt and a function to call + whenever a complete line of input is ready. The user must then + call rl_callback_read_char() every time some input is available, and + rl_callback_read_char() will call the user's function with the complete + text read in at each end of line. The terminal is kept prepped and + signals handled all the time, except during calls to the user's function. */ + +rl_vcpfunc_t *rl_linefunc; /* user callback function */ +static int in_handler; /* terminal_prepped and signals set? */ + +/* Make sure the terminal is set up, initialize readline, and prompt. */ +static void +_rl_callback_newline () +{ + rl_initialize (); + + if (in_handler == 0) + { + in_handler = 1; + + (*rl_prep_term_function) (_rl_meta_flag); + +#if defined (HANDLE_SIGNALS) + rl_set_signals (); +#endif + } + + readline_internal_setup (); +} + +/* Install a readline handler, set up the terminal, and issue the prompt. */ +void +rl_callback_handler_install (prompt, linefunc) + const char *prompt; + rl_vcpfunc_t *linefunc; +{ + rl_set_prompt (prompt); + rl_linefunc = linefunc; + _rl_callback_newline (); +} + +/* Read one character, and dispatch to the handler if it ends the line. */ +void +rl_callback_read_char () +{ + char *line; + int eof; + + if (rl_linefunc == NULL) + { + fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n"); + abort (); + } + + eof = readline_internal_char (); + + /* We loop in case some function has pushed input back with rl_execute_next. */ + for (;;) + { + if (rl_done) + { + line = readline_internal_teardown (eof); + + (*rl_deprep_term_function) (); +#if defined (HANDLE_SIGNALS) + rl_clear_signals (); +#endif + in_handler = 0; + (*rl_linefunc) (line); + + /* If the user did not clear out the line, do it for him. */ + if (rl_line_buffer[0]) + _rl_init_line_state (); + + /* Redisplay the prompt if readline_handler_{install,remove} + not called. */ + if (in_handler == 0 && rl_linefunc) + _rl_callback_newline (); + } + if (rl_pending_input || _rl_pushed_input_available ()) + eof = readline_internal_char (); + else + break; + } +} + +/* Remove the handler, and make sure the terminal is in its normal state. */ +void +rl_callback_handler_remove () +{ + rl_linefunc = NULL; + if (in_handler) + { + in_handler = 0; + (*rl_deprep_term_function) (); +#if defined (HANDLE_SIGNALS) + rl_clear_signals (); +#endif + } +} + +#endif diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index c50f9420f..04ac3d0c3 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -5,10 +5,10 @@ @ifinfo This document describes the GNU Readline Library, a utility for aiding -in the consitency of user interface across discrete programs that need +in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988-2004 Free Software Foundation, Inc. +Copyright (C) 1988-2005 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice diff --git a/lib/readline/doc/rltech.texi~ b/lib/readline/doc/rltech.texi~ index bfeae5925..c50f9420f 100644 --- a/lib/readline/doc/rltech.texi~ +++ b/lib/readline/doc/rltech.texi~ @@ -911,10 +911,14 @@ possibly containing conversion specifications such as @samp{%d}, and any additional arguments necessary to satisfy the conversion specifications. The resulting string is displayed in the @dfn{echo area}. The echo area is also used to display numeric arguments and search strings. +You should call @code{rl_save_prompt} to save the prompt information +before calling this function. @end deftypefun @deftypefun int rl_clear_message (void) -Clear the message in the echo area. +Clear the message in the echo area. If the prompt was saved with a call to +@code{rl_save_prompt} before the last call to @code{rl_message}, +call @code{rl_restore_prompt} before calling this function. @end deftypefun @deftypefun void rl_save_prompt (void) @@ -925,6 +929,9 @@ displaying a new message in the message area with @code{rl_message()}. @deftypefun void rl_restore_prompt (void) Restore the local Readline prompt display state saved by the most recent call to @code{rl_save_prompt}. +if @code{rl_save_prompt} was called to save the prompt before a call +to @code{rl_message}, this function should be called before the +corresponding call to @coode{rl_clear_message}. @end deftypefun @deftypefun int rl_expand_prompt (char *prompt) diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index bffb0c820..8f0459b05 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -10,7 +10,7 @@ use these features. There is a document entitled "readline.texinfo" which contains both end-user and programmer documentation for the GNU Readline Library. -Copyright (C) 1988-2004 Free Software Foundation, Inc. +Copyright (C) 1988-2005 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. diff --git a/lib/readline/doc/rluser.texi~ b/lib/readline/doc/rluser.texi~ index eccfcd8a2..bffb0c820 100644 --- a/lib/readline/doc/rluser.texi~ +++ b/lib/readline/doc/rluser.texi~ @@ -404,6 +404,12 @@ If set to @samp{none}, Readline never rings the bell. If set to If set to @samp{audible} (the default), Readline attempts to ring the terminal's bell. +@item bind-tty-special-chars +@vindex bind-tty-special-chars +If set to @samp{on}, Readline attempts to bind the control characters +treated specially by the kernel's terminal driver to their Readline +equivalents. + @item comment-begin @vindex comment-begin The string to insert at the beginning of the line when the @@ -1012,6 +1018,8 @@ With an argument @var{n}, insert the @var{n}th word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the @var{n}th word from the end of the previous command. +Once the argument @var{n} is computed, the argument is extracted +as if the @samp{!@var{n}} history expansion had been specified. @item yank-last-arg (M-. or M-_) Insert last argument to the previous command (the last word of the @@ -1019,6 +1027,8 @@ previous history entry). With an argument, behave exactly like @code{yank-nth-arg}. Successive calls to @code{yank-last-arg} move back through the history list, inserting the last argument of each line in turn. +The history expansion facilities are used to extract the last argument, +as if the @samp{!$} history expansion had been specified. @end ftable @@ -1530,7 +1540,7 @@ special variable as delimiters. Shell quoting is honored. Each word is then expanded using brace expansion, tilde expansion, parameter and variable expansion, -command substitution, arithmetic expansion, and pathname expansion, +command substitution, and arithmetic expansion, as described above (@pxref{Shell Expansions}). The results are split using the rules described above (@pxref{Word Splitting}). diff --git a/lib/readline/doc/rluserman.texi b/lib/readline/doc/rluserman.texi index 8681a86c4..db80b3126 100644 --- a/lib/readline/doc/rluserman.texi +++ b/lib/readline/doc/rluserman.texi @@ -14,7 +14,7 @@ This manual describes the end user interface of the GNU Readline Library consistency of user interface across discrete programs which provide a command line interface. -Copyright @copyright{} 1988-2004 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2005 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice diff --git a/lib/readline/doc/rluserman.texi~ b/lib/readline/doc/rluserman.texi~ new file mode 100644 index 000000000..8681a86c4 --- /dev/null +++ b/lib/readline/doc/rluserman.texi~ @@ -0,0 +1,88 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rluserman.info +@settitle GNU Readline Library +@comment %**end of header (This is for running Texinfo on a region.) + +@setchapternewpage odd + +@include version.texi + +@copying +This manual describes the end user interface of the GNU Readline Library +(version @value{VERSION}, @value{UPDATED}), a library which aids in the +consistency of user interface across discrete programs which provide +a command line interface. + +Copyright @copyright{} 1988-2004 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* RLuserman: (rluserman). The GNU readline library User's Manual. +@end direntry + +@titlepage +@title GNU Readline Library User Interface +@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU Readline Library + +This document describes the end user interface of the GNU Readline Library, +a utility which aids in the consistency of user interface across discrete +programs which provide a command line interface. + +@menu +* Command Line Editing:: GNU Readline User's Manual. +* Copying This Manual:: Copying This Manual. +@end menu +@end ifnottex + +@include rluser.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@bye diff --git a/lib/readline/readline.c b/lib/readline/readline.c index c3a352a0e..74fa5eb69 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -295,14 +295,16 @@ readline (prompt) rl_set_prompt (prompt); rl_initialize (); - (*rl_prep_term_function) (_rl_meta_flag); + if (rl_prep_term_function) + (*rl_prep_term_function) (_rl_meta_flag); #if defined (HANDLE_SIGNALS) rl_set_signals (); #endif value = readline_internal (); - (*rl_deprep_term_function) (); + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); #if defined (HANDLE_SIGNALS) rl_clear_signals (); diff --git a/lib/readline/readline.c~ b/lib/readline/readline.c~ index 70eebbf21..c3a352a0e 100644 --- a/lib/readline/readline.c~ +++ b/lib/readline/readline.c~ @@ -1,7 +1,7 @@ /* readline.c -- a general facility for reading lines of input with emacs style editing and completion. */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of the GNU Readline Library, a library for reading lines of text with interactive input and history editing. diff --git a/lib/readline/signals.c b/lib/readline/signals.c index 8e9c0ae60..6b77a85a0 100644 --- a/lib/readline/signals.c +++ b/lib/readline/signals.c @@ -1,6 +1,6 @@ /* signals.c -- signal handling support for readline. */ -/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of the GNU Readline Library, a library for reading lines of text with interactive input and history editing. @@ -368,7 +368,8 @@ void rl_cleanup_after_signal () { _rl_clean_up_for_exit (); - (*rl_deprep_term_function) (); + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); rl_clear_signals (); rl_clear_pending_input (); } @@ -377,7 +378,8 @@ rl_cleanup_after_signal () void rl_reset_after_signal () { - (*rl_prep_term_function) (_rl_meta_flag); + if (rl_prep_term_function) + (*rl_prep_term_function) (_rl_meta_flag); rl_set_signals (); } diff --git a/lib/readline/signals.c~ b/lib/readline/signals.c~ new file mode 100644 index 000000000..f46467c7c --- /dev/null +++ b/lib/readline/signals.c~ @@ -0,0 +1,406 @@ +/* signals.c -- signal handling support for readline. */ + +/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + The GNU Readline Library 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. + + The GNU General Public License is often shipped with GNU software, and + is generally kept in a file called COPYING or LICENSE. If you do not + have a copy of the license, write to the Free Software Foundation, + 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include +#endif + +#include /* Just for NULL. Yuck. */ +#include +#include + +#if defined (HAVE_UNISTD_H) +# include +#endif /* HAVE_UNISTD_H */ + +/* System-specific feature definitions and include files. */ +#include "rldefs.h" + +#if defined (GWINSZ_IN_SYS_IOCTL) +# include +#endif /* GWINSZ_IN_SYS_IOCTL */ + +#if defined (HANDLE_SIGNALS) +/* Some standard library routines. */ +#include "readline.h" +#include "history.h" + +#include "rlprivate.h" + +#if !defined (RETSIGTYPE) +# if defined (VOID_SIGHANDLER) +# define RETSIGTYPE void +# else +# define RETSIGTYPE int +# endif /* !VOID_SIGHANDLER */ +#endif /* !RETSIGTYPE */ + +#if defined (VOID_SIGHANDLER) +# define SIGHANDLER_RETURN return +#else +# define SIGHANDLER_RETURN return (0) +#endif + +/* This typedef is equivalent to the one for Function; it allows us + to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ +typedef RETSIGTYPE SigHandler (); + +#if defined (HAVE_POSIX_SIGNALS) +typedef struct sigaction sighandler_cxt; +# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh) +#else +typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt; +# define sigemptyset(m) +#endif /* !HAVE_POSIX_SIGNALS */ + +#ifndef SA_RESTART +# define SA_RESTART 0 +#endif + +static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); +static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); + +/* Exported variables for use by applications. */ + +/* If non-zero, readline will install its own signal handlers for + SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */ +int rl_catch_signals = 1; + +/* If non-zero, readline will install a signal handler for SIGWINCH. */ +#ifdef SIGWINCH +int rl_catch_sigwinch = 1; +#else +int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ +#endif + +static int signals_set_flag; +static int sigwinch_set_flag; + +/* **************************************************************** */ +/* */ +/* Signal Handling */ +/* */ +/* **************************************************************** */ + +static sighandler_cxt old_int, old_term, old_alrm, old_quit; +#if defined (SIGTSTP) +static sighandler_cxt old_tstp, old_ttou, old_ttin; +#endif +#if defined (SIGWINCH) +static sighandler_cxt old_winch; +#endif + +/* Readline signal handler functions. */ + +static RETSIGTYPE +rl_signal_handler (sig) + int sig; +{ +#if defined (HAVE_POSIX_SIGNALS) + sigset_t set; +#else /* !HAVE_POSIX_SIGNALS */ +# if defined (HAVE_BSD_SIGNALS) + long omask; +# else /* !HAVE_BSD_SIGNALS */ + sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */ +# endif /* !HAVE_BSD_SIGNALS */ +#endif /* !HAVE_POSIX_SIGNALS */ + + RL_SETSTATE(RL_STATE_SIGHANDLER); + +#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS) + /* Since the signal will not be blocked while we are in the signal + handler, ignore it until rl_clear_signals resets the catcher. */ + if (sig == SIGINT || sig == SIGALRM) + rl_set_sighandler (sig, SIG_IGN, &dummy_cxt); +#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */ + + switch (sig) + { + case SIGINT: + rl_free_line_state (); + /* FALLTHROUGH */ + +#if defined (SIGTSTP) + case SIGTSTP: + case SIGTTOU: + case SIGTTIN: +#endif /* SIGTSTP */ + case SIGALRM: + case SIGTERM: + case SIGQUIT: + rl_cleanup_after_signal (); + +#if defined (HAVE_POSIX_SIGNALS) + sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set); + sigdelset (&set, sig); +#else /* !HAVE_POSIX_SIGNALS */ +# if defined (HAVE_BSD_SIGNALS) + omask = sigblock (0); +# endif /* HAVE_BSD_SIGNALS */ +#endif /* !HAVE_POSIX_SIGNALS */ + +#if defined (__EMX__) + signal (sig, SIG_ACK); +#endif + + kill (getpid (), sig); + + /* Let the signal that we just sent through. */ +#if defined (HAVE_POSIX_SIGNALS) + sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); +#else /* !HAVE_POSIX_SIGNALS */ +# if defined (HAVE_BSD_SIGNALS) + sigsetmask (omask & ~(sigmask (sig))); +# endif /* HAVE_BSD_SIGNALS */ +#endif /* !HAVE_POSIX_SIGNALS */ + + rl_reset_after_signal (); + } + + RL_UNSETSTATE(RL_STATE_SIGHANDLER); + SIGHANDLER_RETURN; +} + +#if defined (SIGWINCH) +static RETSIGTYPE +rl_sigwinch_handler (sig) + int sig; +{ + SigHandler *oh; + +#if defined (MUST_REINSTALL_SIGHANDLERS) + sighandler_cxt dummy_winch; + + /* We don't want to change old_winch -- it holds the state of SIGWINCH + disposition set by the calling application. We need this state + because we call the application's SIGWINCH handler after updating + our own idea of the screen size. */ + rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); +#endif + + RL_SETSTATE(RL_STATE_SIGHANDLER); + rl_resize_terminal (); + + /* If another sigwinch handler has been installed, call it. */ + oh = (SigHandler *)old_winch.sa_handler; + if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL) + (*oh) (sig); + + RL_UNSETSTATE(RL_STATE_SIGHANDLER); + SIGHANDLER_RETURN; +} +#endif /* SIGWINCH */ + +/* Functions to manage signal handling. */ + +#if !defined (HAVE_POSIX_SIGNALS) +static int +rl_sigaction (sig, nh, oh) + int sig; + sighandler_cxt *nh, *oh; +{ + oh->sa_handler = signal (sig, nh->sa_handler); + return 0; +} +#endif /* !HAVE_POSIX_SIGNALS */ + +/* Set up a readline-specific signal handler, saving the old signal + information in OHANDLER. Return the old signal handler, like + signal(). */ +static SigHandler * +rl_set_sighandler (sig, handler, ohandler) + int sig; + SigHandler *handler; + sighandler_cxt *ohandler; +{ + sighandler_cxt old_handler; +#if defined (HAVE_POSIX_SIGNALS) + struct sigaction act; + + act.sa_handler = handler; + act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0; + sigemptyset (&act.sa_mask); + sigemptyset (&ohandler->sa_mask); + sigaction (sig, &act, &old_handler); +#else + old_handler.sa_handler = (SigHandler *)signal (sig, handler); +#endif /* !HAVE_POSIX_SIGNALS */ + + /* XXX -- assume we have memcpy */ + /* If rl_set_signals is called twice in a row, don't set the old handler to + rl_signal_handler, because that would cause infinite recursion. */ + if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler) + memcpy (ohandler, &old_handler, sizeof (sighandler_cxt)); + + return (ohandler->sa_handler); +} + +static void +rl_maybe_set_sighandler (sig, handler, ohandler) + int sig; + SigHandler *handler; + sighandler_cxt *ohandler; +{ + sighandler_cxt dummy; + SigHandler *oh; + + sigemptyset (&dummy.sa_mask); + oh = rl_set_sighandler (sig, handler, ohandler); + if (oh == (SigHandler *)SIG_IGN) + rl_sigaction (sig, ohandler, &dummy); +} + +int +rl_set_signals () +{ + sighandler_cxt dummy; + SigHandler *oh; + + if (rl_catch_signals && signals_set_flag == 0) + { + rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int); + rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term); + rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit); + + oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm); + if (oh == (SigHandler *)SIG_IGN) + rl_sigaction (SIGALRM, &old_alrm, &dummy); +#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART) + /* If the application using readline has already installed a signal + handler with SA_RESTART, SIGALRM will cause reads to be restarted + automatically, so readline should just get out of the way. Since + we tested for SIG_IGN above, we can just test for SIG_DFL here. */ + if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART)) + rl_sigaction (SIGALRM, &old_alrm, &dummy); +#endif /* HAVE_POSIX_SIGNALS */ + +#if defined (SIGTSTP) + rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp); +#endif /* SIGTSTP */ + +#if defined (SIGTTOU) + rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou); +#endif /* SIGTTOU */ + +#if defined (SIGTTIN) + rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin); +#endif /* SIGTTIN */ + + signals_set_flag = 1; + } + +#if defined (SIGWINCH) + if (rl_catch_sigwinch && sigwinch_set_flag == 0) + { + rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch); + sigwinch_set_flag = 1; + } +#endif /* SIGWINCH */ + + return 0; +} + +int +rl_clear_signals () +{ + sighandler_cxt dummy; + + if (rl_catch_signals && signals_set_flag == 1) + { + sigemptyset (&dummy.sa_mask); + + rl_sigaction (SIGINT, &old_int, &dummy); + rl_sigaction (SIGTERM, &old_term, &dummy); + rl_sigaction (SIGQUIT, &old_quit, &dummy); + rl_sigaction (SIGALRM, &old_alrm, &dummy); + +#if defined (SIGTSTP) + rl_sigaction (SIGTSTP, &old_tstp, &dummy); +#endif /* SIGTSTP */ + +#if defined (SIGTTOU) + rl_sigaction (SIGTTOU, &old_ttou, &dummy); +#endif /* SIGTTOU */ + +#if defined (SIGTTIN) + rl_sigaction (SIGTTIN, &old_ttin, &dummy); +#endif /* SIGTTIN */ + + signals_set_flag = 0; + } + +#if defined (SIGWINCH) + if (rl_catch_sigwinch && sigwinch_set_flag == 1) + { + sigemptyset (&dummy.sa_mask); + rl_sigaction (SIGWINCH, &old_winch, &dummy); + sigwinch_set_flag = 0; + } +#endif + + return 0; +} + +/* Clean up the terminal and readline state after catching a signal, before + resending it to the calling application. */ +void +rl_cleanup_after_signal () +{ + _rl_clean_up_for_exit (); + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); + rl_clear_signals (); + rl_clear_pending_input (); +} + +/* Reset the terminal and readline state after a signal handler returns. */ +void +rl_reset_after_signal () +{ + if (rl_prep_term_function) + (*rl_prep_term_function) (_rl_meta_flag); + rl_set_signals (); +} + +/* Free up the readline variable line state for the current line (undo list, + any partial history entry, any keyboard macros in progress, and any + numeric arguments in process) after catching a signal, before calling + rl_cleanup_after_signal(). */ +void +rl_free_line_state () +{ + register HIST_ENTRY *entry; + + rl_free_undo_list (); + + entry = current_history (); + if (entry) + entry->data = (char *)NULL; + + _rl_kill_kbd_macro (); + rl_clear_message (); + _rl_init_argument (); +} + +#endif /* HANDLE_SIGNALS */ diff --git a/lib/readline/text.c b/lib/readline/text.c index 16fb2c536..59f55b9e8 100644 --- a/lib/readline/text.c +++ b/lib/readline/text.c @@ -785,11 +785,13 @@ _rl_insert_char (count, c) rl_insert_text (str); } } +#if defined (HANDLE_MULTIBYTE) else { rl_insert_text (incoming); stored_count = 0; } +#endif return 0; } diff --git a/subst.c b/subst.c index ae9a62567..c71801a3b 100644 --- a/subst.c +++ b/subst.c @@ -3449,9 +3449,38 @@ match_upattern (string, pat, mtype, sp, ep) char **sp, **ep; { int c, len; - register char *p, *p1; + register char *p, *p1, *npat; char *end; + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = STRLEN (pat); + if (pat[0] != '*' || pat[len - 1] != '*') + { + p = npat = xmalloc (len + 3); + p1 = pat; + if (*p1 != '*') + *p++ = '*'; + while (*p1) + *p++ = *p1++; + if (p1[-1] != '*' || p[-2] == '\\') + *p++ = '*'; + *p = '\0'; + } + else + npat = pat; + c = strmatch (npat, string, FNMATCH_EXTFLAG); + if (npat != pat) + free (npat); + if (c == FNM_NOMATCH) + return (0); + len = STRLEN (string); end = string + len; @@ -3559,7 +3588,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep) int mtype; char **sp, **ep; { - wchar_t wc; + wchar_t wc, *wp, *nwpat, *wp1; int len; #if 0 size_t n, n1; /* Apple's gcc seems to miscompile this badly */ @@ -3567,6 +3596,35 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep) int n, n1; #endif + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = wcslen (wpat); + if (wpat[0] != L'*' || wpat[len - 1] != L'*') + { + wp = nwpat = xmalloc ((len + 3) * sizeof (wchar_t)); + wp1 = wpat; + if (*wp1 != L'*') + *wp++ = L'*'; + while (*wp1 != L'\0') + *wp++ = *wp1++; + if (wp1[-1] != L'*' || wp1[-2] == L'\\') + *wp++ = L'*'; + *wp = '\0'; + } + else + nwpat = wpat; + len = wcsmatch (nwpat, wstring, FNMATCH_EXTFLAG); + if (nwpat != wpat) + free (nwpat); + if (len == FNM_NOMATCH) + return (0); + switch (mtype) { case MATCH_ANY: diff --git a/subst.c.orig b/subst.c.orig index 3b42602e2..ae9a62567 100644 --- a/subst.c.orig +++ b/subst.c.orig @@ -1,10 +1,10 @@ -/* subst.c -- The part of the shell that does parameter, command, and - globbing substitutions. */ +/* subst.c -- The part of the shell that does parameter, command, arithmetic, + and globbing substitutions. */ /* ``Have a little faith, there's magic in the night. You ain't a beauty, but, hey, you're alright.'' */ -/* Copyright (C) 1987-2004 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -163,6 +163,7 @@ static int glob_argv_flags_size; #endif static WORD_LIST expand_word_error, expand_word_fatal; +static WORD_DESC expand_wdesc_error, expand_wdesc_fatal; static char expand_param_error, expand_param_fatal; /* Tell the expansion functions to not longjmp back to top_level on fatal @@ -204,9 +205,12 @@ static char *remove_quoted_nulls __P((char *)); static int unquoted_substring __P((char *, char *)); static int unquoted_member __P((int, char *)); -static int do_assignment_internal __P((const char *, int)); +#if defined (ARRAY_VARS) +static SHELL_VAR *do_compound_assignment __P((char *, char *, int)); +#endif +static int do_assignment_internal __P((const WORD_DESC *, int)); -static char *string_extract_verbatim __P((char *, int *, char *)); +static char *string_extract_verbatim __P((char *, size_t, int *, char *)); static char *string_extract __P((char *, int *, char *, int)); static char *string_extract_double_quoted __P((char *, int *, int)); static inline char *string_extract_single_quoted __P((char *, int *)); @@ -256,9 +260,9 @@ static arrayind_t array_length_reference __P((char *)); static int valid_brace_expansion_word __P((char *, int)); static int chk_atstar __P((char *, int, int *, int *)); -static char *parameter_brace_expand_word __P((char *, int, int)); -static char *parameter_brace_expand_indir __P((char *, int, int, int *, int *)); -static char *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *)); +static WORD_DESC *parameter_brace_expand_word __P((char *, int, int)); +static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *)); +static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *)); static void parameter_brace_expand_error __P((char *, char *)); static int valid_length_expression __P((char *)); @@ -274,8 +278,8 @@ static char *pos_params_pat_subst __P((char *, char *, char *, int)); static char *parameter_brace_patsub __P((char *, char *, char *, int)); -static char *parameter_brace_expand __P((char *, int *, int, int *, int *)); -static char *param_expand __P((char *, int *, int, int *, int *, int *, int *, int)); +static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int *, int *)); +static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int)); static WORD_LIST *expand_word_internal __P((WORD_DESC *, int, int, int *, int *)); @@ -552,7 +556,7 @@ string_extract (string, sindex, charlist, flags) char *temp; DECLARE_MBSTATE; - slen = strlen (string + *sindex) + *sindex; + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 0; i = *sindex; while (c = string[i]) { @@ -827,7 +831,8 @@ string_extract_single_quoted (string, sindex) char *t; DECLARE_MBSTATE; - slen = strlen (string + *sindex) + *sindex; + /* Don't need slen for ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 0; i = *sindex; while (string[i] && string[i] != '\'') ADVANCE_CHAR (string, slen, i); @@ -862,13 +867,13 @@ skip_single_quoted (string, slen, sind) /* Just like string_extract, but doesn't hack backslashes or any of that other stuff. Obeys CTLESC quoting. Used to do splitting on $IFS. */ static char * -string_extract_verbatim (string, sindex, charlist) +string_extract_verbatim (string, slen, sindex, charlist) char *string; + size_t slen; int *sindex; char *charlist; { register int i = *sindex; - size_t slen; #if defined (HANDLE_MULTIBYTE) size_t clen; wchar_t *wcharlist; @@ -884,8 +889,12 @@ string_extract_verbatim (string, sindex, charlist) return temp; } - slen = strlen (string + *sindex) + *sindex; i = *sindex; +#if 0 + /* See how the MBLEN and ADVANCE_CHAR macros work to understand why we need + this only if MB_CUR_MAX > 1. */ + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 1; +#endif #if defined (HANDLE_MULTIBYTE) clen = strlen (charlist); wcharlist = 0; @@ -902,7 +911,7 @@ string_extract_verbatim (string, sindex, charlist) } #if defined (HANDLE_MULTIBYTE) - mblength = MBLEN (string + i, slen - 1); + mblength = MBLEN (string + i, slen - i); if (mblength > 1) { wchar_t wc; @@ -983,12 +992,28 @@ extract_process_subst (string, starter, sindex) #endif /* PROCESS_SUBSTITUTION */ #if defined (ARRAY_VARS) +/* This can be fooled by unquoted right parens in the passed string. If + each caller verifies that the last character in STRING is a right paren, + we don't even need to call extract_delimited_string. */ char * extract_array_assignment_list (string, sindex) char *string; int *sindex; { +#if 0 return (extract_delimited_string (string, sindex, "(", (char *)NULL, ")", 0)); +#else + int slen; + char *ret; + + slen = strlen (string); /* ( */ + if (string[slen - 1] == ')') + { + ret = substring (string, *sindex, slen - 1); + *sindex = slen - 1; + return ret; + } +#endif } #endif @@ -1749,7 +1774,10 @@ string_list_dollar_star (list) sep[1] = '\0'; } else - memcpy (sep, ifs_firstc, ifs_firstc_len); + { + memcpy (sep, ifs_firstc, ifs_firstc_len); + sep[ifs_firstc_len] = '\0'; + } #else sep[0] = ifs_firstc; sep[1] = '\0'; @@ -1772,7 +1800,7 @@ string_list_dollar_at (list, quoted) WORD_LIST *list; int quoted; { - char *ifs; + char *ifs, *ret; #if defined (HANDLE_MULTIBYTE) char sep[MB_CUR_MAX + 1]; #else @@ -1786,19 +1814,15 @@ string_list_dollar_at (list, quoted) #if defined (HANDLE_MULTIBYTE) if (ifs && *ifs) { - size_t mblength; - mblength = MBLEN (ifs, strnlen (ifs, MB_CUR_MAX)); - if (MB_INVALIDCH (mblength) || mblength == 1) + if (ifs_firstc_len == 1) { - sep[0] = *ifs; + sep[0] = ifs_firstc[0]; sep[1] = '\0'; } - else if (mblength == 0) - sep[0] = '\0'; else { - memcpy (sep, ifs, mblength); - sep[mblength] = '\0'; + memcpy (sep, ifs_firstc, ifs_firstc_len); + sep[ifs_firstc_len] = '\0'; } } else @@ -1887,9 +1911,12 @@ list_string (string, separators, quoted) extract a word, stopping at a separator skip sequences of spc, tab, or nl as long as they are separators This obeys the field splitting rules in Posix.2. */ + slen = (MB_CUR_MAX > 1) ? strlen (string) : 1; for (result = (WORD_LIST *)NULL, sindex = 0; string[sindex]; ) { - current_word = string_extract_verbatim (string, &sindex, separators); + /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim + unless multibyte chars are possible. */ + current_word = string_extract_verbatim (string, slen, &sindex, separators); if (current_word == 0) break; @@ -1899,10 +1926,9 @@ list_string (string, separators, quoted) below. */ if (QUOTED_NULL (current_word)) { - t = make_bare_word (""); - t->flags |= W_QUOTED; - free (t->word); + t = alloc_word_desc (); t->word = make_quoted_char ('\0'); + t->flags |= W_QUOTED|W_HASQUOTEDNULL; result = make_word_list (t, result); } else if (current_word[0] != '\0') @@ -1911,6 +1937,7 @@ list_string (string, separators, quoted) perform quoted null character removal on the current word. */ remove_quoted_nulls (current_word); result = add_string_to_list (current_word, result); + result->word->flags &= ~W_HASQUOTEDNULL; /* just to be sure */ if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) result->word->flags |= W_QUOTED; } @@ -1919,10 +1946,9 @@ list_string (string, separators, quoted) Bourne shell style, then add a quoted null argument. */ else if (!sh_style_split && !spctabnl (string[sindex])) { - t = make_bare_word (""); - t->flags |= W_QUOTED; - free (t->word); + t = alloc_word_desc (); t->word = make_quoted_char ('\0'); + t->flags |= W_QUOTED|W_HASQUOTEDNULL; result = make_word_list (t, result); } @@ -1935,8 +1961,6 @@ list_string (string, separators, quoted) if (string[sindex]) { DECLARE_MBSTATE; - if (slen == 0) - slen = strlen (string); ADVANCE_CHAR (string, slen, sindex); } @@ -1950,7 +1974,13 @@ list_string (string, separators, quoted) field delimiter, not a separate delimiter that would result in an empty field. Look at POSIX.2, 3.6.5, (3)(b). */ if (string[sindex] && whitesep && issep (string[sindex]) && !spctabnl (string[sindex])) - sindex++; + { + sindex++; + /* An IFS character that is not IFS white space, along with any + adjacent IFS white space, shall delimit a field. (SUSv3) */ + while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex])) + sindex++; + } } return (REVERSE_LIST (result, WORD_LIST *)); } @@ -2006,7 +2036,10 @@ get_word_from_string (stringp, separators, endptr) This obeys the field splitting rules in Posix.2. */ sindex = 0; - current_word = string_extract_verbatim (s, &sindex, separators); + /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim + unless multibyte chars are possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (s) : 1; + current_word = string_extract_verbatim (s, slen, &sindex, separators); /* Set ENDPTR to the first character after the end of the word. */ if (endptr) @@ -2019,8 +2052,6 @@ get_word_from_string (stringp, separators, endptr) if (s[sindex]) { DECLARE_MBSTATE; - if (slen == 0) - slen = strlen (s); ADVANCE_CHAR (s, slen, sindex); } @@ -2034,7 +2065,13 @@ get_word_from_string (stringp, separators, endptr) delimiter, not a separate delimiter that would result in an empty field. Look at POSIX.2, 3.6.5, (3)(b). */ if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex])) - sindex++; + { + sindex++; + /* An IFS character that is not IFS white space, along with any adjacent + IFS white space, shall delimit a field. */ + while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex])) + sindex++; + } /* Update STRING to point to the next field. */ *stringp = s + sindex; @@ -2122,25 +2159,55 @@ list_string_with_quotes (string) /* */ /********************************************************/ +#if defined (ARRAY_VARS) +static SHELL_VAR * +do_compound_assignment (name, value, flags) + char *name, *value; + int flags; +{ + SHELL_VAR *v; + int off, mklocal; + + mklocal = flags & ASS_MKLOCAL; + + if (mklocal && variable_context) + { + v = find_variable (name); + if (v == 0 || array_p (v) == 0) + v = make_local_array_variable (name); + v = assign_array_var_from_string (v, value, flags); + } + else + v = assign_array_from_string (name, value, flags); + + return (v); +} +#endif + /* Given STRING, an assignment string, get the value of the right side of the `=', and bind it to the left side. If EXPAND is true, then perform parameter expansion, command substitution, and arithmetic expansion on the right-hand side. Perform tilde expansion in any case. Do not perform word splitting on the result of expansion. */ static int -do_assignment_internal (string, expand) - const char *string; +do_assignment_internal (word, expand) + const WORD_DESC *word; int expand; { - int offset; - char *name, *value; + int offset, tlen, appendop, assign_list, aflags; + char *name, *value, *ovalue, *nvalue; SHELL_VAR *entry; #if defined (ARRAY_VARS) char *t; int ni; #endif - int assign_list = 0; + const char *string; + if (word == 0 || word->word == 0) + return 0; + + appendop = assign_list = aflags = 0; + string = word->word; offset = assignment (string, 0); name = savestring (string); value = (char *)NULL; @@ -2149,28 +2216,31 @@ do_assignment_internal (string, expand) { char *temp; - name[offset] = 0; + if (name[offset - 1] == '+') + { + appendop = 1; + name[offset - 1] = '\0'; + } + + name[offset] = 0; /* might need this set later */ temp = name + offset + 1; + tlen = STRLEN (temp); #if defined (ARRAY_VARS) - if (expand && temp[0] == LPAREN && xstrchr (temp, RPAREN)) +# if 0 + if (expand && temp[0] == LPAREN && temp[tlen-1] == RPAREN) +#else + if (expand && (word->flags & W_COMPASSIGN)) +#endif { assign_list = ni = 1; - value = extract_delimited_string (temp, &ni, "(", (char *)NULL, ")", 0); + value = extract_array_assignment_list (temp, &ni); } else #endif - /* Perform tilde expansion. */ if (expand && temp[0]) - { - temp = (xstrchr (temp, '~') && unquoted_member ('~', temp)) - ? bash_tilde_expand (temp, 1) - : savestring (temp); - - value = expand_string_if_necessary (temp, 0, expand_string_unsplit); - free (temp); - } + value = expand_string_if_necessary (temp, 0, expand_string_assignment); else value = savestring (temp); } @@ -2182,10 +2252,19 @@ do_assignment_internal (string, expand) } if (echo_command_at_execute) - xtrace_print_assignment (name, value, assign_list, 1); + { + if (appendop) + name[offset - 1] = '+'; + xtrace_print_assignment (name, value, assign_list, 1); + if (appendop) + name[offset - 1] = '\0'; + } #define ASSIGN_RETURN(r) do { FREE (value); free (name); return (r); } while (0) + if (appendop) + aflags |= ASS_APPEND; + #if defined (ARRAY_VARS) if (t = xstrchr (name, '[')) /*]*/ { @@ -2194,15 +2273,19 @@ do_assignment_internal (string, expand) report_error (_("%s: cannot assign list to array member"), name); ASSIGN_RETURN (0); } - entry = assign_array_element (name, value); + entry = assign_array_element (name, value, aflags); if (entry == 0) ASSIGN_RETURN (0); } else if (assign_list) - entry = assign_array_from_string (name, value); + { + if (word->flags & W_ASSIGNARG) + aflags |= ASS_MKLOCAL; + entry = do_compound_assignment (name, value, aflags); + } else #endif /* ARRAY_VARS */ - entry = bind_variable (name, value); + entry = bind_variable (name, value, aflags); stupidly_hack_special_variables (name); @@ -2214,22 +2297,39 @@ do_assignment_internal (string, expand) } /* Perform the assignment statement in STRING, and expand the - right side by doing command and parameter expansion. */ + right side by doing tilde, command and parameter expansion. */ int do_assignment (string) - const char *string; + char *string; +{ + WORD_DESC td; + + td.flags = W_ASSIGNMENT; + td.word = string; + + return do_assignment_internal (&td, 1); +} + +int +do_word_assignment (word) + WORD_DESC *word; { - return do_assignment_internal (string, 1); + return do_assignment_internal (word, 1); } /* Given STRING, an assignment string, get the value of the right side - of the `=', and bind it to the left side. Do not do command and - parameter substitution on the right hand side. */ + of the `=', and bind it to the left side. Do not perform any word + expansions on the right hand side. */ int do_assignment_no_expand (string) - const char *string; + char *string; { - return do_assignment_internal (string, 0); + WORD_DESC td; + + td.flags = W_ASSIGNMENT; + td.word = string; + + do_assignment_internal (&td, 0); } /*************************************************** @@ -2338,9 +2438,6 @@ pos_params (string, start, end, quoted) t->next = (WORD_LIST *)NULL; if (string[0] == '*') -#if 0 - ret = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (quote_list (h)) : string_list (h); -#else { if (quoted & Q_DOUBLE_QUOTES) ret = string_list_dollar_star (quote_list (h)); @@ -2349,7 +2446,6 @@ pos_params (string, start, end, quoted) else ret = string_list (h); } -#endif else ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h); if (t != params) @@ -2366,9 +2462,9 @@ pos_params (string, start, end, quoted) /******************************************************************/ #if defined (PROCESS_SUBSTITUTION) -#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC) +#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC || s == '~') #else -#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC) +#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~') #endif /* If there are any characters in STRING that require full expansion, @@ -2386,7 +2482,8 @@ expand_string_if_necessary (string, quoted, func) char *ret; DECLARE_MBSTATE; - slen = strlen (string); + /* Don't need string length for ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (string) : 0; i = saw_quote = 0; while (string[i]) { @@ -2456,6 +2553,14 @@ expand_string_unsplit_to_string (string, quoted) return (expand_string_to_string_internal (string, quoted, expand_string_unsplit)); } +char * +expand_assignment_string_to_string (string, quoted) + char *string; + int quoted; +{ + return (expand_string_to_string_internal (string, quoted, expand_string_assignment)); +} + #if defined (COND_COMMAND) /* Just remove backslashes in STRING. Returns a new string. */ char * @@ -2495,13 +2600,6 @@ cond_expand_word (w, special) if (w->word == 0 || w->word[0] == '\0') return ((char *)NULL); - if (xstrchr (w->word, '~') && unquoted_member ('~', w->word)) - { - p = bash_tilde_expand (w->word, 0); - free (w->word); - w->word = p; - } - l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0); if (l) { @@ -2595,7 +2693,43 @@ expand_string_unsplit (string, quoted) if (value) { if (value->word) - remove_quoted_nulls (value->word->word); + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } + dequote_list (value); + } + return (value); +} + +/* Expand the rhs of an assignment statement */ +WORD_LIST * +expand_string_assignment (string, quoted) + char *string; + int quoted; +{ + WORD_DESC td; + WORD_LIST *value; + + if (string == 0 || *string == '\0') + return ((WORD_LIST *)NULL); + + expand_no_split_dollar_star = 1; + + td.flags = W_ASSIGNRHS; + td.word = savestring (string); + value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL); + FREE (td.word); + + expand_no_split_dollar_star = 0; + + if (value) + { + if (value->word) + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } dequote_list (value); } return (value); @@ -2633,7 +2767,10 @@ expand_prompt_string (string, quoted) if (value) { if (value->word) - remove_quoted_nulls (value->word->word); + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } dequote_list (value); } return (value); @@ -3012,7 +3149,10 @@ word_list_remove_quoted_nulls (list) register WORD_LIST *t; for (t = list; t; t = t->next) - remove_quoted_nulls (t->word->word); + { + remove_quoted_nulls (t->word->word); + t->word->flags &= ~W_HASQUOTEDNULL; + } } /* **************************************************************** */ @@ -3557,8 +3697,6 @@ getpattern (value, quoted, expandpat) WORD_LIST *l; int i; - tword = xstrchr (value, '~') ? bash_tilde_expand (value, 0) : savestring (value); - /* There is a problem here: how to handle single or double quotes in the pattern string when the whole expression is between double quotes? POSIX.2 says that enclosing double quotes do not cause the pattern to @@ -3576,11 +3714,10 @@ getpattern (value, quoted, expandpat) /* expand_string_for_rhs () leaves WORD quoted and does not perform word splitting. */ - l = *tword ? expand_string_for_rhs (tword, + l = *value ? expand_string_for_rhs (value, (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? Q_PATQUOTE : quoted, (int *)NULL, (int *)NULL) : (WORD_LIST *)0; - free (tword); pat = string_list (l); dispose_words (l); if (pat) @@ -3621,18 +3758,19 @@ list_remove_pattern (list, pattern, patspec, itype, quoted) for (new = (WORD_LIST *)NULL, l = list; l; l = l->next) { tword = remove_pattern (l->word->word, pattern, patspec); +#if 0 w = make_bare_word (tword); FREE (tword); +#else + w = alloc_word_desc (); + w->word = tword ? tword : savestring (""); +#endif new = make_word_list (w, new); } l = REVERSE_LIST (new, WORD_LIST *); if (itype == '*') -#if 0 - tword = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (l) : string_list (l); -#else tword = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (l) : string_list (l); -#endif else tword = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (l) : l); @@ -4270,7 +4408,7 @@ command_substitute (string, quoted) char *string; int quoted; { - pid_t pid, old_pid, old_pipeline_pgrp; + pid_t pid, old_pid, old_pipeline_pgrp, old_async_pid; char *istring; int result, fildes[2], function_value, pflags, rc; @@ -4318,7 +4456,14 @@ command_substitute (string, quoted) cleanup_the_pipeline (); #endif + old_async_pid = last_asynchronous_pid; +#if 0 pid = make_child ((char *)NULL, 0); +#else + pid = make_child ((char *)NULL, subshell_environment&SUBSHELL_ASYNC); +#endif + last_asynchronous_pid = old_async_pid; + if (pid == 0) /* Reset the signal handlers in the child, but don't free the trap strings. */ @@ -4600,18 +4745,21 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at) VAR_IS_SPECIAL is non-zero if NAME is one of the special variables in the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that NAME was found inside of a double-quoted expression. */ -static char * +static WORD_DESC * parameter_brace_expand_word (name, var_is_special, quoted) char *name; int var_is_special, quoted; { + WORD_DESC *ret; char *temp, *tt; intmax_t arg_index; SHELL_VAR *var; int atype; - /* Handle multiple digit arguments, as in ${11}. */ - + ret = 0; + temp = 0; + + /* Handle multiple digit arguments, as in ${11}. */ if (legal_number (name, &arg_index)) { tt = get_dollar_var_value (arg_index); @@ -4630,8 +4778,8 @@ parameter_brace_expand_word (name, var_is_special, quoted) tt[sindex = 0] = '$'; strcpy (tt + 1, name); - temp = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL, - (int *)NULL, (int *)NULL, 0); + ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL, + (int *)NULL, (int *)NULL, 0); free (tt); } #if defined (ARRAY_VARS) @@ -4665,20 +4813,27 @@ parameter_brace_expand_word (name, var_is_special, quoted) else temp = (char *)NULL; - return (temp); + if (ret == 0) + { + ret = alloc_word_desc (); + ret->word = temp; + } + return ret; } /* Expand an indirect reference to a variable: ${!NAME} expands to the value of the variable whose name is the value of NAME. */ -static char * +static WORD_DESC * parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at) char *name; int var_is_special, quoted; int *quoted_dollar_atp, *contains_dollar_at; { char *temp, *t; + WORD_DESC *w; - t = parameter_brace_expand_word (name, var_is_special, quoted); + w = parameter_brace_expand_word (name, var_is_special, quoted); + t = w->word; /* Have to dequote here if necessary */ if (t) { @@ -4688,53 +4843,52 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c free (t); t = temp; } + dispose_word_desc (w); + chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at); if (t == 0) - return (t); - temp = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted); + return (WORD_DESC *)NULL; + + w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted); free (t); - return temp; + + return w; } /* Expand the right side of a parameter expansion of the form ${NAMEcVALUE}, depending on the value of C, the separating character. C can be one of "-", "+", or "=". QUOTED is true if the entire brace expression occurs between double quotes. */ -static char * +static WORD_DESC * parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat) char *name, *value; int c, quoted, *qdollaratp, *hasdollarat; { + WORD_DESC *w; WORD_LIST *l; char *t, *t1, *temp; int hasdol; - /* XXX - Should we tilde expand in an assignment context if C is `='? */ - if (*value == '~') - temp = bash_tilde_expand (value, 0); - else if (xstrchr (value, '~') && unquoted_substring ("=~", value)) - temp = bash_tilde_expand (value, 1); - else - temp = savestring (value); - /* If the entire expression is between double quotes, we want to treat the value as a double-quoted string, with the exception that we strip embedded unescaped double quotes. */ - if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *temp) + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value) { hasdol = 0; - t = string_extract_double_quoted (temp, &hasdol, 1); - free (temp); - temp = t; + temp = string_extract_double_quoted (value, &hasdol, 1); } + else + temp = value; + w = alloc_word_desc (); hasdol = 0; /* XXX was 0 not quoted */ l = *temp ? expand_string_for_rhs (temp, quoted, &hasdol, (int *)NULL) : (WORD_LIST *)0; if (hasdollarat) *hasdollarat = hasdol || (l && l->next); - free (temp); + if (temp != value) + free (temp); if (l) { /* The expansion of TEMP returned something. We need to treat things @@ -4760,12 +4914,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat) temp = (char *)xmalloc (2); temp[0] = CTLNUL; temp[1] = '\0'; + w->flags |= W_HASQUOTEDNULL; } else temp = (char *)NULL; if (c == '-' || c == '+') - return (temp); + { + w->word = temp; + return w; + } /* c == '=' */ t = temp ? savestring (temp) : savestring (""); @@ -4773,12 +4931,14 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat) free (t); #if defined (ARRAY_VARS) if (valid_array_reference (name)) - assign_array_element (name, t1); + assign_array_element (name, t1, 0); else #endif /* ARRAY_VARS */ - bind_variable (name, t1); + bind_variable (name, t1, 0); free (t1); - return (temp); + + w->word = temp; + return w; } /* Deal with the right hand side of a ${name:?value} expansion in the case @@ -4794,15 +4954,7 @@ parameter_brace_expand_error (name, value) if (value && *value) { - if (*value == '~') - temp = bash_tilde_expand (value, 0); - else if (xstrchr (value, '~') && unquoted_substring ("=~", value)) - temp = bash_tilde_expand (value, 1); - else - temp = savestring (value); - - l = expand_string (temp, 0); - FREE (temp); + l = expand_string (value, 0); temp = string_list (l); report_error ("%s: %s", name, temp ? temp : ""); /* XXX was value not "" */ FREE (temp); @@ -4838,14 +4990,22 @@ mbstrlen (s) const char *s; { size_t clen, nc; - mbstate_t mbs; + mbstate_t mbs, mbsbak; nc = 0; memset (&mbs, 0, sizeof (mbs)); - while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && (MB_INVALIDCH(clen) == 0)) + mbsbak = mbs; + while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0) { + if (MB_INVALIDCH(clen)) + { + clen = 1; /* assume single byte */ + mbs = mbsbak; + } + s += clen; nc++; + mbsbak = mbs; } return nc; } @@ -5141,6 +5301,15 @@ get_var_and_type (varname, value, quoted, varp, valp) } *varp = v; } + else if (v && (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']')) + { + vtype = VT_VARIABLE; + *varp = v; + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + *valp = dequote_string (value); + else + *valp = dequote_escapes (value); + } else return -1; } @@ -5152,7 +5321,6 @@ get_var_and_type (varname, value, quoted, varp, valp) } else #endif -#if 1 { if (value && vtype == VT_VARIABLE) { @@ -5164,9 +5332,6 @@ get_var_and_type (varname, value, quoted, varp, valp) else *valp = value; } -#else - *valp = (value && vtype == VT_VARIABLE) ? dequote_escapes (value) : value; -#endif return vtype; } @@ -5192,7 +5357,8 @@ mb_substring (string, s, e) DECLARE_MBSTATE; start = 0; - slen = STRLEN (string); + /* Don't need string length in ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? STRLEN (string) : 0; i = s; while (string[start] && i--) @@ -5391,10 +5557,15 @@ pos_params_pat_subst (string, pat, rep, mflags) for ( ; params; params = params->next) { ret = pat_subst (params->word->word, pat, rep, mflags); +#if 0 w = make_bare_word (ret); + FREE (ret); +#else + w = alloc_word_desc (); + w->word = ret ? ret : savestring (""); +#endif dispose_word (params->word); params->word = w; - FREE (ret); } if ((mflags & (MATCH_QUOTED|MATCH_STARSUB)) == (MATCH_QUOTED|MATCH_STARSUB)) @@ -5456,16 +5627,9 @@ parameter_brace_patsub (varname, value, patsub, quoted) if (rep && *rep == '\0') rep = (char *)NULL; -#if 0 - /* Expand PAT and REP for command, variable and parameter, arithmetic, - and process substitution. Also perform quote removal. Do not - perform word splitting or filename generation. */ - pat = expand_string_if_necessary (lpatsub, (quoted & ~Q_DOUBLE_QUOTES), expand_string_unsplit); -#else /* Perform the same expansions on the pattern as performed by the pattern removal expansions. */ pat = getpattern (lpatsub, quoted, 1); -#endif if (rep) { @@ -5550,7 +5714,7 @@ parameter_brace_patsub (varname, value, patsub, quoted) /****************************************************************/ /* ${[#][!]name[[:]#[#]%[%]-=?+[word][:e1[:e2]]]} */ -static char * +static WORD_DESC * parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_dollar_at) char *string; int *indexp, quoted, *quoted_dollar_atp, *contains_dollar_at; @@ -5558,7 +5722,8 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll int check_nullness, var_is_set, var_is_null, var_is_special; int want_substring, want_indir, want_patsub; char *name, *value, *temp, *temp1; - int t_index, sindex, c; + WORD_DESC *tdesc, *ret; + int t_index, sindex, c, tflag; intmax_t number; value = (char *)NULL; @@ -5569,6 +5734,9 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll t_index = ++sindex; name = string_extract (string, &t_index, "#%:-=?+/}", EX_VARNAME); + ret = 0; + tflag = 0; + /* If the name really consists of a special variable, then make sure that we have the entire name. We don't allow indirect references to special variables except `#', `?', `@' and `*'. */ @@ -5671,7 +5839,14 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll free (name); *indexp = sindex; - return ((number < 0) ? &expand_param_error : itos (number)); + if (number < 0) + return (&expand_wdesc_error); + else + { + ret = alloc_word_desc (); + ret->word = itos (number); + return ret; + } } /* ${@} is identical to $@. */ @@ -5711,7 +5886,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll free (xlist); free (temp1); *indexp = sindex; - return (temp); + + ret = alloc_word_desc (); + ret->word = temp; + return ret; } #if defined (ARRAY_VARS) @@ -5737,7 +5915,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll free (temp1); *indexp = sindex; - return (temp); + + ret = alloc_word_desc (); + ret->word = temp; + return ret; } free (temp1); @@ -5753,9 +5934,18 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll } if (want_indir) - temp = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); + tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); else - temp = parameter_brace_expand_word (name, var_is_special, quoted); + tdesc = parameter_brace_expand_word (name, var_is_special, quoted); + + if (tdesc) + { + temp = tdesc->word; + tflag = tdesc->flags; + dispose_word_desc (tdesc); + } + else + temp = (char *)0; #if defined (ARRAY_VARS) if (valid_array_reference (name)) @@ -5788,7 +5978,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll FREE (name); FREE (value); FREE (temp); - return (temp1); + + if (temp1 == &expand_param_error) + return (&expand_wdesc_error); + else if (temp1 == &expand_param_fatal) + return (&expand_wdesc_fatal); + + ret = alloc_word_desc (); + ret->word = temp1; + return ret; } else if (want_patsub) { @@ -5796,7 +5994,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll FREE (name); FREE (value); FREE (temp); - return (temp1); + + if (temp1 == &expand_param_error) + return (&expand_wdesc_error); + else if (temp1 == &expand_param_fatal) + return (&expand_wdesc_fatal); + + ret = alloc_word_desc (); + ret->word = temp1; + return ret; } /* Do the right thing based on which character ended the variable name. */ @@ -5809,7 +6015,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll FREE (value); FREE (temp); free (name); - return &expand_param_error; + return &expand_wdesc_error; case RBRACE: if (var_is_set == 0 && unbound_vars_is_error) @@ -5819,7 +6025,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll FREE (temp); free (name); last_command_exit_value = EXECUTION_FAILURE; - return (interactive_shell ? &expand_param_error : &expand_param_fatal); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } break; @@ -5858,10 +6064,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll FREE (temp); if (value) { - temp = parameter_brace_expand_rhs (name, value, c, - quoted, - quoted_dollar_atp, - contains_dollar_at); + ret = parameter_brace_expand_rhs (name, value, c, + quoted, + quoted_dollar_atp, + contains_dollar_at); + /* XXX - fix up later, esp. noting presence of + W_HASQUOTEDNULL in ret->flags */ free (value); } else @@ -5882,12 +6090,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll report_error (_("$%s: cannot assign in this way"), name); free (name); free (value); - return &expand_param_error; + return &expand_wdesc_error; } else if (c == '?') { parameter_brace_expand_error (name, value); - return (interactive_shell ? &expand_param_error : &expand_param_fatal); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } else if (c != '+') { @@ -5899,9 +6107,11 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll if (contains_dollar_at) *contains_dollar_at = 0; - temp = parameter_brace_expand_rhs (name, value, c, quoted, - quoted_dollar_atp, - contains_dollar_at); + ret = parameter_brace_expand_rhs (name, value, c, quoted, + quoted_dollar_atp, + contains_dollar_at); + /* XXX - fix up later, esp. noting presence of + W_HASQUOTEDNULL in tdesc->flags */ } free (value); } @@ -5909,13 +6119,20 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll break; } free (name); - return (temp); + + if (ret == 0) + { + ret = alloc_word_desc (); + ret->flags = tflag; + ret->word = temp; + } + return (ret); } /* Expand a single ${xxx} expansion. The braces are optional. When the braces are used, parameter_brace_expand() does the work, possibly calling param_expand recursively. */ -static char * +static WORD_DESC * param_expand (string, sindex, quoted, expanded_something, contains_dollar_at, quoted_dollar_at_p, had_quoted_null_p, pflags) @@ -5929,11 +6146,15 @@ param_expand (string, sindex, quoted, expanded_something, intmax_t number; SHELL_VAR *var; WORD_LIST *list; + WORD_DESC *tdesc, *ret; + int tflag; zindex = *sindex; c = string[++zindex]; temp = (char *)NULL; + ret = tdesc = (WORD_DESC *)NULL; + tflag = 0; /* Do simple cases first. Switch on what follows '$'. */ switch (c) @@ -5957,18 +6178,15 @@ param_expand (string, sindex, quoted, expanded_something, uerror[2] = '\0'; err_unboundvar (uerror); last_command_exit_value = EXECUTION_FAILURE; - return (interactive_shell ? &expand_param_error : &expand_param_fatal); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } -#if 1 if (temp1) temp = (*temp1 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) ? quote_string (temp1) : quote_escapes (temp1); else temp = (char *)NULL; -#else - temp = temp1 ? quote_escapes (temp1) : (char *)NULL; -#endif + break; /* $$ -- pid of the invoking shell. */ @@ -6008,7 +6226,7 @@ param_expand (string, sindex, quoted, expanded_something, uerror[2] = '\0'; err_unboundvar (uerror); last_command_exit_value = EXECUTION_FAILURE; - return (interactive_shell ? &expand_param_error : &expand_param_fatal); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } } else @@ -6031,19 +6249,32 @@ param_expand (string, sindex, quoted, expanded_something, quote the whole string, including the separators. If IFS is unset, the parameters are separated by ' '; if $IFS is null, the parameters are concatenated. */ -#if 0 - temp = string_list_dollar_star (list); -#else temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list); -#endif temp1 = quote_string (temp); + if (*temp == 0) + tflag |= W_HASQUOTEDNULL; free (temp); temp = temp1; } else { - /* If the $* is not quoted it is identical to $@ */ + /* We check whether or not we're eventually going to split $* here, + for example when IFS is empty and we are processing the rhs of + an assignment statement. In that case, we don't separate the + arguments at all. Otherwise, if the $* is not quoted it is + identical to $@ */ +#if 1 +# if defined (HANDLE_MULTIBYTE) + if (expand_no_split_dollar_star && ifs_firstc[0] == 0) +# else + if (expand_no_split_dollar_star && ifs_firstc == 0) +# endif + temp = string_list_dollar_star (list); + else + temp = string_list_dollar_at (list, quoted); +#else temp = string_list_dollar_at (list, quoted); +#endif if (expand_no_split_dollar_star == 0 && contains_dollar_at) *contains_dollar_at = 1; } @@ -6079,11 +6310,14 @@ param_expand (string, sindex, quoted, expanded_something, break; case LBRACE: - temp = parameter_brace_expand (string, &zindex, quoted, - quoted_dollar_at_p, - contains_dollar_at); - if (temp == &expand_param_error || temp == &expand_param_fatal) - return (temp); + tdesc = parameter_brace_expand (string, &zindex, quoted, + quoted_dollar_at_p, + contains_dollar_at); + + /* Fix this later when parameter_brace_expand returns a WORD_DESC * */ + if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal) + return (tdesc); + temp = tdesc ? tdesc->word : (char *)0; /* XXX */ /* Quoted nulls should be removed if there is anything else @@ -6093,18 +6327,24 @@ param_expand (string, sindex, quoted, expanded_something, in the string, discard TEMP, and go on. The exception to this is when we have "${@}" and $1 is '', since $@ needs special handling. */ + /* XXX - fix this once parameter_brace_expand returns a WORD_DESC * */ +#if 0 if (temp && QUOTED_NULL (temp)) +#else + if (tdesc && tdesc->word && (tdesc->flags & W_HASQUOTEDNULL) && QUOTED_NULL (temp)) +#endif { if (had_quoted_null_p) *had_quoted_null_p = 1; if (*quoted_dollar_at_p == 0) { free (temp); - temp = (char *)NULL; + tdesc->word = temp = (char *)NULL; } } + ret = tdesc; goto return0; /* Do command or arithmetic substitution. */ @@ -6147,10 +6387,10 @@ arithsub: if (interactive_shell == 0 && posixly_correct) { last_command_exit_value = EXECUTION_FAILURE; - return (&expand_param_fatal); + return (&expand_wdesc_fatal); } else - return (&expand_param_error); + return (&expand_wdesc_error); } temp = itos (number); break; @@ -6244,8 +6484,8 @@ unbound_variable: free (temp1); last_command_exit_value = EXECUTION_FAILURE; return ((unbound_vars_is_error && interactive_shell == 0) - ? &expand_param_fatal - : &expand_param_error); + ? &expand_wdesc_fatal + : &expand_wdesc_error); } if (string[zindex]) @@ -6253,7 +6493,14 @@ unbound_variable: return0: *sindex = zindex; - return (temp); + + if (ret == 0) + { + ret = alloc_word_desc (); + ret->flags = tflag; /* XXX */ + ret->word = temp; + } + return ret; } /* Make a word list which is the result of parameter and variable @@ -6321,10 +6568,13 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin string (e.g., "xx"ab), or is fully quoted (e.g., "xxab"). */ int quoted_state; + /* State flags */ int had_quoted_null; int has_dollar_at; int tflag; + int assignoff; /* If assignment, offset of `=' */ + register unsigned char c; /* Current character. */ int t_index; /* For calls to string_extract_xxx. */ @@ -6340,11 +6590,15 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin string = word->word; if (string == 0) goto finished_with_string; - string_size = strlen (string); + /* Don't need the string length for the SADD... and COPY_ macros unless + multibyte characters are possible. */ + string_size = (MB_CUR_MAX > 1) ? strlen (string) : 1; if (contains_dollar_at) *contains_dollar_at = 0; + assignoff = -1; + /* Begin the expansion. */ for (sindex = 0; ;) @@ -6414,25 +6668,109 @@ add_string: } #endif /* PROCESS_SUBSTITUTION */ + case '=': + /* Posix.2 section 3.6.1 says that tildes following `=' in words + which are not assignment statements are not expanded. If the + shell isn't in posix mode, though, we perform tilde expansion + on `likely candidate' unquoted assignment statements (flags + include W_ASSIGNMENT but not W_QUOTED). A likely candidate + contains an unquoted :~ or =~. Something to think about: we + now have a flag that says to perform tilde expansion on arguments + to `assignment builtins' like declare and export that look like + assignment statements. We now do tilde expansion on such words + even in POSIX mode. */ + if (word->flags & (W_ASSIGNRHS|W_NOTILDE)) + goto add_character; + /* If we're not in posix mode or forcing assignment-statement tilde + expansion, note where the `=' appears in the word and prepare to + do tilde expansion following the first `='. */ + if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + assignoff == -1 && sindex > 0) + assignoff = sindex; + if (sindex == assignoff && string[sindex+1] == '~') /* XXX */ + word->flags |= W_ITILDE; +#if 0 + else if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + string[sindex+1] == '~') + word->flags |= W_ITILDE; +#endif + goto add_character; + + case ':': + if (word->flags & W_NOTILDE) + goto add_character; + if ((word->flags & (W_ASSIGNMENT|W_ASSIGNRHS)) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + string[sindex+1] == '~') + word->flags |= W_ITILDE; + goto add_character; + + case '~': + /* If the word isn't supposed to be tilde expanded, or we're not + at the start of a word or after an unquoted : or = in an + assignment statement, we don't do tilde expansion. */ + if ((word->flags & W_NOTILDE) || + (sindex > 0 && ((word->flags & W_ITILDE) == 0)) || + (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + { + word->flags &= ~W_ITILDE; + goto add_character; + } + + if (word->flags & W_ASSIGNRHS) + tflag = 2; + else if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP))) + tflag = 1; + else + tflag = 0; + + temp = bash_tilde_find_word (string + sindex, tflag, &t_index); + + word->flags &= ~W_ITILDE; + + if (temp && *temp && t_index > 0) + { + temp1 = bash_tilde_expand (temp, tflag); + free (temp); + temp = temp1; + sindex += t_index; + goto add_string; + } + else + { + FREE (temp); + goto add_character; + } + case '$': if (expanded_something) *expanded_something = 1; has_dollar_at = 0; - temp = param_expand (string, &sindex, quoted, expanded_something, + tword = param_expand (string, &sindex, quoted, expanded_something, &has_dollar_at, "ed_dollar_at, &had_quoted_null, (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0); - if (temp == &expand_param_error || temp == &expand_param_fatal) + if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal) { free (string); free (istring); - return ((temp == &expand_param_error) ? &expand_word_error - : &expand_word_fatal); + return ((tword == &expand_wdesc_error) ? &expand_word_error + : &expand_word_fatal); } if (contains_dollar_at && has_dollar_at) *contains_dollar_at = 1; + + if (tword && (tword->flags & W_HASQUOTEDNULL)) + had_quoted_null = 1; + + temp = tword->word; + dispose_word_desc (tword); + goto add_string; break; @@ -6500,11 +6838,7 @@ add_twochars: break; case '"': -#if 0 - if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE)) -#else if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) -#endif goto add_character; t_index = ++sindex; @@ -6518,11 +6852,13 @@ add_twochars: if (temp && *temp) { - tword = make_word (temp); /* XXX */ - free (temp); + tword = alloc_word_desc (); + tword->word = temp; + temp = (char *)NULL; has_dollar_at = 0; + /* Need to get W_HASQUOTEDNULL flag through this function. */ list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL); if (list == &expand_word_error || list == &expand_word_fatal) @@ -6558,6 +6894,9 @@ add_twochars: if (list) dequote_list (list); + if (list && list->word && (list->word->flags & W_HASQUOTEDNULL)) + had_quoted_null = 1; + if (has_dollar_at) { quoted_dollar_at++; @@ -6597,8 +6936,9 @@ add_twochars: else { temp = savestring (list->word->word); + tflag = list->word->flags; dispose_words (list); -#if 1 + /* If the string is not a quoted null string, we want to remove any embedded unquoted CTLNUL characters. We do not want to turn quoted null strings back into @@ -6607,15 +6947,13 @@ add_twochars: contain other characters. For example, if we have x"$*"y or "x$*y" and there are no positional parameters, the $* should expand into nothing. */ - /* HOWEVER, this fails if the string contains a literal - CTLNUL or CTLNUL is contained in the (non-null) expansion - of some variable. I'm not sure what to do about this - yet. There has to be some way to indicate the difference - between the two. An auxiliary data structure might be - necessary. */ - if (QUOTED_NULL (temp) == 0) + /* We use the W_HASQUOTEDNULL flag to differentiate the + cases: a quoted null character as above and when + CTLNUL is contained in the (non-null) expansion + of some variable. We use the had_quoted_null flag to + pass the value through this function to its caller. */ + if ((tflag & W_HASQUOTEDNULL) && QUOTED_NULL (temp) == 0) remove_quoted_nulls (temp); /* XXX */ -#endif } } else @@ -6646,11 +6984,7 @@ add_twochars: /* break; */ case '\'': -#if 0 - if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT|Q_PATQUOTE)) -#else if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) -#endif goto add_character; t_index = ++sindex; @@ -6766,6 +7100,7 @@ finished_with_string: istring[0] = CTLNUL; istring[1] = '\0'; tword = make_bare_word (istring); + tword->flags |= W_HASQUOTEDNULL; /* XXX */ list = make_word_list (tword, (WORD_LIST *)NULL); if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) tword->flags |= W_QUOTED; @@ -6779,9 +7114,9 @@ finished_with_string: else { tword = make_bare_word (istring); - list = make_word_list (tword, (WORD_LIST *)NULL); if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) tword->flags |= W_QUOTED; + list = make_word_list (tword, (WORD_LIST *)NULL); } #else else @@ -6791,13 +7126,19 @@ finished_with_string: else if (word->flags & W_NOSPLIT) { tword = make_bare_word (istring); - list = make_word_list (tword, (WORD_LIST *)NULL); if (word->flags & W_ASSIGNMENT) tword->flags |= W_ASSIGNMENT; /* XXX */ + if (word->flags & W_COMPASSIGN) + tword->flags |= W_COMPASSIGN; /* XXX */ if (word->flags & W_NOGLOB) tword->flags |= W_NOGLOB; /* XXX */ + if (word->flags & W_NOEXPAND) + tword->flags |= W_NOEXPAND; /* XXX */ if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) tword->flags |= W_QUOTED; + if (had_quoted_null) + tword->flags |= W_HASQUOTEDNULL; + list = make_word_list (tword, (WORD_LIST *)NULL); } else { @@ -6816,13 +7157,19 @@ finished_with_string: else { tword = make_bare_word (istring); - list = make_word_list (tword, (WORD_LIST *)NULL); if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED)) tword->flags |= W_QUOTED; if (word->flags & W_ASSIGNMENT) tword->flags |= W_ASSIGNMENT; + if (word->flags & W_COMPASSIGN) + tword->flags |= W_COMPASSIGN; if (word->flags & W_NOGLOB) tword->flags |= W_NOGLOB; + if (word->flags & W_NOEXPAND) + tword->flags |= W_NOEXPAND; + if (had_quoted_null) + tword->flags |= W_HASQUOTEDNULL; /* XXX */ + list = make_word_list (tword, (WORD_LIST *)NULL); } } @@ -6910,8 +7257,8 @@ word_quote_removal (word, quoted) char *t; t = string_quote_removal (word->word, quoted); - w = make_bare_word (t); - free (t); + w = alloc_word_desc (); + w->word = t ? t : savestring (""); return (w); } @@ -6923,12 +7270,23 @@ word_list_quote_removal (list, quoted) WORD_LIST *list; int quoted; { - WORD_LIST *result, *t, *tresult; + WORD_LIST *result, *t, *tresult, *e; for (t = list, result = (WORD_LIST *)NULL; t; t = t->next) { tresult = make_word_list (word_quote_removal (t->word, quoted), (WORD_LIST *)NULL); +#if 0 result = (WORD_LIST *) list_append (result, tresult); +#else + if (result == 0) + result = e = tresult; + else + { + e->next = tresult; + while (e->next) + e = e->next; + } +#endif } return (result); } @@ -7384,28 +7742,30 @@ shell_expand_word_list (tlist, eflags) next = tlist->next; - /* Posix.2 section 3.6.1 says that tildes following `=' in words - which are not assignment statements are not expanded. If the - shell isn't in posix mode, though, we perform tilde expansion - on `likely candidate' unquoted assignment statements (flags - include W_ASSIGNMENT but not W_QUOTED). A likely candidate - contains an unquoted :~ or =~. Something to think about: we - now have a flag that says to perform tilde expansion on arguments - to `assignment builtins' like declare and export that look like - assignment statements. We now do tilde expansion on such words - even in POSIX mode. */ - if (((tlist->word->flags & (W_ASSIGNMENT|W_QUOTED)) == W_ASSIGNMENT) && - (posixly_correct == 0 || (tlist->word->flags & W_TILDEEXP)) && - (unquoted_substring ("=~", temp_string) || unquoted_substring (":~", temp_string))) - { - tlist->word->word = bash_tilde_expand (temp_string, 1); - free (temp_string); - } - else if (temp_string[0] == '~') - { - tlist->word->word = bash_tilde_expand (temp_string, 0); - free (temp_string); +#if defined (ARRAY_VARS) + /* If this is a compound array assignment to a builtin that accepts + such assignments (e.g., `declare'), take the assignment and perform + it separately, handling the semantics of declarations inside shell + functions. This avoids the double-evaluation of such arguments, + because `declare' does some evaluation of compound assignments on + its own. */ + if ((tlist->word->flags & (W_COMPASSIGN|W_ASSIGNARG)) == (W_COMPASSIGN|W_ASSIGNARG)) + { + int t; + + t = do_word_assignment (tlist->word); + if (t == 0) + { + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + + /* Now transform the word as ksh93 appears to do and go on */ + t = assignment (tlist->word->word, 0); + tlist->word->word[t] = '\0'; + tlist->word->flags &= ~(W_ASSIGNMENT|W_NOSPLIT|W_COMPASSIGN|W_ASSIGNARG); } +#endif expanded_something = 0; expanded = expand_word_internal @@ -7493,7 +7853,7 @@ expand_word_list_internal (list, eflags) for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next) { this_command_name = (char *)NULL; /* no arithmetic errors */ - tint = do_assignment (temp_list->word->word); + tint = do_word_assignment (temp_list->word); /* Variable assignment errors in non-interactive shells running in Posix.2 mode cause the shell to exit. */ if (tint == 0) @@ -7541,23 +7901,23 @@ expand_word_list_internal (list, eflags) if ((eflags & WEXP_VARASSIGN) && subst_assign_varlist) { - sh_assign_func_t *assign_func; + sh_wassign_func_t *assign_func; /* If the remainder of the words expand to nothing, Posix.2 requires that the variable and environment assignments affect the shell's environment. */ - assign_func = new_list ? assign_in_env : do_assignment; + assign_func = new_list ? assign_in_env : do_word_assignment; tempenv_assign_error = 0; for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next) { this_command_name = (char *)NULL; - tint = (*assign_func) (temp_list->word->word); + tint = (*assign_func) (temp_list->word); /* Variable assignment errors in non-interactive shells running in Posix.2 mode cause the shell to exit. */ if (tint == 0) { - if (assign_func == do_assignment) + if (assign_func == do_word_assignment) { last_command_exit_value = EXECUTION_FAILURE; if (interactive_shell == 0 && posixly_correct) diff --git a/subst.c.save b/subst.c.save new file mode 100644 index 000000000..d13502681 --- /dev/null +++ b/subst.c.save @@ -0,0 +1,8000 @@ +/* subst.c -- The part of the shell that does parameter, command, arithmetic, + and globbing substitutions. */ + +/* ``Have a little faith, there's magic in the night. You ain't a + beauty, but, hey, you're alright.'' */ + +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2, or (at your option) any later + version. + + Bash is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with Bash; see the file COPYING. If not, write to the Free Software + Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + +#include "config.h" + +#include "bashtypes.h" +#include +#include "chartypes.h" +#include +#include +#include + +#if defined (HAVE_UNISTD_H) +# include +#endif + +#include "bashansi.h" +#include "posixstat.h" +#include "bashintl.h" + +#include "shell.h" +#include "flags.h" +#include "jobs.h" +#include "execute_cmd.h" +#include "filecntl.h" +#include "trap.h" +#include "pathexp.h" +#include "mailcheck.h" + +#include "shmbutil.h" + +#include "builtins/getopt.h" +#include "builtins/common.h" + +#include +#include + +#if !defined (errno) +extern int errno; +#endif /* !errno */ + +/* The size that strings change by. */ +#define DEFAULT_INITIAL_ARRAY_SIZE 112 +#define DEFAULT_ARRAY_SIZE 128 + +/* Variable types. */ +#define VT_VARIABLE 0 +#define VT_POSPARMS 1 +#define VT_ARRAYVAR 2 +#define VT_ARRAYMEMBER 3 + +#define VT_STARSUB 128 /* $* or ${array[*]} -- used to split */ + +/* Flags for quoted_strchr */ +#define ST_BACKSL 0x01 +#define ST_CTLESC 0x02 +#define ST_SQUOTE 0x04 /* unused yet */ +#define ST_DQUOTE 0x08 /* unused yet */ + +/* Flags for the string extraction functions. */ +#define EX_NOALLOC 0x01 /* just skip; don't return substring */ +#define EX_VARNAME 0x02 /* variable name; for string_extract () */ + +/* Flags for the `pflags' argument to param_expand() */ +#define PF_NOCOMSUB 0x01 /* Do not perform command substitution */ + +/* These defs make it easier to use the editor. */ +#define LBRACE '{' +#define RBRACE '}' +#define LPAREN '(' +#define RPAREN ')' + +/* Evaluates to 1 if C is one of the shell's special parameters whose length + can be taken, but is also one of the special expansion characters. */ +#define VALID_SPECIAL_LENGTH_PARAM(c) \ + ((c) == '-' || (c) == '?' || (c) == '#') + +/* Evaluates to 1 if C is one of the shell's special parameters for which an + indirect variable reference may be made. */ +#define VALID_INDIR_PARAM(c) \ + ((c) == '#' || (c) == '?' || (c) == '@' || (c) == '*') + +/* Evaluates to 1 if C is one of the OP characters that follows the parameter + in ${parameter[:]OPword}. */ +#define VALID_PARAM_EXPAND_CHAR(c) (sh_syntaxtab[(unsigned char)c] & CSUBSTOP) + +/* Evaluates to 1 if this is one of the shell's special variables. */ +#define SPECIAL_VAR(name, wi) \ + ((DIGIT (*name) && all_digits (name)) || \ + (name[1] == '\0' && (sh_syntaxtab[(unsigned char)*name] & CSPECVAR)) || \ + (wi && name[2] == '\0' && VALID_INDIR_PARAM (name[1]))) + +/* An expansion function that takes a string and a quoted flag and returns + a WORD_LIST *. Used as the type of the third argument to + expand_string_if_necessary(). */ +typedef WORD_LIST *EXPFUNC __P((char *, int)); + +/* Process ID of the last command executed within command substitution. */ +pid_t last_command_subst_pid = NO_PID; +pid_t current_command_subst_pid = NO_PID; + +/* Variables used to keep track of the characters in IFS. */ +SHELL_VAR *ifs_var; +char *ifs_value; +unsigned char ifs_cmap[UCHAR_MAX + 1]; + +#if defined (HANDLE_MULTIBYTE) +unsigned char ifs_firstc[MB_LEN_MAX]; +size_t ifs_firstc_len; +#else +unsigned char ifs_firstc; +#endif + +/* Extern functions and variables from different files. */ +extern int last_command_exit_value, last_command_exit_signal; +extern int subshell_environment; +extern int subshell_level; +extern int eof_encountered; +extern int return_catch_flag, return_catch_value; +extern pid_t dollar_dollar_pid; +extern int posixly_correct; +extern char *this_command_name; +extern struct fd_bitmap *current_fds_to_close; +extern int wordexp_only; +extern int expanding_redir; +extern int tempenv_assign_error; + +/* Non-zero means to allow unmatched globbed filenames to expand to + a null file. */ +int allow_null_glob_expansion; + +/* Non-zero means to throw an error when globbing fails to match anything. */ +int fail_glob_expansion; + +#if 0 +/* Variables to keep track of which words in an expanded word list (the + output of expand_word_list_internal) are the result of globbing + expansions. GLOB_ARGV_FLAGS is used by execute_cmd.c. + (CURRENTLY UNUSED). */ +char *glob_argv_flags; +static int glob_argv_flags_size; +#endif + +static WORD_LIST expand_word_error, expand_word_fatal; +static WORD_DESC expand_wdesc_error, expand_wdesc_fatal; +static char expand_param_error, expand_param_fatal; + +/* Tell the expansion functions to not longjmp back to top_level on fatal + errors. Enabled when doing completion and prompt string expansion. */ +static int no_longjmp_on_fatal_error = 0; + +/* Set by expand_word_unsplit; used to inhibit splitting and re-joining + $* on $IFS, primarily when doing assignment statements. */ +static int expand_no_split_dollar_star = 0; + +/* Used to hold a list of variable assignments preceding a command. Global + so the SIGCHLD handler in jobs.c can unwind-protect it when it runs a + SIGCHLD trap. */ +WORD_LIST *subst_assign_varlist = (WORD_LIST *)NULL; + +/* A WORD_LIST of words to be expanded by expand_word_list_internal, + without any leading variable assignments. */ +static WORD_LIST *garglist = (WORD_LIST *)NULL; + +static char *quoted_substring __P((char *, int, int)); +static int quoted_strlen __P((char *)); +static char *quoted_strchr __P((char *, int, int)); + +static char *expand_string_if_necessary __P((char *, int, EXPFUNC *)); +static inline char *expand_string_to_string_internal __P((char *, int, EXPFUNC *)); +static WORD_LIST *call_expand_word_internal __P((WORD_DESC *, int, int, int *, int *)); +static WORD_LIST *expand_string_internal __P((char *, int)); +static WORD_LIST *expand_string_leave_quoted __P((char *, int)); +static WORD_LIST *expand_string_for_rhs __P((char *, int, int *, int *)); + +static WORD_LIST *list_quote_escapes __P((WORD_LIST *)); +static char *dequote_escapes __P((char *)); +static char *make_quoted_char __P((int)); +static WORD_LIST *quote_list __P((WORD_LIST *)); +static WORD_LIST *dequote_list __P((WORD_LIST *)); +static char *remove_quoted_escapes __P((char *)); +static char *remove_quoted_nulls __P((char *)); + +static int unquoted_substring __P((char *, char *)); +static int unquoted_member __P((int, char *)); + +#if defined (ARRAY_VARS) +static SHELL_VAR *do_compound_assignment __P((char *, char *, int)); +#endif +static int do_assignment_internal __P((const WORD_DESC *, int)); + +static char *string_extract_verbatim __P((char *, size_t, int *, char *)); +static char *string_extract __P((char *, int *, char *, int)); +static char *string_extract_double_quoted __P((char *, int *, int)); +static inline char *string_extract_single_quoted __P((char *, int *)); +static inline int skip_single_quoted __P((char *, size_t, int)); +static int skip_double_quoted __P((char *, size_t, int)); +static char *extract_delimited_string __P((char *, int *, char *, char *, char *, int)); +static char *extract_dollar_brace_string __P((char *, int *, int, int)); + +static char *pos_params __P((char *, int, int, int)); + +static unsigned char *mb_getcharlens __P((char *, int)); + +static char *remove_upattern __P((char *, char *, int)); +#if defined (HANDLE_MULTIBYTE) +# if !defined (HAVE_WCSDUP) +static wchar_t *wcsdup __P((wchar_t *)); +# endif +static wchar_t *remove_wpattern __P((wchar_t *, size_t, wchar_t *, int)); +#endif +static char *remove_pattern __P((char *, char *, int)); + +static int match_pattern_char __P((char *, char *)); +static int match_upattern __P((char *, char *, int, char **, char **)); +#if defined (HANDLE_MULTIBYTE) +static int match_pattern_wchar __P((wchar_t *, wchar_t *)); +static int match_wpattern __P((wchar_t *, char **, size_t, wchar_t *, int, char **, char **)); +#endif +static int match_pattern __P((char *, char *, int, char **, char **)); +static int getpatspec __P((int, char *)); +static char *getpattern __P((char *, int, int)); +static char *variable_remove_pattern __P((char *, char *, int, int)); +static char *list_remove_pattern __P((WORD_LIST *, char *, int, int, int)); +static char *parameter_list_remove_pattern __P((int, char *, int, int)); +#ifdef ARRAY_VARS +static char *array_remove_pattern __P((ARRAY *, char *, int, char *, int)); +#endif +static char *parameter_brace_remove_pattern __P((char *, char *, char *, int, int)); + +static char *process_substitute __P((char *, int)); + +static char *read_comsub __P((int, int)); + +#ifdef ARRAY_VARS +static arrayind_t array_length_reference __P((char *)); +#endif + +static int valid_brace_expansion_word __P((char *, int)); +static int chk_atstar __P((char *, int, int *, int *)); + +static WORD_DESC *parameter_brace_expand_word __P((char *, int, int)); +static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *)); +static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *)); +static void parameter_brace_expand_error __P((char *, char *)); + +static int valid_length_expression __P((char *)); +static intmax_t parameter_brace_expand_length __P((char *)); + +static char *skiparith __P((char *, int)); +static int verify_substring_values __P((char *, char *, int, intmax_t *, intmax_t *)); +static int get_var_and_type __P((char *, char *, int, SHELL_VAR **, char **)); +static char *mb_substring __P((char *, int, int)); +static char *parameter_brace_substring __P((char *, char *, char *, int)); + +static char *pos_params_pat_subst __P((char *, char *, char *, int)); + +static char *parameter_brace_patsub __P((char *, char *, char *, int)); + +static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int *, int *)); +static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int)); + +static WORD_LIST *expand_word_internal __P((WORD_DESC *, int, int, int *, int *)); + +static WORD_LIST *word_list_split __P((WORD_LIST *)); + +static void exp_jump_to_top_level __P((int)); + +static WORD_LIST *separate_out_assignments __P((WORD_LIST *)); +static WORD_LIST *glob_expand_word_list __P((WORD_LIST *, int)); +#ifdef BRACE_EXPANSION +static WORD_LIST *brace_expand_word_list __P((WORD_LIST *, int)); +#endif +static WORD_LIST *shell_expand_word_list __P((WORD_LIST *, int)); +static WORD_LIST *expand_word_list_internal __P((WORD_LIST *, int)); + +/* **************************************************************** */ +/* */ +/* Utility Functions */ +/* */ +/* **************************************************************** */ + +#ifdef INCLUDE_UNUSED +static char * +quoted_substring (string, start, end) + char *string; + int start, end; +{ + register int len, l; + register char *result, *s, *r; + + len = end - start; + + /* Move to string[start], skipping quoted characters. */ + for (s = string, l = 0; *s && l < start; ) + { + if (*s == CTLESC) + { + s++; + continue; + } + l++; + if (*s == 0) + break; + } + + r = result = (char *)xmalloc (2*len + 1); /* save room for quotes */ + + /* Copy LEN characters, including quote characters. */ + s = string + l; + for (l = 0; l < len; s++) + { + if (*s == CTLESC) + *r++ = *s++; + *r++ = *s; + l++; + if (*s == 0) + break; + } + *r = '\0'; + return result; +} +#endif + +#ifdef INCLUDE_UNUSED +/* Return the length of S, skipping over quoted characters */ +static int +quoted_strlen (s) + char *s; +{ + register char *p; + int i; + + i = 0; + for (p = s; *p; p++) + { + if (*p == CTLESC) + { + p++; + if (*p == 0) + return (i + 1); + } + i++; + } + + return i; +} +#endif + +/* Find the first occurrence of character C in string S, obeying shell + quoting rules. If (FLAGS & ST_BACKSL) is non-zero, backslash-escaped + characters are skipped. If (FLAGS & ST_CTLESC) is non-zero, characters + escaped with CTLESC are skipped. */ +static char * +quoted_strchr (s, c, flags) + char *s; + int c, flags; +{ + register char *p; + + for (p = s; *p; p++) + { + if (((flags & ST_BACKSL) && *p == '\\') + || ((flags & ST_CTLESC) && *p == CTLESC)) + { + p++; + if (*p == '\0') + return ((char *)NULL); + continue; + } + else if (*p == c) + return p; + } + return ((char *)NULL); +} + +/* Return 1 if CHARACTER appears in an unquoted portion of + STRING. Return 0 otherwise. CHARACTER must be a single-byte character. */ +static int +unquoted_member (character, string) + int character; + char *string; +{ + size_t slen; + int sindex, c; + DECLARE_MBSTATE; + + slen = strlen (string); + sindex = 0; + while (c = string[sindex]) + { + if (c == character) + return (1); + + switch (c) + { + default: + ADVANCE_CHAR (string, slen, sindex); + break; + + case '\\': + sindex++; + if (string[sindex]) + ADVANCE_CHAR (string, slen, sindex); + break; + + case '\'': + sindex = skip_single_quoted (string, slen, ++sindex); + break; + + case '"': + sindex = skip_double_quoted (string, slen, ++sindex); + break; + } + } + return (0); +} + +/* Return 1 if SUBSTR appears in an unquoted portion of STRING. */ +static int +unquoted_substring (substr, string) + char *substr, *string; +{ + size_t slen; + int sindex, c, sublen; + DECLARE_MBSTATE; + + if (substr == 0 || *substr == '\0') + return (0); + + slen = strlen (string); + sublen = strlen (substr); + for (sindex = 0; c = string[sindex]; ) + { + if (STREQN (string + sindex, substr, sublen)) + return (1); + + switch (c) + { + case '\\': + sindex++; + + if (string[sindex]) + ADVANCE_CHAR (string, slen, sindex); + break; + + case '\'': + sindex = skip_single_quoted (string, slen, ++sindex); + break; + + case '"': + sindex = skip_double_quoted (string, slen, ++sindex); + break; + + default: + ADVANCE_CHAR (string, slen, sindex); + break; + } + } + return (0); +} + +/* Most of the substitutions must be done in parallel. In order + to avoid using tons of unclear goto's, I have some functions + for manipulating malloc'ed strings. They all take INDX, a + pointer to an integer which is the offset into the string + where manipulation is taking place. They also take SIZE, a + pointer to an integer which is the current length of the + character array for this string. */ + +/* Append SOURCE to TARGET at INDEX. SIZE is the current amount + of space allocated to TARGET. SOURCE can be NULL, in which + case nothing happens. Gets rid of SOURCE by freeing it. + Returns TARGET in case the location has changed. */ +INLINE char * +sub_append_string (source, target, indx, size) + char *source, *target; + int *indx, *size; +{ + if (source) + { + int srclen, n; + + srclen = STRLEN (source); + if (srclen >= (int)(*size - *indx)) + { + n = srclen + *indx; + n = (n + DEFAULT_ARRAY_SIZE) - (n % DEFAULT_ARRAY_SIZE); + target = (char *)xrealloc (target, (*size = n)); + } + + FASTCOPY (source, target + *indx, srclen); + *indx += srclen; + target[*indx] = '\0'; + + free (source); + } + return (target); +} + +#if 0 +/* UNUSED */ +/* Append the textual representation of NUMBER to TARGET. + INDX and SIZE are as in SUB_APPEND_STRING. */ +char * +sub_append_number (number, target, indx, size) + intmax_t number; + int *indx, *size; + char *target; +{ + char *temp; + + temp = itos (number); + return (sub_append_string (temp, target, indx, size)); +} +#endif + +/* Extract a substring from STRING, starting at SINDEX and ending with + one of the characters in CHARLIST. Don't make the ending character + part of the string. Leave SINDEX pointing at the ending character. + Understand about backslashes in the string. If (flags & EX_VARNAME) + is non-zero, and array variables have been compiled into the shell, + everything between a `[' and a corresponding `]' is skipped over. + If (flags & EX_NOALLOC) is non-zero, don't return the substring, just + update SINDEX. */ +static char * +string_extract (string, sindex, charlist, flags) + char *string; + int *sindex; + char *charlist; + int flags; +{ + register int c, i; + size_t slen; + char *temp; + DECLARE_MBSTATE; + + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 0; + i = *sindex; + while (c = string[i]) + { + if (c == '\\') + { + if (string[i + 1]) + i++; + else + break; + } +#if defined (ARRAY_VARS) + else if ((flags & EX_VARNAME) && c == '[') + { + int ni; + /* If this is an array subscript, skip over it and continue. */ + ni = skipsubscript (string, i); + if (string[ni] == ']') + i = ni; + } +#endif + else if (MEMBER (c, charlist)) + break; + + ADVANCE_CHAR (string, slen, i); + } + + temp = (flags & EX_NOALLOC) ? (char *)NULL : substring (string, *sindex, i); + *sindex = i; + return (temp); +} + +/* Extract the contents of STRING as if it is enclosed in double quotes. + SINDEX, when passed in, is the offset of the character immediately + following the opening double quote; on exit, SINDEX is left pointing after + the closing double quote. If STRIPDQ is non-zero, unquoted double + quotes are stripped and the string is terminated by a null byte. + Backslashes between the embedded double quotes are processed. If STRIPDQ + is zero, an unquoted `"' terminates the string. */ +static char * +string_extract_double_quoted (string, sindex, stripdq) + char *string; + int *sindex, stripdq; +{ + size_t slen; + char *send; + int j, i, t; + unsigned char c; + char *temp, *ret; /* The new string we return. */ + int pass_next, backquote, si; /* State variables for the machine. */ + int dquote; + DECLARE_MBSTATE; + + slen = strlen (string + *sindex) + *sindex; + send = string + slen; + + pass_next = backquote = dquote = 0; + temp = (char *)xmalloc (1 + slen - *sindex); + + j = 0; + i = *sindex; + while (c = string[i]) + { + /* Process a character that was quoted by a backslash. */ + if (pass_next) + { + /* Posix.2 sez: + + ``The backslash shall retain its special meaning as an escape + character only when followed by one of the characters: + $ ` " \ ''. + + If STRIPDQ is zero, we handle the double quotes here and let + expand_word_internal handle the rest. If STRIPDQ is non-zero, + we have already been through one round of backslash stripping, + and want to strip these backslashes only if DQUOTE is non-zero, + indicating that we are inside an embedded double-quoted string. */ + + /* If we are in an embedded quoted string, then don't strip + backslashes before characters for which the backslash + retains its special meaning, but remove backslashes in + front of other characters. If we are not in an + embedded quoted string, don't strip backslashes at all. + This mess is necessary because the string was already + surrounded by double quotes (and sh has some really weird + quoting rules). + The returned string will be run through expansion as if + it were double-quoted. */ + if ((stripdq == 0 && c != '"') || + (stripdq && ((dquote && (sh_syntaxtab[c] & CBSDQUOTE)) || dquote == 0))) + temp[j++] = '\\'; + pass_next = 0; + +add_one_character: + COPY_CHAR_I (temp, j, string, send, i); + continue; + } + + /* A backslash protects the next character. The code just above + handles preserving the backslash in front of any character but + a double quote. */ + if (c == '\\') + { + pass_next++; + i++; + continue; + } + + /* Inside backquotes, ``the portion of the quoted string from the + initial backquote and the characters up to the next backquote + that is not preceded by a backslash, having escape characters + removed, defines that command''. */ + if (backquote) + { + if (c == '`') + backquote = 0; + temp[j++] = c; + i++; + continue; + } + + if (c == '`') + { + temp[j++] = c; + backquote++; + i++; + continue; + } + + /* Pass everything between `$(' and the matching `)' or a quoted + ${ ... } pair through according to the Posix.2 specification. */ + if (c == '$' && ((string[i + 1] == LPAREN) || (string[i + 1] == LBRACE))) + { + int free_ret = 1; + + si = i + 2; + if (string[i + 1] == LPAREN) + ret = extract_delimited_string (string, &si, "$(", "(", ")", 0); /*)*/ + else + ret = extract_dollar_brace_string (string, &si, 1, 0); + + temp[j++] = '$'; + temp[j++] = string[i + 1]; + + /* Just paranoia; ret will not be 0 unless no_longjmp_on_fatal_error + is set. */ + if (ret == 0 && no_longjmp_on_fatal_error) + { + free_ret = 0; + ret = string + i + 2; + } + + for (t = 0; ret[t]; t++, j++) + temp[j] = ret[t]; + temp[j] = string[si]; + + if (string[si]) + { + j++; + i = si + 1; + } + else + i = si; + + if (free_ret) + free (ret); + continue; + } + + /* Add any character but a double quote to the quoted string we're + accumulating. */ + if (c != '"') + goto add_one_character; + + /* c == '"' */ + if (stripdq) + { + dquote ^= 1; + i++; + continue; + } + + break; + } + temp[j] = '\0'; + + /* Point to after the closing quote. */ + if (c) + i++; + *sindex = i; + + return (temp); +} + +/* This should really be another option to string_extract_double_quoted. */ +static int +skip_double_quoted (string, slen, sind) + char *string; + size_t slen; + int sind; +{ + int c, i; + char *ret; + int pass_next, backquote, si; + DECLARE_MBSTATE; + + pass_next = backquote = 0; + i = sind; + while (c = string[i]) + { + if (pass_next) + { + pass_next = 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (c == '\\') + { + pass_next++; + i++; + continue; + } + else if (backquote) + { + if (c == '`') + backquote = 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (c == '`') + { + backquote++; + i++; + continue; + } + else if (c == '$' && ((string[i + 1] == LPAREN) || (string[i + 1] == LBRACE))) + { + si = i + 2; + if (string[i + 1] == LPAREN) + ret = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC); /* ) */ + else + ret = extract_dollar_brace_string (string, &si, 0, EX_NOALLOC); + + i = si + 1; + continue; + } + else if (c != '"') + { + ADVANCE_CHAR (string, slen, i); + continue; + } + else + break; + } + + if (c) + i++; + + return (i); +} + +/* Extract the contents of STRING as if it is enclosed in single quotes. + SINDEX, when passed in, is the offset of the character immediately + following the opening single quote; on exit, SINDEX is left pointing after + the closing single quote. */ +static inline char * +string_extract_single_quoted (string, sindex) + char *string; + int *sindex; +{ + register int i; + size_t slen; + char *t; + DECLARE_MBSTATE; + + /* Don't need slen for ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 0; + i = *sindex; + while (string[i] && string[i] != '\'') + ADVANCE_CHAR (string, slen, i); + + t = substring (string, *sindex, i); + + if (string[i]) + i++; + *sindex = i; + + return (t); +} + +static inline int +skip_single_quoted (string, slen, sind) + char *string; + size_t slen; + int sind; +{ + register int c; + DECLARE_MBSTATE; + + c = sind; + while (string[c] && string[c] != '\'') + ADVANCE_CHAR (string, slen, c); + + if (string[c]) + c++; + return c; +} + +/* Just like string_extract, but doesn't hack backslashes or any of + that other stuff. Obeys CTLESC quoting. Used to do splitting on $IFS. */ +static char * +string_extract_verbatim (string, slen, sindex, charlist) + char *string; + size_t slen; + int *sindex; + char *charlist; +{ + register int i = *sindex; +#if defined (HANDLE_MULTIBYTE) + size_t clen; + wchar_t *wcharlist; +#endif + int c; + char *temp; + DECLARE_MBSTATE; + + if (charlist[0] == '\'' && charlist[1] == '\0') + { + temp = string_extract_single_quoted (string, sindex); + --*sindex; /* leave *sindex at separator character */ + return temp; + } + + i = *sindex; +#if 0 + /* See how the MBLEN and ADVANCE_CHAR macros work to understand why we need + this only if MB_CUR_MAX > 1. */ + slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 1; +#endif +#if defined (HANDLE_MULTIBYTE) + clen = strlen (charlist); + wcharlist = 0; +#endif + while (c = string[i]) + { +#if defined (HANDLE_MULTIBYTE) + size_t mblength; +#endif + if (c == CTLESC) + { + i += 2; + continue; + } + +#if defined (HANDLE_MULTIBYTE) + mblength = MBLEN (string + i, slen - i); + if (mblength > 1) + { + wchar_t wc; + mblength = mbtowc (&wc, string + i, slen - i); + if (MB_INVALIDCH (mblength)) + { + if (MEMBER (c, charlist)) + break; + } + else + { + if (wcharlist == 0) + { + size_t len; + len = mbstowcs (wcharlist, charlist, 0); + if (len == -1) + len = 0; + wcharlist = xmalloc ((sizeof (wchar_t) * len) + 1); + mbstowcs (wcharlist, charlist, len); + } + + if (wcschr (wcharlist, wc)) + break; + } + } + else +#endif + if (MEMBER (c, charlist)) + break; + + ADVANCE_CHAR (string, slen, i); + } + +#if defined (HANDLE_MULTIBYTE) + FREE (wcharlist); +#endif + + temp = substring (string, *sindex, i); + *sindex = i; + + return (temp); +} + +/* Extract the $( construct in STRING, and return a new string. + Start extracting at (SINDEX) as if we had just seen "$(". + Make (SINDEX) get the position of the matching ")". ) */ +char * +extract_command_subst (string, sindex) + char *string; + int *sindex; +{ + return (extract_delimited_string (string, sindex, "$(", "(", ")", 0)); /*)*/ +} + +/* Extract the $[ construct in STRING, and return a new string. (]) + Start extracting at (SINDEX) as if we had just seen "$[". + Make (SINDEX) get the position of the matching "]". */ +char * +extract_arithmetic_subst (string, sindex) + char *string; + int *sindex; +{ + return (extract_delimited_string (string, sindex, "$[", "[", "]", 0)); /*]*/ +} + +#if defined (PROCESS_SUBSTITUTION) +/* Extract the <( or >( construct in STRING, and return a new string. + Start extracting at (SINDEX) as if we had just seen "<(". + Make (SINDEX) get the position of the matching ")". */ /*))*/ +char * +extract_process_subst (string, starter, sindex) + char *string; + char *starter; + int *sindex; +{ + return (extract_delimited_string (string, sindex, starter, "(", ")", 0)); +} +#endif /* PROCESS_SUBSTITUTION */ + +#if defined (ARRAY_VARS) +/* This can be fooled by unquoted right parens in the passed string. If + each caller verifies that the last character in STRING is a right paren, + we don't even need to call extract_delimited_string. */ +char * +extract_array_assignment_list (string, sindex) + char *string; + int *sindex; +{ +#if 0 + return (extract_delimited_string (string, sindex, "(", (char *)NULL, ")", 0)); +#else + int slen; + char *ret; + + slen = strlen (string); /* ( */ + if (string[slen - 1] == ')') + { + ret = substring (string, *sindex, slen - 1); + *sindex = slen - 1; + return ret; + } +#endif +} +#endif + +/* Extract and create a new string from the contents of STRING, a + character string delimited with OPENER and CLOSER. SINDEX is + the address of an int describing the current offset in STRING; + it should point to just after the first OPENER found. On exit, + SINDEX gets the position of the last character of the matching CLOSER. + If OPENER is more than a single character, ALT_OPENER, if non-null, + contains a character string that can also match CLOSER and thus + needs to be skipped. */ +static char * +extract_delimited_string (string, sindex, opener, alt_opener, closer, flags) + char *string; + int *sindex; + char *opener, *alt_opener, *closer; + int flags; +{ + int i, c, si; + size_t slen; + char *t, *result; + int pass_character, nesting_level; + int len_closer, len_opener, len_alt_opener; + DECLARE_MBSTATE; + + slen = strlen (string + *sindex) + *sindex; + len_opener = STRLEN (opener); + len_alt_opener = STRLEN (alt_opener); + len_closer = STRLEN (closer); + + pass_character = 0; + + nesting_level = 1; + i = *sindex; + + while (nesting_level) + { + c = string[i]; + + if (c == 0) + break; + + if (pass_character) /* previous char was backslash */ + { + pass_character = 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + + if (c == CTLESC || c == '\\') + { + pass_character++; + i++; + continue; + } + + /* Process a nested OPENER. */ + if (STREQN (string + i, opener, len_opener)) + { + si = i + len_opener; + t = extract_delimited_string (string, &si, opener, alt_opener, closer, flags|EX_NOALLOC); + i = si + 1; + continue; + } + + /* Process a nested ALT_OPENER */ + if (len_alt_opener && STREQN (string + i, alt_opener, len_alt_opener)) + { + si = i + len_alt_opener; + t = extract_delimited_string (string, &si, alt_opener, alt_opener, closer, flags|EX_NOALLOC); + i = si + 1; + continue; + } + + /* If the current substring terminates the delimited string, decrement + the nesting level. */ + if (STREQN (string + i, closer, len_closer)) + { + i += len_closer - 1; /* move to last byte of the closer */ + nesting_level--; + if (nesting_level == 0) + break; + } + + /* Pass old-style command substitution through verbatim. */ + if (c == '`') + { + si = i + 1; + t = string_extract (string, &si, "`", flags|EX_NOALLOC); + i = si + 1; + continue; + } + + /* Pass single-quoted and double-quoted strings through verbatim. */ + if (c == '\'' || c == '"') + { + si = i + 1; + i = (c == '\'') ? skip_single_quoted (string, slen, si) + : skip_double_quoted (string, slen, si); + continue; + } + + /* move past this character, which was not special. */ + ADVANCE_CHAR (string, slen, i); + } + + if (c == 0 && nesting_level) + { + if (no_longjmp_on_fatal_error == 0) + { + report_error (_("bad substitution: no closing `%s' in %s"), closer, string); + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + else + { + *sindex = i; + return (char *)NULL; + } + } + + si = i - *sindex - len_closer + 1; + if (flags & EX_NOALLOC) + result = (char *)NULL; + else + { + result = (char *)xmalloc (1 + si); + strncpy (result, string + *sindex, si); + result[si] = '\0'; + } + *sindex = i; + + return (result); +} + +/* Extract a parameter expansion expression within ${ and } from STRING. + Obey the Posix.2 rules for finding the ending `}': count braces while + skipping over enclosed quoted strings and command substitutions. + SINDEX is the address of an int describing the current offset in STRING; + it should point to just after the first `{' found. On exit, SINDEX + gets the position of the matching `}'. QUOTED is non-zero if this + occurs inside double quotes. */ +/* XXX -- this is very similar to extract_delimited_string -- XXX */ +static char * +extract_dollar_brace_string (string, sindex, quoted, flags) + char *string; + int *sindex, quoted, flags; +{ + register int i, c; + size_t slen; + int pass_character, nesting_level, si; + char *result, *t; + DECLARE_MBSTATE; + + pass_character = 0; + nesting_level = 1; + slen = strlen (string + *sindex) + *sindex; + + i = *sindex; + while (c = string[i]) + { + if (pass_character) + { + pass_character = 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + + /* CTLESCs and backslashes quote the next character. */ + if (c == CTLESC || c == '\\') + { + pass_character++; + i++; + continue; + } + + if (string[i] == '$' && string[i+1] == LBRACE) + { + nesting_level++; + i += 2; + continue; + } + + if (c == RBRACE) + { + nesting_level--; + if (nesting_level == 0) + break; + i++; + continue; + } + + /* Pass the contents of old-style command substitutions through + verbatim. */ + if (c == '`') + { + si = i + 1; + t = string_extract (string, &si, "`", flags|EX_NOALLOC); + i = si + 1; + continue; + } + + /* Pass the contents of new-style command substitutions and + arithmetic substitutions through verbatim. */ + if (string[i] == '$' && string[i+1] == LPAREN) + { + si = i + 2; + t = extract_delimited_string (string, &si, "$(", "(", ")", flags|EX_NOALLOC); /*)*/ + i = si + 1; + continue; + } + + /* Pass the contents of single-quoted and double-quoted strings + through verbatim. */ + if (c == '\'' || c == '"') + { + si = i + 1; + i = (c == '\'') ? skip_single_quoted (string, slen, si) + : skip_double_quoted (string, slen, si); + /* skip_XXX_quoted leaves index one past close quote */ + continue; + } + + /* move past this character, which was not special. */ + ADVANCE_CHAR (string, slen, i); + } + + if (c == 0 && nesting_level) + { + if (no_longjmp_on_fatal_error == 0) + { /* { */ + report_error ("bad substitution: no closing `%s' in %s", "}", string); + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + else + { + *sindex = i; + return ((char *)NULL); + } + } + + result = (flags & EX_NOALLOC) ? (char *)NULL : substring (string, *sindex, i); + *sindex = i; + + return (result); +} + +/* Remove backslashes which are quoting backquotes from STRING. Modifies + STRING, and returns a pointer to it. */ +char * +de_backslash (string) + char *string; +{ + register size_t slen; + register int i, j, prev_i; + DECLARE_MBSTATE; + + slen = strlen (string); + i = j = 0; + + /* Loop copying string[i] to string[j], i >= j. */ + while (i < slen) + { + if (string[i] == '\\' && (string[i + 1] == '`' || string[i + 1] == '\\' || + string[i + 1] == '$')) + i++; + prev_i = i; + ADVANCE_CHAR (string, slen, i); + if (j < prev_i) + do string[j++] = string[prev_i++]; while (prev_i < i); + else + j = i; + } + string[j] = '\0'; + + return (string); +} + +#if 0 +/*UNUSED*/ +/* Replace instances of \! in a string with !. */ +void +unquote_bang (string) + char *string; +{ + register int i, j; + register char *temp; + + temp = (char *)xmalloc (1 + strlen (string)); + + for (i = 0, j = 0; (temp[j] = string[i]); i++, j++) + { + if (string[i] == '\\' && string[i + 1] == '!') + { + temp[j] = '!'; + i++; + } + } + strcpy (string, temp); + free (temp); +} +#endif + +#if defined (READLINE) +/* Return 1 if the portion of STRING ending at EINDEX is quoted (there is + an unclosed quoted string), or if the character at EINDEX is quoted + by a backslash. NO_LONGJMP_ON_FATAL_ERROR is used to flag that the various + single and double-quoted string parsing functions should not return an + error if there are unclosed quotes or braces. The characters that this + recognizes need to be the same as the contents of + rl_completer_quote_characters. */ + +#define CQ_RETURN(x) do { no_longjmp_on_fatal_error = 0; return (x); } while (0) + +int +char_is_quoted (string, eindex) + char *string; + int eindex; +{ + int i, pass_next, c; + size_t slen; + DECLARE_MBSTATE; + + slen = strlen (string); + no_longjmp_on_fatal_error = 1; + i = pass_next = 0; + while (i <= eindex) + { + c = string[i]; + + if (pass_next) + { + pass_next = 0; + if (i >= eindex) /* XXX was if (i >= eindex - 1) */ + CQ_RETURN(1); + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (c == '\\') + { + pass_next = 1; + i++; + continue; + } + else if (c == '\'' || c == '"') + { + i = (c == '\'') ? skip_single_quoted (string, slen, ++i) + : skip_double_quoted (string, slen, ++i); + if (i > eindex) + CQ_RETURN(1); + /* no increment, the skip_xxx functions go one past end */ + } + else + ADVANCE_CHAR (string, slen, i); + } + + CQ_RETURN(0); +} + +int +unclosed_pair (string, eindex, openstr) + char *string; + int eindex; + char *openstr; +{ + int i, pass_next, openc, olen; + size_t slen; + DECLARE_MBSTATE; + + slen = strlen (string); + olen = strlen (openstr); + i = pass_next = openc = 0; + while (i <= eindex) + { + if (pass_next) + { + pass_next = 0; + if (i >= eindex) /* XXX was if (i >= eindex - 1) */ + return 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (string[i] == '\\') + { + pass_next = 1; + i++; + continue; + } + else if (STREQN (string + i, openstr, olen)) + { + openc = 1 - openc; + i += olen; + } + else if (string[i] == '\'' || string[i] == '"') + { + i = (string[i] == '\'') ? skip_single_quoted (string, slen, i) + : skip_double_quoted (string, slen, i); + if (i > eindex) + return 0; + } + else + ADVANCE_CHAR (string, slen, i); + } + return (openc); +} + +/* Skip characters in STRING until we find a character in DELIMS, and return + the index of that character. START is the index into string at which we + begin. This is similar in spirit to strpbrk, but it returns an index into + STRING and takes a starting index. This little piece of code knows quite + a lot of shell syntax. It's very similar to skip_double_quoted and other + functions of that ilk. */ +int +skip_to_delim (string, start, delims) + char *string; + int start; + char *delims; +{ + int i, pass_next, backq, si, c; + size_t slen; + char *temp; + DECLARE_MBSTATE; + + slen = strlen (string + start) + start; + no_longjmp_on_fatal_error = 1; + i = start; + pass_next = backq = 0; + while (c = string[i]) + { + if (pass_next) + { + pass_next = 0; + if (c == 0) + CQ_RETURN(i); + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (c == '\\') + { + pass_next = 1; + i++; + continue; + } + else if (backq) + { + if (c == '`') + backq = 0; + ADVANCE_CHAR (string, slen, i); + continue; + } + else if (c == '`') + { + backq = 1; + i++; + continue; + } + else if (c == '\'' || c == '"') + { + i = (c == '\'') ? skip_single_quoted (string, slen, ++i) + : skip_double_quoted (string, slen, ++i); + /* no increment, the skip functions increment past the closing quote. */ + } + else if (c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE)) + { + si = i + 2; + if (string[si] == '\0') + CQ_RETURN(si); + + if (string[i+1] == LPAREN) + temp = extract_delimited_string (string, &si, "$(", "(", ")", EX_NOALLOC); /* ) */ + else + temp = extract_dollar_brace_string (string, &si, 0, EX_NOALLOC); + i = si; + if (string[i] == '\0') /* don't increment i past EOS in loop */ + break; + i++; + continue; + } + else if (member (c, delims)) + break; + else + ADVANCE_CHAR (string, slen, i); + } + + CQ_RETURN(i); +} + +/* Split STRING (length SLEN) at DELIMS, and return a WORD_LIST with the + individual words. If DELIMS is NULL, the current value of $IFS is used + to split the string, and the function follows the shell field splitting + rules. SENTINEL is an index to look for. NWP, if non-NULL, + gets the number of words in the returned list. CWP, if non-NULL, gets + the index of the word containing SENTINEL. Non-whitespace chars in + DELIMS delimit separate fields. */ +WORD_LIST * +split_at_delims (string, slen, delims, sentinel, nwp, cwp) + char *string; + int slen; + char *delims; + int sentinel; + int *nwp, *cwp; +{ + int ts, te, i, nw, cw, ifs_split; + char *token, *d, *d2; + WORD_LIST *ret, *tl; + + if (string == 0 || *string == '\0') + { + if (nwp) + *nwp = 0; + if (cwp) + *cwp = 0; + return ((WORD_LIST *)NULL); + } + + d = (delims == 0) ? ifs_value : delims; + ifs_split = delims == 0; + + /* Make d2 the non-whitespace characters in delims */ + d2 = 0; + if (delims) + { + size_t slength; +#if defined (HANDLE_MULTIBYTE) + size_t mblength = 1; +#endif + DECLARE_MBSTATE; + + slength = strlen (delims); + d2 = (char *)xmalloc (slength + 1); + i = ts = 0; + while (delims[i]) + { +#if defined (HANDLE_MULTIBYTE) + mbstate_t state_bak = state; + mblength = MBRLEN (delims + i, slength, &state); + if (MB_INVALIDCH (mblength)) + state = state_bak; + else if (mblength > 1) + { + memcpy (d2 + ts, delims + i, mblength); + ts += mblength; + i += mblength; + slength -= mblength; + continue; + } +#endif + if (whitespace (delims[i]) == 0) + d2[ts++] = delims[i]; + + i++; + slength--; + } + d2[ts] = '\0'; + } + + ret = (WORD_LIST *)NULL; + + /* Remove sequences of whitspace characters at the start of the string, as + long as those characters are delimiters. */ + for (i = 0; member (string[i], d) && spctabnl (string[i]); i++) + ; + if (string[i] == '\0') + return (ret); + + ts = i; + nw = 0; + cw = -1; + while (1) + { + te = skip_to_delim (string, ts, d); + + /* If we have a non-whitespace delimiter character, use it to make a + separate field. This is just about what $IFS splitting does and + is closer to the behavior of the shell parser. */ + if (ts == te && d2 && member (string[ts], d2)) + { + te = ts + 1; + /* If we're using IFS splitting, the non-whitespace delimiter char + and any additional IFS whitespace delimits a field. */ + if (ifs_split) + while (member (string[te], d) && spctabnl (string[te])) + te++; + else + while (member (string[te], d2)) + te++; + } + + token = substring (string, ts, te); + + ret = add_string_to_list (token, ret); + free (token); + nw++; + + if (sentinel >= ts && sentinel <= te) + cw = nw; + + /* If the cursor is at whitespace just before word start, set the + sentinel word to the current word. */ + if (cwp && cw == -1 && sentinel == ts-1) + cw = nw; + + /* If the cursor is at whitespace between two words, make a new, empty + word, add it before (well, after, since the list is in reverse order) + the word we just added, and set the current word to that one. */ + if (cwp && cw == -1 && sentinel < ts) + { + tl = make_word_list (make_word (""), ret->next); + ret->next = tl; + cw = nw; + nw++; + } + + if (string[te] == 0) + break; + + i = te; + while (member (string[i], d) && (ifs_split || spctabnl(string[i]))) + i++; + + if (string[i]) + ts = i; + else + break; + } + + /* Special case for SENTINEL at the end of STRING. If we haven't found + the word containing SENTINEL yet, and the index we're looking for is at + the end of STRING, add an additional null argument and set the current + word pointer to that. */ + if (cwp && cw == -1 && sentinel >= slen) + { + if (whitespace (string[sentinel - 1])) + { + token = ""; + ret = add_string_to_list (token, ret); + nw++; + } + cw = nw; + } + + if (nwp) + *nwp = nw; + if (cwp) + *cwp = cw; + + return (REVERSE_LIST (ret, WORD_LIST *)); +} +#endif /* READLINE */ + +#if 0 +/* UNUSED */ +/* Extract the name of the variable to bind to from the assignment string. */ +char * +assignment_name (string) + char *string; +{ + int offset; + char *temp; + + offset = assignment (string, 0); + if (offset == 0) + return (char *)NULL; + temp = substring (string, 0, offset); + return (temp); +} +#endif + +/* **************************************************************** */ +/* */ +/* Functions to convert strings to WORD_LISTs and vice versa */ +/* */ +/* **************************************************************** */ + +/* Return a single string of all the words in LIST. SEP is the separator + to put between individual elements of LIST in the output string. */ +char * +string_list_internal (list, sep) + WORD_LIST *list; + char *sep; +{ + register WORD_LIST *t; + char *result, *r; + int word_len, sep_len, result_size; + + if (list == 0) + return ((char *)NULL); + + /* Short-circuit quickly if we don't need to separate anything. */ + if (list->next == 0) + return (savestring (list->word->word)); + + /* This is nearly always called with either sep[0] == 0 or sep[1] == 0. */ + sep_len = STRLEN (sep); + result_size = 0; + + for (t = list; t; t = t->next) + { + if (t != list) + result_size += sep_len; + result_size += strlen (t->word->word); + } + + r = result = (char *)xmalloc (result_size + 1); + + for (t = list; t; t = t->next) + { + if (t != list && sep_len) + { + if (sep_len > 1) + { + FASTCOPY (sep, r, sep_len); + r += sep_len; + } + else + *r++ = sep[0]; + } + + word_len = strlen (t->word->word); + FASTCOPY (t->word->word, r, word_len); + r += word_len; + } + + *r = '\0'; + return (result); +} + +/* Return a single string of all the words present in LIST, separating + each word with a space. */ +char * +string_list (list) + WORD_LIST *list; +{ + return (string_list_internal (list, " ")); +} + +/* Return a single string of all the words present in LIST, obeying the + quoting rules for "$*", to wit: (P1003.2, draft 11, 3.5.2) "If the + expansion [of $*] appears within a double quoted string, it expands + to a single field with the value of each parameter separated by the + first character of the IFS variable, or by a if IFS is unset." */ +char * +string_list_dollar_star (list) + WORD_LIST *list; +{ +#if defined (HANDLE_MULTIBYTE) + char sep[MB_CUR_MAX + 1]; +#else + char sep[2]; +#endif + + +#if defined (HANDLE_MULTIBYTE) + if (ifs_firstc_len == 1) + { + sep[0] = ifs_firstc[0]; + sep[1] = '\0'; + } + else + { + memcpy (sep, ifs_firstc, ifs_firstc_len); + sep[ifs_firstc_len] = '\0'; + } +#else + sep[0] = ifs_firstc; + sep[1] = '\0'; +#endif + + return (string_list_internal (list, sep)); +} + +/* Turn $@ into a string. If (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + is non-zero, the $@ appears within double quotes, and we should quote + the list before converting it into a string. If IFS is unset, and the + word is not quoted, we just need to quote CTLESC and CTLNUL characters + in the words in the list, because the default value of $IFS is + , IFS characters in the words in the list should + also be split. If IFS is null, and the word is not quoted, we need + to quote the words in the list to preserve the positional parameters + exactly. */ +char * +string_list_dollar_at (list, quoted) + WORD_LIST *list; + int quoted; +{ + char *ifs, *ret; +#if defined (HANDLE_MULTIBYTE) + char sep[MB_CUR_MAX + 1]; +#else + char sep[2]; +#endif + WORD_LIST *tlist; + + /* XXX this could just be ifs = ifs_value; */ + ifs = ifs_var ? value_cell (ifs_var) : (char *)0; + +#if defined (HANDLE_MULTIBYTE) + if (ifs && *ifs) + { + if (ifs_firstc_len == 1) + { + sep[0] = ifs_firstc[0]; + sep[1] = '\0'; + } + else + { + memcpy (sep, ifs_firstc, ifs_firstc_len); + sep[ifs_firstc_len] = '\0'; + } + } + else + { + sep[0] = ' '; + sep[1] = '\0'; + } +#else + sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs; + sep[1] = '\0'; +#endif + + tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0)) + ? quote_list (list) + : list_quote_escapes (list); + return (string_list_internal (tlist, sep)); +} + +/* Return the list of words present in STRING. Separate the string into + words at any of the characters found in SEPARATORS. If QUOTED is + non-zero then word in the list will have its quoted flag set, otherwise + the quoted flag is left as make_word () deemed fit. + + This obeys the P1003.2 word splitting semantics. If `separators' is + exactly , then the splitting algorithm is that of + the Bourne shell, which treats any sequence of characters from `separators' + as a delimiter. If IFS is unset, which results in `separators' being set + to "", no splitting occurs. If separators has some other value, the + following rules are applied (`IFS white space' means zero or more + occurrences of , , or , as long as those characters + are in `separators'): + + 1) IFS white space is ignored at the start and the end of the + string. + 2) Each occurrence of a character in `separators' that is not + IFS white space, along with any adjacent occurrences of + IFS white space delimits a field. + 3) Any nonzero-length sequence of IFS white space delimits a field. + */ + +/* BEWARE! list_string strips null arguments. Don't call it twice and + expect to have "" preserved! */ + +/* This performs word splitting and quoted null character removal on + STRING. */ +#define issep(c) \ + (((separators)[0]) ? ((separators)[1] ? isifs(c) \ + : (c) == (separators)[0]) \ + : 0) + +WORD_LIST * +list_string (string, separators, quoted) + register char *string, *separators; + int quoted; +{ + WORD_LIST *result; + WORD_DESC *t; + char *current_word, *s; + int sindex, sh_style_split, whitesep; + size_t slen; + + if (!string || !*string) + return ((WORD_LIST *)NULL); + + sh_style_split = separators && separators[0] == ' ' && + separators[1] == '\t' && + separators[2] == '\n' && + separators[3] == '\0'; + + slen = 0; + /* Remove sequences of whitespace at the beginning of STRING, as + long as those characters appear in IFS. Do not do this if + STRING is quoted or if there are no separator characters. */ + if (!quoted || !separators || !*separators) + { + for (s = string; *s && spctabnl (*s) && issep (*s); s++); + + if (!*s) + return ((WORD_LIST *)NULL); + + string = s; + } + + /* OK, now STRING points to a word that does not begin with white space. + The splitting algorithm is: + extract a word, stopping at a separator + skip sequences of spc, tab, or nl as long as they are separators + This obeys the field splitting rules in Posix.2. */ + slen = (MB_CUR_MAX > 1) ? strlen (string) : 1; + for (result = (WORD_LIST *)NULL, sindex = 0; string[sindex]; ) + { + /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim + unless multibyte chars are possible. */ + current_word = string_extract_verbatim (string, slen, &sindex, separators); + if (current_word == 0) + break; + + /* If we have a quoted empty string, add a quoted null argument. We + want to preserve the quoted null character iff this is a quoted + empty string; otherwise the quoted null characters are removed + below. */ + if (QUOTED_NULL (current_word)) + { + t = alloc_word_desc (); + t->word = make_quoted_char ('\0'); + t->flags |= W_QUOTED|W_HASQUOTEDNULL; + result = make_word_list (t, result); + } + else if (current_word[0] != '\0') + { + /* If we have something, then add it regardless. However, + perform quoted null character removal on the current word. */ + remove_quoted_nulls (current_word); + result = add_string_to_list (current_word, result); + result->word->flags &= ~W_HASQUOTEDNULL; /* just to be sure */ + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + result->word->flags |= W_QUOTED; + } + + /* If we're not doing sequences of separators in the traditional + Bourne shell style, then add a quoted null argument. */ + else if (!sh_style_split && !spctabnl (string[sindex])) + { + t = alloc_word_desc (); + t->word = make_quoted_char ('\0'); + t->flags |= W_QUOTED|W_HASQUOTEDNULL; + result = make_word_list (t, result); + } + + free (current_word); + + /* Note whether or not the separator is IFS whitespace, used later. */ + whitesep = string[sindex] && spctabnl (string[sindex]); + + /* Move past the current separator character. */ + if (string[sindex]) + { + DECLARE_MBSTATE; + ADVANCE_CHAR (string, slen, sindex); + } + + /* Now skip sequences of space, tab, or newline characters if they are + in the list of separators. */ + while (string[sindex] && spctabnl (string[sindex]) && issep (string[sindex])) + sindex++; + + /* If the first separator was IFS whitespace and the current character + is a non-whitespace IFS character, it should be part of the current + field delimiter, not a separate delimiter that would result in an + empty field. Look at POSIX.2, 3.6.5, (3)(b). */ + if (string[sindex] && whitesep && issep (string[sindex]) && !spctabnl (string[sindex])) + { + sindex++; + /* An IFS character that is not IFS white space, along with any + adjacent IFS white space, shall delimit a field. (SUSv3) */ + while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex])) + sindex++; + } + } + return (REVERSE_LIST (result, WORD_LIST *)); +} + +/* Parse a single word from STRING, using SEPARATORS to separate fields. + ENDPTR is set to the first character after the word. This is used by + the `read' builtin. This is never called with SEPARATORS != $IFS; + it should be simplified. + + XXX - this function is very similar to list_string; they should be + combined - XXX */ +char * +get_word_from_string (stringp, separators, endptr) + char **stringp, *separators, **endptr; +{ + register char *s; + char *current_word; + int sindex, sh_style_split, whitesep; + size_t slen; + + if (!stringp || !*stringp || !**stringp) + return ((char *)NULL); + + s = *stringp; + + sh_style_split = separators && separators[0] == ' ' && + separators[1] == '\t' && + separators[2] == '\n' && + separators[3] == '\0'; + + slen = 0; + + /* Remove sequences of whitespace at the beginning of STRING, as + long as those characters appear in IFS. */ + if (sh_style_split || !separators || !*separators) + { + for (; *s && spctabnl (*s) && isifs (*s); s++); + + /* If the string is nothing but whitespace, update it and return. */ + if (!*s) + { + *stringp = s; + if (endptr) + *endptr = s; + return ((char *)NULL); + } + } + + /* OK, S points to a word that does not begin with white space. + Now extract a word, stopping at a separator, save a pointer to + the first character after the word, then skip sequences of spc, + tab, or nl as long as they are separators. + + This obeys the field splitting rules in Posix.2. */ + sindex = 0; + /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim + unless multibyte chars are possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (s) : 1; + current_word = string_extract_verbatim (s, slen, &sindex, separators); + + /* Set ENDPTR to the first character after the end of the word. */ + if (endptr) + *endptr = s + sindex; + + /* Note whether or not the separator is IFS whitespace, used later. */ + whitesep = s[sindex] && spctabnl (s[sindex]); + + /* Move past the current separator character. */ + if (s[sindex]) + { + DECLARE_MBSTATE; + ADVANCE_CHAR (s, slen, sindex); + } + + /* Now skip sequences of space, tab, or newline characters if they are + in the list of separators. */ + while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex])) + sindex++; + + /* If the first separator was IFS whitespace and the current character is + a non-whitespace IFS character, it should be part of the current field + delimiter, not a separate delimiter that would result in an empty field. + Look at POSIX.2, 3.6.5, (3)(b). */ + if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex])) + { + sindex++; + /* An IFS character that is not IFS white space, along with any adjacent + IFS white space, shall delimit a field. */ + while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex])) + sindex++; + } + + /* Update STRING to point to the next field. */ + *stringp = s + sindex; + return (current_word); +} + +/* Remove IFS white space at the end of STRING. Start at the end + of the string and walk backwards until the beginning of the string + or we find a character that's not IFS white space and not CTLESC. + Only let CTLESC escape a white space character if SAW_ESCAPE is + non-zero. */ +char * +strip_trailing_ifs_whitespace (string, separators, saw_escape) + char *string, *separators; + int saw_escape; +{ + char *s; + + s = string + STRLEN (string) - 1; + while (s > string && ((spctabnl (*s) && isifs (*s)) || + (saw_escape && *s == CTLESC && spctabnl (s[1])))) + s--; + *++s = '\0'; + return string; +} + +#if 0 +/* UNUSED */ +/* Split STRING into words at whitespace. Obeys shell-style quoting with + backslashes, single and double quotes. */ +WORD_LIST * +list_string_with_quotes (string) + char *string; +{ + WORD_LIST *list; + char *token, *s; + size_t s_len; + int c, i, tokstart, len; + + for (s = string; s && *s && spctabnl (*s); s++) + ; + if (s == 0 || *s == 0) + return ((WORD_LIST *)NULL); + + s_len = strlen (s); + tokstart = i = 0; + list = (WORD_LIST *)NULL; + while (1) + { + c = s[i]; + if (c == '\\') + { + i++; + if (s[i]) + i++; + } + else if (c == '\'') + i = skip_single_quoted (s, s_len, ++i); + else if (c == '"') + i = skip_double_quoted (s, s_len, ++i); + else if (c == 0 || spctabnl (c)) + { + /* We have found the end of a token. Make a word out of it and + add it to the word list. */ + token = substring (s, tokstart, i); + list = add_string_to_list (token, list); + free (token); + while (spctabnl (s[i])) + i++; + if (s[i]) + tokstart = i; + else + break; + } + else + i++; /* normal character */ + } + return (REVERSE_LIST (list, WORD_LIST *)); +} +#endif + +/********************************************************/ +/* */ +/* Functions to perform assignment statements */ +/* */ +/********************************************************/ + +#if defined (ARRAY_VARS) +static SHELL_VAR * +do_compound_assignment (name, value, flags) + char *name, *value; + int flags; +{ + SHELL_VAR *v; + int off, mklocal; + + mklocal = flags & ASS_MKLOCAL; + + if (mklocal && variable_context) + { + v = find_variable (name); + if (v == 0 || array_p (v) == 0) + v = make_local_array_variable (name); + v = assign_array_var_from_string (v, value, flags); + } + else + v = assign_array_from_string (name, value, flags); + + return (v); +} +#endif + +/* Given STRING, an assignment string, get the value of the right side + of the `=', and bind it to the left side. If EXPAND is true, then + perform parameter expansion, command substitution, and arithmetic + expansion on the right-hand side. Perform tilde expansion in any + case. Do not perform word splitting on the result of expansion. */ +static int +do_assignment_internal (word, expand) + const WORD_DESC *word; + int expand; +{ + int offset, tlen, appendop, assign_list, aflags; + char *name, *value, *ovalue, *nvalue; + SHELL_VAR *entry; +#if defined (ARRAY_VARS) + char *t; + int ni; +#endif + const char *string; + + if (word == 0 || word->word == 0) + return 0; + + appendop = assign_list = aflags = 0; + string = word->word; + offset = assignment (string, 0); + name = savestring (string); + value = (char *)NULL; + + if (name[offset] == '=') + { + char *temp; + + if (name[offset - 1] == '+') + { + appendop = 1; + name[offset - 1] = '\0'; + } + + name[offset] = 0; /* might need this set later */ + temp = name + offset + 1; + tlen = STRLEN (temp); + +#if defined (ARRAY_VARS) +# if 0 + if (expand && temp[0] == LPAREN && temp[tlen-1] == RPAREN) +#else + if (expand && (word->flags & W_COMPASSIGN)) +#endif + { + assign_list = ni = 1; + value = extract_array_assignment_list (temp, &ni); + } + else +#endif + + if (expand && temp[0]) + value = expand_string_if_necessary (temp, 0, expand_string_assignment); + else + value = savestring (temp); + } + + if (value == 0) + { + value = (char *)xmalloc (1); + value[0] = '\0'; + } + + if (echo_command_at_execute) + { + if (appendop) + name[offset - 1] = '+'; + xtrace_print_assignment (name, value, assign_list, 1); + if (appendop) + name[offset - 1] = '\0'; + } + +#define ASSIGN_RETURN(r) do { FREE (value); free (name); return (r); } while (0) + + if (appendop) + aflags |= ASS_APPEND; + +#if defined (ARRAY_VARS) + if (t = xstrchr (name, '[')) /*]*/ + { + if (assign_list) + { + report_error (_("%s: cannot assign list to array member"), name); + ASSIGN_RETURN (0); + } + entry = assign_array_element (name, value, aflags); + if (entry == 0) + ASSIGN_RETURN (0); + } + else if (assign_list) + { + if (word->flags & W_ASSIGNARG) + aflags |= ASS_MKLOCAL; + entry = do_compound_assignment (name, value, aflags); + } + else +#endif /* ARRAY_VARS */ + entry = bind_variable (name, value, aflags); + + stupidly_hack_special_variables (name); + + if (entry) + VUNSETATTR (entry, att_invisible); + + /* Return 1 if the assignment seems to have been performed correctly. */ + ASSIGN_RETURN (entry ? ((readonly_p (entry) == 0) && noassign_p (entry) == 0) : 0); +} + +/* Perform the assignment statement in STRING, and expand the + right side by doing tilde, command and parameter expansion. */ +int +do_assignment (string) + char *string; +{ + WORD_DESC td; + + td.flags = W_ASSIGNMENT; + td.word = string; + + return do_assignment_internal (&td, 1); +} + +int +do_word_assignment (word) + WORD_DESC *word; +{ + return do_assignment_internal (word, 1); +} + +/* Given STRING, an assignment string, get the value of the right side + of the `=', and bind it to the left side. Do not perform any word + expansions on the right hand side. */ +int +do_assignment_no_expand (string) + char *string; +{ + WORD_DESC td; + + td.flags = W_ASSIGNMENT; + td.word = string; + + do_assignment_internal (&td, 0); +} + +/*************************************************** + * * + * Functions to manage the positional parameters * + * * + ***************************************************/ + +/* Return the word list that corresponds to `$*'. */ +WORD_LIST * +list_rest_of_args () +{ + register WORD_LIST *list, *args; + int i; + + /* Break out of the loop as soon as one of the dollar variables is null. */ + for (i = 1, list = (WORD_LIST *)NULL; i < 10 && dollar_vars[i]; i++) + list = make_word_list (make_bare_word (dollar_vars[i]), list); + + for (args = rest_of_args; args; args = args->next) + list = make_word_list (make_bare_word (args->word->word), list); + + return (REVERSE_LIST (list, WORD_LIST *)); +} + +int +number_of_args () +{ + register WORD_LIST *list; + int n; + + for (n = 0; n < 9 && dollar_vars[n+1]; n++) + ; + for (list = rest_of_args; list; list = list->next) + n++; + return n; +} + +/* Return the value of a positional parameter. This handles values > 10. */ +char * +get_dollar_var_value (ind) + intmax_t ind; +{ + char *temp; + WORD_LIST *p; + + if (ind < 10) + temp = dollar_vars[ind] ? savestring (dollar_vars[ind]) : (char *)NULL; + else /* We want something like ${11} */ + { + ind -= 10; + for (p = rest_of_args; p && ind--; p = p->next) + ; + temp = p ? savestring (p->word->word) : (char *)NULL; + } + return (temp); +} + +/* Make a single large string out of the dollar digit variables, + and the rest_of_args. If DOLLAR_STAR is 1, then obey the special + case of "$*" with respect to IFS. */ +char * +string_rest_of_args (dollar_star) + int dollar_star; +{ + register WORD_LIST *list; + char *string; + + list = list_rest_of_args (); + string = dollar_star ? string_list_dollar_star (list) : string_list (list); + dispose_words (list); + return (string); +} + +/* Return a string containing the positional parameters from START to + END, inclusive. If STRING[0] == '*', we obey the rules for $*, + which only makes a difference if QUOTED is non-zero. If QUOTED includes + Q_HERE_DOCUMENT or Q_DOUBLE_QUOTES, this returns a quoted list, otherwise + no quoting chars are added. */ +static char * +pos_params (string, start, end, quoted) + char *string; + int start, end, quoted; +{ + WORD_LIST *save, *params, *h, *t; + char *ret; + int i; + + /* see if we can short-circuit. if start == end, we want 0 parameters. */ + if (start == end) + return ((char *)NULL); + + save = params = list_rest_of_args (); + if (save == 0) + return ((char *)NULL); + + for (i = 1; params && i < start; i++) + params = params->next; + if (params == 0) + return ((char *)NULL); + for (h = t = params; params && i < end; i++) + { + t = params; + params = params->next; + } + + t->next = (WORD_LIST *)NULL; + if (string[0] == '*') + { + if (quoted & Q_DOUBLE_QUOTES) + ret = string_list_dollar_star (quote_list (h)); + else if (quoted & Q_HERE_DOCUMENT) + ret = string_list (quote_list (h)); + else + ret = string_list (h); + } + else + ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h); + if (t != params) + t->next = params; + + dispose_words (save); + return (ret); +} + +/******************************************************************/ +/* */ +/* Functions to expand strings to strings or WORD_LISTs */ +/* */ +/******************************************************************/ + +#if defined (PROCESS_SUBSTITUTION) +#define EXP_CHAR(s) (s == '$' || s == '`' || s == '<' || s == '>' || s == CTLESC || s == '~') +#else +#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~') +#endif + +/* If there are any characters in STRING that require full expansion, + then call FUNC to expand STRING; otherwise just perform quote + removal if necessary. This returns a new string. */ +static char * +expand_string_if_necessary (string, quoted, func) + char *string; + int quoted; + EXPFUNC *func; +{ + WORD_LIST *list; + size_t slen; + int i, saw_quote; + char *ret; + DECLARE_MBSTATE; + + /* Don't need string length for ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? strlen (string) : 0; + i = saw_quote = 0; + while (string[i]) + { + if (EXP_CHAR (string[i])) + break; + else if (string[i] == '\'' || string[i] == '\\' || string[i] == '"') + saw_quote = 1; + ADVANCE_CHAR (string, slen, i); + } + + if (string[i]) + { + list = (*func) (string, quoted); + if (list) + { + ret = string_list (list); + dispose_words (list); + } + else + ret = (char *)NULL; + } + else if (saw_quote && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0)) + ret = string_quote_removal (string, quoted); + else + ret = savestring (string); + + return ret; +} + +static inline char * +expand_string_to_string_internal (string, quoted, func) + char *string; + int quoted; + EXPFUNC *func; +{ + WORD_LIST *list; + char *ret; + + if (string == 0 || *string == '\0') + return ((char *)NULL); + + list = (*func) (string, quoted); + if (list) + { + ret = string_list (list); + dispose_words (list); + } + else + ret = (char *)NULL; + + return (ret); +} + +char * +expand_string_to_string (string, quoted) + char *string; + int quoted; +{ + return (expand_string_to_string_internal (string, quoted, expand_string)); +} + +char * +expand_string_unsplit_to_string (string, quoted) + char *string; + int quoted; +{ + return (expand_string_to_string_internal (string, quoted, expand_string_unsplit)); +} + +char * +expand_assignment_string_to_string (string, quoted) + char *string; + int quoted; +{ + return (expand_string_to_string_internal (string, quoted, expand_string_assignment)); +} + +#if defined (COND_COMMAND) +/* Just remove backslashes in STRING. Returns a new string. */ +char * +remove_backslashes (string) + char *string; +{ + char *r, *ret, *s; + + r = ret = (char *)xmalloc (strlen (string) + 1); + for (s = string; s && *s; ) + { + if (*s == '\\') + s++; + if (*s == 0) + break; + *r++ = *s++; + } + *r = '\0'; + return ret; +} + +/* This needs better error handling. */ +/* Expand W for use as an argument to a unary or binary operator in a + [[...]] expression. If SPECIAL is nonzero, this is the rhs argument + to the != or == operator, and should be treated as a pattern. In + this case, we quote the string specially for the globbing code. The + caller is responsible for removing the backslashes if the unquoted + words is needed later. */ +char * +cond_expand_word (w, special) + WORD_DESC *w; + int special; +{ + char *r, *p; + WORD_LIST *l; + + if (w->word == 0 || w->word[0] == '\0') + return ((char *)NULL); + + l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0); + if (l) + { + if (special == 0) + { + dequote_list (l); + r = string_list (l); + } + else + { + p = string_list (l); + r = quote_string_for_globbing (p, QGLOB_CVTNULL); + free (p); + } + dispose_words (l); + } + else + r = (char *)NULL; + + return r; +} +#endif + +/* Call expand_word_internal to expand W and handle error returns. + A convenience function for functions that don't want to handle + any errors or free any memory before aborting. */ +static WORD_LIST * +call_expand_word_internal (w, q, i, c, e) + WORD_DESC *w; + int q, i, *c, *e; +{ + WORD_LIST *result; + + result = expand_word_internal (w, q, i, c, e); + if (result == &expand_word_error || result == &expand_word_fatal) + { + /* By convention, each time this error is returned, w->word has + already been freed (it sometimes may not be in the fatal case, + but that doesn't result in a memory leak because we're going + to exit in most cases). */ + w->word = (char *)NULL; + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level ((result == &expand_word_error) ? DISCARD : FORCE_EOF); + /* NOTREACHED */ + } + else + return (result); +} + +/* Perform parameter expansion, command substitution, and arithmetic + expansion on STRING, as if it were a word. Leave the result quoted. */ +static WORD_LIST * +expand_string_internal (string, quoted) + char *string; + int quoted; +{ + WORD_DESC td; + WORD_LIST *tresult; + + if (string == 0 || *string == 0) + return ((WORD_LIST *)NULL); + + td.flags = 0; + td.word = savestring (string); + + tresult = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL); + + FREE (td.word); + return (tresult); +} + +/* Expand STRING by performing parameter expansion, command substitution, + and arithmetic expansion. Dequote the resulting WORD_LIST before + returning it, but do not perform word splitting. The call to + remove_quoted_nulls () is in here because word splitting normally + takes care of quote removal. */ +WORD_LIST * +expand_string_unsplit (string, quoted) + char *string; + int quoted; +{ + WORD_LIST *value; + + if (string == 0 || *string == '\0') + return ((WORD_LIST *)NULL); + + expand_no_split_dollar_star = 1; + value = expand_string_internal (string, quoted); + expand_no_split_dollar_star = 0; + + if (value) + { + if (value->word) + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } + dequote_list (value); + } + return (value); +} + +/* Expand the rhs of an assignment statement */ +WORD_LIST * +expand_string_assignment (string, quoted) + char *string; + int quoted; +{ + WORD_DESC td; + WORD_LIST *value; + + if (string == 0 || *string == '\0') + return ((WORD_LIST *)NULL); + + expand_no_split_dollar_star = 1; + + td.flags = W_ASSIGNRHS; + td.word = savestring (string); + value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL); + FREE (td.word); + + expand_no_split_dollar_star = 0; + + if (value) + { + if (value->word) + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } + dequote_list (value); + } + return (value); +} + + +/* Expand one of the PS? prompt strings. This is a sort of combination of + expand_string_unsplit and expand_string_internal, but returns the + passed string when an error occurs. Might want to trap other calls + to jump_to_top_level here so we don't endlessly loop. */ +WORD_LIST * +expand_prompt_string (string, quoted) + char *string; + int quoted; +{ + WORD_LIST *value; + WORD_DESC td; + + if (string == 0 || *string == 0) + return ((WORD_LIST *)NULL); + + td.flags = 0; + td.word = savestring (string); + + no_longjmp_on_fatal_error = 1; + value = expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL); + no_longjmp_on_fatal_error = 0; + + if (value == &expand_word_error || value == &expand_word_fatal) + { + value = make_word_list (make_bare_word (string), (WORD_LIST *)NULL); + return value; + } + FREE (td.word); + if (value) + { + if (value->word) + { + remove_quoted_nulls (value->word->word); + value->word->flags &= ~W_HASQUOTEDNULL; + } + dequote_list (value); + } + return (value); +} + +/* Expand STRING just as if you were expanding a word, but do not dequote + the resultant WORD_LIST. This is called only from within this file, + and is used to correctly preserve quoted characters when expanding + things like ${1+"$@"}. This does parameter expansion, command + substitution, arithmetic expansion, and word splitting. */ +static WORD_LIST * +expand_string_leave_quoted (string, quoted) + char *string; + int quoted; +{ + WORD_LIST *tlist; + WORD_LIST *tresult; + + if (string == 0 || *string == '\0') + return ((WORD_LIST *)NULL); + + tlist = expand_string_internal (string, quoted); + + if (tlist) + { + tresult = word_list_split (tlist); + dispose_words (tlist); + return (tresult); + } + return ((WORD_LIST *)NULL); +} + +/* This does not perform word splitting or dequote the WORD_LIST + it returns. */ +static WORD_LIST * +expand_string_for_rhs (string, quoted, dollar_at_p, has_dollar_at) + char *string; + int quoted, *dollar_at_p, *has_dollar_at; +{ + WORD_DESC td; + WORD_LIST *tresult; + + if (string == 0 || *string == '\0') + return (WORD_LIST *)NULL; + + td.flags = 0; + td.word = string; + tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at); + return (tresult); +} + +/* Expand STRING just as if you were expanding a word. This also returns + a list of words. Note that filename globbing is *NOT* done for word + or string expansion, just when the shell is expanding a command. This + does parameter expansion, command substitution, arithmetic expansion, + and word splitting. Dequote the resultant WORD_LIST before returning. */ +WORD_LIST * +expand_string (string, quoted) + char *string; + int quoted; +{ + WORD_LIST *result; + + if (string == 0 || *string == '\0') + return ((WORD_LIST *)NULL); + + result = expand_string_leave_quoted (string, quoted); + return (result ? dequote_list (result) : result); +} + +/*************************************************** + * * + * Functions to handle quoting chars * + * * + ***************************************************/ + +/* Conventions: + + A string with s[0] == CTLNUL && s[1] == 0 is a quoted null string. + The parser passes CTLNUL as CTLESC CTLNUL. */ + +/* Quote escape characters in string s, but no other characters. This is + used to protect CTLESC and CTLNUL in variable values from the rest of + the word expansion process after the variable is expanded. */ +char * +quote_escapes (string) + char *string; +{ + register char *s, *t; + size_t slen; + char *result, *send; + DECLARE_MBSTATE; + + slen = strlen (string); + send = string + slen; + + t = result = (char *)xmalloc ((slen * 2) + 1); + s = string; + + while (*s) + { + if (*s == CTLESC || *s == CTLNUL) + *t++ = CTLESC; + COPY_CHAR_P (t, s, send); + } + *t = '\0'; + return (result); +} + +static WORD_LIST * +list_quote_escapes (list) + WORD_LIST *list; +{ + register WORD_LIST *w; + char *t; + + for (w = list; w; w = w->next) + { + t = w->word->word; + w->word->word = quote_escapes (t); + free (t); + } + return list; +} + +/* Inverse of quote_escapes; remove CTLESC protecting CTLESC or CTLNUL. + + The parser passes us CTLESC as CTLESC CTLESC and CTLNUL as CTLESC CTLNUL. + This is necessary to make unquoted CTLESC and CTLNUL characters in the + data stream pass through properly. + + We need to remove doubled CTLESC characters inside quoted strings before + quoting the entire string, so we do not double the number of CTLESC + characters. + + Also used by parts of the pattern substitution code. */ +static char * +dequote_escapes (string) + char *string; +{ + register char *s, *t; + size_t slen; + char *result, *send; + DECLARE_MBSTATE; + + if (string == 0) + return string; + + slen = strlen (string); + send = string + slen; + + t = result = (char *)xmalloc (slen + 1); + s = string; + + if (strchr (string, CTLESC) == 0) + return (strcpy (result, s)); + + while (*s) + { + if (*s == CTLESC && (s[1] == CTLESC || s[1] == CTLNUL)) + { + s++; + if (*s == '\0') + break; + } + COPY_CHAR_P (t, s, send); + } + *t = '\0'; + return result; +} + +/* Return a new string with the quoted representation of character C. */ +static char * +make_quoted_char (c) + int c; +{ + char *temp; + + temp = (char *)xmalloc (3); + if (c == 0) + { + temp[0] = CTLNUL; + temp[1] = '\0'; + } + else + { + temp[0] = CTLESC; + temp[1] = c; + temp[2] = '\0'; + } + return (temp); +} + +/* Quote STRING. Return a new string. */ +char * +quote_string (string) + char *string; +{ + register char *t; + size_t slen; + char *result, *send; + + if (*string == 0) + { + result = (char *)xmalloc (2); + result[0] = CTLNUL; + result[1] = '\0'; + } + else + { + DECLARE_MBSTATE; + + slen = strlen (string); + send = string + slen; + + result = (char *)xmalloc ((slen * 2) + 1); + + for (t = result; string < send; ) + { + *t++ = CTLESC; + COPY_CHAR_P (t, string, send); + } + *t = '\0'; + } + return (result); +} + +/* De-quoted quoted characters in STRING. */ +char * +dequote_string (string) + char *string; +{ + register char *s, *t; + size_t slen; + char *result, *send; + DECLARE_MBSTATE; + + slen = strlen (string); + + t = result = (char *)xmalloc (slen + 1); + + if (QUOTED_NULL (string)) + { + result[0] = '\0'; + return (result); + } + + /* If no character in the string can be quoted, don't bother examining + each character. Just return a copy of the string passed to us. */ + if (strchr (string, CTLESC) == NULL) + return (strcpy (result, string)); + + send = string + slen; + s = string; + while (*s) + { + if (*s == CTLESC) + { + s++; + if (*s == '\0') + break; + } + COPY_CHAR_P (t, s, send); + } + + *t = '\0'; + return (result); +} + +/* Quote the entire WORD_LIST list. */ +static WORD_LIST * +quote_list (list) + WORD_LIST *list; +{ + register WORD_LIST *w; + char *t; + + for (w = list; w; w = w->next) + { + t = w->word->word; + w->word->word = quote_string (t); + free (t); + w->word->flags |= W_QUOTED; + } + return list; +} + +static WORD_LIST * +dequote_list (list) + WORD_LIST *list; +{ + register char *s; + register WORD_LIST *tlist; + + for (tlist = list; tlist; tlist = tlist->next) + { + s = dequote_string (tlist->word->word); + free (tlist->word->word); + tlist->word->word = s; + } + return list; +} + +/* Remove CTLESC protecting a CTLESC or CTLNUL in place. Return the passed + string. */ +static char * +remove_quoted_escapes (string) + char *string; +{ + char *t; + + if (string) + { + t = dequote_escapes (string); + strcpy (string, t); + free (t); + } + + return (string); +} + +/* Perform quoted null character removal on STRING. We don't allow any + quoted null characters in the middle or at the ends of strings because + of how expand_word_internal works. remove_quoted_nulls () turns + STRING into an empty string iff it only consists of a quoted null, + and removes all unquoted CTLNUL characters. */ +static char * +remove_quoted_nulls (string) + char *string; +{ + register size_t slen; + register int i, j, prev_i; + DECLARE_MBSTATE; + + if (strchr (string, CTLNUL) == 0) /* XXX */ + return string; /* XXX */ + + slen = strlen (string); + i = j = 0; + + while (i < slen) + { + if (string[i] == CTLESC) + { + /* Old code had j++, but we cannot assume that i == j at this + point -- what if a CTLNUL has already been removed from the + string? We don't want to drop the CTLESC or recopy characters + that we've already copied down. */ + i++; string[j++] = CTLESC; + if (i == slen) + break; + } + else if (string[i] == CTLNUL) + i++; + + prev_i = i; + ADVANCE_CHAR (string, slen, i); + if (j < prev_i) + { + do string[j++] = string[prev_i++]; while (prev_i < i); + } + else + j = i; + } + string[j] = '\0'; + + return (string); +} + +/* Perform quoted null character removal on each element of LIST. + This modifies LIST. */ +void +word_list_remove_quoted_nulls (list) + WORD_LIST *list; +{ + register WORD_LIST *t; + + for (t = list; t; t = t->next) + { + remove_quoted_nulls (t->word->word); + t->word->flags &= ~W_HASQUOTEDNULL; + } +} + +/* **************************************************************** */ +/* */ +/* Functions for Matching and Removing Patterns */ +/* */ +/* **************************************************************** */ + +#if defined (HANDLE_MULTIBYTE) +#if 0 /* Currently unused */ +static unsigned char * +mb_getcharlens (string, len) + char *string; + int len; +{ + int i, offset, last; + unsigned char *ret; + char *p; + DECLARE_MBSTATE; + + i = offset = 0; + last = 0; + ret = (unsigned char *)xmalloc (len); + memset (ret, 0, len); + while (string[last]) + { + ADVANCE_CHAR (string, len, offset); + ret[last] = offset - last; + last = offset; + } + return ret; +} +#endif +#endif + +/* Remove the portion of PARAM matched by PATTERN according to OP, where OP + can have one of 4 values: + RP_LONG_LEFT remove longest matching portion at start of PARAM + RP_SHORT_LEFT remove shortest matching portion at start of PARAM + RP_LONG_RIGHT remove longest matching portion at end of PARAM + RP_SHORT_RIGHT remove shortest matching portion at end of PARAM +*/ + +#define RP_LONG_LEFT 1 +#define RP_SHORT_LEFT 2 +#define RP_LONG_RIGHT 3 +#define RP_SHORT_RIGHT 4 + +static char * +remove_upattern (param, pattern, op) + char *param, *pattern; + int op; +{ + register int len; + register char *end; + register char *p, *ret, c; + + len = STRLEN (param); + end = param + len; + + switch (op) + { + case RP_LONG_LEFT: /* remove longest match at start */ + for (p = end; p >= param; p--) + { + c = *p; *p = '\0'; + if (strmatch (pattern, param, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + *p = c; + return (savestring (p)); + } + *p = c; + + } + break; + + case RP_SHORT_LEFT: /* remove shortest match at start */ + for (p = param; p <= end; p++) + { + c = *p; *p = '\0'; + if (strmatch (pattern, param, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + *p = c; + return (savestring (p)); + } + *p = c; + } + break; + + case RP_LONG_RIGHT: /* remove longest match at end */ + for (p = param; p <= end; p++) + { + if (strmatch (pattern, p, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + c = *p; *p = '\0'; + ret = savestring (param); + *p = c; + return (ret); + } + } + break; + + case RP_SHORT_RIGHT: /* remove shortest match at end */ + for (p = end; p >= param; p--) + { + if (strmatch (pattern, p, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + c = *p; *p = '\0'; + ret = savestring (param); + *p = c; + return (ret); + } + } + break; + } + + return (savestring (param)); /* no match, return original string */ +} + +#if defined (HANDLE_MULTIBYTE) + +#if !defined (HAVE_WCSDUP) +static wchar_t * +wcsdup (ws) + wchar_t *ws; +{ + wchar_t *ret; + size_t len; + + len = wcslen (ws); + ret = xmalloc ((len + 1) * sizeof (wchar_t)); + if (ret == 0) + return ret; + return (wcscpy (ret, ws)); +} +#endif /* !HAVE_WCSDUP */ + +static wchar_t * +remove_wpattern (wparam, wstrlen, wpattern, op) + wchar_t *wparam; + size_t wstrlen; + wchar_t *wpattern; + int op; +{ + wchar_t wc; + int n, n1; + wchar_t *ret; + + switch (op) + { + case RP_LONG_LEFT: /* remove longest match at start */ + for (n = wstrlen; n >= 0; n--) + { + wc = wparam[n]; wparam[n] = L'\0'; + if (wcsmatch (wpattern, wparam, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + wparam[n] = wc; + return (wcsdup (wparam + n)); + } + wparam[n] = wc; + } + break; + + case RP_SHORT_LEFT: /* remove shortest match at start */ + for (n = 0; n <= wstrlen; n++) + { + wc = wparam[n]; wparam[n] = L'\0'; + if (wcsmatch (wpattern, wparam, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + wparam[n] = wc; + return (wcsdup (wparam + n)); + } + wparam[n] = wc; + } + break; + + case RP_LONG_RIGHT: /* remove longest match at end */ + for (n = 0; n <= wstrlen; n++) + { + if (wcsmatch (wpattern, wparam + n, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + wc = wparam[n]; wparam[n] = L'\0'; + ret = wcsdup (wparam); + wparam[n] = wc; + return (ret); + } + } + break; + + case RP_SHORT_RIGHT: /* remove shortest match at end */ + for (n = wstrlen; n >= 0; n--) + { + if (wcsmatch (wpattern, wparam + n, FNMATCH_EXTFLAG) != FNM_NOMATCH) + { + wc = wparam[n]; wparam[n] = L'\0'; + ret = wcsdup (wparam); + wparam[n] = wc; + return (ret); + } + } + break; + } + + return (wcsdup (wparam)); /* no match, return original string */ +} +#endif /* HANDLE_MULTIBYTE */ + +static char * +remove_pattern (param, pattern, op) + char *param, *pattern; + int op; +{ + if (param == NULL) + return (param); + if (*param == '\0' || pattern == NULL || *pattern == '\0') /* minor optimization */ + return (savestring (param)); + +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1) + { + wchar_t *ret, *oret; + size_t n; + wchar_t *wparam, *wpattern; + mbstate_t ps; + char *xret; + + n = xdupmbstowcs (&wpattern, NULL, pattern); + if (n == (size_t)-1) + return (remove_upattern (param, pattern, op)); + n = xdupmbstowcs (&wparam, NULL, param); + if (n == (size_t)-1) + { + free (wpattern); + return (remove_upattern (param, pattern, op)); + } + oret = ret = remove_wpattern (wparam, n, wpattern, op); + + free (wparam); + free (wpattern); + + n = strlen (param); + xret = xmalloc (n + 1); + memset (&ps, '\0', sizeof (mbstate_t)); + n = wcsrtombs (xret, (const wchar_t **)&ret, n, &ps); + xret[n] = '\0'; /* just to make sure */ + free (oret); + return xret; + } + else +#endif + return (remove_upattern (param, pattern, op)); +} + +/* Return 1 of the first character of STRING could match the first + character of pattern PAT. Used to avoid n2 calls to strmatch(). */ +static int +match_pattern_char (pat, string) + char *pat, *string; +{ + char c; + + if (*string == 0) + return (0); + + switch (c = *pat++) + { + default: + return (*string == c); + case '\\': + return (*string == *pat); + case '?': + return (*pat == LPAREN ? 1 : (*string != '\0')); + case '*': + return (1); + case '+': + case '!': + case '@': + return (*pat == LPAREN ? 1 : (*string == c)); + case '[': + return (*string != '\0'); + } +} + +/* Match PAT anywhere in STRING and return the match boundaries. + This returns 1 in case of a successful match, 0 otherwise. SP + and EP are pointers into the string where the match begins and + ends, respectively. MTYPE controls what kind of match is attempted. + MATCH_BEG and MATCH_END anchor the match at the beginning and end + of the string, respectively. The longest match is returned. */ +static int +match_upattern (string, pat, mtype, sp, ep) + char *string, *pat; + int mtype; + char **sp, **ep; +{ + int c, len; + register char *p, *p1, *npat; + char *end; + + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = STRLEN (pat); + if (pat[0] != '*' || pat[len - 1] != '*') + { + p = npat = xmalloc (len + 3); + p1 = pat; + if (*p1 != '*') + *p++ = '*'; + while (*p1) + *p++ = *p1++; + if (p1[-1] != '*') + *p++ = '*'; + *p = '\0'; + } + else + npat = pat; + c = strmatch (npat, string, FNMATCH_EXTFLAG); + if (npat != pat) + free (npat); + if (c == FNM_NOMATCH) + return (0); + + len = STRLEN (string); + end = string + len; + + switch (mtype) + { + case MATCH_ANY: + for (p = string; p <= end; p++) + { + if (match_pattern_char (pat, p)) + { + for (p1 = end; p1 >= p; p1--) + { + c = *p1; *p1 = '\0'; + if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0) + { + *p1 = c; + *sp = p; + *ep = p1; + return 1; + } + *p1 = c; + } + } + } + + return (0); + + case MATCH_BEG: + if (match_pattern_char (pat, string) == 0) + return (0); + + for (p = end; p >= string; p--) + { + c = *p; *p = '\0'; + if (strmatch (pat, string, FNMATCH_EXTFLAG) == 0) + { + *p = c; + *sp = string; + *ep = p; + return 1; + } + *p = c; + } + + return (0); + + case MATCH_END: + for (p = string; p <= end; p++) + { + if (strmatch (pat, p, FNMATCH_EXTFLAG) == 0) + { + *sp = p; + *ep = end; + return 1; + } + + } + + return (0); + } + + return (0); +} + +#if defined (HANDLE_MULTIBYTE) +/* Return 1 of the first character of WSTRING could match the first + character of pattern WPAT. Wide character version. */ +static int +match_pattern_wchar (wpat, wstring) + wchar_t *wpat, *wstring; +{ + wchar_t wc; + + if (*wstring == 0) + return (0); + + switch (wc = *wpat++) + { + default: + return (*wstring == wc); + case L'\\': + return (*wstring == *wpat); + case L'?': + return (*wpat == LPAREN ? 1 : (*wstring != L'\0')); + case L'*': + return (1); + case L'+': + case L'!': + case L'@': + return (*wpat == LPAREN ? 1 : (*wstring == wc)); + case L'[': + return (*wstring != L'\0'); + } +} + +/* Match WPAT anywhere in WSTRING and return the match boundaries. + This returns 1 in case of a successful match, 0 otherwise. Wide + character version. */ +static int +match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep) + wchar_t *wstring; + char **indices; + size_t wstrlen; + wchar_t *wpat; + int mtype; + char **sp, **ep; +{ + wchar_t wc, *wp; + int len; +#if 0 + size_t n, n1; /* Apple's gcc seems to miscompile this badly */ +#else + int n, n1; +#endif + + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = wcslen (wpat); + if (wpat[0] != L'*' || wpat[len - 1] != L'*') + { + wp = xmalloc ((len + 3) * sizeof (wchar_t)); + wp[0] = L'*'; + wcscpy (wp + 1, wpat); + wp[len+1] = L'*'; + wp[len+2] = '\0'; + } + else + wp = wpat; + len = wcsmatch (wp, wstring, FNMATCH_EXTFLAG); + if (wp != wpat) + free (wp); + if (len == FNM_NOMATCH) + return (0); + + switch (mtype) + { + case MATCH_ANY: + for (n = 0; n <= wstrlen; n++) + { + if (match_pattern_wchar (wpat, wstring + n)) + { + for (n1 = wstrlen; n1 >= n; n1--) + { + wc = wstring[n1]; wstring[n1] = L'\0'; + if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0) + { + wstring[n1] = wc; + *sp = indices[n]; + *ep = indices[n1]; + return 1; + } + wstring[n1] = wc; + } + } + } + + return (0); + + case MATCH_BEG: + if (match_pattern_wchar (wpat, wstring) == 0) + return (0); + + for (n = wstrlen; n >= 0; n--) + { + wc = wstring[n]; wstring[n] = L'\0'; + if (wcsmatch (wpat, wstring, FNMATCH_EXTFLAG) == 0) + { + wstring[n] = wc; + *sp = indices[0]; + *ep = indices[n]; + return 1; + } + wstring[n] = wc; + } + + return (0); + + case MATCH_END: + for (n = 0; n <= wstrlen; n++) + { + if (wcsmatch (wpat, wstring + n, FNMATCH_EXTFLAG) == 0) + { + *sp = indices[n]; + *ep = indices[wstrlen]; + return 1; + } + } + + return (0); + } + + return (0); +} +#endif /* HANDLE_MULTIBYTE */ + +static int +match_pattern (string, pat, mtype, sp, ep) + char *string, *pat; + int mtype; + char **sp, **ep; +{ +#if defined (HANDLE_MULTIBYTE) + int ret; + size_t n; + wchar_t *wstring, *wpat; + char **indices; +#endif + + if (string == 0 || *string == 0 || pat == 0 || *pat == 0) + return (0); + +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1) + { + n = xdupmbstowcs (&wpat, NULL, pat); + if (n == (size_t)-1) + return (match_upattern (string, pat, mtype, sp, ep)); + n = xdupmbstowcs (&wstring, &indices, string); + if (n == (size_t)-1) + { + free (wpat); + return (match_upattern (string, pat, mtype, sp, ep)); + } + ret = match_wpattern (wstring, indices, n, wpat, mtype, sp, ep); + + free (wpat); + free (wstring); + free (indices); + + return (ret); + } + else +#endif + return (match_upattern (string, pat, mtype, sp, ep)); +} + +static int +getpatspec (c, value) + int c; + char *value; +{ + if (c == '#') + return ((*value == '#') ? RP_LONG_LEFT : RP_SHORT_LEFT); + else /* c == '%' */ + return ((*value == '%') ? RP_LONG_RIGHT : RP_SHORT_RIGHT); +} + +/* Posix.2 says that the WORD should be run through tilde expansion, + parameter expansion, command substitution and arithmetic expansion. + This leaves the result quoted, so quote_string_for_globbing () has + to be called to fix it up for strmatch (). If QUOTED is non-zero, + it means that the entire expression was enclosed in double quotes. + This means that quoting characters in the pattern do not make any + special pattern characters quoted. For example, the `*' in the + following retains its special meaning: "${foo#'*'}". */ +static char * +getpattern (value, quoted, expandpat) + char *value; + int quoted, expandpat; +{ + char *pat, *tword; + WORD_LIST *l; + int i; + + /* There is a problem here: how to handle single or double quotes in the + pattern string when the whole expression is between double quotes? + POSIX.2 says that enclosing double quotes do not cause the pattern to + be quoted, but does that leave us a problem with @ and array[@] and their + expansions inside a pattern? */ +#if 0 + if (expandpat && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *tword) + { + i = 0; + pat = string_extract_double_quoted (tword, &i, 1); + free (tword); + tword = pat; + } +#endif + + /* expand_string_for_rhs () leaves WORD quoted and does not perform + word splitting. */ + l = *value ? expand_string_for_rhs (value, + (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? Q_PATQUOTE : quoted, + (int *)NULL, (int *)NULL) + : (WORD_LIST *)0; + pat = string_list (l); + dispose_words (l); + if (pat) + { + tword = quote_string_for_globbing (pat, QGLOB_CVTNULL); + free (pat); + pat = tword; + } + return (pat); +} + +#if 0 +/* Handle removing a pattern from a string as a result of ${name%[%]value} + or ${name#[#]value}. */ +static char * +variable_remove_pattern (value, pattern, patspec, quoted) + char *value, *pattern; + int patspec, quoted; +{ + char *tword; + + tword = remove_pattern (value, pattern, patspec); + + return (tword); +} +#endif + +static char * +list_remove_pattern (list, pattern, patspec, itype, quoted) + WORD_LIST *list; + char *pattern; + int patspec, itype, quoted; +{ + WORD_LIST *new, *l; + WORD_DESC *w; + char *tword; + + for (new = (WORD_LIST *)NULL, l = list; l; l = l->next) + { + tword = remove_pattern (l->word->word, pattern, patspec); +#if 0 + w = make_bare_word (tword); + FREE (tword); +#else + w = alloc_word_desc (); + w->word = tword ? tword : savestring (""); +#endif + new = make_word_list (w, new); + } + + l = REVERSE_LIST (new, WORD_LIST *); + if (itype == '*') + tword = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (l) : string_list (l); + else + tword = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (l) : l); + + dispose_words (l); + return (tword); +} + +static char * +parameter_list_remove_pattern (itype, pattern, patspec, quoted) + int itype; + char *pattern; + int patspec, quoted; +{ + char *ret; + WORD_LIST *list; + + list = list_rest_of_args (); + if (list == 0) + return ((char *)NULL); + ret = list_remove_pattern (list, pattern, patspec, itype, quoted); + dispose_words (list); + return (ret); +} + +#if defined (ARRAY_VARS) +static char * +array_remove_pattern (a, pattern, patspec, varname, quoted) + ARRAY *a; + char *pattern; + int patspec; + char *varname; /* so we can figure out how it's indexed */ + int quoted; +{ + int itype; + char *ret; + WORD_LIST *list; + SHELL_VAR *v; + + /* compute itype from varname here */ + v = array_variable_part (varname, &ret, 0); + itype = ret[0]; + + list = array_to_word_list (a); + if (list == 0) + return ((char *)NULL); + ret = list_remove_pattern (list, pattern, patspec, itype, quoted); + dispose_words (list); + + return ret; +} +#endif /* ARRAY_VARS */ + +static char * +parameter_brace_remove_pattern (varname, value, patstr, rtype, quoted) + char *varname, *value, *patstr; + int rtype, quoted; +{ + int vtype, patspec, starsub; + char *temp1, *val, *pattern; + SHELL_VAR *v; + + if (value == 0) + return ((char *)NULL); + + this_command_name = varname; + + vtype = get_var_and_type (varname, value, quoted, &v, &val); + if (vtype == -1) + return ((char *)NULL); + + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + + patspec = getpatspec (rtype, patstr); + if (patspec == RP_LONG_LEFT || patspec == RP_LONG_RIGHT) + patstr++; + + pattern = getpattern (patstr, quoted, 1); + + temp1 = (char *)NULL; /* shut up gcc */ + switch (vtype) + { + case VT_VARIABLE: + case VT_ARRAYMEMBER: + temp1 = remove_pattern (val, pattern, patspec); + if (vtype == VT_VARIABLE) + FREE (val); + if (temp1) + { + val = quote_escapes (temp1); + free (temp1); + temp1 = val; + } + break; +#if defined (ARRAY_VARS) + case VT_ARRAYVAR: + temp1 = array_remove_pattern (array_cell (v), pattern, patspec, varname, quoted); + if (temp1 && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0)) + { + val = quote_escapes (temp1); + free (temp1); + temp1 = val; + } + break; +#endif + case VT_POSPARMS: + temp1 = parameter_list_remove_pattern (varname[0], pattern, patspec, quoted); + if (temp1 && ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0)) + { + val = quote_escapes (temp1); + free (temp1); + temp1 = val; + } + break; + } + + FREE (pattern); + return temp1; +} + +/******************************************* + * * + * Functions to expand WORD_DESCs * + * * + *******************************************/ + +/* Expand WORD, performing word splitting on the result. This does + parameter expansion, command substitution, arithmetic expansion, + word splitting, and quote removal. */ + +WORD_LIST * +expand_word (word, quoted) + WORD_DESC *word; + int quoted; +{ + WORD_LIST *result, *tresult; + + tresult = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL); + result = word_list_split (tresult); + dispose_words (tresult); + return (result ? dequote_list (result) : result); +} + +/* Expand WORD, but do not perform word splitting on the result. This + does parameter expansion, command substitution, arithmetic expansion, + and quote removal. */ +WORD_LIST * +expand_word_unsplit (word, quoted) + WORD_DESC *word; + int quoted; +{ + WORD_LIST *result; + + expand_no_split_dollar_star = 1; + result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL); + expand_no_split_dollar_star = 0; + + return (result ? dequote_list (result) : result); +} + +/* Perform shell expansions on WORD, but do not perform word splitting or + quote removal on the result. */ +WORD_LIST * +expand_word_leave_quoted (word, quoted) + WORD_DESC *word; + int quoted; +{ + return (call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL)); +} + +#if defined (PROCESS_SUBSTITUTION) + +/*****************************************************************/ +/* */ +/* Hacking Process Substitution */ +/* */ +/*****************************************************************/ + +#if !defined (HAVE_DEV_FD) +/* Named pipes must be removed explicitly with `unlink'. This keeps a list + of FIFOs the shell has open. unlink_fifo_list will walk the list and + unlink all of them. add_fifo_list adds the name of an open FIFO to the + list. NFIFO is a count of the number of FIFOs in the list. */ +#define FIFO_INCR 20 + +struct temp_fifo { + char *file; + pid_t proc; +}; + +static struct temp_fifo *fifo_list = (struct temp_fifo *)NULL; +static int nfifo; +static int fifo_list_size; + +static void +add_fifo_list (pathname) + char *pathname; +{ + if (nfifo >= fifo_list_size - 1) + { + fifo_list_size += FIFO_INCR; + fifo_list = (struct temp_fifo *)xrealloc (fifo_list, + fifo_list_size * sizeof (struct temp_fifo)); + } + + fifo_list[nfifo].file = savestring (pathname); + nfifo++; +} + +void +unlink_fifo_list () +{ + int saved, i, j; + + if (nfifo == 0) + return; + + for (i = saved = 0; i < nfifo; i++) + { + if ((fifo_list[i].proc == -1) || (kill(fifo_list[i].proc, 0) == -1)) + { + unlink (fifo_list[i].file); + free (fifo_list[i].file); + fifo_list[i].file = (char *)NULL; + fifo_list[i].proc = -1; + } + else + saved++; + } + + /* If we didn't remove some of the FIFOs, compact the list. */ + if (saved) + { + for (i = j = 0; i < nfifo; i++) + if (fifo_list[i].file) + { + fifo_list[j].file = fifo_list[i].file; + fifo_list[j].proc = fifo_list[i].proc; + j++; + } + nfifo = j; + } + else + nfifo = 0; +} + +static char * +make_named_pipe () +{ + char *tname; + + tname = sh_mktmpname ("sh-np", MT_USERANDOM); + if (mkfifo (tname, 0600) < 0) + { + free (tname); + return ((char *)NULL); + } + + add_fifo_list (tname); + return (tname); +} + +#else /* HAVE_DEV_FD */ + +/* DEV_FD_LIST is a bitmap of file descriptors attached to pipes the shell + has open to children. NFDS is a count of the number of bits currently + set in DEV_FD_LIST. TOTFDS is a count of the highest possible number + of open files. */ +static char *dev_fd_list = (char *)NULL; +static int nfds; +static int totfds; /* The highest possible number of open files. */ + +static void +add_fifo_list (fd) + int fd; +{ + if (!dev_fd_list || fd >= totfds) + { + int ofds; + + ofds = totfds; + totfds = getdtablesize (); + if (totfds < 0 || totfds > 256) + totfds = 256; + if (fd > totfds) + totfds = fd + 2; + + dev_fd_list = (char *)xrealloc (dev_fd_list, totfds); + memset (dev_fd_list + ofds, '\0', totfds - ofds); + } + + dev_fd_list[fd] = 1; + nfds++; +} + +void +unlink_fifo_list () +{ + register int i; + + if (nfds == 0) + return; + + for (i = 0; nfds && i < totfds; i++) + if (dev_fd_list[i]) + { + close (i); + dev_fd_list[i] = 0; + nfds--; + } + + nfds = 0; +} + +#if defined (NOTDEF) +print_dev_fd_list () +{ + register int i; + + fprintf (stderr, "pid %ld: dev_fd_list:", (long)getpid ()); + fflush (stderr); + + for (i = 0; i < totfds; i++) + { + if (dev_fd_list[i]) + fprintf (stderr, " %d", i); + } + fprintf (stderr, "\n"); +} +#endif /* NOTDEF */ + +static char * +make_dev_fd_filename (fd) + int fd; +{ + char *ret, intbuf[INT_STRLEN_BOUND (int) + 1], *p; + + ret = (char *)xmalloc (sizeof (DEV_FD_PREFIX) + 4); + + strcpy (ret, DEV_FD_PREFIX); + p = inttostr (fd, intbuf, sizeof (intbuf)); + strcpy (ret + sizeof (DEV_FD_PREFIX) - 1, p); + + add_fifo_list (fd); + return (ret); +} + +#endif /* HAVE_DEV_FD */ + +/* Return a filename that will open a connection to the process defined by + executing STRING. HAVE_DEV_FD, if defined, means open a pipe and return + a filename in /dev/fd corresponding to a descriptor that is one of the + ends of the pipe. If not defined, we use named pipes on systems that have + them. Systems without /dev/fd and named pipes are out of luck. + + OPEN_FOR_READ_IN_CHILD, if 1, means open the named pipe for reading or + use the read end of the pipe and dup that file descriptor to fd 0 in + the child. If OPEN_FOR_READ_IN_CHILD is 0, we open the named pipe for + writing or use the write end of the pipe in the child, and dup that + file descriptor to fd 1 in the child. The parent does the opposite. */ + +static char * +process_substitute (string, open_for_read_in_child) + char *string; + int open_for_read_in_child; +{ + char *pathname; + int fd, result; + pid_t old_pid, pid; +#if defined (HAVE_DEV_FD) + int parent_pipe_fd, child_pipe_fd; + int fildes[2]; +#endif /* HAVE_DEV_FD */ +#if defined (JOB_CONTROL) + pid_t old_pipeline_pgrp; +#endif + + if (!string || !*string || wordexp_only) + return ((char *)NULL); + +#if !defined (HAVE_DEV_FD) + pathname = make_named_pipe (); +#else /* HAVE_DEV_FD */ + if (pipe (fildes) < 0) + { + sys_error (_("cannot make pipe for process substitution")); + return ((char *)NULL); + } + /* If OPEN_FOR_READ_IN_CHILD == 1, we want to use the write end of + the pipe in the parent, otherwise the read end. */ + parent_pipe_fd = fildes[open_for_read_in_child]; + child_pipe_fd = fildes[1 - open_for_read_in_child]; + /* Move the parent end of the pipe to some high file descriptor, to + avoid clashes with FDs used by the script. */ + parent_pipe_fd = move_to_high_fd (parent_pipe_fd, 1, 64); + + pathname = make_dev_fd_filename (parent_pipe_fd); +#endif /* HAVE_DEV_FD */ + + if (!pathname) + { + sys_error (_("cannot make pipe for process substitution")); + return ((char *)NULL); + } + + old_pid = last_made_pid; + +#if defined (JOB_CONTROL) + old_pipeline_pgrp = pipeline_pgrp; + pipeline_pgrp = shell_pgrp; + save_pipeline (1); +#endif /* JOB_CONTROL */ + + pid = make_child ((char *)NULL, 1); + if (pid == 0) + { + reset_terminating_signals (); /* XXX */ + free_pushed_string_input (); + /* Cancel traps, in trap.c. */ + restore_original_signals (); + setup_async_signals (); + subshell_environment |= SUBSHELL_COMSUB; + } + +#if defined (JOB_CONTROL) + set_sigchld_handler (); + stop_making_children (); + pipeline_pgrp = old_pipeline_pgrp; +#endif /* JOB_CONTROL */ + + if (pid < 0) + { + sys_error (_("cannot make child for process substitution")); + free (pathname); +#if defined (HAVE_DEV_FD) + close (parent_pipe_fd); + close (child_pipe_fd); +#endif /* HAVE_DEV_FD */ + return ((char *)NULL); + } + + if (pid > 0) + { +#if defined (JOB_CONTROL) + restore_pipeline (1); +#endif + +#if !defined (HAVE_DEV_FD) + fifo_list[nfifo-1].proc = pid; +#endif + + last_made_pid = old_pid; + +#if defined (JOB_CONTROL) && defined (PGRP_PIPE) + close_pgrp_pipe (); +#endif /* JOB_CONTROL && PGRP_PIPE */ + +#if defined (HAVE_DEV_FD) + close (child_pipe_fd); +#endif /* HAVE_DEV_FD */ + + return (pathname); + } + + set_sigint_handler (); + +#if defined (JOB_CONTROL) + set_job_control (0); +#endif /* JOB_CONTROL */ + +#if !defined (HAVE_DEV_FD) + /* Open the named pipe in the child. */ + fd = open (pathname, open_for_read_in_child ? O_RDONLY|O_NONBLOCK : O_WRONLY); + if (fd < 0) + { + /* Two separate strings for ease of translation. */ + if (open_for_read_in_child) + sys_error (_("cannot open named pipe %s for reading"), pathname); + else + sys_error (_("cannot open named pipe %s for writing"), pathname); + + exit (127); + } + if (open_for_read_in_child) + { + if (sh_unset_nodelay_mode (fd) < 0) + { + sys_error (_("cannout reset nodelay mode for fd %d"), fd); + exit (127); + } + } +#else /* HAVE_DEV_FD */ + fd = child_pipe_fd; +#endif /* HAVE_DEV_FD */ + + if (dup2 (fd, open_for_read_in_child ? 0 : 1) < 0) + { + sys_error (_("cannot duplicate named pipe %s as fd %d"), pathname, + open_for_read_in_child ? 0 : 1); + exit (127); + } + + if (fd != (open_for_read_in_child ? 0 : 1)) + close (fd); + + /* Need to close any files that this process has open to pipes inherited + from its parent. */ + if (current_fds_to_close) + { + close_fd_bitmap (current_fds_to_close); + current_fds_to_close = (struct fd_bitmap *)NULL; + } + +#if defined (HAVE_DEV_FD) + /* Make sure we close the parent's end of the pipe and clear the slot + in the fd list so it is not closed later, if reallocated by, for + instance, pipe(2). */ + close (parent_pipe_fd); + dev_fd_list[parent_pipe_fd] = 0; +#endif /* HAVE_DEV_FD */ + + result = parse_and_execute (string, "process substitution", (SEVAL_NONINT|SEVAL_NOHIST)); + +#if !defined (HAVE_DEV_FD) + /* Make sure we close the named pipe in the child before we exit. */ + close (open_for_read_in_child ? 0 : 1); +#endif /* !HAVE_DEV_FD */ + + exit (result); + /*NOTREACHED*/ +} +#endif /* PROCESS_SUBSTITUTION */ + +/***********************************/ +/* */ +/* Command Substitution */ +/* */ +/***********************************/ + +static char * +read_comsub (fd, quoted) + int fd, quoted; +{ + char *istring, buf[128], *bufp; + int istring_index, istring_size, c; + ssize_t bufn; + + istring = (char *)NULL; + istring_index = istring_size = bufn = 0; + +#ifdef __CYGWIN__ + setmode (fd, O_TEXT); /* we don't want CR/LF, we want Unix-style */ +#endif + + /* Read the output of the command through the pipe. */ + while (1) + { + if (fd < 0) + break; + if (--bufn <= 0) + { + bufn = zread (fd, buf, sizeof (buf)); + if (bufn <= 0) + break; + bufp = buf; + } + c = *bufp++; + + if (c == 0) + { +#if 0 + internal_warning ("read_comsub: ignored null byte in input"); +#endif + continue; + } + + /* Add the character to ISTRING, possibly after resizing it. */ + RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE); + + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || c == CTLESC || c == CTLNUL) + istring[istring_index++] = CTLESC; + + istring[istring_index++] = c; + +#if 0 +#if defined (__CYGWIN__) + if (c == '\n' && istring_index > 1 && istring[istring_index - 2] == '\r') + { + istring_index--; + istring[istring_index - 1] = '\n'; + } +#endif +#endif + } + + if (istring) + istring[istring_index] = '\0'; + + /* If we read no output, just return now and save ourselves some + trouble. */ + if (istring_index == 0) + { + FREE (istring); + return (char *)NULL; + } + + /* Strip trailing newlines from the output of the command. */ + if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + { + while (istring_index > 0) + { + if (istring[istring_index - 1] == '\n') + { + --istring_index; + + /* If the newline was quoted, remove the quoting char. */ + if (istring[istring_index - 1] == CTLESC) + --istring_index; + } + else + break; + } + istring[istring_index] = '\0'; + } + else + strip_trailing (istring, istring_index - 1, 1); + + return istring; +} + +/* Perform command substitution on STRING. This returns a string, + possibly quoted. */ +char * +command_substitute (string, quoted) + char *string; + int quoted; +{ + pid_t pid, old_pid, old_pipeline_pgrp, old_async_pid; + char *istring; + int result, fildes[2], function_value, pflags, rc; + + istring = (char *)NULL; + + /* Don't fork () if there is no need to. In the case of no command to + run, just return NULL. */ + if (!string || !*string || (string[0] == '\n' && !string[1])) + return ((char *)NULL); + + if (wordexp_only && read_but_dont_execute) + { + last_command_exit_value = 125; + jump_to_top_level (EXITPROG); + } + + /* We're making the assumption here that the command substitution will + eventually run a command from the file system. Since we'll run + maybe_make_export_env in this subshell before executing that command, + the parent shell and any other shells it starts will have to remake + the environment. If we make it before we fork, other shells won't + have to. Don't bother if we have any temporary variable assignments, + though, because the export environment will be remade after this + command completes anyway, but do it if all the words to be expanded + are variable assignments. */ + if (subst_assign_varlist == 0 || garglist == 0) + maybe_make_export_env (); /* XXX */ + + /* Flags to pass to parse_and_execute() */ + pflags = interactive ? SEVAL_RESETLINE : 0; + + /* Pipe the output of executing STRING into the current shell. */ + if (pipe (fildes) < 0) + { + sys_error (_("cannot make pipe for command substitution")); + goto error_exit; + } + + old_pid = last_made_pid; +#if defined (JOB_CONTROL) + old_pipeline_pgrp = pipeline_pgrp; + /* Don't reset the pipeline pgrp if we're already a subshell in a pipeline. */ + if ((subshell_environment & SUBSHELL_PIPE) == 0) + pipeline_pgrp = shell_pgrp; + cleanup_the_pipeline (); +#endif + + old_async_pid = last_asynchronous_pid; +#if 0 + pid = make_child ((char *)NULL, 0); +#else + pid = make_child ((char *)NULL, subshell_environment&SUBSHELL_ASYNC); +#endif + last_asynchronous_pid = old_async_pid; + + if (pid == 0) + /* Reset the signal handlers in the child, but don't free the + trap strings. */ + reset_signal_handlers (); + +#if defined (JOB_CONTROL) + set_sigchld_handler (); + stop_making_children (); + pipeline_pgrp = old_pipeline_pgrp; +#else + stop_making_children (); +#endif /* JOB_CONTROL */ + + if (pid < 0) + { + sys_error (_("cannot make child for command substitution")); + error_exit: + + FREE (istring); + close (fildes[0]); + close (fildes[1]); + return ((char *)NULL); + } + + if (pid == 0) + { + set_sigint_handler (); /* XXX */ + + free_pushed_string_input (); + + if (dup2 (fildes[1], 1) < 0) + { + sys_error (_("command_substitute: cannot duplicate pipe as fd 1")); + exit (EXECUTION_FAILURE); + } + + /* If standard output is closed in the parent shell + (such as after `exec >&-'), file descriptor 1 will be + the lowest available file descriptor, and end up in + fildes[0]. This can happen for stdin and stderr as well, + but stdout is more important -- it will cause no output + to be generated from this command. */ + if ((fildes[1] != fileno (stdin)) && + (fildes[1] != fileno (stdout)) && + (fildes[1] != fileno (stderr))) + close (fildes[1]); + + if ((fildes[0] != fileno (stdin)) && + (fildes[0] != fileno (stdout)) && + (fildes[0] != fileno (stderr))) + close (fildes[0]); + + /* The currently executing shell is not interactive. */ + interactive = 0; + + /* This is a subshell environment. */ + subshell_environment |= SUBSHELL_COMSUB; + + /* When not in POSIX mode, command substitution does not inherit + the -e flag. */ + if (posixly_correct == 0) + exit_immediately_on_error = 0; + + remove_quoted_escapes (string); + + startup_state = 2; /* see if we can avoid a fork */ + /* Give command substitution a place to jump back to on failure, + so we don't go back up to main (). */ + result = setjmp (top_level); + + /* If we're running a command substitution inside a shell function, + trap `return' so we don't return from the function in the subshell + and go off to never-never land. */ + if (result == 0 && return_catch_flag) + function_value = setjmp (return_catch); + else + function_value = 0; + + if (result == ERREXIT) + rc = last_command_exit_value; + else if (result == EXITPROG) + rc = last_command_exit_value; + else if (result) + rc = EXECUTION_FAILURE; + else if (function_value) + rc = return_catch_value; + else + { + subshell_level++; + rc = parse_and_execute (string, "command substitution", pflags|SEVAL_NOHIST); + subshell_level--; + } + + last_command_exit_value = rc; + rc = run_exit_trap (); + exit (rc); + } + else + { +#if defined (JOB_CONTROL) && defined (PGRP_PIPE) + close_pgrp_pipe (); +#endif /* JOB_CONTROL && PGRP_PIPE */ + + close (fildes[1]); + + istring = read_comsub (fildes[0], quoted); + + close (fildes[0]); + + current_command_subst_pid = pid; + last_command_exit_value = wait_for (pid); + last_command_subst_pid = pid; + last_made_pid = old_pid; + +#if defined (JOB_CONTROL) + /* If last_command_exit_value > 128, then the substituted command + was terminated by a signal. If that signal was SIGINT, then send + SIGINT to ourselves. This will break out of loops, for instance. */ + if (last_command_exit_value == (128 + SIGINT) && last_command_exit_signal == SIGINT) + kill (getpid (), SIGINT); + + /* wait_for gives the terminal back to shell_pgrp. If some other + process group should have it, give it away to that group here. + pipeline_pgrp is non-zero only while we are constructing a + pipline, so what we are concerned about is whether or not that + pipeline was started in the background. A pipeline started in + the background should never get the tty back here. */ +#if 0 + if (interactive && pipeline_pgrp != (pid_t)0 && pipeline_pgrp != last_asynchronous_pid) +#else + if (interactive && pipeline_pgrp != (pid_t)0 && (subshell_environment & SUBSHELL_ASYNC) == 0) +#endif + give_terminal_to (pipeline_pgrp, 0); +#endif /* JOB_CONTROL */ + + return (istring); + } +} + +/******************************************************** + * * + * Utility functions for parameter expansion * + * * + ********************************************************/ + +#if defined (ARRAY_VARS) + +static arrayind_t +array_length_reference (s) + char *s; +{ + int len; + arrayind_t ind; + char *t, c; + ARRAY *array; + SHELL_VAR *var; + + var = array_variable_part (s, &t, &len); + + /* If unbound variables should generate an error, report one and return + failure. */ + if ((var == 0 || array_p (var) == 0) && unbound_vars_is_error) + { + c = *--t; + *t = '\0'; + err_unboundvar (s); + *t = c; + return (-1); + } + else if (var == 0) + return 0; + + /* We support a couple of expansions for variables that are not arrays. + We'll return the length of the value for v[0], and 1 for v[@] or + v[*]. Return 0 for everything else. */ + + array = array_p (var) ? array_cell (var) : (ARRAY *)NULL; + + if (ALL_ELEMENT_SUB (t[0]) && t[1] == ']') + return (array_p (var) ? array_num_elements (array) : 1); + + ind = array_expand_index (t, len); + if (ind < 0) + { + err_badarraysub (t); + return (-1); + } + + if (array_p (var)) + t = array_reference (array, ind); + else + t = (ind == 0) ? value_cell (var) : (char *)NULL; + + len = STRLEN (t); + return (len); +} +#endif /* ARRAY_VARS */ + +static int +valid_brace_expansion_word (name, var_is_special) + char *name; + int var_is_special; +{ + if (DIGIT (*name) && all_digits (name)) + return 1; + else if (var_is_special) + return 1; +#if defined (ARRAY_VARS) + else if (valid_array_reference (name)) + return 1; +#endif /* ARRAY_VARS */ + else if (legal_identifier (name)) + return 1; + else + return 0; +} + +static int +chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at) + char *name; + int quoted; + int *quoted_dollar_atp, *contains_dollar_at; +{ + char *temp1; + + if (name == 0) + { + if (quoted_dollar_atp) + *quoted_dollar_atp = 0; + if (contains_dollar_at) + *contains_dollar_at = 0; + return 0; + } + + /* check for $@ and $* */ + if (name[0] == '@' && name[1] == 0) + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + else if (name[0] == '*' && name[1] == '\0' && quoted == 0) + { + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + + /* Now check for ${array[@]} and ${array[*]} */ +#if defined (ARRAY_VARS) + else if (valid_array_reference (name)) + { + temp1 = xstrchr (name, '['); + if (temp1 && temp1[1] == '@' && temp1[2] == ']') + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } /* [ */ + /* ${array[*]}, when unquoted, should be treated like ${array[@]}, + which should result in separate words even when IFS is unset. */ + if (temp1 && temp1[1] == '*' && temp1[2] == ']' && quoted == 0) + { + if (contains_dollar_at) + *contains_dollar_at = 1; + return 1; + } + } +#endif + return 0; +} + +/* Parameter expand NAME, and return a new string which is the expansion, + or NULL if there was no expansion. + VAR_IS_SPECIAL is non-zero if NAME is one of the special variables in + the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that + NAME was found inside of a double-quoted expression. */ +static WORD_DESC * +parameter_brace_expand_word (name, var_is_special, quoted) + char *name; + int var_is_special, quoted; +{ + WORD_DESC *ret; + char *temp, *tt; + intmax_t arg_index; + SHELL_VAR *var; + int atype; + + ret = 0; + temp = 0; + + /* Handle multiple digit arguments, as in ${11}. */ + if (legal_number (name, &arg_index)) + { + tt = get_dollar_var_value (arg_index); + if (tt) + temp = (*tt && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + ? quote_string (tt) + : quote_escapes (tt); + else + temp = (char *)NULL; + FREE (tt); + } + else if (var_is_special) /* ${@} */ + { + int sindex; + tt = (char *)xmalloc (2 + strlen (name)); + tt[sindex = 0] = '$'; + strcpy (tt + 1, name); + + ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL, + (int *)NULL, (int *)NULL, 0); + free (tt); + } +#if defined (ARRAY_VARS) + else if (valid_array_reference (name)) + { + temp = array_value (name, quoted, &atype); + if (atype == 0 && temp) + temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + ? quote_string (temp) + : quote_escapes (temp); + } +#endif + else if (var = find_variable (name)) + { + if (var_isset (var) && invisible_p (var) == 0) + { +#if defined (ARRAY_VARS) + temp = array_p (var) ? array_reference (array_cell (var), 0) : value_cell (var); +#else + temp = value_cell (var); +#endif + + if (temp) + temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + ? quote_string (temp) + : quote_escapes (temp); + } + else + temp = (char *)NULL; + } + else + temp = (char *)NULL; + + if (ret == 0) + { + ret = alloc_word_desc (); + ret->word = temp; + } + return ret; +} + +/* Expand an indirect reference to a variable: ${!NAME} expands to the + value of the variable whose name is the value of NAME. */ +static WORD_DESC * +parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at) + char *name; + int var_is_special, quoted; + int *quoted_dollar_atp, *contains_dollar_at; +{ + char *temp, *t; + WORD_DESC *w; + + w = parameter_brace_expand_word (name, var_is_special, quoted); + t = w->word; + /* Have to dequote here if necessary */ + if (t) + { + temp = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + ? dequote_string (t) + : dequote_escapes (t); + free (t); + t = temp; + } + dispose_word_desc (w); + + chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at); + if (t == 0) + return (WORD_DESC *)NULL; + + w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted); + free (t); + + return w; +} + +/* Expand the right side of a parameter expansion of the form ${NAMEcVALUE}, + depending on the value of C, the separating character. C can be one of + "-", "+", or "=". QUOTED is true if the entire brace expression occurs + between double quotes. */ +static WORD_DESC * +parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat) + char *name, *value; + int c, quoted, *qdollaratp, *hasdollarat; +{ + WORD_DESC *w; + WORD_LIST *l; + char *t, *t1, *temp; + int hasdol; + + /* If the entire expression is between double quotes, we want to treat + the value as a double-quoted string, with the exception that we strip + embedded unescaped double quotes. */ + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value) + { + hasdol = 0; + temp = string_extract_double_quoted (value, &hasdol, 1); + } + else + temp = value; + + w = alloc_word_desc (); + hasdol = 0; + /* XXX was 0 not quoted */ + l = *temp ? expand_string_for_rhs (temp, quoted, &hasdol, (int *)NULL) + : (WORD_LIST *)0; + if (hasdollarat) + *hasdollarat = hasdol || (l && l->next); + if (temp != value) + free (temp); + if (l) + { + /* The expansion of TEMP returned something. We need to treat things + slightly differently if HASDOL is non-zero. If we have "$@", the + individual words have already been quoted. We need to turn them + into a string with the words separated by the first character of + $IFS without any additional quoting, so string_list_dollar_at won't + do the right thing. We use string_list_dollar_star instead. */ + temp = (hasdol || l->next) ? string_list_dollar_star (l) : string_list (l); + + /* If l->next is not null, we know that TEMP contained "$@", since that + is the only expansion that creates more than one word. */ + if (qdollaratp && ((hasdol && quoted) || l->next)) + *qdollaratp = 1; + dispose_words (l); + } + else if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && hasdol) + { + /* The brace expansion occurred between double quotes and there was + a $@ in TEMP. It does not matter if the $@ is quoted, as long as + it does not expand to anything. In this case, we want to return + a quoted empty string. */ + temp = (char *)xmalloc (2); + temp[0] = CTLNUL; + temp[1] = '\0'; + w->flags |= W_HASQUOTEDNULL; + } + else + temp = (char *)NULL; + + if (c == '-' || c == '+') + { + w->word = temp; + return w; + } + + /* c == '=' */ + t = temp ? savestring (temp) : savestring (""); + t1 = dequote_string (t); + free (t); +#if defined (ARRAY_VARS) + if (valid_array_reference (name)) + assign_array_element (name, t1, 0); + else +#endif /* ARRAY_VARS */ + bind_variable (name, t1, 0); + free (t1); + + w->word = temp; + return w; +} + +/* Deal with the right hand side of a ${name:?value} expansion in the case + that NAME is null or not set. If VALUE is non-null it is expanded and + used as the error message to print, otherwise a standard message is + printed. */ +static void +parameter_brace_expand_error (name, value) + char *name, *value; +{ + WORD_LIST *l; + char *temp; + + if (value && *value) + { + l = expand_string (value, 0); + temp = string_list (l); + report_error ("%s: %s", name, temp ? temp : ""); /* XXX was value not "" */ + FREE (temp); + dispose_words (l); + } + else + report_error (_("%s: parameter null or not set"), name); + + /* Free the data we have allocated during this expansion, since we + are about to longjmp out. */ + free (name); + FREE (value); +} + +/* Return 1 if NAME is something for which parameter_brace_expand_length is + OK to do. */ +static int +valid_length_expression (name) + char *name; +{ + return (name[1] == '\0' || /* ${#} */ + ((sh_syntaxtab[(unsigned char) name[1]] & CSPECVAR) && name[2] == '\0') || /* special param */ + (DIGIT (name[1]) && all_digits (name + 1)) || /* ${#11} */ +#if defined (ARRAY_VARS) + valid_array_reference (name + 1) || /* ${#a[7]} */ +#endif + legal_identifier (name + 1)); /* ${#PS1} */ +} + +#if defined (HANDLE_MULTIBYTE) +size_t +mbstrlen (s) + const char *s; +{ + size_t clen, nc; + mbstate_t mbs, mbsbak; + + nc = 0; + memset (&mbs, 0, sizeof (mbs)); + mbsbak = mbs; + while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0) + { + if (MB_INVALIDCH(clen)) + { + clen = 1; /* assume single byte */ + mbs = mbsbak; + } + + s += clen; + nc++; + mbsbak = mbs; + } + return nc; +} +#endif + + +/* Handle the parameter brace expansion that requires us to return the + length of a parameter. */ +static intmax_t +parameter_brace_expand_length (name) + char *name; +{ + char *t, *newname; + intmax_t number, arg_index; + WORD_LIST *list; +#if defined (ARRAY_VARS) + SHELL_VAR *var; +#endif + + if (name[1] == '\0') /* ${#} */ + number = number_of_args (); + else if ((name[1] == '@' || name[1] == '*') && name[2] == '\0') /* ${#@}, ${#*} */ + number = number_of_args (); + else if ((sh_syntaxtab[(unsigned char) name[1]] & CSPECVAR) && name[2] == '\0') + { + /* Take the lengths of some of the shell's special parameters. */ + switch (name[1]) + { + case '-': + t = which_set_flags (); + break; + case '?': + t = itos (last_command_exit_value); + break; + case '$': + t = itos (dollar_dollar_pid); + break; + case '!': + if (last_asynchronous_pid == NO_PID) + t = (char *)NULL; + else + t = itos (last_asynchronous_pid); + break; + case '#': + t = itos (number_of_args ()); + break; + } + number = STRLEN (t); + FREE (t); + } +#if defined (ARRAY_VARS) + else if (valid_array_reference (name + 1)) + number = array_length_reference (name + 1); +#endif /* ARRAY_VARS */ + else + { + number = 0; + + if (legal_number (name + 1, &arg_index)) /* ${#1} */ + { + t = get_dollar_var_value (arg_index); + number = MB_STRLEN (t); + FREE (t); + } +#if defined (ARRAY_VARS) + else if ((var = find_variable (name + 1)) && (invisible_p (var) == 0) && array_p (var)) + { + t = array_reference (array_cell (var), 0); + number = MB_STRLEN (t); + } +#endif + else /* ${#PS1} */ + { + newname = savestring (name); + newname[0] = '$'; + list = expand_string (newname, Q_DOUBLE_QUOTES); + t = list ? string_list (list) : (char *)NULL; + free (newname); + if (list) + dispose_words (list); + + number = MB_STRLEN (t); + FREE (t); + } + } + + return (number); +} + +/* Skip characters in SUBSTR until DELIM. SUBSTR is an arithmetic expression, + so we do some ad-hoc parsing of an arithmetic expression to find + the first DELIM, instead of using strchr(3). Two rules: + 1. If the substring contains a `(', read until closing `)'. + 2. If the substring contains a `?', read past one `:' for each `?'. +*/ + +static char * +skiparith (substr, delim) + char *substr; + int delim; +{ + size_t sublen; + int skipcol, pcount, i; + DECLARE_MBSTATE; + + sublen = strlen (substr); + i = skipcol = pcount = 0; + while (substr[i]) + { + /* Balance parens */ + if (substr[i] == LPAREN) + { + pcount++; + i++; + continue; + } + if (substr[i] == RPAREN && pcount) + { + pcount--; + i++; + continue; + } + if (pcount) + { + ADVANCE_CHAR (substr, sublen, i); + continue; + } + + /* Skip one `:' for each `?' */ + if (substr[i] == ':' && skipcol) + { + skipcol--; + i++; + continue; + } + if (substr[i] == delim) + break; + if (substr[i] == '?') + { + skipcol++; + i++; + continue; + } + ADVANCE_CHAR (substr, sublen, i); + } + + return (substr + i); +} + +/* Verify and limit the start and end of the desired substring. If + VTYPE == 0, a regular shell variable is being used; if it is 1, + then the positional parameters are being used; if it is 2, then + VALUE is really a pointer to an array variable that should be used. + Return value is 1 if both values were OK, 0 if there was a problem + with an invalid expression, or -1 if the values were out of range. */ +static int +verify_substring_values (value, substr, vtype, e1p, e2p) + char *value, *substr; + int vtype; + intmax_t *e1p, *e2p; +{ + char *t, *temp1, *temp2; + arrayind_t len; + int expok; +#if defined (ARRAY_VARS) + ARRAY *a; +#endif + + /* duplicate behavior of strchr(3) */ + t = skiparith (substr, ':'); + if (*t && *t == ':') + *t = '\0'; + else + t = (char *)0; + + temp1 = expand_string_if_necessary (substr, Q_DOUBLE_QUOTES, expand_string); + *e1p = evalexp (temp1, &expok); + free (temp1); + if (expok == 0) + return (0); + + len = -1; /* paranoia */ + switch (vtype) + { + case VT_VARIABLE: + case VT_ARRAYMEMBER: + len = MB_STRLEN (value); + break; + case VT_POSPARMS: + len = number_of_args () + 1; + break; +#if defined (ARRAY_VARS) + case VT_ARRAYVAR: + a = (ARRAY *)value; + /* For arrays, the first value deals with array indices. Negative + offsets count from one past the array's maximum index. */ + len = array_max_index (a) + (*e1p < 0); /* arrays index from 0 to n - 1 */ + break; +#endif + } + + if (len == -1) /* paranoia */ + return -1; + + if (*e1p < 0) /* negative offsets count from end */ + *e1p += len; + + if (*e1p > len || *e1p < 0) + return (-1); + +#if defined (ARRAY_VARS) + /* For arrays, the second offset deals with the number of elements. */ + if (vtype == VT_ARRAYVAR) + len = array_num_elements (a); +#endif + + if (t) + { + t++; + temp2 = savestring (t); + temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); + free (temp2); + t[-1] = ':'; + *e2p = evalexp (temp1, &expok); + free (temp1); + if (expok == 0) + return (0); + if (*e2p < 0) + { + internal_error (_("%s: substring expression < 0"), t); + return (0); + } +#if defined (ARRAY_VARS) + /* In order to deal with sparse arrays, push the intelligence about how + to deal with the number of elements desired down to the array- + specific functions. */ + if (vtype != VT_ARRAYVAR) +#endif + { + *e2p += *e1p; /* want E2 chars starting at E1 */ + if (*e2p > len) + *e2p = len; + } + } + else + *e2p = len; + + return (1); +} + +/* Return the type of variable specified by VARNAME (simple variable, + positional param, or array variable). Also return the value specified + by VARNAME (value of a variable or a reference to an array element). + If this returns VT_VARIABLE, the caller assumes that CTLESC and CTLNUL + characters in the value are quoted with CTLESC and takes appropriate + steps. For convenience, *VALP is set to the dequoted VALUE. */ +static int +get_var_and_type (varname, value, quoted, varp, valp) + char *varname, *value; + int quoted; + SHELL_VAR **varp; + char **valp; +{ + int vtype; + char *temp; +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + /* This sets vtype to VT_VARIABLE or VT_POSPARMS */ + vtype = (varname[0] == '@' || varname[0] == '*') && varname[1] == '\0'; + if (vtype == VT_POSPARMS && varname[0] == '*') + vtype |= VT_STARSUB; + *varp = (SHELL_VAR *)NULL; + +#if defined (ARRAY_VARS) + if (valid_array_reference (varname)) + { + v = array_variable_part (varname, &temp, (int *)0); + if (v && array_p (v)) + { /* [ */ + if (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']') + { + vtype = VT_ARRAYVAR; + if (temp[0] == '*') + vtype |= VT_STARSUB; + *valp = (char *)array_cell (v); + } + else + { + vtype = VT_ARRAYMEMBER; + *valp = array_value (varname, 1, (int *)NULL); + } + *varp = v; + } + else if (v && (ALL_ELEMENT_SUB (temp[0]) && temp[1] == ']')) + { + vtype = VT_VARIABLE; + *varp = v; + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + *valp = dequote_string (value); + else + *valp = dequote_escapes (value); + } + else + return -1; + } + else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v)) + { + vtype = VT_ARRAYMEMBER; + *varp = v; + *valp = array_reference (array_cell (v), 0); + } + else +#endif + { + if (value && vtype == VT_VARIABLE) + { + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + *valp = dequote_string (value); + else + *valp = dequote_escapes (value); + } + else + *valp = value; + } + + return vtype; +} + +/******************************************************/ +/* */ +/* Functions to extract substrings of variable values */ +/* */ +/******************************************************/ + +#if defined (HANDLE_MULTIBYTE) +/* Character-oriented rather than strictly byte-oriented substrings. S and + E, rather being strict indices into STRING, indicate character (possibly + multibyte character) positions that require calculation. + Used by the ${param:offset[:length]} expansion. */ +static char * +mb_substring (string, s, e) + char *string; + int s, e; +{ + char *tt; + int start, stop, i, slen; + DECLARE_MBSTATE; + + start = 0; + /* Don't need string length in ADVANCE_CHAR unless multibyte chars possible. */ + slen = (MB_CUR_MAX > 1) ? STRLEN (string) : 0; + + i = s; + while (string[start] && i--) + ADVANCE_CHAR (string, slen, start); + stop = start; + i = e - s; + while (string[stop] && i--) + ADVANCE_CHAR (string, slen, stop); + tt = substring (string, start, stop); + return tt; +} +#endif + +/* Process a variable substring expansion: ${name:e1[:e2]}. If VARNAME + is `@', use the positional parameters; otherwise, use the value of + VARNAME. If VARNAME is an array variable, use the array elements. */ + +static char * +parameter_brace_substring (varname, value, substr, quoted) + char *varname, *value, *substr; + int quoted; +{ + intmax_t e1, e2; + int vtype, r, starsub; + char *temp, *val, *tt; + SHELL_VAR *v; + + if (value == 0) + return ((char *)NULL); + + this_command_name = varname; + + vtype = get_var_and_type (varname, value, quoted, &v, &val); + if (vtype == -1) + return ((char *)NULL); + + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + + r = verify_substring_values (val, substr, vtype, &e1, &e2); + if (r <= 0) + return ((r == 0) ? &expand_param_error : (char *)NULL); + + switch (vtype) + { + case VT_VARIABLE: + case VT_ARRAYMEMBER: +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1) + tt = mb_substring (val, e1, e2); + else +#endif + tt = substring (val, e1, e2); + + if (vtype == VT_VARIABLE) + FREE (val); + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + temp = quote_string (tt); + else + temp = tt ? quote_escapes (tt) : (char *)NULL; + FREE (tt); + break; + case VT_POSPARMS: + tt = pos_params (varname, e1, e2, quoted); + if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0) + { + temp = tt ? quote_escapes (tt) : (char *)NULL; + FREE (tt); + } + else + temp = tt; + break; +#if defined (ARRAY_VARS) + case VT_ARRAYVAR: + /* We want E2 to be the number of elements desired (arrays can be sparse, + so verify_substring_values just returns the numbers specified and we + rely on array_subrange to understand how to deal with them). */ + tt = array_subrange (array_cell (v), e1, e2, starsub, quoted); + if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0) + { + temp = tt ? quote_escapes (tt) : (char *)NULL; + FREE (tt); + } + else + temp = tt; + break; +#endif + default: + temp = (char *)NULL; + } + + return temp; +} + +/****************************************************************/ +/* */ +/* Functions to perform pattern substitution on variable values */ +/* */ +/****************************************************************/ + +char * +pat_subst (string, pat, rep, mflags) + char *string, *pat, *rep; + int mflags; +{ + char *ret, *s, *e, *str; + int rsize, rptr, l, replen, mtype; + + mtype = mflags & MATCH_TYPEMASK; + + /* Special cases: + * 1. A null pattern with mtype == MATCH_BEG means to prefix STRING + * with REP and return the result. + * 2. A null pattern with mtype == MATCH_END means to append REP to + * STRING and return the result. + */ + if ((pat == 0 || *pat == 0) && (mtype == MATCH_BEG || mtype == MATCH_END)) + { + replen = STRLEN (rep); + l = strlen (string); + ret = (char *)xmalloc (replen + l + 2); + if (replen == 0) + strcpy (ret, string); + else if (mtype == MATCH_BEG) + { + strcpy (ret, rep); + strcpy (ret + replen, string); + } + else + { + strcpy (ret, string); + strcpy (ret + l, rep); + } + return (ret); + } + + ret = (char *)xmalloc (rsize = 64); + ret[0] = '\0'; + + for (replen = STRLEN (rep), rptr = 0, str = string;;) + { + if (match_pattern (str, pat, mtype, &s, &e) == 0) + break; + l = s - str; + RESIZE_MALLOCED_BUFFER (ret, rptr, (l + replen), rsize, 64); + + /* OK, now copy the leading unmatched portion of the string (from + str to s) to ret starting at rptr (the current offset). Then copy + the replacement string at ret + rptr + (s - str). Increment + rptr (if necessary) and str and go on. */ + if (l) + { + strncpy (ret + rptr, str, l); + rptr += l; + } + if (replen) + { + strncpy (ret + rptr, rep, replen); + rptr += replen; + } + str = e; /* e == end of match */ + + if (((mflags & MATCH_GLOBREP) == 0) || mtype != MATCH_ANY) + break; + + if (s == e) + e++, str++; /* avoid infinite recursion on zero-length match */ + } + + /* Now copy the unmatched portion of the input string */ + if (*str) + { + RESIZE_MALLOCED_BUFFER (ret, rptr, STRLEN(str) + 1, rsize, 64); + strcpy (ret + rptr, str); + } + else + ret[rptr] = '\0'; + + return ret; +} + +/* Do pattern match and replacement on the positional parameters. */ +static char * +pos_params_pat_subst (string, pat, rep, mflags) + char *string, *pat, *rep; + int mflags; +{ + WORD_LIST *save, *params; + WORD_DESC *w; + char *ret, *tt; + + save = params = list_rest_of_args (); + if (save == 0) + return ((char *)NULL); + + for ( ; params; params = params->next) + { + ret = pat_subst (params->word->word, pat, rep, mflags); +#if 0 + w = make_bare_word (ret); + FREE (ret); +#else + w = alloc_word_desc (); + w->word = ret ? ret : savestring (""); +#endif + dispose_word (params->word); + params->word = w; + } + + if ((mflags & (MATCH_QUOTED|MATCH_STARSUB)) == (MATCH_QUOTED|MATCH_STARSUB)) + ret = string_list_dollar_star (quote_list (save)); + else + ret = string_list ((mflags & MATCH_QUOTED) ? quote_list (save) : save); + dispose_words (save); + + return (ret); +} + +/* Perform pattern substitution on VALUE, which is the expansion of + VARNAME. PATSUB is an expression supplying the pattern to match + and the string to substitute. QUOTED is a flags word containing + the type of quoting currently in effect. */ +static char * +parameter_brace_patsub (varname, value, patsub, quoted) + char *varname, *value, *patsub; + int quoted; +{ + int vtype, mflags, starsub; + char *val, *temp, *pat, *rep, *p, *lpatsub, *tt; + SHELL_VAR *v; + + if (value == 0) + return ((char *)NULL); + + this_command_name = varname; + + vtype = get_var_and_type (varname, value, quoted, &v, &val); + if (vtype == -1) + return ((char *)NULL); + + starsub = vtype & VT_STARSUB; + vtype &= ~VT_STARSUB; + + mflags = 0; + if (*patsub == '/') + { + mflags |= MATCH_GLOBREP; + patsub++; + } + + /* Malloc this because expand_string_if_necessary or one of the expansion + functions in its call chain may free it on a substitution error. */ + lpatsub = savestring (patsub); + + if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + mflags |= MATCH_QUOTED; + + if (starsub) + mflags |= MATCH_STARSUB; + + if (rep = quoted_strchr (lpatsub, '/', ST_BACKSL)) + *rep++ = '\0'; + else + rep = (char *)NULL; + + if (rep && *rep == '\0') + rep = (char *)NULL; + + /* Perform the same expansions on the pattern as performed by the + pattern removal expansions. */ + pat = getpattern (lpatsub, quoted, 1); + + if (rep) + { + if ((mflags & MATCH_QUOTED) == 0) + rep = expand_string_if_necessary (rep, quoted, expand_string_unsplit); + else + rep = expand_string_to_string_internal (rep, quoted, expand_string_unsplit); + } + + p = pat; + if (pat && pat[0] == '#') + { + mflags |= MATCH_BEG; + p++; + } + else if (pat && pat[0] == '%') + { + mflags |= MATCH_END; + p++; + } + else + mflags |= MATCH_ANY; + + /* OK, we now want to substitute REP for PAT in VAL. If + flags & MATCH_GLOBREP is non-zero, the substitution is done + everywhere, otherwise only the first occurrence of PAT is + replaced. The pattern matching code doesn't understand + CTLESC quoting CTLESC and CTLNUL so we use the dequoted variable + values passed in (VT_VARIABLE) so the pattern substitution + code works right. We need to requote special chars after + we're done for VT_VARIABLE and VT_ARRAYMEMBER, and for the + other cases if QUOTED == 0, since the posparams and arrays + indexed by * or @ do special things when QUOTED != 0. */ + + switch (vtype) + { + case VT_VARIABLE: + case VT_ARRAYMEMBER: + temp = pat_subst (val, p, rep, mflags); + if (vtype == VT_VARIABLE) + FREE (val); + if (temp) + { + tt = quote_escapes (temp); + free (temp); + temp = tt; + } + break; + case VT_POSPARMS: + temp = pos_params_pat_subst (val, p, rep, mflags); + if (temp && (mflags & MATCH_QUOTED) == 0) + { + tt = quote_escapes (temp); + free (temp); + temp = tt; + } + break; +#if defined (ARRAY_VARS) + case VT_ARRAYVAR: + temp = array_patsub (array_cell (v), p, rep, mflags); + if (temp && (mflags & MATCH_QUOTED) == 0) + { + tt = quote_escapes (temp); + free (temp); + temp = tt; + } + break; +#endif + } + + FREE (pat); + FREE (rep); + free (lpatsub); + + return temp; +} + +/****************************************************************/ +/* */ +/* Functions to perform parameter expansion on a string */ +/* */ +/****************************************************************/ + +/* ${[#][!]name[[:]#[#]%[%]-=?+[word][:e1[:e2]]]} */ +static WORD_DESC * +parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_dollar_at) + char *string; + int *indexp, quoted, *quoted_dollar_atp, *contains_dollar_at; +{ + int check_nullness, var_is_set, var_is_null, var_is_special; + int want_substring, want_indir, want_patsub; + char *name, *value, *temp, *temp1; + WORD_DESC *tdesc, *ret; + int t_index, sindex, c, tflag; + intmax_t number; + + value = (char *)NULL; + var_is_set = var_is_null = var_is_special = check_nullness = 0; + want_substring = want_indir = want_patsub = 0; + + sindex = *indexp; + t_index = ++sindex; + name = string_extract (string, &t_index, "#%:-=?+/}", EX_VARNAME); + + ret = 0; + tflag = 0; + + /* If the name really consists of a special variable, then make sure + that we have the entire name. We don't allow indirect references + to special variables except `#', `?', `@' and `*'. */ + if ((sindex == t_index && + (string[t_index] == '-' || + string[t_index] == '?' || + string[t_index] == '#')) || + (sindex == t_index - 1 && string[sindex] == '!' && + (string[t_index] == '#' || + string[t_index] == '?' || + string[t_index] == '@' || + string[t_index] == '*'))) + { + t_index++; + free (name); + temp1 = string_extract (string, &t_index, "#%:-=?+/}", 0); + name = (char *)xmalloc (3 + (strlen (temp1))); + *name = string[sindex]; + if (string[sindex] == '!') + { + /* indirect reference of $#, $?, $@, or $* */ + name[1] = string[sindex + 1]; + strcpy (name + 2, temp1); + } + else + strcpy (name + 1, temp1); + free (temp1); + } + sindex = t_index; + + /* Find out what character ended the variable name. Then + do the appropriate thing. */ + if (c = string[sindex]) + sindex++; + + /* If c is followed by one of the valid parameter expansion + characters, move past it as normal. If not, assume that + a substring specification is being given, and do not move + past it. */ + if (c == ':' && VALID_PARAM_EXPAND_CHAR (string[sindex])) + { + check_nullness++; + if (c = string[sindex]) + sindex++; + } + else if (c == ':' && string[sindex] != RBRACE) + want_substring = 1; + else if (c == '/' && string[sindex] != RBRACE) + want_patsub = 1; + + /* Catch the valid and invalid brace expressions that made it through the + tests above. */ + /* ${#-} is a valid expansion and means to take the length of $-. + Similarly for ${#?} and ${##}... */ + if (name[0] == '#' && name[1] == '\0' && check_nullness == 0 && + VALID_SPECIAL_LENGTH_PARAM (c) && string[sindex] == RBRACE) + { + name = (char *)xrealloc (name, 3); + name[1] = c; + name[2] = '\0'; + c = string[sindex++]; + } + + /* ...but ${#%}, ${#:}, ${#=}, ${#+}, and ${#/} are errors. */ + if (name[0] == '#' && name[1] == '\0' && check_nullness == 0 && + member (c, "%:=+/") && string[sindex] == RBRACE) + { + temp = (char *)NULL; + goto bad_substitution; + } + + /* Indirect expansion begins with a `!'. A valid indirect expansion is + either a variable name, one of the positional parameters or a special + variable that expands to one of the positional parameters. */ + want_indir = *name == '!' && + (legal_variable_starter ((unsigned char)name[1]) || DIGIT (name[1]) + || VALID_INDIR_PARAM (name[1])); + + /* Determine the value of this variable. */ + + /* Check for special variables, directly referenced. */ + if (SPECIAL_VAR (name, want_indir)) + var_is_special++; + + /* Check for special expansion things, like the length of a parameter */ + if (*name == '#' && name[1]) + { + /* If we are not pointing at the character just after the + closing brace, then we haven't gotten all of the name. + Since it begins with a special character, this is a bad + substitution. Also check NAME for validity before trying + to go on. */ + if (string[sindex - 1] != RBRACE || (valid_length_expression (name) == 0)) + { + temp = (char *)NULL; + goto bad_substitution; + } + + number = parameter_brace_expand_length (name); + free (name); + + *indexp = sindex; + if (number < 0) + return (&expand_wdesc_error); + else + { + ret = alloc_word_desc (); + ret->word = itos (number); + return ret; + } + } + + /* ${@} is identical to $@. */ + if (name[0] == '@' && name[1] == '\0') + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + + if (contains_dollar_at) + *contains_dollar_at = 1; + } + + /* Process ${!PREFIX*} expansion. */ + if (want_indir && string[sindex - 1] == RBRACE && + (string[sindex - 2] == '*' || string[sindex - 2] == '@') && + legal_variable_starter ((unsigned char) name[1])) + { + char **x; + WORD_LIST *xlist; + + temp1 = savestring (name + 1); + number = strlen (temp1); + temp1[number - 1] = '\0'; + x = all_variables_matching_prefix (temp1); + xlist = strvec_to_word_list (x, 0, 0); + if (string[sindex - 2] == '*') + temp = string_list_dollar_star (xlist); + else + { + temp = string_list_dollar_at (xlist, quoted); + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + } + free (x); + free (xlist); + free (temp1); + *indexp = sindex; + + ret = alloc_word_desc (); + ret->word = temp; + return ret; + } + +#if defined (ARRAY_VARS) + /* Process ${!ARRAY[@]} and ${!ARRAY[*]} expansion. */ /* [ */ + if (want_indir && string[sindex - 1] == RBRACE && + string[sindex - 2] == ']' && valid_array_reference (name+1)) + { + char *x, *x1; + + temp1 = savestring (name + 1); + x = array_variable_name (temp1, &x1, (int *)0); /* [ */ + FREE (x); + if (ALL_ELEMENT_SUB (x1[0]) && x1[1] == ']') + { + temp = array_keys (temp1, quoted); + if (x1[0] == '@') + { + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + } + + free (temp1); + *indexp = sindex; + + ret = alloc_word_desc (); + ret->word = temp; + return ret; + } + + free (temp1); + } +#endif /* ARRAY_VARS */ + + /* Make sure that NAME is valid before trying to go on. */ + if (valid_brace_expansion_word (want_indir ? name + 1 : name, + var_is_special) == 0) + { + temp = (char *)NULL; + goto bad_substitution; + } + + if (want_indir) + tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); + else + tdesc = parameter_brace_expand_word (name, var_is_special, quoted); + + if (tdesc) + { + temp = tdesc->word; + tflag = tdesc->flags; + dispose_word_desc (tdesc); + } + else + temp = (char *)0; + +#if defined (ARRAY_VARS) + if (valid_array_reference (name)) + chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at); +#endif + + var_is_set = temp != (char *)0; + var_is_null = check_nullness && (var_is_set == 0 || *temp == 0); + + /* Get the rest of the stuff inside the braces. */ + if (c && c != RBRACE) + { + /* Extract the contents of the ${ ... } expansion + according to the Posix.2 rules. */ + value = extract_dollar_brace_string (string, &sindex, quoted, 0); + if (string[sindex] == RBRACE) + sindex++; + else + goto bad_substitution; + } + else + value = (char *)NULL; + + *indexp = sindex; + + /* If this is a substring spec, process it and add the result. */ + if (want_substring) + { + temp1 = parameter_brace_substring (name, temp, value, quoted); + FREE (name); + FREE (value); + FREE (temp); + + if (temp1 == &expand_param_error) + return (&expand_wdesc_error); + else if (temp1 == &expand_param_fatal) + return (&expand_wdesc_fatal); + + ret = alloc_word_desc (); + ret->word = temp1; + return ret; + } + else if (want_patsub) + { + temp1 = parameter_brace_patsub (name, temp, value, quoted); + FREE (name); + FREE (value); + FREE (temp); + + if (temp1 == &expand_param_error) + return (&expand_wdesc_error); + else if (temp1 == &expand_param_fatal) + return (&expand_wdesc_fatal); + + ret = alloc_word_desc (); + ret->word = temp1; + return ret; + } + + /* Do the right thing based on which character ended the variable name. */ + switch (c) + { + default: + case '\0': + bad_substitution: + report_error (_("%s: bad substitution"), string ? string : "??"); + FREE (value); + FREE (temp); + free (name); + return &expand_wdesc_error; + + case RBRACE: + if (var_is_set == 0 && unbound_vars_is_error) + { + err_unboundvar (name); + FREE (value); + FREE (temp); + free (name); + last_command_exit_value = EXECUTION_FAILURE; + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); + } + break; + + case '#': /* ${param#[#]pattern} */ + case '%': /* ${param%[%]pattern} */ + if (value == 0 || *value == '\0' || temp == 0 || *temp == '\0') + { + FREE (value); + break; + } + temp1 = parameter_brace_remove_pattern (name, temp, value, c, quoted); + free (temp); + free (value); + temp = temp1; + break; + + case '-': + case '=': + case '?': + case '+': + if (var_is_set && var_is_null == 0) + { + /* If the operator is `+', we don't want the value of the named + variable for anything, just the value of the right hand side. */ + + if (c == '+') + { + /* XXX -- if we're double-quoted and the named variable is "$@", + we want to turn off any special handling of "$@" -- + we're not using it, so whatever is on the rhs applies. */ + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 0; + if (contains_dollar_at) + *contains_dollar_at = 0; + + FREE (temp); + if (value) + { + ret = parameter_brace_expand_rhs (name, value, c, + quoted, + quoted_dollar_atp, + contains_dollar_at); + /* XXX - fix up later, esp. noting presence of + W_HASQUOTEDNULL in ret->flags */ + free (value); + } + else + temp = (char *)NULL; + } + else + { + FREE (value); + } + /* Otherwise do nothing; just use the value in TEMP. */ + } + else /* VAR not set or VAR is NULL. */ + { + FREE (temp); + temp = (char *)NULL; + if (c == '=' && var_is_special) + { + report_error (_("$%s: cannot assign in this way"), name); + free (name); + free (value); + return &expand_wdesc_error; + } + else if (c == '?') + { + parameter_brace_expand_error (name, value); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); + } + else if (c != '+') + { + /* XXX -- if we're double-quoted and the named variable is "$@", + we want to turn off any special handling of "$@" -- + we're not using it, so whatever is on the rhs applies. */ + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) + *quoted_dollar_atp = 0; + if (contains_dollar_at) + *contains_dollar_at = 0; + + ret = parameter_brace_expand_rhs (name, value, c, quoted, + quoted_dollar_atp, + contains_dollar_at); + /* XXX - fix up later, esp. noting presence of + W_HASQUOTEDNULL in tdesc->flags */ + } + free (value); + } + + break; + } + free (name); + + if (ret == 0) + { + ret = alloc_word_desc (); + ret->flags = tflag; + ret->word = temp; + } + return (ret); +} + +/* Expand a single ${xxx} expansion. The braces are optional. When + the braces are used, parameter_brace_expand() does the work, + possibly calling param_expand recursively. */ +static WORD_DESC * +param_expand (string, sindex, quoted, expanded_something, + contains_dollar_at, quoted_dollar_at_p, had_quoted_null_p, + pflags) + char *string; + int *sindex, quoted, *expanded_something, *contains_dollar_at; + int *quoted_dollar_at_p, *had_quoted_null_p, pflags; +{ + char *temp, *temp1, uerror[3]; + int zindex, t_index, expok; + unsigned char c; + intmax_t number; + SHELL_VAR *var; + WORD_LIST *list; + WORD_DESC *tdesc, *ret; + int tflag; + + zindex = *sindex; + c = string[++zindex]; + + temp = (char *)NULL; + ret = tdesc = (WORD_DESC *)NULL; + tflag = 0; + + /* Do simple cases first. Switch on what follows '$'. */ + switch (c) + { + /* $0 .. $9? */ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + temp1 = dollar_vars[TODIGIT (c)]; + if (unbound_vars_is_error && temp1 == (char *)NULL) + { + uerror[0] = '$'; + uerror[1] = c; + uerror[2] = '\0'; + err_unboundvar (uerror); + last_command_exit_value = EXECUTION_FAILURE; + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); + } + if (temp1) + temp = (*temp1 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) + ? quote_string (temp1) + : quote_escapes (temp1); + else + temp = (char *)NULL; + + break; + + /* $$ -- pid of the invoking shell. */ + case '$': + temp = itos (dollar_dollar_pid); + break; + + /* $# -- number of positional parameters. */ + case '#': + temp = itos (number_of_args ()); + break; + + /* $? -- return value of the last synchronous command. */ + case '?': + temp = itos (last_command_exit_value); + break; + + /* $- -- flags supplied to the shell on invocation or by `set'. */ + case '-': + temp = which_set_flags (); + break; + + /* $! -- Pid of the last asynchronous command. */ + case '!': + /* If no asynchronous pids have been created, expand to nothing. + If `set -u' has been executed, and no async processes have + been created, this is an expansion error. */ + if (last_asynchronous_pid == NO_PID) + { + if (expanded_something) + *expanded_something = 0; + temp = (char *)NULL; + if (unbound_vars_is_error) + { + uerror[0] = '$'; + uerror[1] = c; + uerror[2] = '\0'; + err_unboundvar (uerror); + last_command_exit_value = EXECUTION_FAILURE; + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); + } + } + else + temp = itos (last_asynchronous_pid); + break; + + /* The only difference between this and $@ is when the arg is quoted. */ + case '*': /* `$*' */ + list = list_rest_of_args (); + + /* If there are no command-line arguments, this should just + disappear if there are other characters in the expansion, + even if it's quoted. */ + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && list == 0) + temp = (char *)NULL; + else if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + { + /* If we have "$*" we want to make a string of the positional + parameters, separated by the first character of $IFS, and + quote the whole string, including the separators. If IFS + is unset, the parameters are separated by ' '; if $IFS is + null, the parameters are concatenated. */ + temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list); + temp1 = quote_string (temp); + if (*temp == 0) + tflag |= W_HASQUOTEDNULL; + free (temp); + temp = temp1; + } + else + { + /* We check whether or not we're eventually going to split $* here, + for example when IFS is empty and we are processing the rhs of + an assignment statement. In that case, we don't separate the + arguments at all. Otherwise, if the $* is not quoted it is + identical to $@ */ +#if 1 +# if defined (HANDLE_MULTIBYTE) + if (expand_no_split_dollar_star && ifs_firstc[0] == 0) +# else + if (expand_no_split_dollar_star && ifs_firstc == 0) +# endif + temp = string_list_dollar_star (list); + else + temp = string_list_dollar_at (list, quoted); +#else + temp = string_list_dollar_at (list, quoted); +#endif + if (expand_no_split_dollar_star == 0 && contains_dollar_at) + *contains_dollar_at = 1; + } + + dispose_words (list); + break; + + /* When we have "$@" what we want is "$1" "$2" "$3" ... This + means that we have to turn quoting off after we split into + the individually quoted arguments so that the final split + on the first character of $IFS is still done. */ + case '@': /* `$@' */ + list = list_rest_of_args (); + + /* We want to flag the fact that we saw this. We can't turn + off quoting entirely, because other characters in the + string might need it (consider "\"$@\""), but we need some + way to signal that the final split on the first character + of $IFS should be done, even though QUOTED is 1. */ + if (quoted_dollar_at_p && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) + *quoted_dollar_at_p = 1; + if (contains_dollar_at) + *contains_dollar_at = 1; + + /* We want to separate the positional parameters with the first + character of $IFS in case $IFS is something other than a space. + We also want to make sure that splitting is done no matter what -- + according to POSIX.2, this expands to a list of the positional + parameters no matter what IFS is set to. */ + temp = string_list_dollar_at (list, quoted); + + dispose_words (list); + break; + + case LBRACE: + tdesc = parameter_brace_expand (string, &zindex, quoted, + quoted_dollar_at_p, + contains_dollar_at); + + /* Fix this later when parameter_brace_expand returns a WORD_DESC * */ + if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal) + return (tdesc); + temp = tdesc ? tdesc->word : (char *)0; + + /* XXX */ + /* Quoted nulls should be removed if there is anything else + in the string. */ + /* Note that we saw the quoted null so we can add one back at + the end of this function if there are no other characters + in the string, discard TEMP, and go on. The exception to + this is when we have "${@}" and $1 is '', since $@ needs + special handling. */ + /* XXX - fix this once parameter_brace_expand returns a WORD_DESC * */ +#if 0 + if (temp && QUOTED_NULL (temp)) +#else + if (tdesc && tdesc->word && (tdesc->flags & W_HASQUOTEDNULL) && QUOTED_NULL (temp)) +#endif + { + if (had_quoted_null_p) + *had_quoted_null_p = 1; + if (*quoted_dollar_at_p == 0) + { + free (temp); + tdesc->word = temp = (char *)NULL; + } + + } + + ret = tdesc; + goto return0; + + /* Do command or arithmetic substitution. */ + case LPAREN: + /* We have to extract the contents of this paren substitution. */ + t_index = zindex + 1; + temp = extract_command_subst (string, &t_index); + zindex = t_index; + + /* For Posix.2-style `$(( ))' arithmetic substitution, + extract the expression and pass it to the evaluator. */ + if (temp && *temp == LPAREN) + { + char *temp2; + temp1 = temp + 1; + temp2 = savestring (temp1); + t_index = strlen (temp2) - 1; + + if (temp2[t_index] != RPAREN) + { + free (temp2); + goto comsub; + } + + /* Cut off ending `)' */ + temp2[t_index] = '\0'; + + /* Expand variables found inside the expression. */ + temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); + free (temp2); + +arithsub: + /* No error messages. */ + this_command_name = (char *)NULL; + number = evalexp (temp1, &expok); + free (temp); + free (temp1); + if (expok == 0) + { + if (interactive_shell == 0 && posixly_correct) + { + last_command_exit_value = EXECUTION_FAILURE; + return (&expand_wdesc_fatal); + } + else + return (&expand_wdesc_error); + } + temp = itos (number); + break; + } + +comsub: + if (pflags & PF_NOCOMSUB) + /* we need zindex+1 because string[zindex] == RPAREN */ + temp1 = substring (string, *sindex, zindex+1); + else + temp1 = command_substitute (temp, quoted); + FREE (temp); + temp = temp1; + break; + + /* Do POSIX.2d9-style arithmetic substitution. This will probably go + away in a future bash release. */ + case '[': + /* Extract the contents of this arithmetic substitution. */ + t_index = zindex + 1; + temp = extract_arithmetic_subst (string, &t_index); + zindex = t_index; + + /* Do initial variable expansion. */ + temp1 = expand_string_if_necessary (temp, Q_DOUBLE_QUOTES, expand_string); + + goto arithsub; + + default: + /* Find the variable in VARIABLE_LIST. */ + temp = (char *)NULL; + + for (t_index = zindex; (c = string[zindex]) && legal_variable_char (c); zindex++) + ; + temp1 = (zindex > t_index) ? substring (string, t_index, zindex) : (char *)NULL; + + /* If this isn't a variable name, then just output the `$'. */ + if (temp1 == 0 || *temp1 == '\0') + { + FREE (temp1); + temp = (char *)xmalloc (2); + temp[0] = '$'; + temp[1] = '\0'; + if (expanded_something) + *expanded_something = 0; + goto return0; + } + + /* If the variable exists, return its value cell. */ + var = find_variable (temp1); + + if (var && invisible_p (var) == 0 && var_isset (var)) + { +#if defined (ARRAY_VARS) + if (array_p (var)) + { + temp = array_reference (array_cell (var), 0); + if (temp) + temp = (*temp && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) + ? quote_string (temp) + : quote_escapes (temp); + else if (unbound_vars_is_error) + goto unbound_variable; + } + else +#endif + { + temp = value_cell (var); + + temp = (*temp && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))) + ? quote_string (temp) + : quote_escapes (temp); + } + + free (temp1); + + goto return0; + } + + temp = (char *)NULL; + +unbound_variable: + if (unbound_vars_is_error) + err_unboundvar (temp1); + else + { + free (temp1); + goto return0; + } + + free (temp1); + last_command_exit_value = EXECUTION_FAILURE; + return ((unbound_vars_is_error && interactive_shell == 0) + ? &expand_wdesc_fatal + : &expand_wdesc_error); + } + + if (string[zindex]) + zindex++; + +return0: + *sindex = zindex; + + if (ret == 0) + { + ret = alloc_word_desc (); + ret->flags = tflag; /* XXX */ + ret->word = temp; + } + return ret; +} + +/* Make a word list which is the result of parameter and variable + expansion, command substitution, arithmetic substitution, and + quote removal of WORD. Return a pointer to a WORD_LIST which is + the result of the expansion. If WORD contains a null word, the + word list returned is also null. + + QUOTED contains flag values defined in shell.h. + + ISEXP is used to tell expand_word_internal that the word should be + treated as the result of an expansion. This has implications for + how IFS characters in the word are treated. + + CONTAINS_DOLLAR_AT and EXPANDED_SOMETHING are return values; when non-null + they point to an integer value which receives information about expansion. + CONTAINS_DOLLAR_AT gets non-zero if WORD contained "$@", else zero. + EXPANDED_SOMETHING get non-zero if WORD contained any parameter expansions, + else zero. + + This only does word splitting in the case of $@ expansion. In that + case, we split on ' '. */ + +/* Values for the local variable quoted_state. */ +#define UNQUOTED 0 +#define PARTIALLY_QUOTED 1 +#define WHOLLY_QUOTED 2 + +static WORD_LIST * +expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_something) + WORD_DESC *word; + int quoted, isexp; + int *contains_dollar_at; + int *expanded_something; +{ + WORD_LIST *list; + WORD_DESC *tword; + + /* The intermediate string that we build while expanding. */ + char *istring; + + /* The current size of the above object. */ + int istring_size; + + /* Index into ISTRING. */ + int istring_index; + + /* Temporary string storage. */ + char *temp, *temp1; + + /* The text of WORD. */ + register char *string; + + /* The size of STRING. */ + size_t string_size; + + /* The index into STRING. */ + int sindex; + + /* This gets 1 if we see a $@ while quoted. */ + int quoted_dollar_at; + + /* One of UNQUOTED, PARTIALLY_QUOTED, or WHOLLY_QUOTED, depending on + whether WORD contains no quoting characters, a partially quoted + string (e.g., "xx"ab), or is fully quoted (e.g., "xxab"). */ + int quoted_state; + + /* State flags */ + int had_quoted_null; + int has_dollar_at; + int tflag; + + int assignoff; /* If assignment, offset of `=' */ + + register unsigned char c; /* Current character. */ + int t_index; /* For calls to string_extract_xxx. */ + + char twochars[2]; + + DECLARE_MBSTATE; + + istring = (char *)xmalloc (istring_size = DEFAULT_INITIAL_ARRAY_SIZE); + istring[istring_index = 0] = '\0'; + quoted_dollar_at = had_quoted_null = has_dollar_at = 0; + quoted_state = UNQUOTED; + + string = word->word; + if (string == 0) + goto finished_with_string; + /* Don't need the string length for the SADD... and COPY_ macros unless + multibyte characters are possible. */ + string_size = (MB_CUR_MAX > 1) ? strlen (string) : 1; + + if (contains_dollar_at) + *contains_dollar_at = 0; + + assignoff = -1; + + /* Begin the expansion. */ + + for (sindex = 0; ;) + { + c = string[sindex]; + + /* Case on toplevel character. */ + switch (c) + { + case '\0': + goto finished_with_string; + + case CTLESC: + sindex++; +#if HANDLE_MULTIBYTE + if (MB_CUR_MAX > 1 && string[sindex]) + { + SADD_MBQCHAR_BODY(temp, string, sindex, string_size); + } + else +#endif + { + temp = (char *)xmalloc (3); + temp[0] = CTLESC; + temp[1] = c = string[sindex]; + temp[2] = '\0'; + } + +dollar_add_string: + if (string[sindex]) + sindex++; + +add_string: + if (temp) + { + istring = sub_append_string (temp, istring, &istring_index, &istring_size); + temp = (char *)0; + } + + break; + +#if defined (PROCESS_SUBSTITUTION) + /* Process substitution. */ + case '<': + case '>': + { + if (string[++sindex] != LPAREN || (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || posixly_correct) + { + sindex--; /* add_character: label increments sindex */ + goto add_character; + } + else + t_index = sindex + 1; /* skip past both '<' and LPAREN */ + + temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index); /*))*/ + sindex = t_index; + + /* If the process substitution specification is `<()', we want to + open the pipe for writing in the child and produce output; if + it is `>()', we want to open the pipe for reading in the child + and consume input. */ + temp = temp1 ? process_substitute (temp1, (c == '>')) : (char *)0; + + FREE (temp1); + + goto dollar_add_string; + } +#endif /* PROCESS_SUBSTITUTION */ + + case '=': + /* Posix.2 section 3.6.1 says that tildes following `=' in words + which are not assignment statements are not expanded. If the + shell isn't in posix mode, though, we perform tilde expansion + on `likely candidate' unquoted assignment statements (flags + include W_ASSIGNMENT but not W_QUOTED). A likely candidate + contains an unquoted :~ or =~. Something to think about: we + now have a flag that says to perform tilde expansion on arguments + to `assignment builtins' like declare and export that look like + assignment statements. We now do tilde expansion on such words + even in POSIX mode. */ + if (word->flags & (W_ASSIGNRHS|W_NOTILDE)) + goto add_character; + /* If we're not in posix mode or forcing assignment-statement tilde + expansion, note where the `=' appears in the word and prepare to + do tilde expansion following the first `='. */ + if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + assignoff == -1 && sindex > 0) + assignoff = sindex; + if (sindex == assignoff && string[sindex+1] == '~') /* XXX */ + word->flags |= W_ITILDE; +#if 0 + else if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + string[sindex+1] == '~') + word->flags |= W_ITILDE; +#endif + goto add_character; + + case ':': + if (word->flags & W_NOTILDE) + goto add_character; + if ((word->flags & (W_ASSIGNMENT|W_ASSIGNRHS)) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP)) && + string[sindex+1] == '~') + word->flags |= W_ITILDE; + goto add_character; + + case '~': + /* If the word isn't supposed to be tilde expanded, or we're not + at the start of a word or after an unquoted : or = in an + assignment statement, we don't do tilde expansion. */ + if ((word->flags & W_NOTILDE) || + (sindex > 0 && ((word->flags & W_ITILDE) == 0)) || + (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + { + word->flags &= ~W_ITILDE; + goto add_character; + } + + if (word->flags & W_ASSIGNRHS) + tflag = 2; + else if ((word->flags & W_ASSIGNMENT) && + (posixly_correct == 0 || (word->flags & W_TILDEEXP))) + tflag = 1; + else + tflag = 0; + + temp = bash_tilde_find_word (string + sindex, tflag, &t_index); + + word->flags &= ~W_ITILDE; + + if (temp && *temp && t_index > 0) + { + temp1 = bash_tilde_expand (temp, tflag); + free (temp); + temp = temp1; + sindex += t_index; + goto add_string; + } + else + { + FREE (temp); + goto add_character; + } + + case '$': + if (expanded_something) + *expanded_something = 1; + + has_dollar_at = 0; + tword = param_expand (string, &sindex, quoted, expanded_something, + &has_dollar_at, "ed_dollar_at, + &had_quoted_null, + (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0); + + if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal) + { + free (string); + free (istring); + return ((tword == &expand_wdesc_error) ? &expand_word_error + : &expand_word_fatal); + } + if (contains_dollar_at && has_dollar_at) + *contains_dollar_at = 1; + + if (tword && (tword->flags & W_HASQUOTEDNULL)) + had_quoted_null = 1; + + temp = tword->word; + dispose_word_desc (tword); + + goto add_string; + break; + + case '`': /* Backquoted command substitution. */ + { + t_index = sindex++; + + if (expanded_something) + *expanded_something = 1; + + temp = string_extract (string, &sindex, "`", 0); + if (word->flags & W_NOCOMSUB) + /* sindex + 1 because string[sindex] == '`' */ + temp1 = substring (string, t_index, sindex + 1); + else + { + de_backslash (temp); + temp1 = command_substitute (temp, quoted); + } + FREE (temp); + temp = temp1; + goto dollar_add_string; + } + + case '\\': + if (string[sindex + 1] == '\n') + { + sindex += 2; + continue; + } + + c = string[++sindex]; + + if (quoted & Q_HERE_DOCUMENT) + tflag = CBSHDOC; + else if (quoted & Q_DOUBLE_QUOTES) + tflag = CBSDQUOTE; + else + tflag = 0; + + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && ((sh_syntaxtab[c] & tflag) == 0)) + { + SCOPY_CHAR_I (twochars, '\\', c, string, sindex, string_size); + } + else if (c == 0) + { + c = CTLNUL; + sindex--; /* add_character: label increments sindex */ + goto add_character; + } + else + { + SCOPY_CHAR_I (twochars, CTLESC, c, string, sindex, string_size); + } + + sindex++; +add_twochars: + /* BEFORE jumping here, we need to increment sindex if appropriate */ + RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, + DEFAULT_ARRAY_SIZE); + istring[istring_index++] = twochars[0]; + istring[istring_index++] = twochars[1]; + istring[istring_index] = '\0'; + + break; + + case '"': + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + goto add_character; + + t_index = ++sindex; + temp = string_extract_double_quoted (string, &sindex, 0); + + /* If the quotes surrounded the entire string, then the + whole word was quoted. */ + quoted_state = (t_index == 1 && string[sindex] == '\0') + ? WHOLLY_QUOTED + : PARTIALLY_QUOTED; + + if (temp && *temp) + { + tword = alloc_word_desc (); + tword->word = temp; + + temp = (char *)NULL; + + has_dollar_at = 0; + /* Need to get W_HASQUOTEDNULL flag through this function. */ + list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL); + + if (list == &expand_word_error || list == &expand_word_fatal) + { + free (istring); + free (string); + /* expand_word_internal has already freed temp_word->word + for us because of the way it prints error messages. */ + tword->word = (char *)NULL; + dispose_word (tword); + return list; + } + + dispose_word (tword); + + /* "$@" (a double-quoted dollar-at) expands into nothing, + not even a NULL word, when there are no positional + parameters. */ + if (list == 0 && has_dollar_at) + { + quoted_dollar_at++; + break; + } + + /* If we get "$@", we know we have expanded something, so we + need to remember it for the final split on $IFS. This is + a special case; it's the only case where a quoted string + can expand into more than one word. It's going to come back + from the above call to expand_word_internal as a list with + a single word, in which all characters are quoted and + separated by blanks. What we want to do is to turn it back + into a list for the next piece of code. */ + if (list) + dequote_list (list); + + if (list && list->word && (list->word->flags & W_HASQUOTEDNULL)) + had_quoted_null = 1; + + if (has_dollar_at) + { + quoted_dollar_at++; + if (contains_dollar_at) + *contains_dollar_at = 1; + if (expanded_something) + *expanded_something = 1; + } + } + else + { + /* What we have is "". This is a minor optimization. */ + FREE (temp); + list = (WORD_LIST *)NULL; + } + + /* The code above *might* return a list (consider the case of "$@", + where it returns "$1", "$2", etc.). We can't throw away the + rest of the list, and we have to make sure each word gets added + as quoted. We test on tresult->next: if it is non-NULL, we + quote the whole list, save it to a string with string_list, and + add that string. We don't need to quote the results of this + (and it would be wrong, since that would quote the separators + as well), so we go directly to add_string. */ + if (list) + { + if (list->next) + { + /* Testing quoted_dollar_at makes sure that "$@" is + split correctly when $IFS does not contain a space. */ + temp = quoted_dollar_at + ? string_list_dollar_at (list, Q_DOUBLE_QUOTES) + : string_list (quote_list (list)); + dispose_words (list); + goto add_string; + } + else + { + temp = savestring (list->word->word); + tflag = list->word->flags; + dispose_words (list); + + /* If the string is not a quoted null string, we want + to remove any embedded unquoted CTLNUL characters. + We do not want to turn quoted null strings back into + the empty string, though. We do this because we + want to remove any quoted nulls from expansions that + contain other characters. For example, if we have + x"$*"y or "x$*y" and there are no positional parameters, + the $* should expand into nothing. */ + /* We use the W_HASQUOTEDNULL flag to differentiate the + cases: a quoted null character as above and when + CTLNUL is contained in the (non-null) expansion + of some variable. We use the had_quoted_null flag to + pass the value through this function to its caller. */ + if ((tflag & W_HASQUOTEDNULL) && QUOTED_NULL (temp) == 0) + remove_quoted_nulls (temp); /* XXX */ + } + } + else + temp = (char *)NULL; + + /* We do not want to add quoted nulls to strings that are only + partially quoted; we can throw them away. */ + if (temp == 0 && quoted_state == PARTIALLY_QUOTED) + continue; + + add_quoted_string: + + if (temp) + { + temp1 = temp; + temp = quote_string (temp); + free (temp1); + goto add_string; + } + else + { + /* Add NULL arg. */ + c = CTLNUL; + sindex--; /* add_character: label increments sindex */ + goto add_character; + } + + /* break; */ + + case '\'': + if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) + goto add_character; + + t_index = ++sindex; + temp = string_extract_single_quoted (string, &sindex); + + /* If the entire STRING was surrounded by single quotes, + then the string is wholly quoted. */ + quoted_state = (t_index == 1 && string[sindex] == '\0') + ? WHOLLY_QUOTED + : PARTIALLY_QUOTED; + + /* If all we had was '', it is a null expansion. */ + if (*temp == '\0') + { + free (temp); + temp = (char *)NULL; + } + else + remove_quoted_escapes (temp); /* ??? */ + + /* We do not want to add quoted nulls to strings that are only + partially quoted; such nulls are discarded. */ + if (temp == 0 && (quoted_state == PARTIALLY_QUOTED)) + continue; + + /* If we have a quoted null expansion, add a quoted NULL to istring. */ + if (temp == 0) + { + c = CTLNUL; + sindex--; /* add_character: label increments sindex */ + goto add_character; + } + else + goto add_quoted_string; + + /* break; */ + + default: + /* This is the fix for " $@ " */ + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (isexp == 0 && isifs (c))) + { + if (string[sindex]) /* from old goto dollar_add_string */ + sindex++; + if (c == 0) + { + c = CTLNUL; + goto add_character; + } + else + { +#if HANDLE_MULTIBYTE + if (MB_CUR_MAX > 1) + sindex--; + + if (MB_CUR_MAX > 1) + { + SADD_MBQCHAR_BODY(temp, string, sindex, string_size); + } + else +#endif + { + twochars[0] = CTLESC; + twochars[1] = c; + goto add_twochars; + } + } + } + + SADD_MBCHAR (temp, string, sindex, string_size); + + add_character: + RESIZE_MALLOCED_BUFFER (istring, istring_index, 1, istring_size, + DEFAULT_ARRAY_SIZE); + istring[istring_index++] = c; + istring[istring_index] = '\0'; + + /* Next character. */ + sindex++; + } + } + +finished_with_string: + /* OK, we're ready to return. If we have a quoted string, and + quoted_dollar_at is not set, we do no splitting at all; otherwise + we split on ' '. The routines that call this will handle what to + do if nothing has been expanded. */ + + /* Partially and wholly quoted strings which expand to the empty + string are retained as an empty arguments. Unquoted strings + which expand to the empty string are discarded. The single + exception is the case of expanding "$@" when there are no + positional parameters. In that case, we discard the expansion. */ + + /* Because of how the code that handles "" and '' in partially + quoted strings works, we need to make ISTRING into a QUOTED_NULL + if we saw quoting characters, but the expansion was empty. + "" and '' are tossed away before we get to this point when + processing partially quoted strings. This makes "" and $xxx"" + equivalent when xxx is unset. We also look to see whether we + saw a quoted null from a ${} expansion and add one back if we + need to. */ + + /* If we expand to nothing and there were no single or double quotes + in the word, we throw it away. Otherwise, we return a NULL word. + The single exception is for $@ surrounded by double quotes when + there are no positional parameters. In that case, we also throw + the word away. */ + + if (*istring == '\0') + { + if (quoted_dollar_at == 0 && (had_quoted_null || quoted_state == PARTIALLY_QUOTED)) + { + istring[0] = CTLNUL; + istring[1] = '\0'; + tword = make_bare_word (istring); + tword->flags |= W_HASQUOTEDNULL; /* XXX */ + list = make_word_list (tword, (WORD_LIST *)NULL); + if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + tword->flags |= W_QUOTED; + } + /* According to sh, ksh, and Posix.2, if a word expands into nothing + and a double-quoted "$@" appears anywhere in it, then the entire + word is removed. */ + else if (quoted_state == UNQUOTED || quoted_dollar_at) + list = (WORD_LIST *)NULL; +#if 0 + else + { + tword = make_bare_word (istring); + if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + tword->flags |= W_QUOTED; + list = make_word_list (tword, (WORD_LIST *)NULL); + } +#else + else + list = (WORD_LIST *)NULL; +#endif + } + else if (word->flags & W_NOSPLIT) + { + tword = make_bare_word (istring); + if (word->flags & W_ASSIGNMENT) + tword->flags |= W_ASSIGNMENT; /* XXX */ + if (word->flags & W_COMPASSIGN) + tword->flags |= W_COMPASSIGN; /* XXX */ + if (word->flags & W_NOGLOB) + tword->flags |= W_NOGLOB; /* XXX */ + if (word->flags & W_NOEXPAND) + tword->flags |= W_NOEXPAND; /* XXX */ + if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) + tword->flags |= W_QUOTED; + if (had_quoted_null) + tword->flags |= W_HASQUOTEDNULL; + list = make_word_list (tword, (WORD_LIST *)NULL); + } + else + { + char *ifs_chars; + + ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char *)NULL; + + /* If we have $@, we need to split the results no matter what. If + IFS is unset or NULL, string_list_dollar_at has separated the + positional parameters with a space, so we split on space (we have + set ifs_chars to " \t\n" above if ifs is unset). If IFS is set, + string_list_dollar_at has separated the positional parameters + with the first character of $IFS, so we split on $IFS. */ + if (has_dollar_at && ifs_chars) + list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1); + else + { + tword = make_bare_word (istring); + if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED)) + tword->flags |= W_QUOTED; + if (word->flags & W_ASSIGNMENT) + tword->flags |= W_ASSIGNMENT; + if (word->flags & W_COMPASSIGN) + tword->flags |= W_COMPASSIGN; + if (word->flags & W_NOGLOB) + tword->flags |= W_NOGLOB; + if (word->flags & W_NOEXPAND) + tword->flags |= W_NOEXPAND; + if (had_quoted_null) + tword->flags |= W_HASQUOTEDNULL; /* XXX */ + list = make_word_list (tword, (WORD_LIST *)NULL); + } + } + + free (istring); + return (list); +} + +/* **************************************************************** */ +/* */ +/* Functions for Quote Removal */ +/* */ +/* **************************************************************** */ + +/* Perform quote removal on STRING. If QUOTED > 0, assume we are obeying the + backslash quoting rules for within double quotes or a here document. */ +char * +string_quote_removal (string, quoted) + char *string; + int quoted; +{ + size_t slen; + char *r, *result_string, *temp, *send; + int sindex, tindex, dquote; + unsigned char c; + DECLARE_MBSTATE; + + /* The result can be no longer than the original string. */ + slen = strlen (string); + send = string + slen; + + r = result_string = (char *)xmalloc (slen + 1); + + for (dquote = sindex = 0; c = string[sindex];) + { + switch (c) + { + case '\\': + c = string[++sindex]; + if (((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || dquote) && (sh_syntaxtab[c] & CBSDQUOTE) == 0) + *r++ = '\\'; + /* FALLTHROUGH */ + + default: + SCOPY_CHAR_M (r, string, send, sindex); + break; + + case '\'': + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || dquote) + { + *r++ = c; + sindex++; + break; + } + tindex = sindex + 1; + temp = string_extract_single_quoted (string, &tindex); + if (temp) + { + strcpy (r, temp); + r += strlen (r); + free (temp); + } + sindex = tindex; + break; + + case '"': + dquote = 1 - dquote; + sindex++; + break; + } + } + *r = '\0'; + return (result_string); +} + +#if 0 +/* UNUSED */ +/* Perform quote removal on word WORD. This allocates and returns a new + WORD_DESC *. */ +WORD_DESC * +word_quote_removal (word, quoted) + WORD_DESC *word; + int quoted; +{ + WORD_DESC *w; + char *t; + + t = string_quote_removal (word->word, quoted); + w = alloc_word_desc (); + w->word = t ? t : savestring (""); + return (w); +} + +/* Perform quote removal on all words in LIST. If QUOTED is non-zero, + the members of the list are treated as if they are surrounded by + double quotes. Return a new list, or NULL if LIST is NULL. */ +WORD_LIST * +word_list_quote_removal (list, quoted) + WORD_LIST *list; + int quoted; +{ + WORD_LIST *result, *t, *tresult, *e; + + for (t = list, result = (WORD_LIST *)NULL; t; t = t->next) + { + tresult = make_word_list (word_quote_removal (t->word, quoted), (WORD_LIST *)NULL); +#if 0 + result = (WORD_LIST *) list_append (result, tresult); +#else + if (result == 0) + result = e = tresult; + else + { + e->next = tresult; + while (e->next) + e = e->next; + } +#endif + } + return (result); +} +#endif + +/******************************************* + * * + * Functions to perform word splitting * + * * + *******************************************/ + +void +setifs (v) + SHELL_VAR *v; +{ + char *t; + unsigned char uc; + + ifs_var = v; + ifs_value = v ? value_cell (v) : " \t\n"; + + /* Should really merge ifs_cmap with sh_syntaxtab. XXX - doesn't yet + handle multibyte chars in IFS */ + memset (ifs_cmap, '\0', sizeof (ifs_cmap)); + for (t = ifs_value ; t && *t; t++) + { + uc = *t; + ifs_cmap[uc] = 1; + } + +#if defined (HANDLE_MULTIBYTE) + if (ifs_value == 0) + { + ifs_firstc[0] = '\0'; + ifs_firstc_len = 1; + } + else + { + size_t ifs_len; + ifs_len = strnlen (ifs_value, MB_CUR_MAX); + ifs_firstc_len = MBLEN (ifs_value, ifs_len); + if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len)) + { + ifs_firstc[0] = ifs_value[0]; + ifs_firstc[1] = '\0'; + ifs_firstc_len = 1; + } + else + memcpy (ifs_firstc, ifs_value, ifs_firstc_len); + } +#else + ifs_firstc = ifs_value ? *ifs_value : 0; +#endif +} + +char * +getifs () +{ + return ifs_value; +} + +/* This splits a single word into a WORD LIST on $IFS, but only if the word + is not quoted. list_string () performs quote removal for us, even if we + don't do any splitting. */ +WORD_LIST * +word_split (w, ifs_chars) + WORD_DESC *w; + char *ifs_chars; +{ + WORD_LIST *result; + + if (w) + { + char *xifs; + + xifs = ((w->flags & W_QUOTED) || ifs_chars == 0) ? "" : ifs_chars; + result = list_string (w->word, xifs, w->flags & W_QUOTED); + } + else + result = (WORD_LIST *)NULL; + + return (result); +} + +/* Perform word splitting on LIST and return the RESULT. It is possible + to return (WORD_LIST *)NULL. */ +static WORD_LIST * +word_list_split (list) + WORD_LIST *list; +{ + WORD_LIST *result, *t, *tresult, *e; + + for (t = list, result = (WORD_LIST *)NULL; t; t = t->next) + { + tresult = word_split (t->word, ifs_value); +#if 0 + result = (WORD_LIST *) list_append (result, tresult); +#else + if (result == 0) + result = e = tresult; + else + { + e->next = tresult; + while (e->next) + e = e->next; + } +#endif + } + return (result); +} + +/************************************************** + * * + * Functions to expand an entire WORD_LIST * + * * + **************************************************/ + +/* Do any word-expansion-specific cleanup and jump to top_level */ +static void +exp_jump_to_top_level (v) + int v; +{ + /* Cleanup code goes here. */ + expand_no_split_dollar_star = 0; /* XXX */ + expanding_redir = 0; + + jump_to_top_level (v); +} + +/* Put NLIST (which is a WORD_LIST * of only one element) at the front of + ELIST, and set ELIST to the new list. */ +#define PREPEND_LIST(nlist, elist) \ + do { nlist->next = elist; elist = nlist; } while (0) + +/* Separate out any initial variable assignments from TLIST. If set -k has + been executed, remove all assignment statements from TLIST. Initial + variable assignments and other environment assignments are placed + on SUBST_ASSIGN_VARLIST. */ +static WORD_LIST * +separate_out_assignments (tlist) + WORD_LIST *tlist; +{ + register WORD_LIST *vp, *lp; + + if (!tlist) + return ((WORD_LIST *)NULL); + + if (subst_assign_varlist) + dispose_words (subst_assign_varlist); /* Clean up after previous error */ + + subst_assign_varlist = (WORD_LIST *)NULL; + vp = lp = tlist; + + /* Separate out variable assignments at the start of the command. + Loop invariant: vp->next == lp + Loop postcondition: + lp = list of words left after assignment statements skipped + tlist = original list of words + */ + while (lp && (lp->word->flags & W_ASSIGNMENT)) + { + vp = lp; + lp = lp->next; + } + + /* If lp != tlist, we have some initial assignment statements. + We make SUBST_ASSIGN_VARLIST point to the list of assignment + words and TLIST point to the remaining words. */ + if (lp != tlist) + { + subst_assign_varlist = tlist; + /* ASSERT(vp->next == lp); */ + vp->next = (WORD_LIST *)NULL; /* terminate variable list */ + tlist = lp; /* remainder of word list */ + } + + /* vp == end of variable list */ + /* tlist == remainder of original word list without variable assignments */ + if (!tlist) + /* All the words in tlist were assignment statements */ + return ((WORD_LIST *)NULL); + + /* ASSERT(tlist != NULL); */ + /* ASSERT((tlist->word->flags & W_ASSIGNMENT) == 0); */ + + /* If the -k option is in effect, we need to go through the remaining + words, separate out the assignment words, and place them on + SUBST_ASSIGN_VARLIST. */ + if (place_keywords_in_env) + { + WORD_LIST *tp; /* tp == running pointer into tlist */ + + tp = tlist; + lp = tlist->next; + + /* Loop Invariant: tp->next == lp */ + /* Loop postcondition: tlist == word list without assignment statements */ + while (lp) + { + if (lp->word->flags & W_ASSIGNMENT) + { + /* Found an assignment statement, add this word to end of + subst_assign_varlist (vp). */ + if (!subst_assign_varlist) + subst_assign_varlist = vp = lp; + else + { + vp->next = lp; + vp = lp; + } + + /* Remove the word pointed to by LP from TLIST. */ + tp->next = lp->next; + /* ASSERT(vp == lp); */ + lp->next = (WORD_LIST *)NULL; + lp = tp->next; + } + else + { + tp = lp; + lp = lp->next; + } + } + } + return (tlist); +} + +#define WEXP_VARASSIGN 0x001 +#define WEXP_BRACEEXP 0x002 +#define WEXP_TILDEEXP 0x004 +#define WEXP_PARAMEXP 0x008 +#define WEXP_PATHEXP 0x010 + +/* All of the expansions, including variable assignments at the start of + the list. */ +#define WEXP_ALL (WEXP_VARASSIGN|WEXP_BRACEEXP|WEXP_TILDEEXP|WEXP_PARAMEXP|WEXP_PATHEXP) + +/* All of the expansions except variable assignments at the start of + the list. */ +#define WEXP_NOVARS (WEXP_BRACEEXP|WEXP_TILDEEXP|WEXP_PARAMEXP|WEXP_PATHEXP) + +/* All of the `shell expansions': brace expansion, tilde expansion, parameter + expansion, command substitution, arithmetic expansion, word splitting, and + quote removal. */ +#define WEXP_SHELLEXP (WEXP_BRACEEXP|WEXP_TILDEEXP|WEXP_PARAMEXP) + +/* Take the list of words in LIST and do the various substitutions. Return + a new list of words which is the expanded list, and without things like + variable assignments. */ + +WORD_LIST * +expand_words (list) + WORD_LIST *list; +{ + return (expand_word_list_internal (list, WEXP_ALL)); +} + +/* Same as expand_words (), but doesn't hack variable or environment + variables. */ +WORD_LIST * +expand_words_no_vars (list) + WORD_LIST *list; +{ + return (expand_word_list_internal (list, WEXP_NOVARS)); +} + +WORD_LIST * +expand_words_shellexp (list) + WORD_LIST *list; +{ + return (expand_word_list_internal (list, WEXP_SHELLEXP)); +} + +static WORD_LIST * +glob_expand_word_list (tlist, eflags) + WORD_LIST *tlist; + int eflags; +{ + char **glob_array, *temp_string; + register int glob_index; + WORD_LIST *glob_list, *output_list, *disposables, *next; + WORD_DESC *tword; + + output_list = disposables = (WORD_LIST *)NULL; + glob_array = (char **)NULL; + while (tlist) + { + /* For each word, either globbing is attempted or the word is + added to orig_list. If globbing succeeds, the results are + added to orig_list and the word (tlist) is added to the list + of disposable words. If globbing fails and failed glob + expansions are left unchanged (the shell default), the + original word is added to orig_list. If globbing fails and + failed glob expansions are removed, the original word is + added to the list of disposable words. orig_list ends up + in reverse order and requires a call to REVERSE_LIST to + be set right. After all words are examined, the disposable + words are freed. */ + next = tlist->next; + + /* If the word isn't an assignment and contains an unquoted + pattern matching character, then glob it. */ + if ((tlist->word->flags & W_NOGLOB) == 0 && + unquoted_glob_pattern_p (tlist->word->word)) + { + glob_array = shell_glob_filename (tlist->word->word); + + /* Handle error cases. + I don't think we should report errors like "No such file + or directory". However, I would like to report errors + like "Read failed". */ + + if (glob_array == 0 || GLOB_FAILED (glob_array)) + { + glob_array = (char **)xmalloc (sizeof (char *)); + glob_array[0] = (char *)NULL; + } + + /* Dequote the current word in case we have to use it. */ + if (glob_array[0] == NULL) + { + temp_string = dequote_string (tlist->word->word); + free (tlist->word->word); + tlist->word->word = temp_string; + } + + /* Make the array into a word list. */ + glob_list = (WORD_LIST *)NULL; + for (glob_index = 0; glob_array[glob_index]; glob_index++) + { + tword = make_bare_word (glob_array[glob_index]); + tword->flags |= W_GLOBEXP; /* XXX */ + glob_list = make_word_list (tword, glob_list); + } + + if (glob_list) + { + output_list = (WORD_LIST *)list_append (glob_list, output_list); + PREPEND_LIST (tlist, disposables); + } + else if (fail_glob_expansion != 0) + { + report_error (_("no match: %s"), tlist->word->word); + jump_to_top_level (DISCARD); + } + else if (allow_null_glob_expansion == 0) + { + /* Failed glob expressions are left unchanged. */ + PREPEND_LIST (tlist, output_list); + } + else + { + /* Failed glob expressions are removed. */ + PREPEND_LIST (tlist, disposables); + } + } + else + { + /* Dequote the string. */ + temp_string = dequote_string (tlist->word->word); + free (tlist->word->word); + tlist->word->word = temp_string; + PREPEND_LIST (tlist, output_list); + } + + strvec_dispose (glob_array); + glob_array = (char **)NULL; + + tlist = next; + } + + if (disposables) + dispose_words (disposables); + + if (output_list) + output_list = REVERSE_LIST (output_list, WORD_LIST *); + + return (output_list); +} + +#if defined (BRACE_EXPANSION) +static WORD_LIST * +brace_expand_word_list (tlist, eflags) + WORD_LIST *tlist; + int eflags; +{ + register char **expansions; + char *temp_string; + WORD_LIST *disposables, *output_list, *next; + WORD_DESC *w; + int eindex; + + for (disposables = output_list = (WORD_LIST *)NULL; tlist; tlist = next) + { + next = tlist->next; + + /* Only do brace expansion if the word has a brace character. If + not, just add the word list element to BRACES and continue. In + the common case, at least when running shell scripts, this will + degenerate to a bunch of calls to `xstrchr', and then what is + basically a reversal of TLIST into BRACES, which is corrected + by a call to REVERSE_LIST () on BRACES when the end of TLIST + is reached. */ + if (xstrchr (tlist->word->word, LBRACE)) + { + expansions = brace_expand (tlist->word->word); + + for (eindex = 0; temp_string = expansions[eindex]; eindex++) + { + w = make_word (temp_string); + /* If brace expansion didn't change the word, preserve + the flags. We may want to preserve the flags + unconditionally someday -- XXX */ + if (STREQ (temp_string, tlist->word->word)) + w->flags = tlist->word->flags; + output_list = make_word_list (w, output_list); + free (expansions[eindex]); + } + free (expansions); + + /* Add TLIST to the list of words to be freed after brace + expansion has been performed. */ + PREPEND_LIST (tlist, disposables); + } + else + PREPEND_LIST (tlist, output_list); + } + + if (disposables) + dispose_words (disposables); + + if (output_list) + output_list = REVERSE_LIST (output_list, WORD_LIST *); + + return (output_list); +} +#endif + +static WORD_LIST * +shell_expand_word_list (tlist, eflags) + WORD_LIST *tlist; + int eflags; +{ + WORD_LIST *expanded, *orig_list, *new_list, *next, *temp_list; + int expanded_something, has_dollar_at; + char *temp_string; + + /* We do tilde expansion all the time. This is what 1003.2 says. */ + new_list = (WORD_LIST *)NULL; + for (orig_list = tlist; tlist; tlist = next) + { + temp_string = tlist->word->word; + + next = tlist->next; + +#if defined (ARRAY_VARS) + /* If this is a compound array assignment to a builtin that accepts + such assignments (e.g., `declare'), take the assignment and perform + it separately, handling the semantics of declarations inside shell + functions. This avoids the double-evaluation of such arguments, + because `declare' does some evaluation of compound assignments on + its own. */ + if ((tlist->word->flags & (W_COMPASSIGN|W_ASSIGNARG)) == (W_COMPASSIGN|W_ASSIGNARG)) + { + int t; + + t = do_word_assignment (tlist->word); + if (t == 0) + { + last_command_exit_value = EXECUTION_FAILURE; + exp_jump_to_top_level (DISCARD); + } + + /* Now transform the word as ksh93 appears to do and go on */ + t = assignment (tlist->word->word, 0); + tlist->word->word[t] = '\0'; + tlist->word->flags &= ~(W_ASSIGNMENT|W_NOSPLIT|W_COMPASSIGN|W_ASSIGNARG); + } +#endif + + expanded_something = 0; + expanded = expand_word_internal + (tlist->word, 0, 0, &has_dollar_at, &expanded_something); + + if (expanded == &expand_word_error || expanded == &expand_word_fatal) + { + /* By convention, each time this error is returned, + tlist->word->word has already been freed. */ + tlist->word->word = (char *)NULL; + + /* Dispose our copy of the original list. */ + dispose_words (orig_list); + /* Dispose the new list we're building. */ + dispose_words (new_list); + + last_command_exit_value = EXECUTION_FAILURE; + if (expanded == &expand_word_error) + exp_jump_to_top_level (DISCARD); + else + exp_jump_to_top_level (FORCE_EOF); + } + + /* Don't split words marked W_NOSPLIT. */ + if (expanded_something && (tlist->word->flags & W_NOSPLIT) == 0) + { + temp_list = word_list_split (expanded); + dispose_words (expanded); + } + else + { + /* If no parameter expansion, command substitution, process + substitution, or arithmetic substitution took place, then + do not do word splitting. We still have to remove quoted + null characters from the result. */ + word_list_remove_quoted_nulls (expanded); + temp_list = expanded; + } + + expanded = REVERSE_LIST (temp_list, WORD_LIST *); + new_list = (WORD_LIST *)list_append (expanded, new_list); + } + + if (orig_list) + dispose_words (orig_list); + + if (new_list) + new_list = REVERSE_LIST (new_list, WORD_LIST *); + + return (new_list); +} + +/* The workhorse for expand_words () and expand_words_no_vars (). + First arg is LIST, a WORD_LIST of words. + Second arg EFLAGS is a flags word controlling which expansions are + performed. + + This does all of the substitutions: brace expansion, tilde expansion, + parameter expansion, command substitution, arithmetic expansion, + process substitution, word splitting, and pathname expansion, according + to the bits set in EFLAGS. Words with the W_QUOTED or W_NOSPLIT bits + set, or for which no expansion is done, do not undergo word splitting. + Words with the W_NOGLOB bit set do not undergo pathname expansion. */ +static WORD_LIST * +expand_word_list_internal (list, eflags) + WORD_LIST *list; + int eflags; +{ + WORD_LIST *new_list, *temp_list; + int tint; + + if (list == 0) + return ((WORD_LIST *)NULL); + + garglist = new_list = copy_word_list (list); + if (eflags & WEXP_VARASSIGN) + { + garglist = new_list = separate_out_assignments (new_list); + if (new_list == 0) + { + if (subst_assign_varlist) + { + /* All the words were variable assignments, so they are placed + into the shell's environment. */ + for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next) + { + this_command_name = (char *)NULL; /* no arithmetic errors */ + tint = do_word_assignment (temp_list->word); + /* Variable assignment errors in non-interactive shells + running in Posix.2 mode cause the shell to exit. */ + if (tint == 0) + { + last_command_exit_value = EXECUTION_FAILURE; + if (interactive_shell == 0 && posixly_correct) + exp_jump_to_top_level (FORCE_EOF); + else + exp_jump_to_top_level (DISCARD); + } + } + dispose_words (subst_assign_varlist); + subst_assign_varlist = (WORD_LIST *)NULL; + } + return ((WORD_LIST *)NULL); + } + } + + /* Begin expanding the words that remain. The expansions take place on + things that aren't really variable assignments. */ + +#if defined (BRACE_EXPANSION) + /* Do brace expansion on this word if there are any brace characters + in the string. */ + if ((eflags & WEXP_BRACEEXP) && brace_expansion && new_list) + new_list = brace_expand_word_list (new_list, eflags); +#endif /* BRACE_EXPANSION */ + + /* Perform the `normal' shell expansions: tilde expansion, parameter and + variable substitution, command substitution, arithmetic expansion, + and word splitting. */ + new_list = shell_expand_word_list (new_list, eflags); + + /* Okay, we're almost done. Now let's just do some filename + globbing. */ + if (new_list) + { + if ((eflags & WEXP_PATHEXP) && disallow_filename_globbing == 0) + /* Glob expand the word list unless globbing has been disabled. */ + new_list = glob_expand_word_list (new_list, eflags); + else + /* Dequote the words, because we're not performing globbing. */ + new_list = dequote_list (new_list); + } + + if ((eflags & WEXP_VARASSIGN) && subst_assign_varlist) + { + sh_wassign_func_t *assign_func; + + /* If the remainder of the words expand to nothing, Posix.2 requires + that the variable and environment assignments affect the shell's + environment. */ + assign_func = new_list ? assign_in_env : do_word_assignment; + tempenv_assign_error = 0; + + for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next) + { + this_command_name = (char *)NULL; + tint = (*assign_func) (temp_list->word); + /* Variable assignment errors in non-interactive shells running + in Posix.2 mode cause the shell to exit. */ + if (tint == 0) + { + if (assign_func == do_word_assignment) + { + last_command_exit_value = EXECUTION_FAILURE; + if (interactive_shell == 0 && posixly_correct) + exp_jump_to_top_level (FORCE_EOF); + else + exp_jump_to_top_level (DISCARD); + } + else + tempenv_assign_error++; + } + } + + dispose_words (subst_assign_varlist); + subst_assign_varlist = (WORD_LIST *)NULL; + } + +#if 0 + tint = list_length (new_list) + 1; + RESIZE_MALLOCED_BUFFER (glob_argv_flags, 0, tint, glob_argv_flags_size, 16); + for (tint = 0, temp_list = new_list; temp_list; temp_list = temp_list->next) + glob_argv_flags[tint++] = (temp_list->word->flags & W_GLOBEXP) ? '1' : '0'; + glob_argv_flags[tint] = '\0'; +#endif + + return (new_list); +} diff --git a/subst.c~ b/subst.c~ index 4a1f15f8f..bc17f989d 100644 --- a/subst.c~ +++ b/subst.c~ @@ -3449,9 +3449,38 @@ match_upattern (string, pat, mtype, sp, ep) char **sp, **ep; { int c, len; - register char *p, *p1; + register char *p, *p1, *npat; char *end; + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = STRLEN (pat); + if (pat[0] != '*' || pat[len - 1] != '*') + { + p = npat = xmalloc (len + 3); + p1 = pat; + if (*p1 != '*') + *p++ = '*'; + while (*p1) + *p++ = *p1++; + if (p1[-1] != '*' || p[-2] == '\\') + *p++ = '*'; + *p = '\0'; + } + else + npat = pat; + c = strmatch (npat, string, FNMATCH_EXTFLAG); + if (npat != pat) + free (npat); + if (c == FNM_NOMATCH) + return (0); + len = STRLEN (string); end = string + len; @@ -3559,7 +3588,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep) int mtype; char **sp, **ep; { - wchar_t wc; + wchar_t wc, *wp, *nwpat, *wp1; int len; #if 0 size_t n, n1; /* Apple's gcc seems to miscompile this badly */ @@ -3567,6 +3596,35 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep) int n, n1; #endif + /* If the pattern doesn't match anywhere in the string, go ahead and + short-circuit right away. A minor optimization, saves a bunch of + unnecessary calls to strmatch (up to N calls for a string of N + characters) if the match is unsuccessful. To preserve the semantics + of the substring matches below, we make sure that the pattern has + `*' as first and last character, making a new pattern if necessary. */ + /* XXX - check this later if I ever implement `**' with special meaning, + since this will potentially result in `**' at the beginning or end */ + len = wcslen (wpat); + if (wpat[0] != L'*' || wpat[len - 1] != L'*') + { + wp = nwpat = xmalloc ((len + 3) * sizeof (wchar_t)); + wp1 = wpat; + if (*wp1 != L'*') + *wp++ = L'*'; + while (*wp1 != L'\0') + *wp++ = *wp1++; + if (wp1[-1] != L'*' || wp1[-2] == L'\\') + *wp++ = L'*'; + *wp = '\0'; + } + else + wp = wpat; + len = wcsmatch (wp, wstring, FNMATCH_EXTFLAG); + if (wp != wpat) + free (wp); + if (len == FNM_NOMATCH) + return (0); + switch (mtype) { case MATCH_ANY: @@ -4997,7 +5055,7 @@ mbstrlen (s) mbsbak = mbs; while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0) { - if ((MB_INVALIDCH(clen) == 0) + if (MB_INVALIDCH(clen)) { clen = 1; /* assume single byte */ mbs = mbsbak;