diff options
author | Jari Aalto <jari.aalto@cante.net> | 1997-09-22 20:22:27 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:51 +0000 |
commit | e8ce775db824de329b81293b4e5d8fbd65624528 (patch) | |
tree | 4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /builtins | |
parent | d166f048818e10cf3799aa24a174fb22835f1acc (diff) | |
download | bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz |
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'builtins')
-rw-r--r-- | builtins/Makefile.in | 6 | ||||
-rw-r--r-- | builtins/declare.def | 2 | ||||
-rw-r--r-- | builtins/evalstring.c | 7 | ||||
-rw-r--r-- | builtins/read.def | 13 | ||||
-rw-r--r-- | builtins/setattr.def | 4 | ||||
-rw-r--r-- | builtins/trap.def | 14 |
6 files changed, 35 insertions, 11 deletions
diff --git a/builtins/Makefile.in b/builtins/Makefile.in index 205f4fc4..73e719d9 100644 --- a/builtins/Makefile.in +++ b/builtins/Makefile.in @@ -97,8 +97,11 @@ mkbuiltins: $(srcdir)/mkbuiltins.c ../config.h common.o: common.c bashgetopt.o: bashgetopt.c getopt.o: getopt.c +evalstring.o: evalstring.c +evalfile.o: evalfile.c -ulimit.o: ulimit.def pipesize.h +ulimit.o: ulimit.def +ulimit.o: pipesize.h pipesize.h: psize.aux $(SHELL) $(srcdir)/psize.sh > pipesize.h @@ -149,6 +152,7 @@ return.o: return.def set.o: set.def setattr.o: setattr.def shift.o: shift.def +shopt.o: shopt.def source.o: source.def suspend.o: suspend.def test.o: test.def diff --git a/builtins/declare.def b/builtins/declare.def index 10a31465..ae49b66b 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -369,8 +369,10 @@ declare_internal (list, local_var) assign_array_var_from_string (var, value); else #endif + /* This essentially duplicates the internals of bind_variable() */ if (offset) { + var->attributes &= ~att_invisible; t = make_variable_value (var, value); FREE (var->value); var->value = t; diff --git a/builtins/evalstring.c b/builtins/evalstring.c index bf4a8a5b..1a22887d 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -160,7 +160,9 @@ parse_and_execute (string, from_file, flags) } else { - dispose_command (command); /* XXX */ +#if 0 + dispose_command (command); /* pe_dispose does this */ +#endif continue; } @@ -192,7 +194,8 @@ parse_and_execute (string, from_file, flags) #if defined (ONESHOT) if (startup_state == 2 && *bash_input.location.string == '\0' && command->type == cm_simple && !command->redirects && - !command->value.Simple->redirects) + !command->value.Simple->redirects && + ((command->flags & CMD_TIME_PIPELINE) == 0)) { command->flags |= CMD_NO_FORK; command->value.Simple->flags |= CMD_NO_FORK; diff --git a/builtins/read.def b/builtins/read.def index 64a4a11a..e1e63541 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -46,6 +46,8 @@ $END # include <unistd.h> #endif +#include <errno.h> + #include "../shell.h" #include "common.h" #include "bashgetopt.h" @@ -55,6 +57,10 @@ $END #include <readline/readline.h> #endif +#if !defined(errno) +extern int errno; +#endif + #define issep(c) (strchr (ifs_chars, (c))) extern int interrupt_immediately; @@ -180,8 +186,11 @@ read_builtin (list) c = rlbuf[rlind++]; } else -#endif - if (read (0, &c, 1) != 1) +#endif + + while (((retval = read (0, &c, 1)) < 0) && errno == EINTR) + ; + if (retval <= 0) { eof = 1; break; diff --git a/builtins/setattr.def b/builtins/setattr.def index e465eecb..d4068a33 100644 --- a/builtins/setattr.def +++ b/builtins/setattr.def @@ -326,7 +326,7 @@ show_var_attributes (var, pattr, nodefs) printf ("%s\n", named_function_string (var->name, function_cell (var), 1)); else { - x = double_quote (value_cell (var)); + x = double_quote (value_cell (var) ? value_cell (var) : ""); printf ("%s=%s\n", var->name, x); free (x); } @@ -366,7 +366,7 @@ set_var_attribute (name, attribute, undo) { if (tv = find_tempenv_variable (name)) { - var = bind_variable (tv->name, tv->value); + var = bind_variable (tv->name, tv->value ? tv->value : ""); dispose_variable (tv); } else diff --git a/builtins/trap.def b/builtins/trap.def index 2d5daca7..252a1dbe 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -191,7 +191,7 @@ static void showtrap (i) int i; { - char *t, *p; + char *t, *p, *sn; p = trap_list[i]; @@ -199,9 +199,15 @@ showtrap (i) return; t = (p == (char *)IGNORE_SIG) ? (char *)NULL : single_quote (p); - printf ("trap -- %s %s\n", t ? t : "''", signal_name (i)); - if (t) - free (t); + sn = signal_name (i); + /* Make sure that signals whose names are unknown (for whatever reason) + are printed as signal numbers. */ + if (STREQN (sn, "SIGJUNK", 7) || STREQN (sn, "unknown", 7)) + printf ("trap -- %s %d\n", t ? t : "''", i); + else + printf ("trap -- %s %s\n", t ? t : "''", sn); + + FREE (t); } static int |