pkgsrc/sysutils/psmisc/patches/patch-ag
jlam c8a1f86f28 Update psmisc to 20.1. Changes from version 19:
- command line -<num> put back in.
 - got rid of annoying "sending signal #" debug message
 - updated killall.1
 - updated killall usage
 - verbose now tells you what signal it is killing with.
 - New maintainer
 - Uses automake/autoconf to determine things
 - License changed to GPL
 - signames.h generated better (suggested by Grant Erickson)
 - uses getopt() for better command line stuff
 - makes less assumptions about process name, closes Debian Bug #53337
 - Doesn't use losetup for loop devices in fuser.
 - Better selection of process name (thanks to David desJardins)
2001-04-24 16:59:34 +00:00

82 lines
1.4 KiB
Text

$NetBSD: patch-ag,v 1.1 2001/04/24 16:59:35 jlam Exp $
--- src/signals.c.orig Wed Dec 13 18:43:15 2000
+++ src/signals.c
@@ -7,9 +7,17 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <sys/param.h>
#include "signals.h"
+#if (defined(BSD) && BSD >= 199306)
+#define HAVE_SYS_SIGNAME
+#endif
+
+#ifdef HAVE_SYS_SIGNAME
+#include <signal.h>
+#else
typedef struct
{
int number;
@@ -22,11 +30,26 @@
#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;
@@ -42,12 +65,26 @@
col += strlen (walk->name) + 1;
}
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;
if (isdigit (*name))
@@ -59,4 +96,5 @@
return walk->number;
fprintf (stderr, "%s: unknown signal; %s -l lists signals.\n", name, cmd);
exit (1);
+#endif
}