mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-12 06:30:50 +02:00
commit bash-20061130 snapshot
This commit is contained in:
@@ -314,11 +314,14 @@ readline (prompt)
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* If readline() is called after installing a callback handler, temporarily
|
||||
turn off the callback state to avoid ensuing messiness. Patch supplied
|
||||
by the gdb folks. */
|
||||
by the gdb folks. XXX -- disabled. This can be fooled and readline
|
||||
left in a strange state by a poorly-timed longjmp. */
|
||||
if (in_callback = RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
RL_UNSETSTATE (RL_STATE_CALLBACK);
|
||||
#endif
|
||||
|
||||
rl_set_prompt (prompt);
|
||||
|
||||
@@ -338,8 +341,10 @@ readline (prompt)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (in_callback)
|
||||
RL_SETSTATE (RL_STATE_CALLBACK);
|
||||
#endif
|
||||
|
||||
return (value);
|
||||
}
|
||||
|
||||
+4
-2
@@ -88,7 +88,7 @@ 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.
|
||||
@@ -101,7 +101,7 @@ 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 wcsdup.o \
|
||||
fmtullong.o fmtumax.o xstrchr.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
|
||||
${LIBOBJS}
|
||||
|
||||
SUPPORT = Makefile
|
||||
@@ -182,6 +182,7 @@ 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
|
||||
|
||||
@@ -241,6 +242,7 @@ 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
|
||||
|
||||
|
||||
@@ -674,6 +674,8 @@ number(p, d, base)
|
||||
|
||||
sd = d; /* signed for ' ' padding in base 10 */
|
||||
flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0;
|
||||
if (*p->pf == 'x' || *p->pf == 'X')
|
||||
flags |= FL_UNSIGNED; /* %x, %X treated as unsigned */
|
||||
if (*p->pf == 'X')
|
||||
flags |= FL_HEXUPPER;
|
||||
|
||||
|
||||
+1
-1
@@ -406,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 \
|
||||
{ \
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/* Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "command.h"
|
||||
#include "general.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
extern ssize_t zread __P((int, char *, size_t));
|
||||
|
||||
/* Dump contents of file descriptor FD to *OSTR. FN is the filename for
|
||||
error messages (not used right now). */
|
||||
int
|
||||
zmapfd (fd, ostr, fn)
|
||||
int fd;
|
||||
char **ostr;
|
||||
char *fn;
|
||||
{
|
||||
ssize_t nr;
|
||||
int rval;
|
||||
char lbuf[128];
|
||||
char *result;
|
||||
int rsize, rind;
|
||||
|
||||
rval = 0;
|
||||
result = (char *)xmalloc (rsize = 64);
|
||||
rind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
nr = zread (fd, lbuf, sizeof (lbuf));
|
||||
if (nr == 0)
|
||||
{
|
||||
rval = rind;
|
||||
break;
|
||||
}
|
||||
else if (nr < 0)
|
||||
{
|
||||
rval = -1;
|
||||
free (result);
|
||||
if (ostr)
|
||||
*ostr = (char *)NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (result, rind, nr, rsize, 128);
|
||||
memcpy (result+rind, lbuf, nr);
|
||||
rind += nr;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (result, rind, 1, rsize, 128);
|
||||
result[rind] = '\0';
|
||||
|
||||
if (ostr)
|
||||
*ostr = result;
|
||||
else
|
||||
free (result);
|
||||
|
||||
return rval;
|
||||
}
|
||||
Reference in New Issue
Block a user