Update of /cvsroot/winbash/winbash
In directory usw-pr-cvs1:/tmp/cvs-serv555
Modified Files:
.build .patchlevel bashline.c general.c machines.h parse.y
shell.h subst.c trap.c version.h
Log Message:
applied gnu bash 1.14.6 diffs
Index: .build
===================================================================
RCS file: /cvsroot/winbash/winbash/.build,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- .build 11 Mar 2002 01:47:03 -0000 1.7
+++ .build 11 Mar 2002 04:50:29 -0000 1.8
@@ -1 +1 @@
-5
+8
Index: .patchlevel
===================================================================
RCS file: /cvsroot/winbash/winbash/.patchlevel,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- .patchlevel 11 Mar 2002 01:47:04 -0000 1.4
+++ .patchlevel 11 Mar 2002 04:50:29 -0000 1.5
@@ -1 +1 @@
-5
+6
Index: bashline.c
===================================================================
RCS file: /cvsroot/winbash/winbash/bashline.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bashline.c 9 Mar 2002 16:05:41 -0000 1.2
+++ bashline.c 11 Mar 2002 04:50:29 -0000 1.3
@@ -792,6 +792,7 @@
command = savestring (VI_EDIT_COMMAND);
}
parse_and_execute (command, "v", -1);
+ rl_line_buffer[0] = '\0'; /* erase pre-edited command */
}
#endif /* VI_MODE */
@@ -1658,35 +1659,64 @@
char **names;
Function *name_func;
{
- char **p;
- int idx;
+ char **newnames;
+ int idx, nidx;
- for (p = names + 1, idx = -1; *p; p++)
+ /* If there is only one completion, see if it is acceptable. If it is
+ not, free it up. In any case, short-circuit and return. This is a
+ special case because names[0] is not the prefix of the list of names
+ if there is only one completion; it is the completion itself. */
+ if (names[1] == (char *)0)
{
- if ((*name_func) (*p))
- {
- if (idx == -1) /* First match found. */
- idx = p - names;
- else
- return; /* Too many matches. */
- }
+ if ((*name_func) (names[0]) == 0)
+ {
+ free (names[0]);
+ names[0] = (char *)NULL;
+ }
+ return;
}
-
- /* If none are acceptable then let the completer handle it. */
- if (idx == -1)
- return;
- /* Delete all non-matching elements. */
- free (names[0]);
- for (p = names + 1; *p; p++)
+ /* Allocate space for array to hold list of pointers to matching
+ filenames. The pointers are copied back to NAMES when done. */
+ for (nidx = 1; names[nidx]; nidx++)
+ ;
+ newnames = (char **)xmalloc ((nidx + 1) * (sizeof (char *)));
+
+ newnames[0] = names[0];
+ for (idx = nidx = 1; names[idx]; idx++)
{
- if (idx == (p - names))
- names[0] = *p;
- else
- free (*p);
+ if ((*name_func) (names[idx]))
+ newnames[nidx++] = names[idx];
+ else
+ free (names[idx]);
+ }
- *p = NULL;
+ newnames[nidx] = (char *)NULL;
+
+ /* If none are acceptable then let the completer handle it. */
+ if (nidx == 1)
+ {
+ free (names[0]);
+ names[0] = (char *)NULL;
+ free (newnames);
+ return;
+ }
+
+ /* If only one is acceptable, copy it to names[0] and return. */
+ if (nidx == 2)
+ {
+ free (names[0]);
+ names[0] = newnames[1];
+ names[1] = (char *)NULL;
+ free (newnames);
+ return;
}
+
+ /* Copy the acceptable names back to NAMES, set the new array end,
+ and return. */
+ for (nidx = 1; newnames[nidx]; nidx++)
+ names[nidx] = newnames[nidx];
+ names[nidx] = (char *)NULL;
}
static void
Index: general.c
===================================================================
RCS file: /cvsroot/winbash/winbash/general.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- general.c 11 Mar 2002 01:47:04 -0000 1.4
+++ general.c 11 Mar 2002 04:50:29 -0000 1.5
@@ -1081,9 +1081,9 @@
*
*/
-#if !defined (USG) && !defined (HPUX)
+#if !defined (USG) && !defined (HPUX) && !defined (HAVE_GETDTABLESIZE)
# define HAVE_GETDTABLESIZE
-#endif /* !USG && !HPUX */
+#endif /* !USG && !HPUX && !HAVE_GETDTABLESIZE */
#if defined (hppa) && (defined (hpux_8) || defined (hpux_9))
# undef HAVE_GETDTABLESIZE
@@ -1180,6 +1180,9 @@
}
#if defined (NO_READ_RESTART_ON_SIGNAL)
+static char localbuf[128];
+static int local_index = 0, local_bufused = 0;
+
/* Posix and USG systems do not guarantee to restart read () if it is
interrupted by a signal. We do the read ourselves, and restart it
if it returns EINTR. */
@@ -1187,9 +1190,6 @@
getc_with_restart (stream)
FILE *stream;
{
- static char localbuf[128];
- static int local_index = 0, local_bufused = 0;
-
/* Try local buffering to reduce the number of read(2) calls. */
if (local_index == local_bufused || local_bufused == 0)
{
@@ -1208,6 +1208,17 @@
}
return (localbuf[local_index++]);
}
+
+int
+ungetc_with_restart (c, fp)
+ int c;
+ FILE *fp;
+{
+ if (local_index == 0 || local_bufused == 0 || c == EOF)
+ return EOF;
+ return (localbuf[--local_index] = c);
+}
+
#endif /* NO_READ_RESTART_ON_SIGNAL */
#if defined (USG) || defined (AIX) || (defined (_POSIX_VERSION) && defined (Ultrix))
Index: machines.h
===================================================================
RCS file: /cvsroot/winbash/winbash/machines.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- machines.h 11 Mar 2002 01:47:04 -0000 1.4
+++ machines.h 11 Mar 2002 04:50:29 -0000 1.5
@@ -96,8 +96,24 @@
# define VOID_SIGHANDLER
# define HAVE_DIRENT
# define HAVE_STRCASECMP
+# undef USE_GNU_MALLOC
#endif /* sparc && __NetBSD__ */
+/* BSDI BSD/OS running on a sparc. */
+#if defined (sparc) && defined (__bsdi__)
+# define M_MACHINE "sun4"
+# define M_OS "BSD_OS"
+# define SYSDEP_CFLAGS -DOPENDIR_NOT_ROBUST -DRLIMTYPE=quad_t
+# define HAVE_SYS_SIGLIST
+# define HAVE_SETLINEBUF
+# define HAVE_GETGROUPS
+# define HAVE_VFPRINTF
+# define HAVE_STRERROR
+# define VOID_SIGHANDLER
+# define HAVE_DIRENT
+# define HAVE_STRCASECMP
+#endif /* sparc && __bsdi__ */
+
#if defined (sun) && !defined (M_MACHINE)
/* We aren't currently using GNU Malloc on Suns because of a bug in Sun's
YP which bites us when Sun free ()'s an already free ()'ed address.
@@ -195,6 +211,26 @@
#endif /* __alpha || alpha */
/* ************************ */
+/* */
+/* NetBSD/pmax (DEC mips) */
+/* */
+/* ************************ */
+#if defined(mips) && defined(__NetBSD__)
+# define M_MACHINE "mips"
+# define M_OS "NetBSD"
+# define SYSDEP_CFLAGS -DOPENDIR_NOT_ROBUST -DINT_GROUPS_ARRAY \
+ -DRLIMTYPE=quad_t
+# define HAVE_SYS_SIGLIST
+# define HAVE_SETLINEBUF
+# define HAVE_GETGROUPS
+# define HAVE_VFPRINTF
+# define HAVE_STRERROR
+# define VOID_SIGHANDLER
+# define HAVE_DIRENT
+# define HAVE_STRCASECMP
+#endif /* mips && __NetBSD__ */
+
+/* ************************ */
/* */
/* Ultrix */
/* */
@@ -308,6 +344,7 @@
-DHAVE_SOCKETS
# endif /* !Irix5 */
# define SYSDEP_CFLAGS SGI_CFLAGS MACHINE_CFLAGS ANSIC
+# define SYSDEP_LDFLAGS MACHINE_CFLAGS
#endif /* sgi */
/* ************************ */
@@ -491,6 +528,7 @@
# if !defined (HAVE_GCC)
# undef MACHINE_CFLAGS
# define MACHINE_CFLAGS -Wf,-XNl3072 -systype bsd43
+# define SYSDEP_LDFLAGS -systype bsd43
# endif /* !HAVE_GCC */
# define SYSDEP_CFLAGS MACHINE_CFLAGS MIPS_CFLAGS
# define HAVE_SYS_SIGLIST
@@ -731,11 +769,11 @@
# define M_MACHINE "i386"
# define M_OS "SCO"
# define SCO_CFLAGS -DUSG -DUSGr3 -DPGRP_PIPE
-# if defined (SCOv4)
+# if defined (SCOv4) || defined (SCOv5)
# define SYSDEP_CFLAGS SCO_CFLAGS -DWAITPID_BROKEN
-# else /* !SCOv4 */
+# else /* !SCOv4 && !SCOv5 */
# define SYSDEP_CFLAGS SCO_CFLAGS -DOPENDIR_NOT_ROBUST -DMUST_UNBLOCK_CHILD
-# endif /* !SCOv4 */
+# endif /* !SCOv4 && !SCOv5 */
# define HAVE_VFPRINTF
# define VOID_SIGHANDLER
# define HAVE_GETGROUPS
@@ -968,6 +1006,30 @@
# undef HAVE_ALLOCA
#endif /* alliant */
+/* ********************* */
+/* */
+/* Linux/m68k */
+/* */
+/* ********************* */
+#if defined (mc68000) && (defined (__linux__) || defined (linux))
+# define M_MACHINE "m68k"
+# define M_OS "Linux"
+# define SYSDEP_CFLAGS -DHAVE_BCOPY -DHAVE_GETPW_DECLS -DHAVE_GETHOSTNAME
+# define REQUIRED_LIBRARIES
+# define HAVE_GETGROUPS
+# define HAVE_STRERROR
+# define VOID_SIGHANDLER
+# define HAVE_SYS_SIGLIST
+# define HAVE_VFPRINTF
+# define HAVE_VARARGS_H
+# if defined (__GNUC__)
+# define HAVE_FIXED_INCLUDES
+# endif /* __GNUC__ */
+# undef USE_GNU_MALLOC
+# undef HAVE_SETLINEBUF
+# define HAVE_STRCASECMP
+#endif /* mc68000 && __linux__ */
+
/* **************************************************************** */
/* */
/* Motorola Delta series running System V R3V6/7 */
@@ -1173,6 +1235,20 @@
# undef USE_GNU_MALLOC
# undef HAVE_RESOURCE
# define HPUX_CFLAGS -DNO_SBRK_DECL -DHAVE_SOCKETS -DHAVE_GETHOSTNAME HPUX_ANSI
+# endif /* HPUX_9 */
+
+# if defined (HPUX_10)
+# define M_OS "hpux_10"
+# if !defined (__GNUC__)
+# undef HAVE_ALLOCA
+# define HPUX_ANSI +O3 -Ae
+# else
+# define HPUX_ANSI
+# endif
+# undef HAVE_GETWD
+# undef USE_GNU_MALLOC
+# undef HAVE_RESOURCE
+# define HPUX_CFLAGS -DNO_SBRK_DECL -DHAVE_SOCKETS -DHAVE_GETHOSTNAME -DBSD_GETPGRP HPUX_ANSI
# endif /* HPUX_9 */
# endif /* !HPUX_USG */
Index: parse.y
===================================================================
RCS file: /cvsroot/winbash/winbash/parse.y,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- parse.y 10 Mar 2002 23:25:31 -0000 1.4
+++ parse.y 11 Mar 2002 04:50:29 -0000 1.5
@@ -964,7 +964,11 @@
yy_stream_unget (c)
int c;
{
+#if defined (NO_READ_RESTART_ON_SIGNAL)
+ return (ungetc_with_restart (c, bash_input.location.file));
+#else
return (ungetc (c, bash_input.location.file));
+#endif
}
void
@@ -1731,6 +1735,9 @@
\
if (word_token_alist[i].token == '{') \
open_brace_awaiting_satisfaction++; \
+\
+ if (word_token_alist[i].token == '}' && open_brace_awaiting_satisfaction) \
+ open_brace_awaiting_satisfaction--; \
\
return (word_token_alist[i].token); \
} \
Index: shell.h
===================================================================
RCS file: /cvsroot/winbash/winbash/shell.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- shell.h 10 Mar 2002 21:45:13 -0000 1.2
+++ shell.h 11 Mar 2002 04:50:29 -0000 1.3
@@ -93,7 +93,7 @@
#define FD_BITMAP_SIZE 32
#define CTLESC '\001'
-#define CTLNUL '\002'
+#define CTLNUL '\177'
/* Information about the current user. */
struct user_info {
Index: subst.c
===================================================================
RCS file: /cvsroot/winbash/winbash/subst.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- subst.c 11 Mar 2002 01:47:04 -0000 1.5
+++ subst.c 11 Mar 2002 04:50:29 -0000 1.6
@@ -199,7 +199,12 @@
char *temp;
if (charlist[0] == '\'' && !charlist[1])
- return (string_extract_single_quoted (string, sindex));
+ {
+ temp = string_extract_single_quoted (string, sindex);
+ i = *sindex - 1;
+ *sindex = i;
+ return (temp);
+ }
for (i = *sindex; (c = string[i]); i++)
{
@@ -732,33 +737,35 @@
for (i = pass_next = quoted = 0; i <= eindex; i++)
{
if (pass_next)
- {
- pass_next = 0;
- if (i >= eindex) /* XXX was if (i >= eindex - 1) */
- return 1;
- continue;
- }
+ {
+ pass_next = 0;
+ if (i >= eindex) /* XXX was if (i >= eindex - 1) */
+ return 1;
+ continue;
+ }
else if (string[i] == '\'')
- {
- i++;
- temp = string_extract_single_quoted (string, &i);
- free (temp);
- if (i > eindex)
- return 1;
- }
+ {
+ i++;
+ temp = string_extract_single_quoted (string, &i);
+ free (temp);
+ if (i > eindex)
+ return 1;
+ i--;
+ }
else if (string[i] == '"')
- {
- i++;
- temp = string_extract_double_quoted (string, &i);
- free (temp);
- if (i > eindex)
- return 1;
- }
+ {
+ i++;
+ temp = string_extract_double_quoted (string, &i);
+ free (temp);
+ if (i > eindex)
+ return 1;
+ i--;
+ }
else if (string[i] == '\\')
- {
- pass_next = 1;
- continue;
- }
+ {
+ pass_next = 1;
+ continue;
+ }
}
return (0);
}
@@ -939,8 +946,35 @@
quoted null characters in the middle or at the ends of strings because
of how expand_word_internal works. remove_quoted_nulls () simply
turns STRING into an empty string iff it only consists of a quoted null. */
+/*
#define remove_quoted_nulls(string) \
do { if (QUOTED_NULL (string)) string[0] ='\0'; } while (0)
+*/
+static void
+remove_quoted_nulls (string)
+ char *string;
+{
+ char *nstr, *s, *p;
+
+ nstr = savestring (string);
+ nstr[0] = '\0';
+ for (p = nstr, s = string; *s; s++)
+ {
+ if (*s == CTLESC)
+ {
+ *p++ = *s++; /* CTLESC */
+ if (*s == 0)
+ break;
+ *p++ = *s; /* quoted char */
+ continue;
+ }
+ if (*s == CTLNUL)
+ continue;
+ *p++ = *s;
+ }
+ *p = '\0';
+ strcpy (string, nstr);
+}
/* Perform quoted null character removal on each element of LIST.
This modifies LIST. */
@@ -1845,7 +1879,7 @@
char *tname;
tname = mktemp (savestring ("/tmp/sh-np-XXXXXX"));
- if (mkfifo (tname, 0666) < 0)
+ if (mkfifo (tname, 0600) < 0)
{
free (tname);
return ((char *) NULL);
@@ -1885,19 +1919,17 @@
{
if (!dev_fd_list || fd >= totfds)
{
- int zero;
+ int ofds;
+ ofds = totfds;
totfds = getdtablesize ();
if (totfds < 0 || totfds > 256)
totfds = 256;
if (fd > totfds)
totfds = fd + 2;
- zero = dev_fd_list == (char *) NULL;
dev_fd_list = xrealloc (dev_fd_list, totfds);
- if (zero)
- bzero (dev_fd_list, totfds);
- /* XXX - should zero out new portion of list here - XXX */
+ bzero (dev_fd_list + ofds, totfds - ofds);
}
dev_fd_list[fd] = 1;
@@ -2533,6 +2565,12 @@
{
temp = string_list (l);
dispose_words (l);
+ }
+ else if (lquote)
+ {
+ temp = xmalloc (2);
+ temp[0] = CTLNUL;
+ temp[1] = '\0';
}
else
temp = (char *)NULL;
Index: trap.c
===================================================================
RCS file: /cvsroot/winbash/winbash/trap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- trap.c 10 Mar 2002 23:25:31 -0000 1.4
+++ trap.c 11 Mar 2002 04:50:29 -0000 1.5
@@ -469,6 +469,10 @@
int
run_exit_trap ()
{
+ int old_exit_value;
+
+ old_exit_value = last_command_exit_value;
+
/* Run the trap only if signal 0 is trapped and not ignored. */
if ((sigmodes[0] & SIG_TRAPPED) &&
(trap_list[0] != (char *)IGNORE_SIG) &&
@@ -484,8 +488,13 @@
if (code == 0)
parse_and_execute (trap_command, "trap", 0);
+ else if (code == EXITPROG)
+ return (last_command_exit_value);
+ else
+ return (old_exit_value);
}
- return (last_command_exit_value);
+
+ return (old_exit_value);
}
/* Set the handler signal SIG to the original and free any trap
Index: version.h
===================================================================
RCS file: /cvsroot/winbash/winbash/version.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- version.h 11 Mar 2002 01:47:04 -0000 1.6
+++ version.h 11 Mar 2002 04:50:29 -0000 1.7
@@ -5,12 +5,12 @@
#define DISTVERSION "1.14"
/* The patch level of this version of the shell. */
-#define PATCHLEVEL 5
+#define PATCHLEVEL 6
/* The last built version of this shell. */
-#define BUILDVERSION 5
+#define BUILDVERSION 8
/* A version string for use by sccs and the what command. */
-#define SCCSVERSION "@(#)Bash version 1.14.5(5) GNU"
+#define SCCSVERSION "@(#)Bash version 1.14.6(8) GNU"
|