Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Use strsignal() rather than direct reference to sys_s...



details:   https://anonhg.NetBSD.org/src/rev/6d35e8f63e00
branches:  trunk
changeset: 445426:6d35e8f63e00
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Oct 28 18:16:01 2018 +0000

description:
Use strsignal() rather than direct reference to sys_siglist[]
(apart from being cleaner, it also simplifies the code, as
strsignal() never fails ... it also removes one reference to NSIG).

diffstat:

 bin/sh/jobs.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r 092392d795b5 -r 6d35e8f63e00 bin/sh/jobs.c
--- a/bin/sh/jobs.c     Sun Oct 28 18:13:47 2018 +0000
+++ b/bin/sh/jobs.c     Sun Oct 28 18:16:01 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jobs.c,v 1.101 2018/09/13 22:12:35 kre Exp $   */
+/*     $NetBSD: jobs.c,v 1.102 2018/10/28 18:16:01 kre Exp $   */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c     8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.101 2018/09/13 22:12:35 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.102 2018/10/28 18:16:01 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -494,11 +494,7 @@
                        else /* WIFSIGNALED(ps->status) */
 #endif
                                st = WTERMSIG(ps->status);
-                       st &= 0x7f;
-                       if (st < NSIG && sys_siglist[st])
-                               scopyn(sys_siglist[st], s + col, 32);
-                       else
-                               fmtstr(s + col, 16, "Signal %d", st);
+                       scopyn(strsignal(st), s + col, 32);
                        if (WCOREDUMP(ps->status)) {
                                col += strlen(s + col);
                                scopyn(" (core dumped)", s + col,  64 - col);



Home | Main Index | Thread Index | Old Index