mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-21 12:57:58 +02:00
commit bash-20090423 snapshot
This commit is contained in:
@@ -7965,3 +7965,92 @@ lib/readline/{input,parens}.c
|
||||
|
||||
lib/sh/fpurge.c
|
||||
- updated implementation, taken from gnulib
|
||||
|
||||
4/21
|
||||
----
|
||||
lib/glob/glob.c
|
||||
- in finddirs, don't try to free a return value of glob_error_return
|
||||
from glob_vector. Bug and fix from werner@suse.de
|
||||
|
||||
lib/readline/signals.c
|
||||
- in rl_echo_signal_char, check that SIGQUIT and SIGTSTP are defined
|
||||
before trying to use them. Bug report and fix from Volker Grabsch
|
||||
<vog@notjusthosting.com>
|
||||
|
||||
4/24
|
||||
----
|
||||
aclocal.m4
|
||||
- add conditional inclusion of <stdint.h> to BASH_CHECK_TYPE
|
||||
|
||||
bashtypes.h,lib/sh/strto[iu]max.c
|
||||
- include <stdint.h> if present for any existing declaration of
|
||||
intmax_t and uintmax_t. Fixes Interix problem reported by
|
||||
Markus Duft <mduft@gentoo.org>
|
||||
|
||||
lib/sh/strindex.c,externs.h,builtins/common.h
|
||||
- renamed strindex to strcasestr to agree with other implementations
|
||||
(e.g., BSD, MacOS X, gnulib); changed callers
|
||||
|
||||
lib/sh/{strindex.c,Makefile.in},Makefile.in
|
||||
- renamed strindex.c to strcasestr.c
|
||||
|
||||
configure.in
|
||||
- add strcasestr to call to AC_REPLACE_FUNCS, take advantage of
|
||||
existing libc implementations
|
||||
|
||||
config.h.in
|
||||
- add define for HAVE_STRCASESTR
|
||||
|
||||
lib/sh/mbscmp.c
|
||||
- fix mbscmp to return correct values when the strings do not contain
|
||||
valid multibyte characters. Ideas from gnulib
|
||||
|
||||
xstrchr.c
|
||||
- only compare current character against C if mblength == 1
|
||||
|
||||
{shell,variables}.c
|
||||
- changed some xstrchr calls back to strchr when the arguments cannot
|
||||
contain multibyte characters
|
||||
|
||||
lib/sh/{xstrchr.c,Makefile.in},Makefile.in
|
||||
- renamed xstrchr to mbschr; renamed file to mbschr.c
|
||||
|
||||
aclocal.m4
|
||||
- change BASH_CHECK_MULTIBYTE to use AC_REPLACE_FUNCS(mbschr)
|
||||
|
||||
externs.h
|
||||
- extern declarations for mbscmp and mbschr, conditional on the usual
|
||||
HAVE_MBSCMP and HAVE_MBSCHR defines
|
||||
|
||||
general.h,{alias,arrayfunc,bashline,general,execute_cmd,subst}.c
|
||||
- changed calls to xstrchr to mbschr
|
||||
|
||||
doc/bash.1
|
||||
- use `pathname expansion' consistently, not `filename expansion' or
|
||||
`filename generation'
|
||||
|
||||
doc/bashref.texi
|
||||
- use the phrase `filename expansion' consistently (since this is
|
||||
what they Gnu people prefer) instead of `pathname expansion' or
|
||||
`filename generation'
|
||||
|
||||
aclocal.m4,config.h.in
|
||||
- check for mbscasecmp in BASH_CHECK_MULTIBYTE, define HAVE_MBSCASECMP
|
||||
if found
|
||||
|
||||
lib/sh/{mbscasecmp.c,Makefile.in}
|
||||
- new file, case-insensitive multibyte string comparison
|
||||
|
||||
externs.h
|
||||
- extern declaration for mbscasecmp
|
||||
|
||||
4/25
|
||||
----
|
||||
lib/readline/display.c
|
||||
- in _rl_move_cursor_relative, don't adjust dpos by woff if it's
|
||||
already less than woff (don't want it less than 0)
|
||||
- in _rl_move_cursor_relative, short-circuit right away if the cursor
|
||||
is at columns 0 and `new' is 0 (doesn't matter if it's a multibyte
|
||||
locale or not, or whether there are invisible chars in the prompt)
|
||||
- in _rl_move_cursor_relative, go ahead and adjust dpos if
|
||||
prompt_physical_chars >= _rl_screenwidth (previous check was just > )
|
||||
|
||||
@@ -7962,3 +7962,84 @@ lib/readline/{input,parens}.c
|
||||
- include "posixselect.h" instead of using inline includes
|
||||
- use new USEC_TO_TIMEVAL define to make sure that values for timeouts
|
||||
greater than one second are handled properly
|
||||
|
||||
lib/sh/fpurge.c
|
||||
- updated implementation, taken from gnulib
|
||||
|
||||
4/21
|
||||
----
|
||||
lib/glob/glob.c
|
||||
- in finddirs, don't try to free a return value of glob_error_return
|
||||
from glob_vector. Bug and fix from werner@suse.de
|
||||
|
||||
lib/readline/signals.c
|
||||
- in rl_echo_signal_char, check that SIGQUIT and SIGTSTP are defined
|
||||
before trying to use them. Bug report and fix from Volker Grabsch
|
||||
<vog@notjusthosting.com>
|
||||
|
||||
4/24
|
||||
----
|
||||
aclocal.m4
|
||||
- add conditional inclusion of <stdint.h> to BASH_CHECK_TYPE
|
||||
|
||||
bashtypes.h,lib/sh/strto[iu]max.c
|
||||
- include <stdint.h> if present for any existing declaration of
|
||||
intmax_t and uintmax_t. Fixes Interix problem reported by
|
||||
Markus Duft <mduft@gentoo.org>
|
||||
|
||||
lib/sh/strindex.c,externs.h,builtins/common.h
|
||||
- renamed strindex to strcasestr to agree with other implementations
|
||||
(e.g., BSD, MacOS X, gnulib); changed callers
|
||||
|
||||
lib/sh/{strindex.c,Makefile.in},Makefile.in
|
||||
- renamed strindex.c to strcasestr.c
|
||||
|
||||
configure.in
|
||||
- add strcasestr to call to AC_REPLACE_FUNCS, take advantage of
|
||||
existing libc implementations
|
||||
|
||||
config.h.in
|
||||
- add define for HAVE_STRCASESTR
|
||||
|
||||
lib/sh/mbscmp.c
|
||||
- fix mbscmp to return correct values when the strings do not contain
|
||||
valid multibyte characters. Ideas from gnulib
|
||||
|
||||
xstrchr.c
|
||||
- only compare current character against C if mblength == 1
|
||||
|
||||
{shell,variables}.c
|
||||
- changed some xstrchr calls back to strchr when the arguments cannot
|
||||
contain multibyte characters
|
||||
|
||||
lib/sh/{xstrchr.c,Makefile.in},Makefile.in
|
||||
- renamed xstrchr to mbschr; renamed file to mbschr.c
|
||||
|
||||
aclocal.m4
|
||||
- change BASH_CHECK_MULTIBYTE to use AC_REPLACE_FUNCS(mbschr)
|
||||
|
||||
externs.h
|
||||
- extern declarations for mbscmp and mbschr, conditional on the usual
|
||||
HAVE_MBSCMP and HAVE_MBSCHR defines
|
||||
|
||||
general.h,{alias,arrayfunc,bashline,general,execute_cmd,subst}.c
|
||||
- changed calls to xstrchr to mbschr
|
||||
|
||||
doc/bash.1
|
||||
- use `pathname expansion' consistently, not `filename expansion' or
|
||||
`filename generation'
|
||||
|
||||
doc/bashref.texi
|
||||
- use the phrase `filename expansion' consistently (since this is
|
||||
what they Gnu people prefer) instead of `pathname expansion' or
|
||||
`filename generation'
|
||||
|
||||
aclocal.m4,config.h.in
|
||||
- check for mbscasecmp in BASH_CHECK_MULTIBYTE, define HAVE_MBSCASECMP
|
||||
if found
|
||||
|
||||
lib/sh/{mbscasecmp.c,Makefile.in}
|
||||
- new file, case-insensitive multibyte string comparison
|
||||
|
||||
externs.h
|
||||
- extern declaration for mbscasecmp
|
||||
|
||||
@@ -352,6 +352,7 @@ lib/readline/histlib.h f
|
||||
lib/readline/chardefs.h f
|
||||
lib/readline/posixdir.h f
|
||||
lib/readline/posixjmp.h f
|
||||
lib/readline/posixselect.h f
|
||||
lib/readline/posixstat.h f
|
||||
lib/readline/ansi_stdlib.h f
|
||||
lib/readline/rlstdc.h f
|
||||
@@ -393,6 +394,8 @@ lib/sh/input_avail.c f
|
||||
lib/sh/itos.c f
|
||||
lib/sh/mailstat.c f
|
||||
lib/sh/makepath.c f
|
||||
lib/sh/mbscasecmp.c f
|
||||
lib/sh/mbschr.c f
|
||||
lib/sh/mbscmp.c f
|
||||
lib/sh/memset.c f
|
||||
lib/sh/mktime.c f
|
||||
@@ -409,9 +412,9 @@ lib/sh/shtty.c f
|
||||
lib/sh/snprintf.c f
|
||||
lib/sh/spell.c f
|
||||
lib/sh/strcasecmp.c f
|
||||
lib/sh/strcasestr.c f
|
||||
lib/sh/strerror.c f
|
||||
lib/sh/strftime.c f
|
||||
lib/sh/strindex.c f
|
||||
lib/sh/stringlist.c f
|
||||
lib/sh/stringvec.c f
|
||||
lib/sh/strnlen.c f
|
||||
@@ -433,7 +436,6 @@ lib/sh/ufuncs.c f
|
||||
lib/sh/vprint.c f
|
||||
lib/sh/wcsdup.c f
|
||||
lib/sh/winsize.c f
|
||||
lib/sh/xstrchr.c f
|
||||
lib/sh/zcatfd.c f
|
||||
lib/sh/zgetline.c f
|
||||
lib/sh/zmapfd.c f
|
||||
|
||||
@@ -215,6 +215,7 @@ include/memalloc.h f
|
||||
include/ocache.h f
|
||||
include/posixdir.h f
|
||||
include/posixjmp.h f
|
||||
include/posixselect.h f
|
||||
include/posixstat.h f
|
||||
include/posixtime.h f
|
||||
include/posixwait.h f
|
||||
@@ -351,6 +352,7 @@ lib/readline/histlib.h f
|
||||
lib/readline/chardefs.h f
|
||||
lib/readline/posixdir.h f
|
||||
lib/readline/posixjmp.h f
|
||||
lib/readline/posixselect.h f
|
||||
lib/readline/posixstat.h f
|
||||
lib/readline/ansi_stdlib.h f
|
||||
lib/readline/rlstdc.h f
|
||||
@@ -392,6 +394,7 @@ lib/sh/input_avail.c f
|
||||
lib/sh/itos.c f
|
||||
lib/sh/mailstat.c f
|
||||
lib/sh/makepath.c f
|
||||
lib/sh/mbschr.c f
|
||||
lib/sh/mbscmp.c f
|
||||
lib/sh/memset.c f
|
||||
lib/sh/mktime.c f
|
||||
@@ -408,9 +411,9 @@ lib/sh/shtty.c f
|
||||
lib/sh/snprintf.c f
|
||||
lib/sh/spell.c f
|
||||
lib/sh/strcasecmp.c f
|
||||
lib/sh/strcasestr.c f
|
||||
lib/sh/strerror.c f
|
||||
lib/sh/strftime.c f
|
||||
lib/sh/strindex.c f
|
||||
lib/sh/stringlist.c f
|
||||
lib/sh/stringvec.c f
|
||||
lib/sh/strnlen.c f
|
||||
@@ -432,7 +435,6 @@ lib/sh/ufuncs.c f
|
||||
lib/sh/vprint.c f
|
||||
lib/sh/wcsdup.c f
|
||||
lib/sh/winsize.c f
|
||||
lib/sh/xstrchr.c f
|
||||
lib/sh/zcatfd.c f
|
||||
lib/sh/zgetline.c f
|
||||
lib/sh/zmapfd.c f
|
||||
|
||||
+3
-3
@@ -198,14 +198,14 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||
${SH_LIBSRC}/pathphys.c ${SH_LIBSRC}/stringlist.c \
|
||||
${SH_LIBSRC}/stringvec.c ${SH_LIBSRC}/tmpfile.c \
|
||||
${SH_LIBSRC}/spell.c ${SH_LIBSRC}/strtrans.c \
|
||||
${SH_LIBSRC}/strindex.c ${SH_LIBSRC}/shquote.c \
|
||||
${SH_LIBSRC}/strcasestr.c ${SH_LIBSRC}/shquote.c \
|
||||
${SH_LIBSRC}/snprintf.c ${SH_LIBSRC}/mailstat.c \
|
||||
${SH_LIBSRC}/fmtulong.c ${SH_LIBSRC}/fmtullong.c \
|
||||
${SH_LIBSRC}/strtoll.c ${SH_LIBSRC}/strtoull.c \
|
||||
${SH_LIBSRC}/strtoimax.c ${SH_LIBSRC}/strtoumax.c \
|
||||
${SH_LIBSRC}/fmtumax.c ${SH_LIBSRC}/netconn.c \
|
||||
${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
|
||||
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \
|
||||
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/mbschr.c \
|
||||
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
|
||||
${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c \
|
||||
${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c \
|
||||
@@ -213,7 +213,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||
${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
|
||||
${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
|
||||
${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/fdprintf.c \
|
||||
${SH_LIBSRC}/input_avail.c
|
||||
${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c
|
||||
|
||||
SHLIB_LIB = -lsh
|
||||
SHLIB_LIBNAME = libsh.a
|
||||
|
||||
+3
-3
@@ -147,7 +147,7 @@ CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
|
||||
|
||||
LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
|
||||
LDFLAGS_FOR_BUILD = $(LDFLAGS)
|
||||
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
|
||||
|
||||
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
|
||||
|
||||
@@ -198,14 +198,14 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
|
||||
${SH_LIBSRC}/pathphys.c ${SH_LIBSRC}/stringlist.c \
|
||||
${SH_LIBSRC}/stringvec.c ${SH_LIBSRC}/tmpfile.c \
|
||||
${SH_LIBSRC}/spell.c ${SH_LIBSRC}/strtrans.c \
|
||||
${SH_LIBSRC}/strindex.c ${SH_LIBSRC}/shquote.c \
|
||||
${SH_LIBSRC}/strcasestr.c ${SH_LIBSRC}/shquote.c \
|
||||
${SH_LIBSRC}/snprintf.c ${SH_LIBSRC}/mailstat.c \
|
||||
${SH_LIBSRC}/fmtulong.c ${SH_LIBSRC}/fmtullong.c \
|
||||
${SH_LIBSRC}/strtoll.c ${SH_LIBSRC}/strtoull.c \
|
||||
${SH_LIBSRC}/strtoimax.c ${SH_LIBSRC}/strtoumax.c \
|
||||
${SH_LIBSRC}/fmtumax.c ${SH_LIBSRC}/netconn.c \
|
||||
${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
|
||||
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/xstrchr.c \
|
||||
${SH_LIBSRC}/memset.c ${SH_LIBSRC}/mbschr.c \
|
||||
${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
|
||||
${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c \
|
||||
${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c \
|
||||
|
||||
Vendored
+6
@@ -80,6 +80,9 @@ AC_CACHE_VAL(bash_cv_type_$1,
|
||||
#if HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
$2
|
||||
], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
|
||||
AC_MSG_RESULT($bash_cv_type_$1)
|
||||
@@ -1690,9 +1693,12 @@ AC_CHECK_HEADERS(wchar.h)
|
||||
AC_CHECK_HEADERS(langinfo.h)
|
||||
|
||||
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
|
||||
AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
|
||||
AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
|
||||
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
|
||||
|
||||
AC_REPLACE_FUNCS(mbschr)
|
||||
|
||||
AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
|
||||
AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
|
||||
AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
|
||||
|
||||
Vendored
+4025
File diff suppressed because it is too large
Load Diff
@@ -526,7 +526,7 @@ alias_expand (string)
|
||||
/* If there is a backslash-escaped character quoted in TOKEN,
|
||||
then we don't do alias expansion. This should check for all
|
||||
other quoting characters, too. */
|
||||
if (xstrchr (token, '\\'))
|
||||
if (mbschr (token, '\\'))
|
||||
expand_this_token = 0;
|
||||
|
||||
/* If we should be expanding here, if we are expanding all words, or if
|
||||
|
||||
@@ -0,0 +1,574 @@
|
||||
/* alias.c -- Not a full alias, but just the kind that we use in the
|
||||
shell. Csh style alias is somewhere else (`over there, in a box'). */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined (ALIAS)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "chartypes.h"
|
||||
#include "bashansi.h"
|
||||
#include "command.h"
|
||||
#include "general.h"
|
||||
#include "externs.h"
|
||||
#include "alias.h"
|
||||
|
||||
#if defined (PROGRAMMABLE_COMPLETION)
|
||||
# include "pcomplete.h"
|
||||
#endif
|
||||
|
||||
#define ALIAS_HASH_BUCKETS 16 /* must be power of two */
|
||||
|
||||
typedef int sh_alias_map_func_t __P((alias_t *));
|
||||
|
||||
static void free_alias_data __P((PTR_T));
|
||||
static alias_t **map_over_aliases __P((sh_alias_map_func_t *));
|
||||
static void sort_aliases __P((alias_t **));
|
||||
static int qsort_alias_compare __P((alias_t **, alias_t **));
|
||||
|
||||
#if defined (READLINE)
|
||||
static int skipquotes __P((char *, int));
|
||||
static int skipws __P((char *, int));
|
||||
static int rd_token __P((char *, int));
|
||||
#endif
|
||||
|
||||
/* Non-zero means expand all words on the line. Otherwise, expand
|
||||
after first expansion if the expansion ends in a space. */
|
||||
int alias_expand_all = 0;
|
||||
|
||||
/* The list of aliases that we have. */
|
||||
HASH_TABLE *aliases = (HASH_TABLE *)NULL;
|
||||
|
||||
void
|
||||
initialize_aliases ()
|
||||
{
|
||||
if (aliases == 0)
|
||||
aliases = hash_create (ALIAS_HASH_BUCKETS);
|
||||
}
|
||||
|
||||
/* Scan the list of aliases looking for one with NAME. Return NULL
|
||||
if the alias doesn't exist, else a pointer to the alias_t. */
|
||||
alias_t *
|
||||
find_alias (name)
|
||||
char *name;
|
||||
{
|
||||
BUCKET_CONTENTS *al;
|
||||
|
||||
if (aliases == 0)
|
||||
return ((alias_t *)NULL);
|
||||
|
||||
al = hash_search (name, aliases, 0);
|
||||
return (al ? (alias_t *)al->data : (alias_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the value of the alias for NAME, or NULL if there is none. */
|
||||
char *
|
||||
get_alias_value (name)
|
||||
char *name;
|
||||
{
|
||||
alias_t *alias;
|
||||
|
||||
if (aliases == 0)
|
||||
return ((char *)NULL);
|
||||
|
||||
alias = find_alias (name);
|
||||
return (alias ? alias->value : (char *)NULL);
|
||||
}
|
||||
|
||||
/* Make a new alias from NAME and VALUE. If NAME can be found,
|
||||
then replace its value. */
|
||||
void
|
||||
add_alias (name, value)
|
||||
char *name, *value;
|
||||
{
|
||||
BUCKET_CONTENTS *elt;
|
||||
alias_t *temp;
|
||||
int n;
|
||||
|
||||
if (!aliases)
|
||||
{
|
||||
initialize_aliases ();
|
||||
temp = (alias_t *)NULL;
|
||||
}
|
||||
else
|
||||
temp = find_alias (name);
|
||||
|
||||
if (temp)
|
||||
{
|
||||
free (temp->value);
|
||||
temp->value = savestring (value);
|
||||
temp->flags &= ~AL_EXPANDNEXT;
|
||||
n = value[strlen (value) - 1];
|
||||
if (n == ' ' || n == '\t')
|
||||
temp->flags |= AL_EXPANDNEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = (alias_t *)xmalloc (sizeof (alias_t));
|
||||
temp->name = savestring (name);
|
||||
temp->value = savestring (value);
|
||||
temp->flags = 0;
|
||||
|
||||
n = value[strlen (value) - 1];
|
||||
if (n == ' ' || n == '\t')
|
||||
temp->flags |= AL_EXPANDNEXT;
|
||||
|
||||
elt = hash_insert (savestring (name), aliases, HASH_NOSRCH);
|
||||
elt->data = temp;
|
||||
#if defined (PROGRAMMABLE_COMPLETION)
|
||||
set_itemlist_dirty (&it_aliases);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete a single alias structure. */
|
||||
static void
|
||||
free_alias_data (data)
|
||||
PTR_T data;
|
||||
{
|
||||
register alias_t *a;
|
||||
|
||||
a = (alias_t *)data;
|
||||
free (a->value);
|
||||
free (a->name);
|
||||
free (data);
|
||||
}
|
||||
|
||||
/* Remove the alias with name NAME from the alias table. Returns
|
||||
the number of aliases left in the table, or -1 if the alias didn't
|
||||
exist. */
|
||||
int
|
||||
remove_alias (name)
|
||||
char *name;
|
||||
{
|
||||
BUCKET_CONTENTS *elt;
|
||||
|
||||
if (aliases == 0)
|
||||
return (-1);
|
||||
|
||||
elt = hash_remove (name, aliases, 0);
|
||||
if (elt)
|
||||
{
|
||||
free_alias_data (elt->data);
|
||||
free (elt->key); /* alias name */
|
||||
free (elt); /* XXX */
|
||||
#if defined (PROGRAMMABLE_COMPLETION)
|
||||
set_itemlist_dirty (&it_aliases);
|
||||
#endif
|
||||
return (aliases->nentries);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Delete all aliases. */
|
||||
void
|
||||
delete_all_aliases ()
|
||||
{
|
||||
if (aliases == 0)
|
||||
return;
|
||||
|
||||
hash_flush (aliases, free_alias_data);
|
||||
hash_dispose (aliases);
|
||||
aliases = (HASH_TABLE *)NULL;
|
||||
#if defined (PROGRAMMABLE_COMPLETION)
|
||||
set_itemlist_dirty (&it_aliases);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return an array of aliases that satisfy the conditions tested by FUNCTION.
|
||||
If FUNCTION is NULL, return all aliases. */
|
||||
static alias_t **
|
||||
map_over_aliases (function)
|
||||
sh_alias_map_func_t *function;
|
||||
{
|
||||
register int i;
|
||||
register BUCKET_CONTENTS *tlist;
|
||||
alias_t *alias, **list;
|
||||
int list_index;
|
||||
|
||||
i = HASH_ENTRIES (aliases);
|
||||
if (i == 0)
|
||||
return ((alias_t **)NULL);
|
||||
|
||||
list = (alias_t **)xmalloc ((i + 1) * sizeof (alias_t *));
|
||||
for (i = list_index = 0; i < aliases->nbuckets; i++)
|
||||
{
|
||||
for (tlist = hash_items (i, aliases); tlist; tlist = tlist->next)
|
||||
{
|
||||
alias = (alias_t *)tlist->data;
|
||||
|
||||
if (!function || (*function) (alias))
|
||||
{
|
||||
list[list_index++] = alias;
|
||||
list[list_index] = (alias_t *)NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (list);
|
||||
}
|
||||
|
||||
static void
|
||||
sort_aliases (array)
|
||||
alias_t **array;
|
||||
{
|
||||
qsort (array, strvec_len ((char **)array), sizeof (alias_t *), (QSFUNC *)qsort_alias_compare);
|
||||
}
|
||||
|
||||
static int
|
||||
qsort_alias_compare (as1, as2)
|
||||
alias_t **as1, **as2;
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = (*as1)->name[0] - (*as2)->name[0]) == 0)
|
||||
result = strcmp ((*as1)->name, (*as2)->name);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Return a sorted list of all defined aliases */
|
||||
alias_t **
|
||||
all_aliases ()
|
||||
{
|
||||
alias_t **list;
|
||||
|
||||
if (aliases == 0 || HASH_ENTRIES (aliases) == 0)
|
||||
return ((alias_t **)NULL);
|
||||
|
||||
list = map_over_aliases ((sh_alias_map_func_t *)NULL);
|
||||
if (list)
|
||||
sort_aliases (list);
|
||||
return (list);
|
||||
}
|
||||
|
||||
char *
|
||||
alias_expand_word (s)
|
||||
char *s;
|
||||
{
|
||||
alias_t *r;
|
||||
|
||||
r = find_alias (s);
|
||||
return (r ? savestring (r->value) : (char *)NULL);
|
||||
}
|
||||
|
||||
/* Readline support functions -- expand all aliases in a line. */
|
||||
|
||||
#if defined (READLINE)
|
||||
|
||||
/* Return non-zero if CHARACTER is a member of the class of characters
|
||||
that are self-delimiting in the shell (this really means that these
|
||||
characters delimit tokens). */
|
||||
#define self_delimiting(character) (member ((character), " \t\n\r;|&()"))
|
||||
|
||||
/* Return non-zero if CHARACTER is a member of the class of characters
|
||||
that delimit commands in the shell. */
|
||||
#define command_separator(character) (member ((character), "\r\n;|&("))
|
||||
|
||||
/* If this is 1, we are checking the next token read for alias expansion
|
||||
because it is the first word in a command. */
|
||||
static int command_word;
|
||||
|
||||
/* This is for skipping quoted strings in alias expansions. */
|
||||
#define quote_char(c) (((c) == '\'') || ((c) == '"'))
|
||||
|
||||
/* Consume a quoted string from STRING, starting at string[START] (so
|
||||
string[START] is the opening quote character), and return the index
|
||||
of the closing quote character matching the opening quote character.
|
||||
This handles single matching pairs of unquoted quotes; it could afford
|
||||
to be a little smarter... This skips words between balanced pairs of
|
||||
quotes, words where the first character is quoted with a `\', and other
|
||||
backslash-escaped characters. */
|
||||
|
||||
static int
|
||||
skipquotes (string, start)
|
||||
char *string;
|
||||
int start;
|
||||
{
|
||||
register int i;
|
||||
int delimiter = string[start];
|
||||
|
||||
/* i starts at START + 1 because string[START] is the opening quote
|
||||
character. */
|
||||
for (i = start + 1 ; string[i] ; i++)
|
||||
{
|
||||
if (string[i] == '\\')
|
||||
{
|
||||
i++; /* skip backslash-quoted quote characters, too */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string[i] == delimiter)
|
||||
return i;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Skip the white space and any quoted characters in STRING, starting at
|
||||
START. Return the new index into STRING, after zero or more characters
|
||||
have been skipped. */
|
||||
static int
|
||||
skipws (string, start)
|
||||
char *string;
|
||||
int start;
|
||||
{
|
||||
register int i;
|
||||
int pass_next, backslash_quoted_word;
|
||||
unsigned char peekc;
|
||||
|
||||
/* skip quoted strings, in ' or ", and words in which a character is quoted
|
||||
with a `\'. */
|
||||
i = backslash_quoted_word = pass_next = 0;
|
||||
|
||||
/* Skip leading whitespace (or separator characters), and quoted words.
|
||||
But save it in the output. */
|
||||
|
||||
for (i = start; string[i]; i++)
|
||||
{
|
||||
if (pass_next)
|
||||
{
|
||||
pass_next = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (whitespace (string[i]))
|
||||
{
|
||||
backslash_quoted_word = 0; /* we are no longer in a backslash-quoted word */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string[i] == '\\')
|
||||
{
|
||||
peekc = string[i+1];
|
||||
if (ISLETTER (peekc))
|
||||
backslash_quoted_word++; /* this is a backslash-quoted word */
|
||||
else
|
||||
pass_next++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* This only handles single pairs of non-escaped quotes. This
|
||||
overloads backslash_quoted_word to also mean that a word like
|
||||
""f is being scanned, so that the quotes will inhibit any expansion
|
||||
of the word. */
|
||||
if (quote_char(string[i]))
|
||||
{
|
||||
i = skipquotes (string, i);
|
||||
/* This could be a line that contains a single quote character,
|
||||
in which case skipquotes () terminates with string[i] == '\0'
|
||||
(the end of the string). Check for that here. */
|
||||
if (string[i] == '\0')
|
||||
break;
|
||||
|
||||
peekc = string[i + 1];
|
||||
if (ISLETTER (peekc))
|
||||
backslash_quoted_word++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we're in the middle of some kind of quoted word, let it
|
||||
pass through. */
|
||||
if (backslash_quoted_word)
|
||||
continue;
|
||||
|
||||
/* If this character is a shell command separator, then set a hint for
|
||||
alias_expand that the next token is the first word in a command. */
|
||||
|
||||
if (command_separator (string[i]))
|
||||
{
|
||||
command_word++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Characters that may appear in a token. Basically, anything except white
|
||||
space and a token separator. */
|
||||
#define token_char(c) (!((whitespace (string[i]) || self_delimiting (string[i]))))
|
||||
|
||||
/* Read from START in STRING until the next separator character, and return
|
||||
the index of that separator. Skip backslash-quoted characters. Call
|
||||
skipquotes () for quoted strings in the middle or at the end of tokens,
|
||||
so all characters show up (e.g. foo'' and foo""bar) */
|
||||
static int
|
||||
rd_token (string, start)
|
||||
char *string;
|
||||
int start;
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* From here to next separator character is a token. */
|
||||
for (i = start; string[i] && token_char (string[i]); i++)
|
||||
{
|
||||
if (string[i] == '\\')
|
||||
{
|
||||
i++; /* skip backslash-escaped character */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this character is a quote character, we want to call skipquotes
|
||||
to get the whole quoted portion as part of this word. That word
|
||||
will not generally match an alias, even if te unquoted word would
|
||||
have. The presence of the quotes in the token serves then to
|
||||
inhibit expansion. */
|
||||
if (quote_char (string[i]))
|
||||
{
|
||||
i = skipquotes (string, i);
|
||||
/* This could be a line that contains a single quote character,
|
||||
in which case skipquotes () terminates with string[i] == '\0'
|
||||
(the end of the string). Check for that here. */
|
||||
if (string[i] == '\0')
|
||||
break;
|
||||
|
||||
/* Now string[i] is the matching quote character, and the
|
||||
quoted portion of the token has been scanned. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return a new line, with any aliases substituted. */
|
||||
char *
|
||||
alias_expand (string)
|
||||
char *string;
|
||||
{
|
||||
register int i, j, start;
|
||||
char *line, *token;
|
||||
int line_len, tl, real_start, expand_next, expand_this_token;
|
||||
alias_t *alias;
|
||||
|
||||
line_len = strlen (string) + 1;
|
||||
line = (char *)xmalloc (line_len);
|
||||
token = (char *)xmalloc (line_len);
|
||||
|
||||
line[0] = i = 0;
|
||||
expand_next = 0;
|
||||
command_word = 1; /* initialized to expand the first word on the line */
|
||||
|
||||
/* Each time through the loop we find the next word in line. If it
|
||||
has an alias, substitute the alias value. If the value ends in ` ',
|
||||
then try again with the next word. Else, if there is no value, or if
|
||||
the value does not end in space, we are done. */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
token[0] = 0;
|
||||
start = i;
|
||||
|
||||
/* Skip white space and quoted characters */
|
||||
i = skipws (string, start);
|
||||
|
||||
if (start == i && string[i] == '\0')
|
||||
{
|
||||
free (token);
|
||||
return (line);
|
||||
}
|
||||
|
||||
/* copy the just-skipped characters into the output string,
|
||||
expanding it if there is not enough room. */
|
||||
j = strlen (line);
|
||||
tl = i - start; /* number of characters just skipped */
|
||||
RESIZE_MALLOCED_BUFFER (line, j, (tl + 1), line_len, (tl + 50));
|
||||
strncpy (line + j, string + start, tl);
|
||||
line[j + tl] = '\0';
|
||||
|
||||
real_start = i;
|
||||
|
||||
command_word = command_word || (command_separator (string[i]));
|
||||
expand_this_token = (command_word || expand_next);
|
||||
expand_next = 0;
|
||||
|
||||
/* Read the next token, and copy it into TOKEN. */
|
||||
start = i;
|
||||
i = rd_token (string, start);
|
||||
|
||||
tl = i - start; /* token length */
|
||||
|
||||
/* If tl == 0, but we're not at the end of the string, then we have a
|
||||
single-character token, probably a delimiter */
|
||||
if (tl == 0 && string[i] != '\0')
|
||||
{
|
||||
tl = 1;
|
||||
i++; /* move past it */
|
||||
}
|
||||
|
||||
strncpy (token, string + start, tl);
|
||||
token [tl] = '\0';
|
||||
|
||||
/* If there is a backslash-escaped character quoted in TOKEN,
|
||||
then we don't do alias expansion. This should check for all
|
||||
other quoting characters, too. */
|
||||
if (xstrchr (token, '\\'))
|
||||
expand_this_token = 0;
|
||||
|
||||
/* If we should be expanding here, if we are expanding all words, or if
|
||||
we are in a location in the string where an expansion is supposed to
|
||||
take place, see if this word has a substitution. If it does, then do
|
||||
the expansion. Note that we defer the alias value lookup until we
|
||||
are sure we are expanding this token. */
|
||||
|
||||
if ((token[0]) &&
|
||||
(expand_this_token || alias_expand_all) &&
|
||||
(alias = find_alias (token)))
|
||||
{
|
||||
char *v;
|
||||
int vlen, llen;
|
||||
|
||||
v = alias->value;
|
||||
vlen = strlen (v);
|
||||
llen = strlen (line);
|
||||
|
||||
/* +3 because we possibly add one more character below. */
|
||||
RESIZE_MALLOCED_BUFFER (line, llen, (vlen + 3), line_len, (vlen + 50));
|
||||
|
||||
strcpy (line + llen, v);
|
||||
|
||||
if ((expand_this_token && vlen && whitespace (v[vlen - 1])) ||
|
||||
alias_expand_all)
|
||||
expand_next = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int llen, tlen;
|
||||
|
||||
llen = strlen (line);
|
||||
tlen = i - real_start; /* tlen == strlen(token) */
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (line, llen, (tlen + 1), line_len, (llen + tlen + 50));
|
||||
|
||||
strncpy (line + llen, string + real_start, tlen);
|
||||
line[llen + tlen] = '\0';
|
||||
}
|
||||
command_word = 0;
|
||||
}
|
||||
}
|
||||
#endif /* READLINE */
|
||||
#endif /* ALIAS */
|
||||
+3
-3
@@ -596,7 +596,7 @@ quote_array_assignment_chars (list)
|
||||
if (l->word == 0 || l->word->word == 0 || l->word->word[0] == '\0')
|
||||
continue; /* should not happen, but just in case... */
|
||||
/* Don't bother if it doesn't look like [ind]=value */
|
||||
if (l->word->word[0] != '[' || xstrchr (l->word->word, '=') == 0) /* ] */
|
||||
if (l->word->word[0] != '[' || mbschr (l->word->word, '=') == 0) /* ] */
|
||||
continue;
|
||||
nword = quote_assign (l->word->word);
|
||||
free (l->word->word);
|
||||
@@ -713,7 +713,7 @@ valid_array_reference (name)
|
||||
char *t;
|
||||
int r, len;
|
||||
|
||||
t = xstrchr (name, '['); /* ] */
|
||||
t = mbschr (name, '['); /* ] */
|
||||
if (t)
|
||||
{
|
||||
*t = '\0';
|
||||
@@ -773,7 +773,7 @@ array_variable_name (s, subp, lenp)
|
||||
char *t, *ret;
|
||||
int ind, ni;
|
||||
|
||||
t = xstrchr (s, '[');
|
||||
t = mbschr (s, '[');
|
||||
if (t == 0)
|
||||
{
|
||||
if (subp)
|
||||
|
||||
+1
-63
@@ -604,69 +604,7 @@ quote_array_assignment_chars (list)
|
||||
}
|
||||
}
|
||||
|
||||
/* This function assumes s[i] == '['; returns with s[ret] == ']' if
|
||||
an array subscript is correctly parsed. */
|
||||
int
|
||||
skipsubscript (s, i)
|
||||
const char *s;
|
||||
int i;
|
||||
{
|
||||
#if 0
|
||||
int count, c;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t state, state_bak;
|
||||
size_t slength, mblength;
|
||||
#endif
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
memset (&state, '\0', sizeof (mbstate_t));
|
||||
slength = strlen (s + i);
|
||||
#endif
|
||||
|
||||
count = 1;
|
||||
while (count)
|
||||
{
|
||||
/* Advance one (possibly multibyte) character in S starting at I. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1)
|
||||
{
|
||||
state_bak = state;
|
||||
mblength = mbrlen (s + i, slength, &state);
|
||||
|
||||
if (MB_INVALIDCH (mblength))
|
||||
{
|
||||
state = state_bak;
|
||||
i++;
|
||||
slength--;
|
||||
}
|
||||
else if (MB_NULLWCH (mblength))
|
||||
return i;
|
||||
else
|
||||
{
|
||||
i += mblength;
|
||||
slength -= mblength;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
++i;
|
||||
|
||||
c = s[i];
|
||||
|
||||
if (c == 0)
|
||||
break;
|
||||
else if (c == '[')
|
||||
count++;
|
||||
else if (c == ']')
|
||||
count--;
|
||||
}
|
||||
|
||||
return i;
|
||||
#else
|
||||
i = skip_to_delim (s, i, "]", SD_NOJMP);
|
||||
return i;
|
||||
#endif
|
||||
}
|
||||
/* skipsubscript moved to subst.c to use private functions. 2009/02/24. */
|
||||
|
||||
/* This function is called with SUB pointing to just after the beginning
|
||||
`[' of an array subscript and removes the array element to which SUB
|
||||
|
||||
+710
-469
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -15,25 +15,25 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'_m4_warn' => 1,
|
||||
@@ -49,13 +49,13 @@
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'm4_include' => 1,
|
||||
|
||||
+1048
-1048
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -1386,7 +1386,7 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
|
||||
/* If the word starts in `~', and there is no slash in the word, then
|
||||
try completing this word as a username. */
|
||||
if (!matches && *text == '~' && !xstrchr (text, '/'))
|
||||
if (matches ==0 && *text == '~' && mbschr (text, '/') == 0)
|
||||
matches = rl_completion_matches (text, rl_username_completion_function);
|
||||
|
||||
/* Another one. Why not? If the word starts in '@', then look through
|
||||
@@ -2666,11 +2666,11 @@ bash_directory_completion_hook (dirname)
|
||||
return_value = should_expand_dirname = 0;
|
||||
local_dirname = *dirname;
|
||||
|
||||
if (xstrchr (local_dirname, '$'))
|
||||
if (mbschr (local_dirname, '$'))
|
||||
should_expand_dirname = 1;
|
||||
else
|
||||
{
|
||||
t = xstrchr (local_dirname, '`');
|
||||
t = mbschr (local_dirname, '`');
|
||||
if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
|
||||
should_expand_dirname = 1;
|
||||
}
|
||||
@@ -3271,7 +3271,7 @@ quote_word_break_chars (text)
|
||||
}
|
||||
/* OK, we have an unquoted character. Check its presence in
|
||||
rl_completer_word_break_characters. */
|
||||
if (xstrchr (rl_completer_word_break_characters, *s))
|
||||
if (mbschr (rl_completer_word_break_characters, *s))
|
||||
*r++ = '\\';
|
||||
/* XXX -- check for standalone tildes here and backslash-quote them */
|
||||
if (s == text && *s == '~' && file_exists (text))
|
||||
@@ -3313,7 +3313,7 @@ bash_quote_filename (s, rtype, qcp)
|
||||
the word being completed contains newlines, since those are not
|
||||
quoted correctly using backslashes (a backslash-newline pair is
|
||||
special to the shell parser). */
|
||||
if (*qcp == '\0' && cs == COMPLETE_BSQUOTE && xstrchr (s, '\n'))
|
||||
if (*qcp == '\0' && cs == COMPLETE_BSQUOTE && mbschr (s, '\n'))
|
||||
cs = COMPLETE_SQUOTE;
|
||||
else if (*qcp == '"')
|
||||
cs = COMPLETE_DQUOTE;
|
||||
@@ -3321,11 +3321,11 @@ bash_quote_filename (s, rtype, qcp)
|
||||
cs = COMPLETE_SQUOTE;
|
||||
#if defined (BANG_HISTORY)
|
||||
else if (*qcp == '\0' && history_expansion && cs == COMPLETE_DQUOTE &&
|
||||
history_expansion_inhibited == 0 && xstrchr (s, '!'))
|
||||
history_expansion_inhibited == 0 && mbschr (s, '!'))
|
||||
cs = COMPLETE_BSQUOTE;
|
||||
|
||||
if (*qcp == '"' && history_expansion && cs == COMPLETE_DQUOTE &&
|
||||
history_expansion_inhibited == 0 && xstrchr (s, '!'))
|
||||
history_expansion_inhibited == 0 && mbschr (s, '!'))
|
||||
{
|
||||
cs = COMPLETE_BSQUOTE;
|
||||
*qcp = '\0';
|
||||
|
||||
+3611
File diff suppressed because it is too large
Load Diff
@@ -35,4 +35,8 @@
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#endif /* _BASHTYPES_H_ */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/* bashtypes.h -- Bash system types. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (_BASHTYPES_H_)
|
||||
# define _BASHTYPES_H_
|
||||
|
||||
#if defined (CRAY)
|
||||
# define word __word
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (CRAY)
|
||||
# undef word
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#endif /* _BASHTYPES_H_ */
|
||||
+1
-1
@@ -612,7 +612,7 @@ get_job_by_name (name, flags)
|
||||
match = STREQN (p->command, name, cl);
|
||||
}
|
||||
else if (flags & JM_SUBSTRING)
|
||||
match = strindex (p->command, name) != (char *)0;
|
||||
match = strcasestr (p->command, name) != (char *)0;
|
||||
else
|
||||
match = STREQN (p->command, name, wl);
|
||||
|
||||
|
||||
@@ -0,0 +1,890 @@
|
||||
/* common.c - utility functions for all builtins */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <chartypes.h>
|
||||
#include "../bashtypes.h"
|
||||
#include "posixstat.h"
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "../bashansi.h"
|
||||
#include "../bashintl.h"
|
||||
|
||||
#define NEED_FPURGE_DECL
|
||||
|
||||
#include "../shell.h"
|
||||
#include "maxpath.h"
|
||||
#include "../flags.h"
|
||||
#include "../jobs.h"
|
||||
#include "../builtins.h"
|
||||
#include "../input.h"
|
||||
#include "../execute_cmd.h"
|
||||
#include "../trap.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "common.h"
|
||||
#include "builtext.h"
|
||||
#include <tilde/tilde.h>
|
||||
|
||||
#if defined (HISTORY)
|
||||
# include "../bashhist.h"
|
||||
#endif
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
extern int indirection_level, subshell_environment;
|
||||
extern int line_number;
|
||||
extern int last_command_exit_value;
|
||||
extern int running_trap;
|
||||
extern int posixly_correct;
|
||||
extern char *this_command_name, *shell_name;
|
||||
extern const char * const bash_getcwd_errstr;
|
||||
|
||||
/* Used by some builtins and the mainline code. */
|
||||
sh_builtin_func_t *last_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
sh_builtin_func_t *this_shell_builtin = (sh_builtin_func_t *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Error reporting, usage, and option processing */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* This is a lot like report_error (), but it is for shell builtins
|
||||
instead of shell control structures, and it won't ever exit the
|
||||
shell. */
|
||||
|
||||
static void
|
||||
builtin_error_prolog ()
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = get_name_for_error ();
|
||||
fprintf (stderr, "%s: ", name);
|
||||
|
||||
if (interactive_shell == 0)
|
||||
fprintf (stderr, _("line %d: "), executing_line_number ());
|
||||
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, "%s: ", this_command_name);
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
builtin_error (const char *format, ...)
|
||||
#else
|
||||
builtin_error (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
builtin_error_prolog ();
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
builtin_warning (const char *format, ...)
|
||||
#else
|
||||
builtin_warning (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
builtin_error_prolog ();
|
||||
fprintf (stderr, _("warning: "));
|
||||
|
||||
SH_VA_START (args, format);
|
||||
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
/* Print a usage summary for the currently-executing builtin command. */
|
||||
void
|
||||
builtin_usage ()
|
||||
{
|
||||
if (this_command_name && *this_command_name)
|
||||
fprintf (stderr, _("%s: usage: "), this_command_name);
|
||||
fprintf (stderr, "%s\n", current_builtin->short_doc);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/* Return if LIST is NULL else barf and jump to top_level. Used by some
|
||||
builtins that do not accept arguments. */
|
||||
void
|
||||
no_args (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
builtin_error (_("too many arguments"));
|
||||
top_level_cleanup ();
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that no options were given to the currently-executing builtin,
|
||||
and return 0 if there were options. */
|
||||
int
|
||||
no_options (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
reset_internal_getopt ();
|
||||
if (internal_getopt (list, "") != -1)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
sh_needarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: option requires an argument"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_neednumarg (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: numeric argument required"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_notfound (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not found"), s);
|
||||
}
|
||||
|
||||
/* Function called when one of the builtin commands detects an invalid
|
||||
option. */
|
||||
void
|
||||
sh_invalidopt (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidoptname (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid option name"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a valid identifier"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidnum (s)
|
||||
char *s;
|
||||
{
|
||||
char *msg;
|
||||
|
||||
if (*s == '0' && isdigit (s[1]))
|
||||
msg = _("invalid octal number");
|
||||
else if (*s == '0' && s[1] == 'x')
|
||||
msg = _("invalid hex number");
|
||||
else
|
||||
msg = _("invalid number");
|
||||
builtin_error ("%s: %s", s, msg);
|
||||
}
|
||||
|
||||
void
|
||||
sh_invalidsig (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: invalid signal specification"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_badpid (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("`%s': not a pid or valid job spec"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_readonly (s)
|
||||
const char *s;
|
||||
{
|
||||
builtin_error (_("%s: readonly variable"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_erange (s, desc)
|
||||
char *s, *desc;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: %s out of range"), s, desc ? desc : _("argument"));
|
||||
else
|
||||
builtin_error (_("%s out of range"), desc ? desc : _("argument"));
|
||||
}
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
void
|
||||
sh_badjob (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: no such job"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_nojobs (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: no job control"), s);
|
||||
else
|
||||
builtin_error (_("no job control"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
void
|
||||
sh_restricted (s)
|
||||
char *s;
|
||||
{
|
||||
if (s)
|
||||
builtin_error (_("%s: restricted"), s);
|
||||
else
|
||||
builtin_error (_("restricted"));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
sh_notbuiltin (s)
|
||||
char *s;
|
||||
{
|
||||
builtin_error (_("%s: not a shell builtin"), s);
|
||||
}
|
||||
|
||||
void
|
||||
sh_wrerror ()
|
||||
{
|
||||
#if defined (DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS) && defined (EPIPE)
|
||||
if (errno != EPIPE)
|
||||
#endif /* DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS && EPIPE */
|
||||
builtin_error (_("write error: %s"), strerror (errno));
|
||||
}
|
||||
|
||||
void
|
||||
sh_ttyerror (set)
|
||||
int set;
|
||||
{
|
||||
if (set)
|
||||
builtin_error (_("error setting terminal attributes: %s"), strerror (errno));
|
||||
else
|
||||
builtin_error (_("error getting terminal attributes: %s"), strerror (errno));
|
||||
}
|
||||
|
||||
int
|
||||
sh_chkwrite (s)
|
||||
int s;
|
||||
{
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
sh_wrerror ();
|
||||
fpurge (stdout);
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Shell positional parameter manipulation */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Convert a WORD_LIST into a C-style argv. Return the number of elements
|
||||
in the list in *IP, if IP is non-null. A convenience function for
|
||||
loadable builtins; also used by `test'. */
|
||||
char **
|
||||
make_builtin_argv (list, ip)
|
||||
WORD_LIST *list;
|
||||
int *ip;
|
||||
{
|
||||
char **argv;
|
||||
|
||||
argv = strvec_from_word_list (list, 0, 1, ip);
|
||||
argv[0] = this_command_name;
|
||||
return argv;
|
||||
}
|
||||
|
||||
/* Remember LIST in $0 ... $9, and REST_OF_ARGS. If DESTRUCTIVE is
|
||||
non-zero, then discard whatever the existing arguments are, else
|
||||
only discard the ones that are to be replaced. */
|
||||
void
|
||||
remember_args (list, destructive)
|
||||
WORD_LIST *list;
|
||||
int destructive;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
if ((destructive || list) && dollar_vars[i])
|
||||
{
|
||||
free (dollar_vars[i]);
|
||||
dollar_vars[i] = (char *)NULL;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
dollar_vars[i] = savestring (list->word->word);
|
||||
list = list->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* If arguments remain, assign them to REST_OF_ARGS.
|
||||
Note that copy_word_list (NULL) returns NULL, and
|
||||
that dispose_words (NULL) does nothing. */
|
||||
if (destructive || list)
|
||||
{
|
||||
dispose_words (rest_of_args);
|
||||
rest_of_args = copy_word_list (list);
|
||||
}
|
||||
|
||||
if (destructive)
|
||||
set_dollar_vars_changed ();
|
||||
}
|
||||
|
||||
static int changed_dollar_vars;
|
||||
|
||||
/* Have the dollar variables been reset to new values since we last
|
||||
checked? */
|
||||
int
|
||||
dollar_vars_changed ()
|
||||
{
|
||||
return (changed_dollar_vars);
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_unchanged ()
|
||||
{
|
||||
changed_dollar_vars = 0;
|
||||
}
|
||||
|
||||
void
|
||||
set_dollar_vars_changed ()
|
||||
{
|
||||
if (variable_context)
|
||||
changed_dollar_vars |= ARGS_FUNC;
|
||||
else if (this_shell_builtin == set_builtin)
|
||||
changed_dollar_vars |= ARGS_SETBLTIN;
|
||||
else
|
||||
changed_dollar_vars |= ARGS_INVOC;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Validating numeric input and arguments */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Read a numeric arg for this_command_name, the name of the shell builtin
|
||||
that wants it. LIST is the word list that the arg is to come from.
|
||||
Accept only the numeric argument; report an error if other arguments
|
||||
follow. If FATAL is 1, call throw_to_top_level, which exits the
|
||||
shell; if it's 2, call jump_to_top_level (DISCARD), which aborts the
|
||||
current command; if FATAL is 0, return an indication of an invalid
|
||||
number by setting *NUMOK == 0 and return -1. */
|
||||
int
|
||||
get_numeric_arg (list, fatal, count)
|
||||
WORD_LIST *list;
|
||||
int fatal;
|
||||
intmax_t *count;
|
||||
{
|
||||
char *arg;
|
||||
|
||||
if (count)
|
||||
*count = 1;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list)
|
||||
{
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || (legal_number (arg, count) == 0))
|
||||
{
|
||||
sh_neednumarg (list->word->word ? list->word->word : "`'");
|
||||
if (fatal == 0)
|
||||
return 0;
|
||||
else if (fatal == 1) /* fatal == 1; abort */
|
||||
throw_to_top_level ();
|
||||
else /* fatal == 2; discard current command */
|
||||
{
|
||||
top_level_cleanup ();
|
||||
jump_to_top_level (DISCARD);
|
||||
}
|
||||
}
|
||||
no_args (list->next);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Get an eight-bit status value from LIST */
|
||||
int
|
||||
get_exitstat (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int status;
|
||||
intmax_t sval;
|
||||
char *arg;
|
||||
|
||||
if (list && list->word && ISOPTION (list->word->word, '-'))
|
||||
list = list->next;
|
||||
|
||||
if (list == 0)
|
||||
return (last_command_exit_value);
|
||||
|
||||
arg = list->word->word;
|
||||
if (arg == 0 || legal_number (arg, &sval) == 0)
|
||||
{
|
||||
sh_neednumarg (list->word->word ? list->word->word : "`'");
|
||||
return 255;
|
||||
}
|
||||
no_args (list->next);
|
||||
|
||||
status = sval & 255;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return the octal number parsed from STRING, or -1 to indicate
|
||||
that the string contained a bad number. */
|
||||
int
|
||||
read_octal (string)
|
||||
char *string;
|
||||
{
|
||||
int result, digits;
|
||||
|
||||
result = digits = 0;
|
||||
while (*string && ISOCTAL (*string))
|
||||
{
|
||||
digits++;
|
||||
result = (result * 8) + (*string++ - '0');
|
||||
if (result > 0777)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (digits == 0 || *string)
|
||||
result = -1;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Manipulating the current working directory */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a consed string which is the current working directory.
|
||||
FOR_WHOM is the name of the caller for error printing. */
|
||||
char *the_current_working_directory = (char *)NULL;
|
||||
|
||||
char *
|
||||
get_working_directory (for_whom)
|
||||
char *for_whom;
|
||||
{
|
||||
if (no_symbolic_links)
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = (char *)NULL;
|
||||
}
|
||||
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
#if defined (GETCWD_BROKEN)
|
||||
the_current_working_directory = getcwd (0, PATH_MAX);
|
||||
#else
|
||||
the_current_working_directory = getcwd (0, 0);
|
||||
#endif
|
||||
if (the_current_working_directory == 0)
|
||||
{
|
||||
fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
|
||||
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
|
||||
_(bash_getcwd_errstr), strerror (errno));
|
||||
return (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (savestring (the_current_working_directory));
|
||||
}
|
||||
|
||||
/* Make NAME our internal idea of the current working directory. */
|
||||
void
|
||||
set_working_directory (name)
|
||||
char *name;
|
||||
{
|
||||
FREE (the_current_working_directory);
|
||||
the_current_working_directory = savestring (name);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Job control support functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
int
|
||||
get_job_by_name (name, flags)
|
||||
const char *name;
|
||||
int flags;
|
||||
{
|
||||
register int i, wl, cl, match, job;
|
||||
register PROCESS *p;
|
||||
register JOB *j;
|
||||
|
||||
job = NO_JOB;
|
||||
wl = strlen (name);
|
||||
for (i = js.j_jobslots - 1; i >= 0; i--)
|
||||
{
|
||||
j = get_job_by_jid (i);
|
||||
if (j == 0 || ((flags & JM_STOPPED) && J_JOBSTATE(j) != JSTOPPED))
|
||||
continue;
|
||||
|
||||
p = j->pipe;
|
||||
do
|
||||
{
|
||||
if (flags & JM_EXACT)
|
||||
{
|
||||
cl = strlen (p->command);
|
||||
match = STREQN (p->command, name, cl);
|
||||
}
|
||||
else if (flags & JM_SUBSTRING)
|
||||
match = strindex (p->command, name) != (char *)0;
|
||||
else
|
||||
match = STREQN (p->command, name, wl);
|
||||
|
||||
if (match == 0)
|
||||
{
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
else if (flags & JM_FIRSTMATCH)
|
||||
return i; /* return first match */
|
||||
else if (job != NO_JOB)
|
||||
{
|
||||
if (this_shell_builtin)
|
||||
builtin_error (_("%s: ambiguous job spec"), name);
|
||||
else
|
||||
report_error (_("%s: ambiguous job spec"), name);
|
||||
return (DUP_JOB);
|
||||
}
|
||||
else
|
||||
job = i;
|
||||
}
|
||||
while (p != j->pipe);
|
||||
}
|
||||
|
||||
return (job);
|
||||
}
|
||||
|
||||
/* Return the job spec found in LIST. */
|
||||
int
|
||||
get_job_spec (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
register char *word;
|
||||
int job, jflags;
|
||||
|
||||
if (list == 0)
|
||||
return (js.j_current);
|
||||
|
||||
word = list->word->word;
|
||||
|
||||
if (*word == '\0')
|
||||
return (NO_JOB);
|
||||
|
||||
if (*word == '%')
|
||||
word++;
|
||||
|
||||
if (DIGIT (*word) && all_digits (word))
|
||||
{
|
||||
job = atoi (word);
|
||||
return (job > js.j_jobslots ? NO_JOB : job - 1);
|
||||
}
|
||||
|
||||
jflags = 0;
|
||||
switch (*word)
|
||||
{
|
||||
case 0:
|
||||
case '%':
|
||||
case '+':
|
||||
return (js.j_current);
|
||||
|
||||
case '-':
|
||||
return (js.j_previous);
|
||||
|
||||
case '?': /* Substring search requested. */
|
||||
jflags |= JM_SUBSTRING;
|
||||
word++;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
return get_job_by_name (word, jflags);
|
||||
}
|
||||
}
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
/*
|
||||
* NOTE: `kill' calls this function with forcecols == 0
|
||||
*/
|
||||
int
|
||||
display_signal_list (list, forcecols)
|
||||
WORD_LIST *list;
|
||||
int forcecols;
|
||||
{
|
||||
register int i, column;
|
||||
char *name;
|
||||
int result, signum, dflags;
|
||||
intmax_t lsignum;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
if (!list)
|
||||
{
|
||||
for (i = 1, column = 0; i < NSIG; i++)
|
||||
{
|
||||
name = signal_name (i);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
continue;
|
||||
|
||||
if (posixly_correct && !forcecols)
|
||||
{
|
||||
/* This is for the kill builtin. POSIX.2 says the signal names
|
||||
are displayed without the `SIG' prefix. */
|
||||
if (STREQN (name, "SIG", 3))
|
||||
name += 3;
|
||||
printf ("%s%s", name, (i == NSIG - 1) ? "" : " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("%2d) %s", i, name);
|
||||
|
||||
if (++column < 5)
|
||||
printf ("\t");
|
||||
else
|
||||
{
|
||||
printf ("\n");
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((posixly_correct && !forcecols) || column != 0)
|
||||
printf ("\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
/* List individual signal names or numbers. */
|
||||
while (list)
|
||||
{
|
||||
if (legal_number (list->word->word, &lsignum))
|
||||
{
|
||||
/* This is specified by Posix.2 so that exit statuses can be
|
||||
mapped into signal numbers. */
|
||||
if (lsignum > 128)
|
||||
lsignum -= 128;
|
||||
if (lsignum < 0 || lsignum >= NSIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
signum = lsignum;
|
||||
name = signal_name (signum);
|
||||
if (STREQN (name, "SIGJUNK", 7) || STREQN (name, "Unknown", 7))
|
||||
{
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
#if defined (JOB_CONTROL)
|
||||
/* POSIX.2 says that `kill -l signum' prints the signal name without
|
||||
the `SIG' prefix. */
|
||||
printf ("%s\n", (this_shell_builtin == kill_builtin) ? name + 3 : name);
|
||||
#else
|
||||
printf ("%s\n", name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
dflags = DSIG_NOCASE;
|
||||
if (posixly_correct == 0 || this_shell_builtin != kill_builtin)
|
||||
dflags |= DSIG_SIGPREFIX;
|
||||
signum = decode_signal (list->word->word, dflags);
|
||||
if (signum == NO_SIG)
|
||||
{
|
||||
sh_invalidsig (list->word->word);
|
||||
result = EXECUTION_FAILURE;
|
||||
list = list->next;
|
||||
continue;
|
||||
}
|
||||
printf ("%d\n", signum);
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Finding builtin commands and their functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Perform a binary search and return the address of the builtin function
|
||||
whose name is NAME. If the function couldn't be found, or the builtin
|
||||
is disabled or has no function associated with it, return NULL.
|
||||
Return the address of the builtin.
|
||||
DISABLED_OKAY means find it even if the builtin is disabled. */
|
||||
struct builtin *
|
||||
builtin_address_internal (name, disabled_okay)
|
||||
char *name;
|
||||
int disabled_okay;
|
||||
{
|
||||
int hi, lo, mid, j;
|
||||
|
||||
hi = num_shell_builtins - 1;
|
||||
lo = 0;
|
||||
|
||||
while (lo <= hi)
|
||||
{
|
||||
mid = (lo + hi) / 2;
|
||||
|
||||
j = shell_builtins[mid].name[0] - name[0];
|
||||
|
||||
if (j == 0)
|
||||
j = strcmp (shell_builtins[mid].name, name);
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
/* It must have a function pointer. It must be enabled, or we
|
||||
must have explicitly allowed disabled functions to be found,
|
||||
and it must not have been deleted. */
|
||||
if (shell_builtins[mid].function &&
|
||||
((shell_builtins[mid].flags & BUILTIN_DELETED) == 0) &&
|
||||
((shell_builtins[mid].flags & BUILTIN_ENABLED) || disabled_okay))
|
||||
return (&shell_builtins[mid]);
|
||||
else
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
if (j > 0)
|
||||
hi = mid - 1;
|
||||
else
|
||||
lo = mid + 1;
|
||||
}
|
||||
return ((struct builtin *)NULL);
|
||||
}
|
||||
|
||||
/* Return the pointer to the function implementing builtin command NAME. */
|
||||
sh_builtin_func_t *
|
||||
find_shell_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the address of builtin with NAME, whether it is enabled or not. */
|
||||
sh_builtin_func_t *
|
||||
builtin_address (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 1);
|
||||
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
/* Return the function implementing the builtin NAME, but only if it is a
|
||||
POSIX.2 special builtin. */
|
||||
sh_builtin_func_t *
|
||||
find_special_builtin (name)
|
||||
char *name;
|
||||
{
|
||||
current_builtin = builtin_address_internal (name, 0);
|
||||
return ((current_builtin && (current_builtin->flags & SPECIAL_BUILTIN)) ?
|
||||
current_builtin->function :
|
||||
(sh_builtin_func_t *)NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
shell_builtin_compare (sbp1, sbp2)
|
||||
struct builtin *sbp1, *sbp2;
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = sbp1->name[0] - sbp2->name[0]) == 0)
|
||||
result = strcmp (sbp1->name, sbp2->name);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Sort the table of shell builtins so that the binary search will work
|
||||
in find_shell_builtin. */
|
||||
void
|
||||
initialize_shell_builtins ()
|
||||
{
|
||||
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
|
||||
(QSFUNC *)shell_builtin_compare);
|
||||
}
|
||||
@@ -659,6 +659,12 @@
|
||||
/* Define if you have the mbrtowc function. */
|
||||
#undef HAVE_MBRTOWC
|
||||
|
||||
/* Define if you have the mbscasecmp function. */
|
||||
#undef HAVE_MBSCASECMP
|
||||
|
||||
/* Define if you have the mbschr function. */
|
||||
#undef HAVE_MBSCHR
|
||||
|
||||
/* Define if you have the mbscmp function. */
|
||||
#undef HAVE_MBSCMP
|
||||
|
||||
@@ -738,6 +744,9 @@
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strcasestr function. */
|
||||
#undef HAVE_STRCASESTR
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
|
||||
+1089
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -728,7 +728,8 @@ AC_CHECK_FUNCS(bcopy bzero confstr fnmatch \
|
||||
AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf)
|
||||
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
|
||||
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
|
||||
AC_REPLACE_FUNCS(getcwd memset strcasecmp strerror strftime strnlen strpbrk strstr)
|
||||
AC_REPLACE_FUNCS(getcwd memset)
|
||||
AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
|
||||
AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
|
||||
AC_REPLACE_FUNCS(fdprintf)
|
||||
|
||||
|
||||
+3
-2
@@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([for Bash 4.0, version 4.013])dnl
|
||||
|
||||
define(bashvers, 4.0)
|
||||
define(relstatus, release)
|
||||
define(relstatus, maint)
|
||||
|
||||
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
|
||||
|
||||
@@ -728,7 +728,8 @@ AC_CHECK_FUNCS(bcopy bzero confstr fnmatch \
|
||||
AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf)
|
||||
AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
|
||||
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
|
||||
AC_REPLACE_FUNCS(getcwd memset strcasecmp strerror strftime strnlen strpbrk strstr)
|
||||
AC_REPLACE_FUNCS(getcwd memset)
|
||||
AC_REPLACE_FUNCS(strcasecmp strerror strftime strnlen strpbrk strstr)
|
||||
AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
|
||||
AC_REPLACE_FUNCS(fdprintf)
|
||||
|
||||
|
||||
@@ -1,58 +1,59 @@
|
||||
*** /fs1/chet/scratch/bash-4.0-patched/parse.y 2009-03-07 15:18:35.000000000 -0500
|
||||
--- parse.y 2009-03-07 14:16:32.000000000 -0500
|
||||
*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
|
||||
--- lib/readline/display.c 2009-04-25 21:42:18.000000000 -0400
|
||||
***************
|
||||
*** 3404,3423 ****
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `case', lex_incase -> 1", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if (shellbreak (ch) == 0)
|
||||
{
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
*** 513,516 ****
|
||||
--- 513,517 ----
|
||||
data structures. */
|
||||
_rl_block_sigint ();
|
||||
+ RL_SETSTATE (RL_STATE_REDISPLAYING);
|
||||
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
--- 3407,3439 ----
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `case', lex_incase -> 1 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
! ; /* don't modify LEX_RESWDOK if we're starting a comment */
|
||||
! else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
|
||||
! /* If we can read a reserved word and we're in case, we're at the
|
||||
! point where we can read a new pattern list or an esac. We
|
||||
! handle the esac case above. If we read a newline, we want to
|
||||
! leave LEX_RESWDOK alone. If we read anything else, we want to
|
||||
! turn off LEX_RESWDOK, since we're going to read a pattern list. */
|
||||
{
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
! /*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
! }
|
||||
! else if MBTEST(shellbreak (ch) == 0)
|
||||
! {
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
if (!rl_display_prompt)
|
||||
***************
|
||||
*** 1237,1240 ****
|
||||
--- 1238,1242 ----
|
||||
}
|
||||
|
||||
+ /* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
+ RL_UNSETSTATE (RL_STATE_REDISPLAYING);
|
||||
_rl_release_sigint ();
|
||||
}
|
||||
***************
|
||||
*** 1773,1777 ****
|
||||
adjust col_lendiff based on the difference between _rl_last_c_pos
|
||||
and _rl_screenwidth */
|
||||
! if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
|
||||
#endif
|
||||
{
|
||||
--- 1775,1779 ----
|
||||
adjust col_lendiff based on the difference between _rl_last_c_pos
|
||||
and _rl_screenwidth */
|
||||
! if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
|
||||
#endif
|
||||
{
|
||||
***************
|
||||
*** 1893,1896 ****
|
||||
--- 1895,1902 ----
|
||||
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
|
||||
cpos = _rl_last_c_pos;
|
||||
+
|
||||
+ if (cpos == 0 && cpos == new)
|
||||
+ return;
|
||||
+
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* If we have multibyte characters, NEW is indexed by the buffer point in
|
||||
***************
|
||||
*** 1906,1912 ****
|
||||
desired display position. */
|
||||
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
|
||||
! (prompt_physical_chars > _rl_screenwidth &&
|
||||
_rl_last_v_pos == prompt_last_screen_line &&
|
||||
! wrap_offset >= woff &&
|
||||
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
|
||||
/* XXX last comparison might need to be >= */
|
||||
--- 1912,1918 ----
|
||||
desired display position. */
|
||||
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
|
||||
! (prompt_physical_chars >= _rl_screenwidth &&
|
||||
_rl_last_v_pos == prompt_last_screen_line &&
|
||||
! wrap_offset >= woff && dpos >= woff &&
|
||||
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
|
||||
/* XXX last comparison might need to be >= */
|
||||
|
||||
+8
-8
@@ -2004,7 +2004,7 @@ prompt.
|
||||
.TP
|
||||
.B PROMPT_DIRTRIM
|
||||
If set to a number greater than zero, the value is used as the number of
|
||||
trailing directory components to retain when expanding the \fB\ew\fB and
|
||||
trailing directory components to retain when expanding the \fB\ew\fP and
|
||||
\fB\eW\fP prompt string escapes (see
|
||||
.SM
|
||||
.B PROMPTING
|
||||
@@ -2240,8 +2240,8 @@ The
|
||||
.B unset
|
||||
builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP]
|
||||
destroys the array element at index \fIsubscript\fP.
|
||||
Care must be taken to avoid unwanted side effects caused by filename
|
||||
generation.
|
||||
Care must be taken to avoid unwanted side effects caused by pathname
|
||||
expansion.
|
||||
\fBunset\fP \fIname\fP, where \fIname\fP is an array, or
|
||||
\fBunset\fP \fIname\fP[\fIsubscript\fP], where
|
||||
\fIsubscript\fP is \fB*\fP or \fB@\fP, removes the entire array.
|
||||
@@ -3021,7 +3021,7 @@ The special pattern characters have the following meanings:
|
||||
.B *
|
||||
Matches any string, including the null string.
|
||||
When the \fBglobstar\fP shell option is enabled, and \fB*\fP is used in
|
||||
a filename expansion context, two adjacent \fB*\fPs used as a single
|
||||
a pathname expansion context, two adjacent \fB*\fPs used as a single
|
||||
pattern will match all files and zero or more directories and
|
||||
subdirectories.
|
||||
If followed by a \fB/\fP, two adjacent \fB*\fPs will match only directories
|
||||
@@ -5708,7 +5708,7 @@ variable
|
||||
.B FIGNORE
|
||||
is used to filter the matches.
|
||||
.PP
|
||||
Any completions specified by a filename expansion pattern to the
|
||||
Any completions specified by a pathname expansion pattern to the
|
||||
\fB\-G\fP option are generated next.
|
||||
The words generated by the pattern need not match the word
|
||||
being completed.
|
||||
@@ -6697,7 +6697,7 @@ Names of all shell variables. May also be specified as \fB\-v\fP.
|
||||
.RE
|
||||
.TP 8
|
||||
\fB\-G\fP \fIglobpat\fP
|
||||
The filename expansion pattern \fIglobpat\fP is expanded to generate
|
||||
The pathname expansion pattern \fIglobpat\fP is expanded to generate
|
||||
the possible completions.
|
||||
.TP 8
|
||||
\fB\-W\fP \fIwordlist\fP
|
||||
@@ -6722,7 +6722,7 @@ of the
|
||||
array variable.
|
||||
.TP 8
|
||||
\fB\-X\fP \fIfilterpat\fP
|
||||
\fIfilterpat\fP is a pattern as used for filename expansion.
|
||||
\fIfilterpat\fP is a pattern as used for pathname expansion.
|
||||
It is applied to the list of possible completions generated by the
|
||||
preceding options and arguments, and each completion matching
|
||||
\fIfilterpat\fP is removed from the list.
|
||||
@@ -8570,7 +8570,7 @@ above for a description of \fBFIGNORE\fP.
|
||||
This option is enabled by default.
|
||||
.TP 8
|
||||
.B globstar
|
||||
If set, the pattern \fB**\fP used in a filename expansion context will
|
||||
If set, the pattern \fB**\fP used in a pathname expansion context will
|
||||
match a files and zero or more directories and subdirectories.
|
||||
If the pattern is followed by a \fB/\fP, only directories and
|
||||
subdirectories match.
|
||||
|
||||
+9412
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -1461,7 +1461,7 @@ bash$ echo a@{d,c,b@}e
|
||||
ade ace abe
|
||||
@end example
|
||||
|
||||
A sequence expression takes the form @code{@{@var{x}..@var{y}[@var{incr}]@}},
|
||||
A sequence expression takes the form @code{@{@var{x}..@var{y}[..@var{incr}]@}},
|
||||
where @var{x} and @var{y} are either integers or single characters,
|
||||
and @var{incr}, an optional increment, is an integer.
|
||||
When integers are supplied, the expression expands to each number between
|
||||
@@ -1767,7 +1767,7 @@ array in turn, and the expansion is the resultant list.
|
||||
@itemx $@{@var{parameter},,@var{pattern}@}
|
||||
This expansion modifies the case of alphabetic characters in @var{parameter}.
|
||||
The @var{pattern} is expanded to produce a pattern just as in
|
||||
pathname expansion.
|
||||
filename expansion.
|
||||
The @samp{^} operator converts lowercase letters matching @var{pattern}
|
||||
to uppercase; the @samp{,} operator converts matching uppercase letters
|
||||
to lowercase.
|
||||
@@ -1941,7 +1941,7 @@ an error message is printed and the command is not executed.
|
||||
If the shell option @code{nocaseglob} is enabled, the match is performed
|
||||
without regard to the case of alphabetic characters.
|
||||
|
||||
When a pattern is used for filename generation, the character @samp{.}
|
||||
When a pattern is used for filename expansion, the character @samp{.}
|
||||
at the start of a filename or immediately following a slash
|
||||
must be matched explicitly, unless the shell option @code{dotglob} is set.
|
||||
When matching a file name, the slash character must always be
|
||||
@@ -4013,7 +4013,7 @@ separately (@pxref{Command Execution Environment}), and may cause
|
||||
subshells to exit before executing all the commands in the subshell.
|
||||
|
||||
@item -f
|
||||
Disable file name generation (globbing).
|
||||
Disable filename expansion (globbing).
|
||||
|
||||
@item -h
|
||||
Locate and remember (hash) commands as they are looked up for execution.
|
||||
@@ -4396,7 +4396,7 @@ performed within @code{$@{@var{parameter}@}} expansions
|
||||
enclosed in double quotes. This option is enabled by default.
|
||||
|
||||
@item failglob
|
||||
If set, patterns which fail to match filenames during pathname expansion
|
||||
If set, patterns which fail to match filenames during filename expansion
|
||||
result in an expansion error.
|
||||
|
||||
@item force_fignore
|
||||
@@ -6039,7 +6039,7 @@ The @code{unset} builtin is used to destroy arrays.
|
||||
@code{unset} @var{name}[@var{subscript}]
|
||||
destroys the array element at index @var{subscript}.
|
||||
Care must be taken to avoid unwanted side effects caused by filename
|
||||
generation.
|
||||
expansion.
|
||||
@code{unset} @var{name}, where @var{name} is an array, removes the
|
||||
entire array. A subscript of @samp{*} or @samp{@@} also removes the
|
||||
entire array.
|
||||
|
||||
+11
-13
@@ -24,7 +24,7 @@ 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.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||
@@ -777,7 +777,7 @@ in @var{consequent-commands}, or zero if none was executed.
|
||||
The syntax of the @code{for} command is:
|
||||
|
||||
@example
|
||||
for @var{name} [in @var{words} @dots{}]; do @var{commands}; done
|
||||
for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done
|
||||
@end example
|
||||
Expand @var{words}, and execute @var{commands} once for each member
|
||||
in the resultant list, with @var{name} bound to the current member.
|
||||
@@ -864,7 +864,7 @@ operator terminates a pattern list.
|
||||
A list of patterns and an associated command-list is known
|
||||
as a @var{clause}.
|
||||
|
||||
Each clause must be terminated with @samp{;;}, @samp{,&}, or @samp{;;&}.
|
||||
Each clause must be terminated with @samp{;;}, @samp{;&}, or @samp{;;&}.
|
||||
The @var{word} undergoes tilde expansion, parameter expansion, command
|
||||
substitution, arithmetic expansion, and quote removal before matching is
|
||||
attempted. Each @var{pattern} undergoes tilde expansion, parameter
|
||||
@@ -1767,7 +1767,7 @@ array in turn, and the expansion is the resultant list.
|
||||
@itemx $@{@var{parameter},,@var{pattern}@}
|
||||
This expansion modifies the case of alphabetic characters in @var{parameter}.
|
||||
The @var{pattern} is expanded to produce a pattern just as in
|
||||
pathname expansion.
|
||||
filename expansion.
|
||||
The @samp{^} operator converts lowercase letters matching @var{pattern}
|
||||
to uppercase; the @samp{,} operator converts matching uppercase letters
|
||||
to lowercase.
|
||||
@@ -1941,7 +1941,7 @@ an error message is printed and the command is not executed.
|
||||
If the shell option @code{nocaseglob} is enabled, the match is performed
|
||||
without regard to the case of alphabetic characters.
|
||||
|
||||
When a pattern is used for filename generation, the character @samp{.}
|
||||
When a pattern is used for filename expansion, the character @samp{.}
|
||||
at the start of a filename or immediately following a slash
|
||||
must be matched explicitly, unless the shell option @code{dotglob} is set.
|
||||
When matching a file name, the slash character must always be
|
||||
@@ -4013,7 +4013,7 @@ separately (@pxref{Command Execution Environment}), and may cause
|
||||
subshells to exit before executing all the commands in the subshell.
|
||||
|
||||
@item -f
|
||||
Disable file name generation (globbing).
|
||||
Disable filename expansion (globbing).
|
||||
|
||||
@item -h
|
||||
Locate and remember (hash) commands as they are looked up for execution.
|
||||
@@ -4396,7 +4396,7 @@ performed within @code{$@{@var{parameter}@}} expansions
|
||||
enclosed in double quotes. This option is enabled by default.
|
||||
|
||||
@item failglob
|
||||
If set, patterns which fail to match filenames during pathname expansion
|
||||
If set, patterns which fail to match filenames during filename expansion
|
||||
result in an expansion error.
|
||||
|
||||
@item force_fignore
|
||||
@@ -5764,12 +5764,10 @@ True if the strings are equal.
|
||||
True if the strings are not equal.
|
||||
|
||||
@item @var{string1} < @var{string2}
|
||||
True if @var{string1} sorts before @var{string2} lexicographically
|
||||
in the current locale.
|
||||
True if @var{string1} sorts before @var{string2} lexicographically.
|
||||
|
||||
@item @var{string1} > @var{string2}
|
||||
True if @var{string1} sorts after @var{string2} lexicographically
|
||||
in the current locale.
|
||||
True if @var{string1} sorts after @var{string2} lexicographically.
|
||||
|
||||
@item @var{arg1} OP @var{arg2}
|
||||
@code{OP} is one of
|
||||
@@ -6041,7 +6039,7 @@ The @code{unset} builtin is used to destroy arrays.
|
||||
@code{unset} @var{name}[@var{subscript}]
|
||||
destroys the array element at index @var{subscript}.
|
||||
Care must be taken to avoid unwanted side effects caused by filename
|
||||
generation.
|
||||
expansion.
|
||||
@code{unset} @var{name}, where @var{name} is an array, removes the
|
||||
entire array. A subscript of @samp{*} or @samp{@@} also removes the
|
||||
entire array.
|
||||
@@ -7325,7 +7323,7 @@ But first, you should
|
||||
make sure that it really is a bug, and that it appears in the latest
|
||||
version of Bash.
|
||||
The latest version of Bash is always available for FTP from
|
||||
@uref{ftp://ftp.gnu.org/pub/bash/}.
|
||||
@uref{ftp://ftp.gnu.org/pub/gnu/bash/}.
|
||||
|
||||
Once you have determined that a bug actually exists, use the
|
||||
@code{bashbug} command to submit a bug report.
|
||||
|
||||
+1
-1
@@ -4372,7 +4372,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
command = (char *)NULL;
|
||||
if (restricted && xstrchr (pathname, '/'))
|
||||
if (restricted && mbschr (pathname, '/'))
|
||||
{
|
||||
internal_error (_("%s: restricted: cannot specify `/' in command names"),
|
||||
pathname);
|
||||
|
||||
@@ -3592,10 +3592,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||
begin_unwind_frame ("simple-command");
|
||||
|
||||
if (echo_command_at_execute)
|
||||
{
|
||||
itrace("execute_simple_command: xtrace_print_word_list: %s", words->word->word);
|
||||
xtrace_print_word_list (words, 1);
|
||||
}
|
||||
|
||||
builtin = (sh_builtin_func_t *)NULL;
|
||||
func = (SHELL_VAR *)NULL;
|
||||
|
||||
@@ -224,6 +224,21 @@ extern char *uitos __P((uintmax_t));
|
||||
|
||||
extern char *sh_makepath __P((const char *, const char *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/mbscasecmp.c */
|
||||
#if !defined (HAVE_MBSCASECMP)
|
||||
extern char *mbscasecmp __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/mbschr.c */
|
||||
#if !defined (HAVE_MBSCHR)
|
||||
extern char *mbschr __P((const char *, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/mbscmp.c */
|
||||
#if !defined (HAVE_MBSCMP)
|
||||
extern char *mbscmp __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/netconn.c */
|
||||
extern int isnetconn __P((int));
|
||||
|
||||
@@ -293,6 +308,11 @@ extern int strncasecmp __P((const char *, const char *, int));
|
||||
extern int strcasecmp __P((const char *, const char *));
|
||||
#endif /* HAVE_STRCASECMP */
|
||||
|
||||
/* declarations for functions defined in lib/sh/strcasestr.c */
|
||||
#if ! HAVE_STRCASESTR
|
||||
extern char *strcasestr __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strerror.c */
|
||||
#if !defined (HAVE_STRERROR) && !defined (strerror)
|
||||
extern char *strerror __P((int));
|
||||
@@ -303,9 +323,6 @@ extern char *strerror __P((int));
|
||||
extern size_t strftime __P((char *, size_t, const char *, const struct tm *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strindex.c */
|
||||
extern char *strindex __P((const char *, const char *));
|
||||
|
||||
/* declarations for functions and structures defined in lib/sh/stringlist.c */
|
||||
|
||||
/* This is a general-purpose argv-style array struct. */
|
||||
@@ -422,10 +439,6 @@ extern unsigned int fsleep __P((unsigned int, unsigned int));
|
||||
/* declarations for functions defined in lib/sh/winsize.c */
|
||||
extern void get_new_window_size __P((int, int *, int *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/xstrchr.c */
|
||||
#undef xstrchr
|
||||
extern char *xstrchr __P((const char *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zcatfd.c */
|
||||
extern int zcatfd __P((int, int, char *));
|
||||
|
||||
|
||||
+458
@@ -0,0 +1,458 @@
|
||||
/* externs.h -- extern function declarations which do not appear in their
|
||||
own header file. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Make sure that this is included *after* config.h! */
|
||||
|
||||
#if !defined (_EXTERNS_H_)
|
||||
# define _EXTERNS_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
/* Functions from expr.c. */
|
||||
extern intmax_t evalexp __P((char *, int *));
|
||||
|
||||
/* Functions from print_cmd.c. */
|
||||
#define FUNC_MULTILINE 0x01
|
||||
#define FUNC_EXTERNAL 0x02
|
||||
|
||||
extern char *make_command_string __P((COMMAND *));
|
||||
extern char *named_function_string __P((char *, COMMAND *, int));
|
||||
|
||||
extern void print_command __P((COMMAND *));
|
||||
extern void print_simple_command __P((SIMPLE_COM *));
|
||||
extern void print_word_list __P((WORD_LIST *, char *));
|
||||
|
||||
/* debugger support */
|
||||
extern void print_for_command_head __P((FOR_COM *));
|
||||
#if defined (SELECT_COMMAND)
|
||||
extern void print_select_command_head __P((SELECT_COM *));
|
||||
#endif
|
||||
extern void print_case_command_head __P((CASE_COM *));
|
||||
#if defined (DPAREN_ARITHMETIC)
|
||||
extern void print_arith_command __P((WORD_LIST *));
|
||||
#endif
|
||||
#if defined (COND_COMMAND)
|
||||
extern void print_cond_command __P((COND_COM *));
|
||||
#endif
|
||||
|
||||
/* set -x support */
|
||||
extern char *indirection_level_string __P((void));
|
||||
extern void xtrace_print_assignment __P((char *, char *, int, int));
|
||||
extern void xtrace_print_word_list __P((WORD_LIST *, int));
|
||||
extern void xtrace_print_for_command_head __P((FOR_COM *));
|
||||
#if defined (SELECT_COMMAND)
|
||||
extern void xtrace_print_select_command_head __P((SELECT_COM *));
|
||||
#endif
|
||||
extern void xtrace_print_case_command_head __P((CASE_COM *));
|
||||
#if defined (DPAREN_ARITHMETIC)
|
||||
extern void xtrace_print_arith_cmd __P((WORD_LIST *));
|
||||
#endif
|
||||
#if defined (COND_COMMAND)
|
||||
extern void xtrace_print_cond_term __P((int, int, WORD_DESC *, char *, char *));
|
||||
#endif
|
||||
|
||||
/* Functions from shell.c. */
|
||||
extern void exit_shell __P((int)) __attribute__((__noreturn__));
|
||||
extern void sh_exit __P((int)) __attribute__((__noreturn__));
|
||||
extern void disable_priv_mode __P((void));
|
||||
extern void unbind_args __P((void));
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
extern int shell_is_restricted __P((char *));
|
||||
extern int maybe_make_restricted __P((char *));
|
||||
#endif
|
||||
|
||||
extern void unset_bash_input __P((int));
|
||||
extern void get_current_user_info __P((void));
|
||||
|
||||
/* Functions from eval.c. */
|
||||
extern int reader_loop __P((void));
|
||||
extern int parse_command __P((void));
|
||||
extern int read_command __P((void));
|
||||
|
||||
/* Functions from braces.c. */
|
||||
#if defined (BRACE_EXPANSION)
|
||||
extern char **brace_expand __P((char *));
|
||||
#endif
|
||||
|
||||
/* Miscellaneous functions from parse.y */
|
||||
extern int yyparse __P((void));
|
||||
extern int return_EOF __P((void));
|
||||
extern char *xparse_dolparen __P((char *, char *, int *, int));
|
||||
extern void reset_parser __P((void));
|
||||
extern WORD_LIST *parse_string_to_word_list __P((char *, int, const char *));
|
||||
|
||||
extern void free_pushed_string_input __P((void));
|
||||
|
||||
extern char *decode_prompt_string __P((char *));
|
||||
|
||||
extern int get_current_prompt_level __P((void));
|
||||
extern void set_current_prompt_level __P((int));
|
||||
|
||||
#if defined (HISTORY)
|
||||
extern char *history_delimiting_chars __P((void));
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in locale.c */
|
||||
extern void set_default_locale __P((void));
|
||||
extern void set_default_locale_vars __P((void));
|
||||
extern int set_locale_var __P((char *, char *));
|
||||
extern int set_lang __P((char *, char *));
|
||||
extern void set_default_lang __P((void));
|
||||
extern char *get_locale_var __P((char *));
|
||||
extern char *localetrans __P((char *, int, int *));
|
||||
extern char *mk_msgstr __P((char *, int *));
|
||||
extern char *localeexpand __P((char *, int, int, int, int *));
|
||||
|
||||
/* Declarations for functions defined in list.c. */
|
||||
extern void list_walk __P((GENERIC_LIST *, sh_glist_func_t *));
|
||||
extern void wlist_walk __P((WORD_LIST *, sh_icpfunc_t *));
|
||||
extern GENERIC_LIST *list_reverse ();
|
||||
extern int list_length ();
|
||||
extern GENERIC_LIST *list_append ();
|
||||
extern GENERIC_LIST *list_remove ();
|
||||
|
||||
/* Declarations for functions defined in stringlib.c */
|
||||
extern int find_string_in_alist __P((char *, STRING_INT_ALIST *, int));
|
||||
extern char *find_token_in_alist __P((int, STRING_INT_ALIST *, int));
|
||||
extern int find_index_in_alist __P((char *, STRING_INT_ALIST *, int));
|
||||
|
||||
extern char *substring __P((char *, int, int));
|
||||
extern char *strsub __P((char *, char *, char *, int));
|
||||
extern char *strcreplace __P((char *, int, char *, int));
|
||||
extern void strip_leading __P((char *));
|
||||
extern void strip_trailing __P((char *, int, int));
|
||||
extern void xbcopy __P((char *, char *, int));
|
||||
|
||||
/* Functions from version.c. */
|
||||
extern char *shell_version_string __P((void));
|
||||
extern void show_shell_version __P((int));
|
||||
|
||||
/* Functions from the bash library, lib/sh/libsh.a. These should really
|
||||
go into a separate include file. */
|
||||
|
||||
/* declarations for functions defined in lib/sh/casemod.c */
|
||||
extern char *sh_modcase __P((const char *, char *, int));
|
||||
|
||||
/* Defines for flags argument to sh_modcase. These need to agree with what's
|
||||
in lib/sh/casemode.c */
|
||||
#define CASE_LOWER 0x0001
|
||||
#define CASE_UPPER 0x0002
|
||||
#define CASE_CAPITALIZE 0x0004
|
||||
#define CASE_UNCAP 0x0008
|
||||
#define CASE_TOGGLE 0x0010
|
||||
#define CASE_TOGGLEALL 0x0020
|
||||
#define CASE_UPFIRST 0x0040
|
||||
#define CASE_LOWFIRST 0x0080
|
||||
|
||||
#define CASE_USEWORDS 0x1000
|
||||
|
||||
/* declarations for functions defined in lib/sh/clktck.c */
|
||||
extern long get_clk_tck __P((void));
|
||||
|
||||
/* declarations for functions defined in lib/sh/clock.c */
|
||||
extern void clock_t_to_secs ();
|
||||
extern void print_clock_t ();
|
||||
|
||||
/* Declarations for functions defined in lib/sh/fdprintf.c */
|
||||
extern void fdprintf __P((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
|
||||
|
||||
/* Declarations for functions defined in lib/sh/fmtulong.c */
|
||||
#define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
|
||||
#define FL_ADDBASE 0x02 /* add base# prefix to converted value */
|
||||
#define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
|
||||
#define FL_UNSIGNED 0x08 /* don't add any sign */
|
||||
|
||||
extern char *fmtulong __P((unsigned long int, int, char *, size_t, int));
|
||||
|
||||
/* Declarations for functions defined in lib/sh/fmtulong.c */
|
||||
#if defined (HAVE_LONG_LONG)
|
||||
extern char *fmtullong __P((unsigned long long int, int, char *, size_t, int));
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in lib/sh/fmtumax.c */
|
||||
extern char *fmtumax __P((uintmax_t, int, char *, size_t, int));
|
||||
|
||||
/* Declarations for functions defined in lib/sh/fpurge.c */
|
||||
#if !HAVE_DECL_FPURGE
|
||||
|
||||
#if HAVE_FPURGE
|
||||
# define fpurge _bash_fpurge
|
||||
#endif
|
||||
extern int fpurge __P((FILE *stream));
|
||||
|
||||
#endif /* HAVE_DECL_FPURGE */
|
||||
|
||||
|
||||
/* Declarations for functions defined in lib/sh/getcwd.c */
|
||||
#if !defined (HAVE_GETCWD)
|
||||
extern char *getcwd __P((char *, size_t));
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in lib/sh/input_avail.c */
|
||||
extern int input_avail __P((int));
|
||||
|
||||
/* Declarations for functions defined in lib/sh/itos.c */
|
||||
extern char *inttostr __P((intmax_t, char *, size_t));
|
||||
extern char *itos __P((intmax_t));
|
||||
extern char *uinttostr __P((uintmax_t, char *, size_t));
|
||||
extern char *uitos __P((uintmax_t));
|
||||
|
||||
/* declarations for functions defined in lib/sh/makepath.c */
|
||||
#define MP_DOTILDE 0x01
|
||||
#define MP_DOCWD 0x02
|
||||
#define MP_RMDOT 0x04
|
||||
#define MP_IGNDOT 0x08
|
||||
|
||||
extern char *sh_makepath __P((const char *, const char *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/mbschr.c */
|
||||
#if !defined (HAVE_MBSCHR)
|
||||
extern char *mbschr __P((const char *, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/mbscmp.c */
|
||||
#if !defined (HAVE_MBSCMP)
|
||||
extern char *mbscmp __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/netconn.c */
|
||||
extern int isnetconn __P((int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/netopen.c */
|
||||
extern int netopen __P((char *));
|
||||
|
||||
/* Declarations for functions defined in lib/sh/oslib.c */
|
||||
|
||||
#if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
|
||||
extern int dup2 __P((int, int));
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_GETDTABLESIZE)
|
||||
extern int getdtablesize __P((void));
|
||||
#endif /* !HAVE_GETDTABLESIZE */
|
||||
|
||||
#if !defined (HAVE_GETHOSTNAME)
|
||||
extern int gethostname __P((char *, int));
|
||||
#endif /* !HAVE_GETHOSTNAME */
|
||||
|
||||
extern int getmaxgroups __P((void));
|
||||
extern long getmaxchild __P((void));
|
||||
|
||||
/* declarations for functions defined in lib/sh/pathcanon.c */
|
||||
#define PATH_CHECKDOTDOT 0x0001
|
||||
#define PATH_CHECKEXISTS 0x0002
|
||||
#define PATH_HARDPATH 0x0004
|
||||
#define PATH_NOALLOC 0x0008
|
||||
|
||||
extern char *sh_canonpath __P((char *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/pathphys.c */
|
||||
extern char *sh_physpath __P((char *, int));
|
||||
extern char *sh_realpath __P((const char *, char *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/setlinebuf.c */
|
||||
#ifdef NEED_SH_SETLINEBUF_DECL
|
||||
extern int sh_setlinebuf __P((FILE *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/shaccess.c */
|
||||
extern int sh_eaccess __P((char *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/shmatch.c */
|
||||
extern int sh_regmatch __P((const char *, const char *, int));
|
||||
|
||||
/* defines for flags argument to sh_regmatch. */
|
||||
#define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */
|
||||
#define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */
|
||||
|
||||
/* declarations for functions defined in lib/sh/shquote.c */
|
||||
extern char *sh_single_quote __P((char *));
|
||||
extern char *sh_double_quote __P((char *));
|
||||
extern char *sh_mkdoublequoted __P((const char *, int, int));
|
||||
extern char *sh_un_double_quote __P((char *));
|
||||
extern char *sh_backslash_quote __P((char *));
|
||||
extern char *sh_backslash_quote_for_double_quotes __P((char *));
|
||||
extern int sh_contains_shell_metas __P((char *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/spell.c */
|
||||
extern int spname __P((char *, char *));
|
||||
extern char *dirspell __P((char *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/strcasecmp.c */
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
extern int strncasecmp __P((const char *, const char *, int));
|
||||
extern int strcasecmp __P((const char *, const char *));
|
||||
#endif /* HAVE_STRCASECMP */
|
||||
|
||||
/* declarations for functions defined in lib/sh/strcasestr.c */
|
||||
#if ! HAVE_STRCASESTR
|
||||
extern char *strcasestr __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strerror.c */
|
||||
#if !defined (HAVE_STRERROR) && !defined (strerror)
|
||||
extern char *strerror __P((int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strftime.c */
|
||||
#if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
|
||||
extern size_t strftime __P((char *, size_t, const char *, const struct tm *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions and structures defined in lib/sh/stringlist.c */
|
||||
|
||||
/* This is a general-purpose argv-style array struct. */
|
||||
typedef struct _list_of_strings {
|
||||
char **list;
|
||||
int list_size;
|
||||
int list_len;
|
||||
} STRINGLIST;
|
||||
|
||||
typedef int sh_strlist_map_func_t __P((char *));
|
||||
|
||||
extern STRINGLIST *strlist_create __P((int));
|
||||
extern STRINGLIST *strlist_resize __P((STRINGLIST *, int));
|
||||
extern void strlist_flush __P((STRINGLIST *));
|
||||
extern void strlist_dispose __P((STRINGLIST *));
|
||||
extern int strlist_remove __P((STRINGLIST *, char *));
|
||||
extern STRINGLIST *strlist_copy __P((STRINGLIST *));
|
||||
extern STRINGLIST *strlist_merge __P((STRINGLIST *, STRINGLIST *));
|
||||
extern STRINGLIST *strlist_append __P((STRINGLIST *, STRINGLIST *));
|
||||
extern STRINGLIST *strlist_prefix_suffix __P((STRINGLIST *, char *, char *));
|
||||
extern void strlist_print __P((STRINGLIST *, char *));
|
||||
extern void strlist_walk __P((STRINGLIST *, sh_strlist_map_func_t *));
|
||||
extern void strlist_sort __P((STRINGLIST *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/stringvec.c */
|
||||
|
||||
extern char **strvec_create __P((int));
|
||||
extern char **strvec_resize __P((char **, int));
|
||||
extern void strvec_flush __P((char **));
|
||||
extern void strvec_dispose __P((char **));
|
||||
extern int strvec_remove __P((char **, char *));
|
||||
extern int strvec_len __P((char **));
|
||||
extern int strvec_search __P((char **, char *));
|
||||
extern char **strvec_copy __P((char **));
|
||||
extern int strvec_strcmp __P((char **, char **));
|
||||
extern void strvec_sort __P((char **));
|
||||
|
||||
extern char **strvec_from_word_list __P((WORD_LIST *, int, int, int *));
|
||||
extern WORD_LIST *strvec_to_word_list __P((char **, int, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/strnlen.c */
|
||||
#if !defined (HAVE_STRNLEN)
|
||||
extern size_t strnlen __P((const char *, size_t));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strpbrk.c */
|
||||
#if !defined (HAVE_STRPBRK)
|
||||
extern char *strpbrk __P((const char *, const char *));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtod.c */
|
||||
#if !defined (HAVE_STRTOD)
|
||||
extern double strtod __P((const char *, char **));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtol.c */
|
||||
#if !HAVE_DECL_STRTOL
|
||||
extern long strtol __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtoll.c */
|
||||
#if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOLL
|
||||
extern long long strtoll __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtoul.c */
|
||||
#if !HAVE_DECL_STRTOUL
|
||||
extern unsigned long strtoul __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtoull.c */
|
||||
#if defined (HAVE_LONG_LONG) && !HAVE_DECL_STRTOULL
|
||||
extern unsigned long long strtoull __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strimax.c */
|
||||
#if !HAVE_DECL_STRTOIMAX
|
||||
extern intmax_t strtoimax __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strumax.c */
|
||||
#if !HAVE_DECL_STRTOUMAX
|
||||
extern uintmax_t strtoumax __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/strtrans.c */
|
||||
extern char *ansicstr __P((char *, int, int, int *, int *));
|
||||
extern char *ansic_quote __P((char *, int, int *));
|
||||
extern int ansic_shouldquote __P((const char *));
|
||||
extern char *ansiexpand __P((char *, int, int, int *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/timeval.c. No prototypes
|
||||
so we don't have to count on having a definition of struct timeval in
|
||||
scope when this file is included. */
|
||||
extern void timeval_to_secs ();
|
||||
extern void print_timeval ();
|
||||
|
||||
/* declarations for functions defined in lib/sh/tmpfile.c */
|
||||
#define MT_USETMPDIR 0x0001
|
||||
#define MT_READWRITE 0x0002
|
||||
#define MT_USERANDOM 0x0004
|
||||
|
||||
extern char *sh_mktmpname __P((char *, int));
|
||||
extern int sh_mktmpfd __P((char *, int, char **));
|
||||
/* extern FILE *sh_mktmpfp __P((char *, int, char **)); */
|
||||
|
||||
/* declarations for functions defined in lib/sh/uconvert.c */
|
||||
extern int uconvert __P((char *, long *, long *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/ufuncs.c */
|
||||
extern unsigned int falarm __P((unsigned int, unsigned int));
|
||||
extern unsigned int fsleep __P((unsigned int, unsigned int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/winsize.c */
|
||||
extern void get_new_window_size __P((int, int *, int *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zcatfd.c */
|
||||
extern int zcatfd __P((int, int, char *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zgetline.c */
|
||||
extern ssize_t zgetline __P((int, char **, size_t *, int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zmapfd.c */
|
||||
extern int zmapfd __P((int, char **, char *));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zread.c */
|
||||
extern ssize_t zread __P((int, char *, size_t));
|
||||
extern ssize_t zreadretry __P((int, char *, size_t));
|
||||
extern ssize_t zreadintr __P((int, char *, size_t));
|
||||
extern ssize_t zreadc __P((int, char *));
|
||||
extern ssize_t zreadcintr __P((int, char *));
|
||||
extern void zreset __P((void));
|
||||
extern void zsyncfd __P((int));
|
||||
|
||||
/* declarations for functions defined in lib/sh/zwrite.c */
|
||||
extern int zwrite __P((int, char *, size_t));
|
||||
|
||||
#endif /* _EXTERNS_H_ */
|
||||
@@ -577,7 +577,7 @@ int
|
||||
absolute_program (string)
|
||||
const char *string;
|
||||
{
|
||||
return ((char *)xstrchr (string, '/') != (char *)NULL);
|
||||
return ((char *)mbschr (string, '/') != (char *)NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
+1136
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,7 @@ extern char *strcpy __P((char *, const char *));
|
||||
#endif
|
||||
|
||||
#ifndef member
|
||||
# define member(c, s) ((c) ? ((char *)xstrchr ((s), (c)) != (char *)NULL) : 0)
|
||||
# define member(c, s) ((c) ? ((char *)mbschr ((s), (c)) != (char *)NULL) : 0)
|
||||
#endif
|
||||
|
||||
#ifndef whitespace
|
||||
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
/* general.h -- defines that everybody likes to use. */
|
||||
|
||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (_GENERAL_H_)
|
||||
#define _GENERAL_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#include "bashtypes.h"
|
||||
#include "chartypes.h"
|
||||
|
||||
#if defined (HAVE_SYS_RESOURCE_H) && defined (RLIMTYPE)
|
||||
# if defined (HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (HAVE_LIMITS_H)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* NULL pointer type. */
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* !__STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
/* Hardly used anymore */
|
||||
#define pointer_to_int(x) (int)((char *)x - (char *)0)
|
||||
|
||||
#if defined (alpha) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__)
|
||||
extern char *strchr (), *strrchr ();
|
||||
#endif
|
||||
|
||||
#if !defined (strcpy) && (defined (HAVE_DECL_STRCPY) && !HAVE_DECL_STRCPY)
|
||||
extern char *strcpy __P((char *, const char *));
|
||||
#endif
|
||||
|
||||
#if !defined (savestring)
|
||||
# define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
|
||||
#endif
|
||||
|
||||
#ifndef member
|
||||
# define member(c, s) ((c) ? ((char *)xstrchr ((s), (c)) != (char *)NULL) : 0)
|
||||
#endif
|
||||
|
||||
#ifndef whitespace
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_MAX
|
||||
# ifdef __CHAR_UNSIGNED__
|
||||
# define CHAR_MAX 0xff
|
||||
# else
|
||||
# define CHAR_MAX 0x7f
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Nonzero if the integer type T is signed. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
/* Bound on length of the string representing an integer value of type T.
|
||||
Subtract one for the sign bit if T is signed;
|
||||
302 / 1000 is log10 (2) rounded up;
|
||||
add one for integer division truncation;
|
||||
add one more for a minus sign if t is signed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
|
||||
+ 1 + TYPE_SIGNED (t))
|
||||
|
||||
|
||||
/* Define exactly what a legal shell identifier consists of. */
|
||||
#define legal_variable_starter(c) (ISALPHA(c) || (c == '_'))
|
||||
#define legal_variable_char(c) (ISALNUM(c) || c == '_')
|
||||
|
||||
/* Definitions used in subst.c and by the `read' builtin for field
|
||||
splitting. */
|
||||
#define spctabnl(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
|
||||
|
||||
/* All structs which contain a `next' field should have that field
|
||||
as the first field in the struct. This means that functions
|
||||
can be written to handle the general case for linked lists. */
|
||||
typedef struct g_list {
|
||||
struct g_list *next;
|
||||
} GENERIC_LIST;
|
||||
|
||||
/* Here is a generic structure for associating character strings
|
||||
with integers. It is used in the parser for shell tokenization. */
|
||||
typedef struct {
|
||||
char *word;
|
||||
int token;
|
||||
} STRING_INT_ALIST;
|
||||
|
||||
/* A macro to avoid making an uneccessary function call. */
|
||||
#define REVERSE_LIST(list, type) \
|
||||
((list && list->next) ? (type)list_reverse ((GENERIC_LIST *)list) \
|
||||
: (type)(list))
|
||||
|
||||
#if __GNUC__ > 1
|
||||
# define FASTCOPY(s, d, n) __builtin_memcpy ((d), (s), (n))
|
||||
#else /* !__GNUC__ */
|
||||
# if !defined (HAVE_BCOPY)
|
||||
# if !defined (HAVE_MEMMOVE)
|
||||
# define FASTCOPY(s, d, n) memcpy ((d), (s), (n))
|
||||
# else
|
||||
# define FASTCOPY(s, d, n) memmove ((d), (s), (n))
|
||||
# endif /* !HAVE_MEMMOVE */
|
||||
# else /* HAVE_BCOPY */
|
||||
# define FASTCOPY(s, d, n) bcopy ((s), (d), (n))
|
||||
# endif /* HAVE_BCOPY */
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* String comparisons that possibly save a function call each. */
|
||||
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
|
||||
#define STREQN(a, b, n) ((n == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
|
||||
|
||||
/* More convenience definitions that possibly save system or libc calls. */
|
||||
#define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
|
||||
#define FREE(s) do { if (s) free (s); } while (0)
|
||||
#define MEMBER(c, s) (((c) && c == (s)[0] && !(s)[1]) || (member(c, s)))
|
||||
|
||||
/* A fairly hairy macro to check whether an allocated string has more room,
|
||||
and to resize it using xrealloc if it does not.
|
||||
STR is the string (char *)
|
||||
CIND is the current index into the string (int)
|
||||
ROOM is the amount of additional room we need in the string (int)
|
||||
CSIZE is the currently-allocated size of STR (int)
|
||||
SINCR is how much to increment CSIZE before calling xrealloc (int) */
|
||||
|
||||
#define RESIZE_MALLOCED_BUFFER(str, cind, room, csize, sincr) \
|
||||
do { \
|
||||
if ((cind) + (room) >= csize) \
|
||||
{ \
|
||||
while ((cind) + (room) >= csize) \
|
||||
csize += (sincr); \
|
||||
str = xrealloc (str, csize); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Function pointers can be declared as (Function *)foo. */
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction (); /* no longer used */
|
||||
typedef char **CPPFunction (); /* no longer used */
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
#ifndef SH_FUNCTION_TYPEDEF
|
||||
# define SH_FUNCTION_TYPEDEF
|
||||
|
||||
/* Shell function typedefs with prototypes */
|
||||
/* `Generic' function pointer typedefs */
|
||||
|
||||
typedef int sh_intfunc_t __P((int));
|
||||
typedef int sh_ivoidfunc_t __P((void));
|
||||
typedef int sh_icpfunc_t __P((char *));
|
||||
typedef int sh_icppfunc_t __P((char **));
|
||||
typedef int sh_iptrfunc_t __P((PTR_T));
|
||||
|
||||
typedef void sh_voidfunc_t __P((void));
|
||||
typedef void sh_vintfunc_t __P((int));
|
||||
typedef void sh_vcpfunc_t __P((char *));
|
||||
typedef void sh_vcppfunc_t __P((char **));
|
||||
typedef void sh_vptrfunc_t __P((PTR_T));
|
||||
|
||||
typedef int sh_wdesc_func_t __P((WORD_DESC *));
|
||||
typedef int sh_wlist_func_t __P((WORD_LIST *));
|
||||
|
||||
typedef int sh_glist_func_t __P((GENERIC_LIST *));
|
||||
|
||||
typedef char *sh_string_func_t __P((char *)); /* like savestring, et al. */
|
||||
|
||||
typedef int sh_msg_func_t __P((const char *, ...)); /* printf(3)-like */
|
||||
typedef void sh_vmsg_func_t __P((const char *, ...)); /* printf(3)-like */
|
||||
|
||||
/* Specific function pointer typedefs. Most of these could be done
|
||||
with #defines. */
|
||||
typedef void sh_sv_func_t __P((char *)); /* sh_vcpfunc_t */
|
||||
typedef void sh_free_func_t __P((PTR_T)); /* sh_vptrfunc_t */
|
||||
typedef void sh_resetsig_func_t __P((int)); /* sh_vintfunc_t */
|
||||
|
||||
typedef int sh_ignore_func_t __P((const char *)); /* sh_icpfunc_t */
|
||||
|
||||
typedef int sh_assign_func_t __P((const char *)); /* sh_icpfunc_t */
|
||||
typedef int sh_wassign_func_t __P((WORD_DESC *));
|
||||
|
||||
typedef int sh_builtin_func_t __P((WORD_LIST *)); /* sh_wlist_func_t */
|
||||
|
||||
#endif /* SH_FUNCTION_TYPEDEF */
|
||||
|
||||
#define NOW ((time_t) time ((time_t *) 0))
|
||||
|
||||
/* Some defines for calling file status functions. */
|
||||
#define FS_EXISTS 0x1
|
||||
#define FS_EXECABLE 0x2
|
||||
#define FS_EXEC_PREFERRED 0x4
|
||||
#define FS_EXEC_ONLY 0x8
|
||||
#define FS_DIRECTORY 0x10
|
||||
#define FS_NODIRS 0x20
|
||||
#define FS_READABLE 0x40
|
||||
|
||||
/* Default maximum for move_to_high_fd */
|
||||
#define HIGH_FD_MAX 256
|
||||
|
||||
/* The type of function passed as the fourth argument to qsort(3). */
|
||||
#ifdef __STDC__
|
||||
typedef int QSFUNC (const void *, const void *);
|
||||
#else
|
||||
typedef int QSFUNC ();
|
||||
#endif
|
||||
|
||||
/* Some useful definitions for Unix pathnames. Argument convention:
|
||||
x == string, c == character */
|
||||
|
||||
#if !defined (__CYGWIN__)
|
||||
# define ABSPATH(x) ((x)[0] == '/')
|
||||
# define RELPATH(x) ((x)[0] != '/')
|
||||
#else /* __CYGWIN__ */
|
||||
# define ABSPATH(x) (((x)[0] && ISALPHA((unsigned char)(x)[0]) && (x)[1] == ':') || ISDIRSEP((x)[0]))
|
||||
# define RELPATH(x) (ABSPATH(x) == 0)
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#define ROOTEDPATH(x) (ABSPATH(x))
|
||||
|
||||
#define DIRSEP '/'
|
||||
#if !defined (__CYGWIN__)
|
||||
# define ISDIRSEP(c) ((c) == '/')
|
||||
#else
|
||||
# define ISDIRSEP(c) ((c) == '/' || (c) == '\\')
|
||||
#endif /* __CYGWIN__ */
|
||||
#define PATHSEP(c) (ISDIRSEP(c) || (c) == 0)
|
||||
|
||||
#if 0
|
||||
/* Declarations for functions defined in xmalloc.c */
|
||||
extern PTR_T xmalloc __P((size_t));
|
||||
extern PTR_T xrealloc __P((void *, size_t));
|
||||
extern void xfree __P((void *));
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in general.c */
|
||||
extern void posix_initialize __P((int));
|
||||
|
||||
#if defined (RLIMTYPE)
|
||||
extern RLIMTYPE string_to_rlimtype __P((char *));
|
||||
extern void print_rlimtype __P((RLIMTYPE, int));
|
||||
#endif
|
||||
|
||||
extern int all_digits __P((char *));
|
||||
extern int legal_number __P((const char *, intmax_t *));
|
||||
extern int legal_identifier __P((char *));
|
||||
extern int check_identifier __P((WORD_DESC *, int));
|
||||
extern int legal_alias_name __P((char *, int));
|
||||
extern int assignment __P((const char *, int));
|
||||
|
||||
extern int sh_unset_nodelay_mode __P((int));
|
||||
extern int sh_validfd __P((int));
|
||||
extern void check_dev_tty __P((void));
|
||||
extern int move_to_high_fd __P((int, int, int));
|
||||
extern int check_binary_file __P((char *, int));
|
||||
|
||||
#ifdef _POSIXSTAT_H_
|
||||
extern int same_file __P((char *, char *, struct stat *, struct stat *));
|
||||
#endif
|
||||
|
||||
extern int sh_openpipe __P((int *));
|
||||
extern int sh_closepipe __P((int *));
|
||||
|
||||
extern int file_exists __P((char *));
|
||||
extern int file_isdir __P((char *));
|
||||
extern int file_iswdir __P((char *));
|
||||
extern int absolute_pathname __P((const char *));
|
||||
extern int absolute_program __P((const char *));
|
||||
|
||||
extern char *make_absolute __P((char *, char *));
|
||||
extern char *base_pathname __P((char *));
|
||||
extern char *full_pathname __P((char *));
|
||||
extern char *polite_directory_format __P((char *));
|
||||
extern char *trim_pathname __P((char *, int));
|
||||
|
||||
extern char *extract_colon_unit __P((char *, int *));
|
||||
|
||||
extern void tilde_initialize __P((void));
|
||||
extern char *bash_tilde_find_word __P((const char *, int, int *));
|
||||
extern char *bash_tilde_expand __P((const char *, int));
|
||||
|
||||
extern int group_member __P((gid_t));
|
||||
extern char **get_group_list __P((int *));
|
||||
extern int *get_group_array __P((int *));
|
||||
|
||||
#endif /* _GENERAL_H_ */
|
||||
+1
-1
@@ -356,7 +356,7 @@ finddirs (pat, sdir, flags, ep, np)
|
||||
*np = 0;
|
||||
if (ep)
|
||||
*ep = 0;
|
||||
if (r)
|
||||
if (r && r != &glob_error_return)
|
||||
free (r);
|
||||
return (struct globval *)0;
|
||||
}
|
||||
|
||||
@@ -1894,6 +1894,10 @@ _rl_move_cursor_relative (new, data)
|
||||
|
||||
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
|
||||
cpos = _rl_last_c_pos;
|
||||
|
||||
if (cpos == 0 && cpos == new)
|
||||
return;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* If we have multibyte characters, NEW is indexed by the buffer point in
|
||||
a multibyte string, but _rl_last_c_pos is the display position. In
|
||||
@@ -1907,9 +1911,9 @@ _rl_move_cursor_relative (new, data)
|
||||
prompt string, since they're both buffer indices and DPOS is a
|
||||
desired display position. */
|
||||
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
|
||||
(prompt_physical_chars > _rl_screenwidth &&
|
||||
(prompt_physical_chars >= _rl_screenwidth &&
|
||||
_rl_last_v_pos == prompt_last_screen_line &&
|
||||
wrap_offset >= woff &&
|
||||
wrap_offset >= woff && dpos >= woff &&
|
||||
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
|
||||
/* XXX last comparison might need to be >= */
|
||||
{
|
||||
|
||||
@@ -1774,7 +1774,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
space_to_eol will insert too many spaces. XXX - maybe we should
|
||||
adjust col_lendiff based on the difference between _rl_last_c_pos
|
||||
and _rl_screenwidth */
|
||||
if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
|
||||
if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
|
||||
#endif
|
||||
{
|
||||
if (_rl_term_autowrap && current_line < inv_botlin)
|
||||
@@ -1894,6 +1894,12 @@ _rl_move_cursor_relative (new, data)
|
||||
|
||||
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
|
||||
cpos = _rl_last_c_pos;
|
||||
|
||||
#if 0
|
||||
if (cpos == 0 && cpos == new)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* If we have multibyte characters, NEW is indexed by the buffer point in
|
||||
a multibyte string, but _rl_last_c_pos is the display position. In
|
||||
@@ -1907,9 +1913,9 @@ _rl_move_cursor_relative (new, data)
|
||||
prompt string, since they're both buffer indices and DPOS is a
|
||||
desired display position. */
|
||||
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
|
||||
(prompt_physical_chars > _rl_screenwidth &&
|
||||
(prompt_physical_chars >= _rl_screenwidth &&
|
||||
_rl_last_v_pos == prompt_last_screen_line &&
|
||||
wrap_offset >= woff &&
|
||||
wrap_offset >= woff && dpos >= woff &&
|
||||
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
|
||||
/* XXX last comparison might need to be >= */
|
||||
{
|
||||
|
||||
@@ -643,8 +643,12 @@ rl_echo_signal_char (sig)
|
||||
switch (sig)
|
||||
{
|
||||
case SIGINT: c = _rl_intr_char; break;
|
||||
#if defined (SIGQUIT)
|
||||
case SIGQUIT: c = _rl_quit_char; break;
|
||||
#endif
|
||||
#if defined (SIGTSTP)
|
||||
case SIGTSTP: c = _rl_susp_char; break;
|
||||
#endif
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
||||
+21
-16
@@ -86,12 +86,12 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
|
||||
vprint.c itos.c rename.c zread.c zwrite.c shtty.c \
|
||||
inet_aton.c netconn.c netopen.c strpbrk.c timeval.c makepath.c \
|
||||
pathcanon.c pathphys.c tmpfile.c stringlist.c stringvec.c spell.c \
|
||||
shquote.c strtrans.c strindex.c snprintf.c mailstat.c \
|
||||
shquote.c strtrans.c strcasestr.c snprintf.c mailstat.c \
|
||||
fmtulong.c fmtullong.c fmtumax.c shmatch.c strnlen.c \
|
||||
strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c strstr.c \
|
||||
mktime.c strftime.c xstrchr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
|
||||
mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
|
||||
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
|
||||
casemod.c fdprintf.c input_avail.c
|
||||
casemod.c fdprintf.c input_avail.c mbscasecmp.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES =
|
||||
@@ -102,10 +102,10 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
|
||||
itos.o zread.o zwrite.o shtty.o shmatch.o eaccess.o \
|
||||
netconn.o netopen.o timeval.o makepath.o pathcanon.o \
|
||||
pathphys.o tmpfile.o stringlist.o stringvec.o spell.o shquote.o \
|
||||
strtrans.o strindex.o snprintf.o mailstat.o fmtulong.o \
|
||||
fmtullong.o fmtumax.o xstrchr.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
strtrans.o snprintf.o mailstat.o fmtulong.o \
|
||||
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
|
||||
fdprintf.o input_avail.o ${LIBOBJS}
|
||||
fdprintf.o input_avail.o mbscasecmp.o ${LIBOBJS}
|
||||
|
||||
SUPPORT = Makefile
|
||||
|
||||
@@ -153,6 +153,7 @@ input_avail.o: input_avail.c
|
||||
itos.o: itos.c
|
||||
mailstat.o: mailstat.c
|
||||
makepath.o: makepath.c
|
||||
mbscasecmp.o: mbscasecmp.c
|
||||
mbscmp.o: mbscmp.c
|
||||
memset.o: memset.c
|
||||
mktime.o: mktime.c
|
||||
@@ -170,7 +171,7 @@ spell.o: spell.c
|
||||
strcasecmp.o: strcasecmp.c
|
||||
strerror.o: strerror.c
|
||||
strftime.o: strftime.c
|
||||
strindex.o: strindex.c
|
||||
strcasestr.o: strcasestr.c
|
||||
stringlist.o: stringlist.c
|
||||
stringvec.o: stringvec.c
|
||||
strnlen.o: strnlen.c
|
||||
@@ -190,7 +191,7 @@ uconvert.o: uconvert.c
|
||||
ufuncs.o: ufuncs.c
|
||||
vprint.o: vprint.c
|
||||
wcsdup.o: wcsdup.c
|
||||
xstrchr.o: xstrchr.c
|
||||
mbschr.o: mbschr.c
|
||||
zcatfd.o: zcatfd.c
|
||||
zmapfd.o: zmapfd.c
|
||||
zgetline.o: zgetline.c
|
||||
@@ -221,6 +222,7 @@ input_avail.o: ${BUILD_DIR}/config.h
|
||||
itos.o: ${BUILD_DIR}/config.h
|
||||
mailstat.o: ${BUILD_DIR}/config.h
|
||||
makepath.o: ${BUILD_DIR}/config.h
|
||||
mbscasecmp.o: ${BUILD_DIR}/config.h
|
||||
mbscmp.o: ${BUILD_DIR}/config.h
|
||||
memset.o: ${BUILD_DIR}/config.h
|
||||
mktime.o: ${BUILD_DIR}/config.h
|
||||
@@ -238,7 +240,7 @@ spell.o: ${BUILD_DIR}/config.h
|
||||
strcasecmp.o: ${BUILD_DIR}/config.h
|
||||
strerror.o: ${BUILD_DIR}/config.h
|
||||
strftime.o: ${BUILD_DIR}/config.h
|
||||
strindex.o: ${BUILD_DIR}/config.h
|
||||
strcasestr.o: ${BUILD_DIR}/config.h
|
||||
stringlist.o: ${BUILD_DIR}/config.h
|
||||
stringvec.o: ${BUILD_DIR}/config.h
|
||||
strnlen.o: ${BUILD_DIR}/config.h
|
||||
@@ -258,7 +260,7 @@ uconvert.o: ${BUILD_DIR}/config.h
|
||||
ufuncs.o: ${BUILD_DIR}/config.h
|
||||
vprint.o: ${BUILD_DIR}/config.h
|
||||
wcsdup.o: ${BUILD_DIR}/config.h
|
||||
xstrchr.o: ${BUILD_DIR}/config.h
|
||||
mbschr.o: ${BUILD_DIR}/config.h
|
||||
zcatfd.o: ${BUILD_DIR}/config.h
|
||||
zgetline.o: ${BUILD_DIR}/config.h
|
||||
zmapfd.o: ${BUILD_DIR}/config.h
|
||||
@@ -393,8 +395,8 @@ strerror.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strerror.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
strindex.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strindex.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strcasestr.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasestr.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
stringlist.o: ${topdir}/bashansi.h
|
||||
stringlist.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
@@ -498,15 +500,19 @@ wcsdup.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
wcsdup.o: ${BASHINCDIR}/stdc.h
|
||||
wcsdup.o: ${topdir}/xmalloc.h
|
||||
|
||||
xstrchr.o: ${topdir}/bashansi.h
|
||||
xstrchr.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
xstrchr.o: ${BASHINCDIR}/shmbutil.h
|
||||
mbschr.o: ${topdir}/bashansi.h
|
||||
mbschr.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbschr.o: ${BASHINCDIR}/shmbutil.h
|
||||
|
||||
zgetline.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
zgetline.o: ${BASHINCDIR}/stdc.h
|
||||
zgetline.o: ${topdir}/xmalloc.h
|
||||
zgetline.o: ${topdir}/bashtypes.h
|
||||
|
||||
mbscasecmp.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbscasecmp.o: ${BASHINCDIR}/stdc.h
|
||||
mbscasecmp.o: ${topdir}/xmalloc.h
|
||||
|
||||
mbscmp.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbscmp.o: ${BASHINCDIR}/stdc.h
|
||||
mbscmp.o: ${topdir}/xmalloc.h
|
||||
@@ -523,4 +529,3 @@ fdprintf.o: ${BASHINCDIR}/stdc.h
|
||||
input_avail.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
input_avail.o: ${BASHINCDIR}/stdc.h
|
||||
input_avail.o: ${topdir}/xmalloc.h
|
||||
|
||||
|
||||
@@ -0,0 +1,525 @@
|
||||
#
|
||||
# Makefile for the Bash library
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1998-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PACKAGE = @PACKAGE_NAME@
|
||||
VERSION = @PACKAGE_VERSION@
|
||||
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
LIBBUILD = ${BUILD_DIR}/lib
|
||||
|
||||
BASHINCDIR = ${topdir}/include
|
||||
|
||||
INTL_LIBSRC = ${topdir}/lib/intl
|
||||
INTL_BUILDDIR = ${LIBBUILD}/intl
|
||||
INTL_INC = @INTL_INC@
|
||||
LIBINTL_H = @LIBINTL_H@
|
||||
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
SHELL = @MAKE_SHELL@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
|
||||
|
||||
PROFILE_FLAGS = @PROFILE_FLAGS@
|
||||
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
|
||||
INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib -I$(BASHINCDIR) -I$(srcdir) $(INTL_INC)
|
||||
|
||||
CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \
|
||||
$(CFLAGS) $(CPPFLAGS)
|
||||
|
||||
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
|
||||
-Wcast-align -Wstrict-prototypes -Wconversion \
|
||||
-Wmissing-prototypes -Wtraditional -Wredundant-decls -pedantic
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CCFLAGS) $<
|
||||
|
||||
# The name of the library target.
|
||||
LIBRARY_NAME = libsh.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
|
||||
strcasecmp.c strerror.c strtod.c strtol.c strtoul.c \
|
||||
vprint.c itos.c rename.c zread.c zwrite.c shtty.c \
|
||||
inet_aton.c netconn.c netopen.c strpbrk.c timeval.c makepath.c \
|
||||
pathcanon.c pathphys.c tmpfile.c stringlist.c stringvec.c spell.c \
|
||||
shquote.c strtrans.c strcasestr.c snprintf.c mailstat.c \
|
||||
fmtulong.c fmtullong.c fmtumax.c shmatch.c strnlen.c \
|
||||
strtoll.c strtoull.c strtoimax.c strtoumax.c memset.c strstr.c \
|
||||
mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
|
||||
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
|
||||
casemod.c fdprintf.c input_avail.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES =
|
||||
|
||||
# The object files contained in $(LIBRARY_NAME)
|
||||
LIBOBJS = @LIBOBJS@
|
||||
OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
|
||||
itos.o zread.o zwrite.o shtty.o shmatch.o eaccess.o \
|
||||
netconn.o netopen.o timeval.o makepath.o pathcanon.o \
|
||||
pathphys.o tmpfile.o stringlist.o stringvec.o spell.o shquote.o \
|
||||
strtrans.o snprintf.o mailstat.o fmtulong.o \
|
||||
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
|
||||
fdprintf.o input_avail.o ${LIBOBJS}
|
||||
|
||||
SUPPORT = Makefile
|
||||
|
||||
all: $(LIBRARY_NAME)
|
||||
|
||||
$(LIBRARY_NAME): $(OBJECTS)
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install:
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(LIBRARY_NAME)
|
||||
|
||||
realclean distclean maintainer-clean: clean
|
||||
$(RM) Makefile
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
# Dependencies
|
||||
|
||||
${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
|
||||
-( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h )
|
||||
|
||||
# rules for losing makes, like SunOS
|
||||
casemod.o: casemod.c
|
||||
clktck.o: clktck.c
|
||||
clock.o: clock.c
|
||||
eaccess.o: eaccess.c
|
||||
fdprintf.o: fdprintf.c
|
||||
fmtullong.o: fmtullong.c
|
||||
fmtulong.o: fmtulong.c
|
||||
fmtumax.o: fmtumax.c
|
||||
fpurge.o: fpurge.c
|
||||
getcwd.o: getcwd.c
|
||||
getenv.o: getenv.c
|
||||
inet_aton.o: inet_aton.c
|
||||
input_avail.o: input_avail.c
|
||||
itos.o: itos.c
|
||||
mailstat.o: mailstat.c
|
||||
makepath.o: makepath.c
|
||||
mbscmp.o: mbscmp.c
|
||||
memset.o: memset.c
|
||||
mktime.o: mktime.c
|
||||
netconn.o: netconn.c
|
||||
netopen.o: netopen.c
|
||||
oslib.o: oslib.c
|
||||
pathcanon.o: pathcanon.c
|
||||
pathphys.o: pathphys.c
|
||||
rename.o: rename.c
|
||||
setlinebuf.o: setlinebuf.c
|
||||
shquote.o: shquote.c
|
||||
shtty.o: shtty.c
|
||||
snprintf.o: snprintf.c
|
||||
spell.o: spell.c
|
||||
strcasecmp.o: strcasecmp.c
|
||||
strerror.o: strerror.c
|
||||
strftime.o: strftime.c
|
||||
strcasestr.o: strcasestr.c
|
||||
stringlist.o: stringlist.c
|
||||
stringvec.o: stringvec.c
|
||||
strnlen.o: strnlen.c
|
||||
strpbrk.o: strpbrk.c
|
||||
strtod.o: strtod.c
|
||||
strtoimax.o: strtoimax.c
|
||||
strtol.o: strtol.c
|
||||
strtoll.o: strtoll.c
|
||||
strtoul.o: strtoul.c
|
||||
strtoull.o: strtoull.c
|
||||
strtoumax.o: strtoumax.c
|
||||
strtrans.o: strtrans.c
|
||||
times.o: times.c
|
||||
timeval.o: timeval.c
|
||||
tmpfile.o: tmpfile.c
|
||||
uconvert.o: uconvert.c
|
||||
ufuncs.o: ufuncs.c
|
||||
vprint.o: vprint.c
|
||||
wcsdup.o: wcsdup.c
|
||||
mbschr.o: mbschr.c
|
||||
zcatfd.o: zcatfd.c
|
||||
zmapfd.o: zmapfd.c
|
||||
zgetline.o: zgetline.c
|
||||
zread.o: zread.c
|
||||
zwrite.o: zwrite.c
|
||||
|
||||
# dependencies for c files that include other c files
|
||||
fmtullong.o: fmtulong.c
|
||||
fmtumax.o: fmtulong.c
|
||||
strtoll.o: strtol.c
|
||||
strtoul.o: strtol.c
|
||||
strtoull.o: strtol.c
|
||||
|
||||
# all files in the library depend on config.h
|
||||
casemod.o: ${BUILD_DIR}/config.h
|
||||
clktck.o: ${BUILD_DIR}/config.h
|
||||
clock.o: ${BUILD_DIR}/config.h
|
||||
eaccess.o: ${BUILD_DIR}/config.h
|
||||
fdprintf.o: ${BUILD_DIR}/config.h
|
||||
fmtullong.o: ${BUILD_DIR}/config.h
|
||||
fmtulong.o: ${BUILD_DIR}/config.h
|
||||
fmtumax.o: ${BUILD_DIR}/config.h
|
||||
fpurge.o: ${BUILD_DIR}/config.h
|
||||
getcwd.o: ${BUILD_DIR}/config.h
|
||||
getenv.o: ${BUILD_DIR}/config.h
|
||||
inet_aton.o: ${BUILD_DIR}/config.h
|
||||
input_avail.o: ${BUILD_DIR}/config.h
|
||||
itos.o: ${BUILD_DIR}/config.h
|
||||
mailstat.o: ${BUILD_DIR}/config.h
|
||||
makepath.o: ${BUILD_DIR}/config.h
|
||||
mbscmp.o: ${BUILD_DIR}/config.h
|
||||
memset.o: ${BUILD_DIR}/config.h
|
||||
mktime.o: ${BUILD_DIR}/config.h
|
||||
netconn.o: ${BUILD_DIR}/config.h
|
||||
netopen.o: ${BUILD_DIR}/config.h
|
||||
oslib.o: ${BUILD_DIR}/config.h
|
||||
pathcanon.o: ${BUILD_DIR}/config.h
|
||||
pathphys.o: ${BUILD_DIR}/config.h
|
||||
rename.o: ${BUILD_DIR}/config.h
|
||||
setlinebuf.o: ${BUILD_DIR}/config.h
|
||||
shquote.o: ${BUILD_DIR}/config.h
|
||||
shtty.o: ${BUILD_DIR}/config.h
|
||||
snprintf.o: ${BUILD_DIR}/config.h
|
||||
spell.o: ${BUILD_DIR}/config.h
|
||||
strcasecmp.o: ${BUILD_DIR}/config.h
|
||||
strerror.o: ${BUILD_DIR}/config.h
|
||||
strftime.o: ${BUILD_DIR}/config.h
|
||||
strcasestr.o: ${BUILD_DIR}/config.h
|
||||
stringlist.o: ${BUILD_DIR}/config.h
|
||||
stringvec.o: ${BUILD_DIR}/config.h
|
||||
strnlen.o: ${BUILD_DIR}/config.h
|
||||
strpbrk.o: ${BUILD_DIR}/config.h
|
||||
strtod.o: ${BUILD_DIR}/config.h
|
||||
strtoimax.o: ${BUILD_DIR}/config.h
|
||||
strtol.o: ${BUILD_DIR}/config.h
|
||||
strtoll.o: ${BUILD_DIR}/config.h
|
||||
strtoul.o: ${BUILD_DIR}/config.h
|
||||
strtoull.o: ${BUILD_DIR}/config.h
|
||||
strtoumax.o: ${BUILD_DIR}/config.h
|
||||
strtrans.o: ${BUILD_DIR}/config.h
|
||||
times.o: ${BUILD_DIR}/config.h
|
||||
timeval.o: ${BUILD_DIR}/config.h
|
||||
tmpfile.o: ${BUILD_DIR}/config.h
|
||||
uconvert.o: ${BUILD_DIR}/config.h
|
||||
ufuncs.o: ${BUILD_DIR}/config.h
|
||||
vprint.o: ${BUILD_DIR}/config.h
|
||||
wcsdup.o: ${BUILD_DIR}/config.h
|
||||
mbschr.o: ${BUILD_DIR}/config.h
|
||||
zcatfd.o: ${BUILD_DIR}/config.h
|
||||
zgetline.o: ${BUILD_DIR}/config.h
|
||||
zmapfd.o: ${BUILD_DIR}/config.h
|
||||
zread.o: ${BUILD_DIR}/config.h
|
||||
zwrite.o: ${BUILD_DIR}/config.h
|
||||
|
||||
clktck.o: ${topdir}/bashtypes.h
|
||||
|
||||
getcwd.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
getcwd.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/posixdir.h
|
||||
getcwd.o: ${BASHINCDIR}/memalloc.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
|
||||
getenv.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
getenv.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
getenv.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
getenv.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
getenv.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
getenv.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
getenv.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
getenv.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
getenv.o: ${BUILD_DIR}/version.h
|
||||
|
||||
inet_aton.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
inet_aton.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
itos.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
itos.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
itos.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
itos.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
itos.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
itos.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
itos.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
itos.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
makepath.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
makepath.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
makepath.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
makepath.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
makepath.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
makepath.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
makepath.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
makepath.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
netconn.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
netconn.o: ${topdir}/bashtypes.h
|
||||
|
||||
netopen.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${topdir}/xmalloc.h
|
||||
netopen.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
netopen.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
netopen.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
netopen.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
netopen.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
netopen.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
netopen.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
netopen.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
|
||||
|
||||
oslib.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
oslib.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
oslib.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
oslib.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
oslib.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
oslib.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
oslib.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
oslib.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
oslib.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
oslib.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
pathcanon.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathcanon.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
pathcanon.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
pathcanon.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
pathcanon.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathcanon.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathcanon.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathcanon.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathcanon.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathcanon.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
pathphys.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/maxpath.h
|
||||
pathphys.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
pathphys.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
pathphys.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
pathphys.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
pathphys.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
pathphys.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
pathphys.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
pathphys.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h
|
||||
pathphys.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
rename.o: ${topdir}/bashtypes.h ${BASHINCDIR}/stdc.h
|
||||
rename.o: ${BASHINCDIR}/posixstat.h
|
||||
|
||||
setlinebuf.o: ${topdir}/xmalloc.h ${topdir}/bashansi.h
|
||||
setlinebuf.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/stdc.h
|
||||
|
||||
eaccess.o: ${topdir}/bashtypes.h
|
||||
eaccess.o: ${BASHINCDIR}/posixstat.h
|
||||
eaccess.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
eaccess.o: ${BASHINCDIR}/filecntl.h
|
||||
eaccess.o: ${BASHINCDIR}/stdc.h
|
||||
eaccess.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
eaccess.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
eaccess.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
eaccess.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
eaccess.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
eaccess.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
eaccess.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
shquote.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
shquote.o: ${BASHINCDIR}/ansi_stdlib.h ${topdir}/xmalloc.h
|
||||
|
||||
shtty.o: ${BASHINCDIR}/shtty.h
|
||||
shtty.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
snprintf.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h ${topdir}/xmalloc.h
|
||||
snprintf.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
snprintf.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
spell.o: ${topdir}/bashtypes.h
|
||||
spell.o: ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/posixdir.h
|
||||
spell.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
|
||||
strcasecmp.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasecmp.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
strerror.o: ${topdir}/bashtypes.h
|
||||
strerror.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
strerror.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
strerror.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
strerror.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strerror.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strerror.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strerror.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
strcasestr.o: ${BASHINCDIR}/stdc.h ${topdir}/bashansi.h
|
||||
strcasestr.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
stringlist.o: ${topdir}/bashansi.h
|
||||
stringlist.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
stringlist.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
stringlist.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
stringlist.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringlist.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringlist.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringlist.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
stringvec.o: ${topdir}/bashansi.h ${BASHINCDIR}/chartypes.h
|
||||
stringvec.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
stringvec.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
stringvec.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
stringvec.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
stringvec.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
stringvec.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
stringvec.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
strnlen.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strpbrk.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtod.o: ${topdir}/bashansi.h
|
||||
strtod.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
|
||||
strtoimax.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtol.o: ${topdir}/bashansi.h
|
||||
strtol.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtol.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoll.o: ${topdir}/bashansi.h
|
||||
strtoll.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoll.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoul.o: ${topdir}/bashansi.h
|
||||
strtoul.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoul.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoull.o: ${topdir}/bashansi.h
|
||||
strtoull.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtoull.o: ${BASHINCDIR}/typemax.h
|
||||
|
||||
strtoumax.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
strtrans.o: ${topdir}/bashansi.h
|
||||
strtrans.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
|
||||
strtrans.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
strtrans.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
strtrans.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
strtrans.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
strtrans.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
strtrans.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h ${BUILD_DIR}/version.h
|
||||
|
||||
times.o: ${BASHINCDIR}/systimes.h
|
||||
times.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
timeval.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
tmpfile.o: ${topdir}/bashtypes.h
|
||||
tmpfile.o: ${BASHINCDIR}/posixstat.h
|
||||
tmpfile.o: ${BASHINCDIR}/filecntl.h
|
||||
|
||||
uconvert.o: ${topdir}/bashtypes.h
|
||||
|
||||
ufuncs.o: ${topdir}/bashtypes.h
|
||||
|
||||
clock.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
mailstat.o: ${topdir}/bashansi.h
|
||||
mailstat.o: ${topdir}/bashtypes.h
|
||||
mailstat.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
mailstat.o: ${BASHINCDIR}/posixstat.h
|
||||
mailstat.o: ${BASHINCDIR}/posixdir.h
|
||||
mailstat.o: ${BASHINCDIR}/maxpath.h
|
||||
|
||||
fmtulong.o: ${topdir}/bashansi.h
|
||||
fmtulong.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtulong.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtulong.o: ${BASHINCDIR}/stdc.h
|
||||
fmtulong.o: ${BASHINCDIR}/typemax.h
|
||||
fmtulong.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
fmtullong.o: ${topdir}/bashansi.h
|
||||
fmtullong.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtullong.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtullong.o: ${BASHINCDIR}/stdc.h
|
||||
fmtullong.o: ${BASHINCDIR}/typemax.h
|
||||
fmtullong.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
fmtumax.o: ${topdir}/bashansi.h
|
||||
fmtumax.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
fmtumax.o: ${BASHINCDIR}/chartypes.h
|
||||
fmtumax.o: ${BASHINCDIR}/stdc.h
|
||||
fmtumax.o: ${BASHINCDIR}/typemax.h
|
||||
fmtumax.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
wcsdup.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
wcsdup.o: ${BASHINCDIR}/stdc.h
|
||||
wcsdup.o: ${topdir}/xmalloc.h
|
||||
|
||||
mbschr.o: ${topdir}/bashansi.h
|
||||
mbschr.o: ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbschr.o: ${BASHINCDIR}/shmbutil.h
|
||||
|
||||
zgetline.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
zgetline.o: ${BASHINCDIR}/stdc.h
|
||||
zgetline.o: ${topdir}/xmalloc.h
|
||||
zgetline.o: ${topdir}/bashtypes.h
|
||||
|
||||
mbscmp.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
mbscmp.o: ${BASHINCDIR}/stdc.h
|
||||
mbscmp.o: ${topdir}/xmalloc.h
|
||||
|
||||
casemod.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
casemod.o: ${BASHINCDIR}/stdc.h
|
||||
casemod.o: ${topdir}/xmalloc.h
|
||||
casemod.o: ${topdir}/bashtypes.h
|
||||
casemod.o: ${BASHINCDIR}/shmbutil.h
|
||||
casemod.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
|
||||
|
||||
fdprintf.o: ${BASHINCDIR}/stdc.h
|
||||
|
||||
input_avail.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
input_avail.o: ${BASHINCDIR}/stdc.h
|
||||
input_avail.o: ${topdir}/xmalloc.h
|
||||
@@ -0,0 +1,78 @@
|
||||
/* mbscasecmp - case-insensitive multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined (HAVE_MBSCASECMP) && defined (HANDLE_MULTIBYTE)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
/* Compare MBS1 and MBS2 without regard to case. */
|
||||
int
|
||||
mbscasecmp (mbs1, mbs2)
|
||||
const char *mbs1;
|
||||
const char *mbs2;
|
||||
{
|
||||
int len1, len2;
|
||||
wchar_t c1, c2, l1, l2;
|
||||
|
||||
len1 = len2 = 0;
|
||||
/* Reset multibyte characters to their initial state. */
|
||||
(void) mblen ((char *) NULL, 0);
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc (&c1, mbs1, MB_CUR_MAX);
|
||||
len2 = mbtowc (&c2, mbs2, MB_CUR_MAX);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
else if (len2 == 0)
|
||||
return 1;
|
||||
else if (len1 > 0 && len2 < 0)
|
||||
return -1;
|
||||
else if (len1 < 0 && len2 > 0)
|
||||
return 1;
|
||||
else if (len1 < 0 && len2 < 0)
|
||||
{
|
||||
len1 = strlen (mbs1);
|
||||
len2 = strlen (mbs2);
|
||||
return (len1 == len2 ? memcmp (mbs1, mbs2, len1)
|
||||
: ((len1 < len2) ? (memcmp (mbs1, mbs2, len1) > 0 ? 1 : -1)
|
||||
: (memcmp (mbs1, mbs2, len2) >= 0 ? 1 : -1)));
|
||||
}
|
||||
|
||||
l1 = towlower (c1);
|
||||
l2 = towlower (c2);
|
||||
|
||||
mbs1 += len1;
|
||||
mbs2 += len2;
|
||||
}
|
||||
while (l1 == l2);
|
||||
|
||||
return l1 - l2;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/* mbscasecmp - case-insensitive multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined (HAVE_MBSCASECMP) && defined (HANDLE_MULTIBYTE)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
/* Compare MBS1 and MBS2. */
|
||||
int
|
||||
mbscasecmp (mbs1, mbs2)
|
||||
const char *mbs1;
|
||||
const char *mbs2;
|
||||
{
|
||||
int len1, len2;
|
||||
wchar_t c1, c2, l1, l2;
|
||||
|
||||
len1 = len2 = 0;
|
||||
/* Reset multibyte characters to their initial state. */
|
||||
(void) mblen ((char *) NULL, 0);
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc (&c1, mbs1, MB_CUR_MAX);
|
||||
len2 = mbtowc (&c2, mbs2, MB_CUR_MAX);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
else if (len2 == 0)
|
||||
return 1;
|
||||
else if (len1 > 0 && len2 < 0)
|
||||
return -1;
|
||||
else if (len1 < 0 && len2 > 0)
|
||||
return 1;
|
||||
else if (len1 < 0 && len2 < 0)
|
||||
{
|
||||
len1 = strlen (mbs1);
|
||||
len2 = strlen (mbs2);
|
||||
return (len1 == len2 ? memcmp (mbs1, mbs2, len1)
|
||||
: ((len1 < len2) ? (memcmp (mbs1, mbs2, len1) > 0 ? 1 : -1)
|
||||
: (memcmp (mbs1, mbs2, len2) >= 0 ? 1 : -1)));
|
||||
}
|
||||
|
||||
l1 = towlower (c1);
|
||||
l2 = towlower (c2);
|
||||
|
||||
mbs1 += len1;
|
||||
mbs2 += len2;
|
||||
}
|
||||
while (l1 == l2);
|
||||
|
||||
return l1 - l2;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/* mbschr.c - strchr(3) that handles multibyte characters. */
|
||||
|
||||
/* Copyright (C) 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
|
||||
#undef mbschr
|
||||
|
||||
/* In some locales, the non-first byte of some multibyte characters have
|
||||
the same value as some ascii character. Faced with these strings, a
|
||||
legacy strchr() might return the wrong value. */
|
||||
|
||||
char *
|
||||
#if defined (PROTOTYPES)
|
||||
mbschr (const char *s, int c)
|
||||
#else
|
||||
mbschr (s, c)
|
||||
const char *s;
|
||||
int c;
|
||||
#endif
|
||||
{
|
||||
#if HANDLE_MULTIBYTE
|
||||
char *pos;
|
||||
mbstate_t state;
|
||||
size_t strlength, mblength;
|
||||
|
||||
/* The locale encodings with said weird property are BIG5, BIG5-HKSCS,
|
||||
GBK, GB18030, SHIFT_JIS, and JOHAB. They exhibit the problem only
|
||||
when c >= 0x30. We can therefore use the faster bytewise search if
|
||||
c <= 0x30. */
|
||||
if ((unsigned char)c >= '0' && MB_CUR_MAX > 1)
|
||||
{
|
||||
pos = (char *)s;
|
||||
memset (&state, '\0', sizeof(mbstate_t));
|
||||
strlength = strlen (s);
|
||||
|
||||
while (strlength > 0)
|
||||
{
|
||||
mblength = mbrlen (pos, strlength, &state);
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1 || mblength == (size_t)0)
|
||||
mblength = 1;
|
||||
|
||||
if (mblength == 1 && c == (unsigned char)*pos)
|
||||
return pos;
|
||||
|
||||
strlength -= mblength;
|
||||
pos += mblength;
|
||||
}
|
||||
|
||||
return ((char *)NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return (strchr (s, c));
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/* xstrchr.c - strchr(3) that handles multibyte characters. */
|
||||
|
||||
/* Copyright (C) 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
|
||||
#undef xstrchr
|
||||
|
||||
/* In some locales, the non-first byte of some multibyte characters have
|
||||
the same value as some ascii character. Faced with these strings, a
|
||||
legacy strchr() might return the wrong value. */
|
||||
|
||||
char *
|
||||
#if defined (PROTOTYPES)
|
||||
xstrchr (const char *s, int c)
|
||||
#else
|
||||
xstrchr (s, c)
|
||||
const char *s;
|
||||
int c;
|
||||
#endif
|
||||
{
|
||||
#if HANDLE_MULTIBYTE
|
||||
char *pos;
|
||||
mbstate_t state;
|
||||
size_t strlength, mblength;
|
||||
|
||||
/* The locale encodings with said weird property are BIG5, BIG5-HKSCS,
|
||||
GBK, GB18030, SHIFT_JIS, and JOHAB. They exhibit the problem only
|
||||
when c >= 0x30. We can therefore use the faster bytewise search if
|
||||
c <= 0x30. */
|
||||
if ((unsigned char)c >= '0' && MB_CUR_MAX > 1)
|
||||
{
|
||||
pos = (char *)s;
|
||||
memset (&state, '\0', sizeof(mbstate_t));
|
||||
strlength = strlen (s);
|
||||
|
||||
while (strlength > 0)
|
||||
{
|
||||
mblength = mbrlen (pos, strlength, &state);
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1 || mblength == (size_t)0)
|
||||
mblength = 1;
|
||||
|
||||
if (mblength == 1 && c == (unsigned char)*pos)
|
||||
return pos;
|
||||
|
||||
strlength -= mblength;
|
||||
pos += mblength;
|
||||
}
|
||||
|
||||
return ((char *)NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return (strchr (s, c));
|
||||
}
|
||||
+16
-6
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Compare MBS1 and MBS2. */
|
||||
int
|
||||
@@ -40,16 +41,25 @@ mbscmp (mbs1, mbs2)
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc ((wchar_t *) &c1, mbs1, MB_CUR_MAX);
|
||||
len2 = mbtowc ((wchar_t *) &c2, mbs2, MB_CUR_MAX);
|
||||
len1 = mbtowc (&c1, mbs1, MB_CUR_MAX);
|
||||
len2 = mbtowc (&c2, mbs2, MB_CUR_MAX);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
if (len2 == 0)
|
||||
else if (len2 == 0)
|
||||
return 1;
|
||||
if (len1 < 0 || len2 < 0)
|
||||
/* FIXME: an illegal character appears. What to do? */
|
||||
return c1 - c2;
|
||||
else if (len1 > 0 && len2 < 0)
|
||||
return -1;
|
||||
else if (len1 < 0 && len2 > 0)
|
||||
return 1;
|
||||
else if (len1 < 0 && len2 < 0)
|
||||
{
|
||||
len1 = strlen (mbs1);
|
||||
len2 = strlen (mbs2);
|
||||
return (len1 == len2 ? memcmp (mbs1, mbs2, len1)
|
||||
: ((len1 < len2) ? (memcmp (mbs1, mbs2, len1) > 0 ? 1 : -1)
|
||||
: (memcmp (mbs1, mbs2, len2) >= 0 ? 1 : -1)));
|
||||
}
|
||||
|
||||
mbs1 += len1;
|
||||
mbs2 += len2;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/* mbscmp - multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined (HAVE_MBSCMP) && defined (HANDLE_MULTIBYTE)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Compare MBS1 and MBS2. */
|
||||
int
|
||||
mbscmp (mbs1, mbs2)
|
||||
const char *mbs1;
|
||||
const char *mbs2;
|
||||
{
|
||||
int len1, len2;
|
||||
wchar_t c1, c2;
|
||||
|
||||
len1 = len2 = 0;
|
||||
/* Reset multibyte characters to their initial state. */
|
||||
(void) mblen ((char *) NULL, 0);
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc ((wchar_t *) &c1, mbs1, MB_CUR_MAX);
|
||||
len2 = mbtowc ((wchar_t *) &c2, mbs2, MB_CUR_MAX);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
else if (len2 == 0)
|
||||
return 1;
|
||||
else if (len1 > 0 && len2 < 0)
|
||||
return -1;
|
||||
else if (len1 < 0 && len2 > 0)
|
||||
return 1;
|
||||
else if (len1 < 0 && len2 < 0)
|
||||
{
|
||||
len1 = strlen (mbs1);
|
||||
len2 = strlen (mbs2);
|
||||
return (len1 == len2 ? memcmp (mbs1, mbs2, len1)
|
||||
: ((len1 < len2) ? (memcmp (mbs1, mbs2, len1) > 0 ? 1 : -1)
|
||||
: (memcmp (mbs1, mbs2, len2) >= 0 ? 1 : -1)));
|
||||
}
|
||||
|
||||
mbs1 += len1;
|
||||
mbs2 += len2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/* strcasestr.c - Find if one string appears as a substring of another string,
|
||||
without regard to case. */
|
||||
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <bashansi.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
/* Determine if s2 occurs in s1. If so, return a pointer to the
|
||||
match in s1. The compare is case insensitive. This is a
|
||||
case-insensitive strstr(3). */
|
||||
char *
|
||||
strcasestr (s1, s2)
|
||||
const char *s1;
|
||||
const char *s2;
|
||||
{
|
||||
register int i, l, len, c;
|
||||
|
||||
c = TOLOWER ((unsigned char)s2[0]);
|
||||
len = strlen (s1);
|
||||
l = strlen (s2);
|
||||
for (i = 0; (len - i) >= l; i++)
|
||||
if ((TOLOWER ((unsigned char)s1[i]) == c) && (strncasecmp (s1 + i, s2, l) == 0))
|
||||
return ((char *)s1 + i);
|
||||
return ((char *)0);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/* strindex.c - Find if one string appears as a substring of another string,
|
||||
without regard to case. */
|
||||
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <bashansi.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
/* Determine if s2 occurs in s1. If so, return a pointer to the
|
||||
match in s1. The compare is case insensitive. This is a
|
||||
case-insensitive strstr(3). */
|
||||
char *
|
||||
strcasestr (s1, s2)
|
||||
const char *s1;
|
||||
const char *s2;
|
||||
{
|
||||
register int i, l, len, c;
|
||||
|
||||
c = TOLOWER ((unsigned char)s2[0]);
|
||||
len = strlen (s1);
|
||||
l = strlen (s2);
|
||||
for (i = 0; (len - i) >= l; i++)
|
||||
if ((TOLOWER ((unsigned char)s1[i]) == c) && (strncasecmp (s1 + i, s2, l) == 0))
|
||||
return ((char *)s1 + i);
|
||||
return ((char *)0);
|
||||
}
|
||||
+5
-1
@@ -1,6 +1,6 @@
|
||||
/* strtoimax - convert string representation of a number into an intmax_t value. */
|
||||
|
||||
/* Copyright 1999-2005 Free Software Foundation, Inc.
|
||||
/* Copyright 1999-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/* strtoimax - convert string representation of a number into an intmax_t value. */
|
||||
|
||||
/* Copyright 1999-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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Written by Paul Eggert. Modified by Chet Ramey for Bash. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
/* Verify a requirement at compile-time (unlike assert, which is runtime). */
|
||||
#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
|
||||
|
||||
#ifndef HAVE_DECL_STRTOL
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_STRTOL
|
||||
extern long strtol __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRTOLL
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG
|
||||
extern long long strtoll __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
#ifdef strtoimax
|
||||
#undef strtoimax
|
||||
#endif
|
||||
|
||||
intmax_t
|
||||
strtoimax (ptr, endptr, base)
|
||||
const char *ptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
#if HAVE_LONG_LONG
|
||||
verify(size_is_that_of_long_or_long_long,
|
||||
(sizeof (intmax_t) == sizeof (long) ||
|
||||
sizeof (intmax_t) == sizeof (long long)));
|
||||
|
||||
if (sizeof (intmax_t) != sizeof (long))
|
||||
return (strtoll (ptr, endptr, base));
|
||||
#else
|
||||
verify (size_is_that_of_long, sizeof (intmax_t) == sizeof (long));
|
||||
#endif
|
||||
|
||||
return (strtol (ptr, endptr, base));
|
||||
}
|
||||
|
||||
#ifdef TESTING
|
||||
# include <stdio.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *p, *endptr;
|
||||
intmax_t x;
|
||||
#if HAVE_LONG_LONG
|
||||
long long y;
|
||||
#endif
|
||||
long z;
|
||||
|
||||
printf ("sizeof intmax_t: %d\n", sizeof (intmax_t));
|
||||
|
||||
#if HAVE_LONG_LONG
|
||||
printf ("sizeof long long: %d\n", sizeof (long long));
|
||||
#endif
|
||||
printf ("sizeof long: %d\n", sizeof (long));
|
||||
|
||||
x = strtoimax("42", &endptr, 10);
|
||||
#if HAVE_LONG_LONG
|
||||
y = strtoll("42", &endptr, 10);
|
||||
#else
|
||||
y = -1;
|
||||
#endif
|
||||
z = strtol("42", &endptr, 10);
|
||||
|
||||
printf ("%lld %lld %ld\n", x, y, z);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
||||
+6
-1
@@ -1,6 +1,6 @@
|
||||
/* strtoumax - convert string representation of a number into an uintmax_t value. */
|
||||
|
||||
/* Copyright 1999-2005 Free Software Foundation, Inc.
|
||||
/* Copyright 1999-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Written by Paul Eggert. Modified by Chet Ramey for Bash. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
@@ -27,6 +28,10 @@
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/* strtoumax - convert string representation of a number into an uintmax_t value. */
|
||||
|
||||
/* Copyright 1999-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Written by Paul Eggert. Modified by Chet Ramey for Bash. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
/* Verify a requirement at compile-time (unlike assert, which is runtime). */
|
||||
#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
|
||||
|
||||
#ifndef HAVE_DECL_STRTOUL
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_STRTOUL
|
||||
extern unsigned long strtoul __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_STRTOULL
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG
|
||||
extern unsigned long long strtoull __P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
#ifdef strtoumax
|
||||
#undef strtoumax
|
||||
#endif
|
||||
|
||||
uintmax_t
|
||||
strtoumax (ptr, endptr, base)
|
||||
const char *ptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
#if HAVE_UNSIGNED_LONG_LONG
|
||||
verify (size_is_that_of_unsigned_long_or_unsigned_long_long,
|
||||
(sizeof (uintmax_t) == sizeof (unsigned long) ||
|
||||
sizeof (uintmax_t) == sizeof (unsigned long long)));
|
||||
|
||||
if (sizeof (uintmax_t) != sizeof (unsigned long))
|
||||
return (strtoull (ptr, endptr, base));
|
||||
#else
|
||||
verify (size_is_that_of_unsigned_long, sizeof (uintmax_t) == sizeof (unsigned long));
|
||||
#endif
|
||||
|
||||
return (strtoul (ptr, endptr, base));
|
||||
}
|
||||
|
||||
#ifdef TESTING
|
||||
# include <stdio.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *p, *endptr;
|
||||
uintmax_t x;
|
||||
#if HAVE_UNSIGNED_LONG_LONG
|
||||
unsigned long long y;
|
||||
#endif
|
||||
unsigned long z;
|
||||
|
||||
printf ("sizeof uintmax_t: %d\n", sizeof (uintmax_t));
|
||||
|
||||
#if HAVE_UNSIGNED_LONG_LONG
|
||||
printf ("sizeof unsigned long long: %d\n", sizeof (unsigned long long));
|
||||
#endif
|
||||
printf ("sizeof unsigned long: %d\n", sizeof (unsigned long));
|
||||
|
||||
x = strtoumax("42", &endptr, 10);
|
||||
#if HAVE_LONG_LONG
|
||||
y = strtoull("42", &endptr, 10);
|
||||
#else
|
||||
y = 0;
|
||||
#endif
|
||||
z = strtoul("42", &endptr, 10);
|
||||
|
||||
printf ("%llu %llu %lu\n", x, y, z);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/* xstrchr.c - strchr(3) that handles multibyte characters. */
|
||||
|
||||
/* Copyright (C) 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "shmbutil.h"
|
||||
|
||||
#undef xstrchr
|
||||
|
||||
/* In some locales, the non-first byte of some multibyte characters have
|
||||
the same value as some ascii character. Faced with these strings, a
|
||||
legacy strchr() might return the wrong value. */
|
||||
|
||||
char *
|
||||
#if defined (PROTOTYPES)
|
||||
xstrchr (const char *s, int c)
|
||||
#else
|
||||
xstrchr (s, c)
|
||||
const char *s;
|
||||
int c;
|
||||
#endif
|
||||
{
|
||||
#if HANDLE_MULTIBYTE
|
||||
char *pos;
|
||||
mbstate_t state;
|
||||
size_t strlength, mblength;
|
||||
|
||||
/* The locale encodings with said weird property are BIG5, BIG5-HKSCS,
|
||||
GBK, GB18030, SHIFT_JIS, and JOHAB. They exhibit the problem only
|
||||
when c >= 0x30. We can therefore use the faster bytewise search if
|
||||
c <= 0x30. */
|
||||
if ((unsigned char)c >= '0' && MB_CUR_MAX > 1)
|
||||
{
|
||||
pos = (char *)s;
|
||||
memset (&state, '\0', sizeof(mbstate_t));
|
||||
strlength = strlen (s);
|
||||
|
||||
while (strlength > 0)
|
||||
{
|
||||
mblength = mbrlen (pos, strlength, &state);
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1 || mblength == (size_t)0)
|
||||
mblength = 1;
|
||||
|
||||
if (c == (unsigned char)*pos)
|
||||
return pos;
|
||||
|
||||
strlength -= mblength;
|
||||
pos += mblength;
|
||||
}
|
||||
|
||||
return ((char *)NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return (strchr (s, c));
|
||||
}
|
||||
@@ -1790,12 +1790,12 @@ show_shell_usage (fp, extra)
|
||||
set_opts = savestring (shell_builtins[i].short_doc);
|
||||
if (set_opts)
|
||||
{
|
||||
s = xstrchr (set_opts, '[');
|
||||
s = strchr (set_opts, '[');
|
||||
if (s == 0)
|
||||
s = set_opts;
|
||||
while (*++s == '-')
|
||||
;
|
||||
t = xstrchr (s, ']');
|
||||
t = strchr (s, ']');
|
||||
if (t)
|
||||
*t = '\0';
|
||||
fprintf (fp, _("\t-%s or -o option\n"), s);
|
||||
|
||||
@@ -2554,7 +2554,7 @@ do_assignment_internal (word, expand)
|
||||
aflags |= ASS_APPEND;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (t = xstrchr (name, '[')) /*]*/
|
||||
if (t = mbschr (name, '[')) /*]*/
|
||||
{
|
||||
if (assign_list)
|
||||
{
|
||||
@@ -5188,7 +5188,7 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
|
||||
#if defined (ARRAY_VARS)
|
||||
else if (valid_array_reference (name))
|
||||
{
|
||||
temp1 = xstrchr (name, '[');
|
||||
temp1 = mbschr (name, '[');
|
||||
if (temp1 && temp1[1] == '@' && temp1[2] == ']')
|
||||
{
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp)
|
||||
@@ -8562,11 +8562,11 @@ brace_expand_word_list (tlist, eflags)
|
||||
/* 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
|
||||
degenerate to a bunch of calls to `mbschr', 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))
|
||||
if (mbschr (tlist->word->word, LBRACE))
|
||||
{
|
||||
expansions = brace_expand (tlist->word->word);
|
||||
|
||||
|
||||
@@ -2554,7 +2554,7 @@ do_assignment_internal (word, expand)
|
||||
aflags |= ASS_APPEND;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (t = xstrchr (name, '[')) /*]*/
|
||||
if (t = mbschr (name, '[')) /*]*/
|
||||
{
|
||||
if (assign_list)
|
||||
{
|
||||
@@ -5077,6 +5077,7 @@ array_length_reference (s)
|
||||
{
|
||||
c = *--t;
|
||||
*t = '\0';
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (s);
|
||||
*t = c;
|
||||
return (-1);
|
||||
@@ -5187,7 +5188,7 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
|
||||
#if defined (ARRAY_VARS)
|
||||
else if (valid_array_reference (name))
|
||||
{
|
||||
temp1 = xstrchr (name, '[');
|
||||
temp1 = mbschr (name, '[');
|
||||
if (temp1 && temp1[1] == '@' && temp1[2] == ']')
|
||||
{
|
||||
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp)
|
||||
@@ -5971,6 +5972,7 @@ pat_subst (string, pat, rep, mflags)
|
||||
|
||||
mtype = mflags & MATCH_TYPEMASK;
|
||||
|
||||
itrace("pat_subst: string = `%s' pat = `%s' rep = `%s'", string, pat, rep);
|
||||
/* Special cases:
|
||||
* 1. A null pattern with mtype == MATCH_BEG means to prefix STRING
|
||||
* with REP and return the result.
|
||||
@@ -6794,11 +6796,11 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
|
||||
case RBRACE:
|
||||
if (var_is_set == 0 && unbound_vars_is_error)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
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;
|
||||
@@ -6954,8 +6956,8 @@ param_expand (string, sindex, quoted, expanded_something,
|
||||
uerror[0] = '$';
|
||||
uerror[1] = c;
|
||||
uerror[2] = '\0';
|
||||
err_unboundvar (uerror);
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (uerror);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
if (temp1)
|
||||
@@ -7002,8 +7004,8 @@ param_expand (string, sindex, quoted, expanded_something,
|
||||
uerror[0] = '$';
|
||||
uerror[1] = c;
|
||||
uerror[2] = '\0';
|
||||
err_unboundvar (uerror);
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (uerror);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
}
|
||||
@@ -7020,8 +7022,8 @@ param_expand (string, sindex, quoted, expanded_something,
|
||||
uerror[0] = '$';
|
||||
uerror[1] = '*';
|
||||
uerror[2] = '\0';
|
||||
err_unboundvar (uerror);
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (uerror);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
|
||||
@@ -7082,8 +7084,8 @@ param_expand (string, sindex, quoted, expanded_something,
|
||||
uerror[0] = '$';
|
||||
uerror[1] = '@';
|
||||
uerror[2] = '\0';
|
||||
err_unboundvar (uerror);
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (uerror);
|
||||
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
|
||||
}
|
||||
|
||||
@@ -7286,7 +7288,10 @@ comsub:
|
||||
|
||||
unbound_variable:
|
||||
if (unbound_vars_is_error)
|
||||
err_unboundvar (temp1);
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
err_unboundvar (temp1);
|
||||
}
|
||||
else
|
||||
{
|
||||
free (temp1);
|
||||
@@ -8558,11 +8563,11 @@ brace_expand_word_list (tlist, eflags)
|
||||
/* 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
|
||||
degenerate to a bunch of calls to `mbschr', 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))
|
||||
if (mbschr (tlist->word->word, LBRACE))
|
||||
{
|
||||
expansions = brace_expand (tlist->word->word);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ lib/readline/tilde.h ../tilde/tilde.h
|
||||
lib/readline/ansi_stdlib.h ../../include/ansi_stdlib.h
|
||||
lib/readline/posixdir.h ../../include/posixdir.h
|
||||
lib/readline/posixjmp.h ../../include/posixjmp.h
|
||||
lib/readline/posixselect.h ../../include/posixselect.h
|
||||
lib/readline/posixstat.h ../../include/posixstat.h
|
||||
#lib/readline/rlstdc.h ../../include/stdc.h
|
||||
#lib/readline/xmalloc.c ../malloc/xmalloc.c
|
||||
|
||||
+1
-1
@@ -867,7 +867,7 @@ make_vers_array ()
|
||||
vv = make_new_array_variable ("BASH_VERSINFO");
|
||||
av = array_cell (vv);
|
||||
strcpy (d, dist_version);
|
||||
s = xstrchr (d, '.');
|
||||
s = strchr (d, '.');
|
||||
if (s)
|
||||
*s++ = '\0';
|
||||
array_insert (av, 0, d);
|
||||
|
||||
+4607
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user