80 lines
1.5 KiB
Text
80 lines
1.5 KiB
Text
$NetBSD: patch-ae,v 1.2 1998/08/07 11:14:08 agc Exp $
|
|
|
|
--- signals.c.orig Tue Mar 28 21:32:06 1995
|
|
+++ signals.c Sun Jul 19 14:07:51 1998
|
|
@@ -2,14 +2,18 @@
|
|
|
|
/* Copyright 1993-1995 Werner Almesberger. See file COPYING for details. */
|
|
|
|
-
|
|
+#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include "signals.h"
|
|
|
|
+#ifdef __NetBSD__
|
|
+#define HAVE_SYS_SIGNAME
|
|
+#endif
|
|
|
|
+#ifndef HAVE_SYS_SIGNAME
|
|
typedef struct {
|
|
int number;
|
|
const char *name;
|
|
@@ -19,9 +23,25 @@
|
|
static SIGNAME signals[] = {
|
|
#include "signames.h"
|
|
{ 0,NULL }};
|
|
-
|
|
+#endif
|
|
|
|
void list_signals(void)
|
|
+#ifdef HAVE_SYS_SIGNAME
|
|
+{
|
|
+ int i, col;
|
|
+
|
|
+ col = 0;
|
|
+ for (i = 1; i < NSIG; i++) {
|
|
+ if (col+strlen(sys_signame[i])+1 > 80) {
|
|
+ putchar('\n');
|
|
+ col = 0;
|
|
+ }
|
|
+ printf("%s%s",col ? " " : "",sys_signame[i]);
|
|
+ col += strlen(sys_signame[i])+1;
|
|
+ }
|
|
+ putchar('\n');
|
|
+}
|
|
+#else
|
|
{
|
|
SIGNAME *walk;
|
|
int col;
|
|
@@ -37,9 +57,22 @@
|
|
}
|
|
putchar('\n');
|
|
}
|
|
-
|
|
+#endif
|
|
|
|
int get_signal(char *name,const char *cmd)
|
|
+#ifdef HAVE_SYS_SIGNAME
|
|
+{
|
|
+ int i;
|
|
+
|
|
+ if (isdigit(*name))
|
|
+ return atoi(name);
|
|
+ for (i = 1; i < NSIG; i++)
|
|
+ if (!strcmp(sys_signame[i],name)) break;
|
|
+ if (i < NSIG) return i;
|
|
+ fprintf(stderr,"%s: unknown signal; %s -l lists signals.\n",name,cmd);
|
|
+ exit(1);
|
|
+}
|
|
+#else
|
|
{
|
|
SIGNAME *walk;
|
|
|
|
@@ -51,3 +84,4 @@
|
|
fprintf(stderr,"%s: unknown signal; %s -l lists signals.\n",name,cmd);
|
|
exit(1);
|
|
}
|
|
+#endif
|