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/748f6a4c22fb
branches:  trunk
changeset: 994258:748f6a4c22fb
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 6e53e89b65bb -r 748f6a4c22fb 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