diff options
author | stefanf <stefanf@FreeBSD.org> | 2006-06-15 07:00:49 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2006-06-15 07:00:49 +0000 |
commit | 40616c7bb389aaa1e23907cad897503212b8e51e (patch) | |
tree | ffddd6afca1624ba622d55a632b321308ad597fc /bin/sh/eval.c | |
parent | 1689a257a3225150b95ea8241663b4784ac60e9f (diff) | |
download | FreeBSD-src-40616c7bb389aaa1e23907cad897503212b8e51e.zip FreeBSD-src-40616c7bb389aaa1e23907cad897503212b8e51e.tar.gz |
Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option. Its value is printed at the beginning of the line if tracing
(-x) is active. PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".
We still need to expand variables in PS1, PS2 and PS4.
PR: 46441 (part of)
Submitted by: schweikh
Obtained from: NetBSD
Diffstat (limited to 'bin/sh/eval.c')
-rw-r--r-- | bin/sh/eval.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index fa2fe59..dc0236d 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -643,14 +643,19 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) /* Print the command if xflag is set. */ if (xflag) { - outc('+', &errout); + char sep = 0; + out2str(ps4val()); for (sp = varlist.list ; sp ; sp = sp->next) { - outc(' ', &errout); + if (sep != 0) + outc(' ', &errout); out2str(sp->text); + sep = ' '; } for (sp = arglist.list ; sp ; sp = sp->next) { - outc(' ', &errout); + if (sep != 0) + outc(' ', &errout); out2str(sp->text); + sep = ' '; } outc('\n', &errout); flushout(&errout); |