Add special signal to the sigs table instead
This commit is contained in:
parent
3ffe690384
commit
63f9f1ac14
5
kill.c
5
kill.c
|
@ -15,6 +15,7 @@ struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
int sig;
|
int sig;
|
||||||
} sigs[] = {
|
} sigs[] = {
|
||||||
|
{ "0", 0 },
|
||||||
#define SIG(n) { #n, SIG##n }
|
#define SIG(n) { #n, SIG##n }
|
||||||
SIG(ABRT), SIG(ALRM), SIG(BUS), SIG(CHLD), SIG(CONT), SIG(FPE), SIG(HUP),
|
SIG(ABRT), SIG(ALRM), SIG(BUS), SIG(CHLD), SIG(CONT), SIG(FPE), SIG(HUP),
|
||||||
SIG(ILL), SIG(INT), SIG(KILL), SIG(PIPE), SIG(QUIT), SIG(SEGV), SIG(STOP),
|
SIG(ILL), SIG(INT), SIG(KILL), SIG(PIPE), SIG(QUIT), SIG(SEGV), SIG(STOP),
|
||||||
|
@ -115,8 +116,6 @@ sig2name(int sig)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (sig == 0)
|
|
||||||
return "0";
|
|
||||||
for (i = 0; i < LEN(sigs); i++)
|
for (i = 0; i < LEN(sigs); i++)
|
||||||
if (sigs[i].sig == sig)
|
if (sigs[i].sig == sig)
|
||||||
return sigs[i].name;
|
return sigs[i].name;
|
||||||
|
@ -130,8 +129,6 @@ name2sig(const char *name)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (strcmp(name, "0") == 0)
|
|
||||||
return 0;
|
|
||||||
for (i = 0; i < LEN(sigs); i++)
|
for (i = 0; i < LEN(sigs); i++)
|
||||||
if (strcasecmp(sigs[i].name, name) == 0)
|
if (strcasecmp(sigs[i].name, name) == 0)
|
||||||
return sigs[i].sig;
|
return sigs[i].sig;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user