1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
$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
|