From e74aaf93854b9453b9949954aec77710b257d8b6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Sep 2009 02:05:45 +0200 Subject: ash,hush: make trap output short signal names, without SIG prefix function old new delta evalvar 1373 1371 -2 builtin_trap 457 441 -16 trapcmd 260 236 -24 Signed-off-by: Denys Vlasenko --- shell/ash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index c909cae..d7355ce 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -12267,13 +12267,16 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) for (signo = 0; signo < NSIG; signo++) { char *tr = trap_ptr[signo]; if (tr) { - out1fmt("trap -- %s %s%s\n", + /* note: bash adds "SIG", but only if invoked + * as "bash". If called as "sh", or if set -o posix, + * then it prints short signal names. + * We are printing short names: */ + out1fmt("trap -- %s %s\n", single_quote(tr), - (signo == 0 ? "" : "SIG"), get_signame(signo)); /* trap_ptr != trap only if we are in special-cased `trap` code. * In this case, we will exit very soon, no need to free(). */ - /* if (trap_ptr != trap) */ + /* if (trap_ptr != trap && tp[0]) */ /* free(tr); */ } } -- cgit v1.1