commit bash-20070329 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:05:53 -05:00
parent 28157acd2d
commit d3ad40dee6
265 changed files with 56692 additions and 40436 deletions
+14 -2
View File
@@ -40,6 +40,8 @@ INTL_BUILDDIR = ${LIBBUILD}/intl
INTL_INC = @INTL_INC@
LIBINTL_H = @LIBINTL_H@
datarootdir = @datarootdir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
@@ -88,7 +90,8 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
shquote.c strtrans.c strindex.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 winsize.c eaccess.c
mktime.c strftime.c xstrchr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
wcsdup.c
# The header files for this library.
HSOURCES =
@@ -100,7 +103,8 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.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 winsize.o ${LIBOBJS}
fmtullong.o fmtumax.o xstrchr.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
${LIBOBJS}
SUPPORT = Makefile
@@ -177,8 +181,10 @@ times.o: times.c
timeval.o: timeval.c
tmpfile.o: tmpfile.c
vprint.o: vprint.c
wcsdup.o: wcsdup.c
xstrchr.o: xstrchr.c
zcatfd.o: zcatfd.c
zmapfd.o: zmapfd.c
zread.o: zread.c
zwrite.o: zwrite.c
@@ -235,8 +241,10 @@ times.o: ${BUILD_DIR}/config.h
timeval.o: ${BUILD_DIR}/config.h
tmpfile.o: ${BUILD_DIR}/config.h
vprint.o: ${BUILD_DIR}/config.h
wcsdup.o: ${BUILD_DIR}/config.h
xstrchr.o: ${BUILD_DIR}/config.h
zcatfd.o: ${BUILD_DIR}/config.h
zmapfd.o: ${BUILD_DIR}/config.h
zread.o: ${BUILD_DIR}/config.h
zwrite.o: ${BUILD_DIR}/config.h
@@ -465,6 +473,10 @@ 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
xstrchr.o: ${topdir}/bashansi.h
xstrchr.o: ${BASHINCDIR}/ansi_stdlib.h
xstrchr.o: ${BASHINCDIR}/shmbutil.h
+10
View File
@@ -66,6 +66,16 @@ extern int errno;
extern int inet_aton __P((const char *, struct in_addr *));
#endif
#ifndef HAVE_GETADDRINFO
static int _getaddr __P((char *, struct in_addr *));
static int _getserv __P((char *, int, unsigned short *));
static int _netopen4 __P((char *, char *, int));
#else /* HAVE_GETADDRINFO */
static int _netopen6 __P((char *, char *, int));
#endif
static int _netopen __P((char *, char *, int));
#ifndef HAVE_GETADDRINFO
/* Stuff the internet address corresponding to HOST into AP, in network
byte order. Return 1 on success, 0 on failure. */
+1 -2
View File
@@ -57,8 +57,7 @@ sh_regmatch (string, pattern, flags)
char *subexp_str;
int subexp_len;
#endif
int result;
int result;
#if defined (ARRAY_VARS)
rematch = (SHELL_VAR *)NULL;
+69 -17
View File
@@ -7,7 +7,7 @@
Unix snprintf implementation.
derived from inetutils/libinetutils/snprintf.c Version 1.1
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001,2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General License as published by
@@ -58,6 +58,11 @@
# include <config.h>
#endif
#if defined(DEBUG)
# undef HAVE_SNPRINTF
# undef HAVE_ASPRINTF
#endif
#if defined(DRIVER) && !defined(HAVE_CONFIG_H)
#define HAVE_LONG_LONG
#define HAVE_LONG_DOUBLE
@@ -65,6 +70,7 @@
#define HAVE_PRINTF_A_FORMAT
#endif
#define HAVE_ISINF_IN_LIBC
#define HAVE_ISNAN_IN_LIBC
#define PREFER_STDARG
#define HAVE_STRINGIZE
#define HAVE_LIMITS_H
@@ -370,6 +376,12 @@ static void xfree __P((void *));
for (; (p)->width > 0; (p)->width--) \
PUT_CHAR((p)->pad, p)
/* pad with zeros from decimal precision */
#define PAD_ZERO(p) \
if ((p)->precision > 0) \
for (; (p)->precision > 0; (p)->precision--) \
PUT_CHAR('0', p)
/* if width and prec. in the args */
#define STAR_ARGS(p) \
do { \
@@ -394,7 +406,7 @@ static void xfree __P((void *));
} \
} while (0)
#if defined (HAVE_LOCALE_H)
#if defined (HAVE_LOCALE_H) && defined (HAVE_LOCALECONV)
# define GETLOCALEDATA(d, t, g) \
do \
{ \
@@ -464,6 +476,8 @@ pow_10(n)
10^x ~= r
* log_10(200) = 2;
* log_10(250) = 2;
*
* NOTE: do not call this with r == 0 -- an infinite loop results.
*/
static int
log_10(r)
@@ -569,8 +583,11 @@ numtoa(number, base, precision, fract)
{
integral_part[0] = '0';
integral_part[1] = '\0';
fraction_part[0] = '0';
fraction_part[1] = '\0';
/* The fractional part has to take the precision into account */
for (ch = 0; ch < precision-1; ch++)
fraction_part[ch] = '0';
fraction_part[ch] = '0';
fraction_part[ch+1] = '\0';
if (fract)
*fract = fraction_part;
return integral_part;
@@ -651,8 +668,13 @@ number(p, d, base)
long sd;
int flags;
/* An explicit precision turns off the zero-padding flag. */
if ((p->flags & PF_ZEROPAD) && p->precision >= 0 && (p->flags & PF_DOT))
p->flags &= ~PF_ZEROPAD;
sd = d; /* signed for ' ' padding in base 10 */
flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
flags = 0;
flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
if (*p->pf == 'X')
flags |= FL_HEXUPPER;
@@ -668,6 +690,12 @@ number(p, d, base)
p->width -= strlen(tmp);
PAD_RIGHT(p);
if ((p->flags & PF_DOT) && p->precision > 0)
{
p->precision -= strlen(tmp);
PAD_ZERO(p);
}
switch (base)
{
case 10:
@@ -711,8 +739,12 @@ lnumber(p, d, base)
long long sd;
int flags;
/* An explicit precision turns off the zero-padding flag. */
if ((p->flags & PF_ZEROPAD) && p->precision >= 0 && (p->flags & PF_DOT))
p->flags &= ~PF_ZEROPAD;
sd = d; /* signed for ' ' padding in base 10 */
flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
if (*p->pf == 'X')
flags |= FL_HEXUPPER;
@@ -728,6 +760,12 @@ lnumber(p, d, base)
p->width -= strlen(tmp);
PAD_RIGHT(p);
if ((p->flags & PF_DOT) && p->precision > 0)
{
p->precision -= strlen(tmp);
PAD_ZERO(p);
}
switch (base)
{
case 10:
@@ -778,6 +816,7 @@ pointer(p, d)
PUT_CHAR(*tmp, p);
tmp++;
}
PAD_LEFT(p);
}
@@ -881,7 +920,9 @@ isinf(d)
#endif
return 0;
}
#endif
#ifndef HAVE_ISNAN_IN_LIBC
static int
isnan(d)
double d;
@@ -943,11 +984,21 @@ floating(p, d)
if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp)))
tmp = t;
if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)
{
/* smash the trailing zeros unless altform */
for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
tmp2[i] = '\0';
if (tmp2[0] == '\0')
p->precision = 0;
}
/* calculate the padding. 1 for the dot */
p->width = p->width -
((d > 0. && p->justify == RIGHT) ? 1:0) -
((p->flags & PF_SPACE) ? 1:0) -
strlen(tmp) - p->precision - 1;
strlen(tmp) - p->precision -
((p->precision != 0 || (p->flags & PF_ALTFORM)) ? 1 : 0); /* radix char */
PAD_RIGHT(p);
PUT_PLUS(d, p, 0.);
PUT_SPACE(d, p, 0.);
@@ -962,11 +1013,6 @@ floating(p, d)
if (p->precision != 0 || (p->flags & PF_ALTFORM))
PUT_CHAR(decpoint, p); /* put the '.' */
if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)
/* smash the trailing zeros unless altform */
for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
tmp2[i] = '\0';
for (; *tmp2; tmp2++)
PUT_CHAR(*tmp2, p); /* the fraction */
@@ -982,14 +1028,19 @@ exponent(p, d)
char *tmp, *tmp2;
int j, i;
if (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))
if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2)))
return; /* already printed nan or inf */
GETLOCALEDATA(decpoint, thoussep, grouping);
DEF_PREC(p);
j = log_10(d);
d = d / pow_10(j); /* get the Mantissa */
d = ROUND(d, p);
if (d == 0.)
j = 0;
else
{
j = log_10(d);
d = d / pow_10(j); /* get the Mantissa */
d = ROUND(d, p);
}
tmp = dtoa(d, p->precision, &tmp2);
/* 1 for unit, 1 for the '.', 1 for 'e|E',
@@ -1047,6 +1098,7 @@ exponent(p, d)
PUT_CHAR(*tmp, p);
tmp++;
}
PAD_LEFT(p);
}
#endif
@@ -1329,7 +1381,7 @@ conv_break:
STAR_ARGS(data);
DEF_PREC(data);
d = GETDOUBLE(data);
i = log_10(d);
i = (d != 0.) ? log_10(d) : -1;
/*
* for '%g|%G' ANSI: use f if exponent
* is in the range or [-4,p] exclusively
+13 -3
View File
@@ -81,8 +81,18 @@ ansicstr (string, len, flags, sawc, rlen)
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7':
#if 1
if (flags & 1)
{
*r++ = '\\';
break;
}
/*FALLTHROUGH*/
#endif
case '0':
/* If (FLAGS & 1), we're translating a string for echo -e (or
the equivalent xpg_echo option), so we obey the SUSv3/
POSIX-2001 requirement and accept 0-3 octal digits after
@@ -166,7 +176,7 @@ ansic_quote (str, flags, rlen)
int flags, *rlen;
{
char *r, *ret, *s;
int l, rsize, t;
int l, rsize;
unsigned char c;
if (str == 0 || *str == 0)
+6 -2
View File
@@ -47,6 +47,9 @@ extern int errno;
extern pid_t dollar_dollar_pid;
static char *get_sys_tmpdir __P((void));
static char *get_tmpdir __P((int));
static char *sys_tmpdir = (char *)NULL;
static int ntmpfiles;
static int tmpnamelen = -1;
@@ -55,8 +58,6 @@ static unsigned long filenum = 1L;
static char *
get_sys_tmpdir ()
{
struct stat sb;
if (sys_tmpdir)
return sys_tmpdir;
@@ -90,6 +91,9 @@ get_tmpdir (flags)
char *tdir;
tdir = (flags & MT_USETMPDIR) ? get_string_value ("TMPDIR") : (char *)NULL;
if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
tdir = 0;
if (tdir == 0)
tdir = get_sys_tmpdir ();
+1
View File
@@ -55,6 +55,7 @@ extern int shell_tty;
#if defined (READLINE)
extern void rl_set_screen_size __P((int, int));
#endif
extern void sh_set_lines_and_columns __P((int, int));
void
get_new_window_size (from_sig, rp, cp)