commit: 8493fe855d21eb6c46fe783ae22b9b33f9ad1b21
parent: 009e70de0d488018408bf2235acf2e0f609384b2
author: Brian Callahan <bcallah@openbsd.org>
date: Sat, 2 May 2020 00:15:39 -0400
Apply some style tweaks.
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/signame.c b/signame.c
@@ -35,7 +35,10 @@
#include <signal.h>
#include <unistd.h>
-static const struct { int sig; const char *name; } signame[] = {
+static const struct {
+ int sig;
+ const char *name;
+} signame[] = {
{ 0, "Signal 0" },
#ifdef SIGHUP
{ SIGHUP, "HUP" },
@@ -138,10 +141,16 @@ static const struct { int sig; const char *name; } signame[] = {
#endif
};
-const char *sig2str(int sig) {
- for (int i = 0; i < sizeof(signame)/sizeof(*signame); i++)
+const char *
+sig2str(int sig)
+{
+ int i;
+
+ for (i = 0; i < sizeof(signame) / sizeof(*signame); i++) {
if (signame[i].sig == sig)
return signame[i].name;
+ }
+
return "UNKNOWN";
}
diff --git a/trap.c b/trap.c
@@ -16,7 +16,7 @@ Trap sigtraps[NSIG + 1];
static struct sigaction Sigact_ign, Sigact_trap;
#ifndef HAVE_SIGNAME
-const char *sig2str(int sig);
+extern const char *sig2str(int);
#endif
void
@@ -39,7 +39,7 @@ inittraps(void)
#ifdef HAVE_SIGLIST
sigtraps[i].mess = sys_siglist[i];
#else
- static char *mess[NSIG+1] = {NULL};
+ static char *mess[NSIG + 1] = { NULL };
if (!mess[i])
mess[i] = strdup(strsignal(i));
sigtraps[i].mess = mess[i];