[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Signal names
From: |
David Masterson |
Subject: |
Re: Signal names |
Date: |
23 Apr 2002 08:44:04 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
>>>>> Tim Auckland writes:
> signal.h does not give you the strings for the signal names, just the
> #defines for the numbers. You have to put in a bit more work to get the
> string-to-number mapping, but it's still do-able.
> Something like:
> #include <signal.h>
> #ifdef SIGHUP
> signame[SIGHUP] = "hup";
> #endif
> ..
> although there's probably a neater way.
How about:
#define STRINGIT(x) #x
#ifdef SIGHUP
signame[SIGHUP] = STRINGIT(SIGHUP);
#endif
You might also be able to create a psuedo-array with the token pasting
operator as in:
#define SIG1 HUP
#define SIG2 INT
#define SIG3 QUIT
...
#define SIG(x) SIG ## x
signame[1] = STRINGIT(SIG(1));
Play with that to see if it works.
> Cfengine also uses an enum somewhere in the signal name mapping code,
> which would have to be dealt with similarly.
You might have to replace the enum with the list of #defines.
--
David Masterson David DOT Masterson AT synopsys DOT com
Sr. R&D Engineer Synopsys, Inc.
Software Engineering Sunnyvale, CA
- Re: Signal names with autoconf?, (continued)
- Re: Signal names with autoconf?, Michael Beattie, 2002/04/23
- Re: Signal names with autoconf?, Mark . Burgess, 2002/04/23
- Re: Signal names with autoconf?, Ted Zlatanov, 2002/04/23
- Re: Signal names with autoconf?, David Masterson, 2002/04/23
- Re: Signal names with autoconf?, Darrell Fuhriman, 2002/04/23
- Re: Signal names with autoconf?, David Masterson, 2002/04/23
- Re: Signal names with autoconf?, Tim Auckland, 2002/04/23
- Re: Signal names with autoconf?, Michael Beattie, 2002/04/23
- Re: Signal names with autoconf?, Nicolas Chuche, 2002/04/23
- Re: Signal names with autoconf?, David Masterson, 2002/04/23
- Re: Signal names,
David Masterson <=