This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strsignal.c implementation


On 05/11/2010 12:24 PM, Joel Sherrill wrote:
On 05/11/2010 10:49 AM, Jeff Johnston wrote:
On 05/11/2010 09:26 AM, Joel Sherrill wrote:
Hi,

I have implemented strsignal.c for RTEMS but
wondered if it was worth trying to make the
implementation match the ifdef's in sys/signal.h
and support other targets?

I have attached the current implementation. I
see two approaches to making it support all
the targets:

+ ifdefs in the table to match the numbers in
sys/signal.h.
+ a long series of code something like this:
#ifdef SIGXXX
if ( signal == SIGXXX )
return "string for SIGXXX";
#endif

Any thoughts or comments?

Yes, IMO it is worth it to make it a shared implementation. Option 2 is
what is used in libc/string/strerror.c for the errno strings.

How about the attached version? I went through the list of
signals and added everyone in sys/signal.h. When the values
could be the same, I added a little extra conditional magic
to see if both were defined and the same to avoid
duplicate case errors.


Looks good. Any chance you could add some documentation to it to save me the trouble? It does not have to be as detailed as strerror.c.


Thanks,

-- Jeff J.


2010-05-11 Joel Sherrill <joel.sherrill@oarcorp.com>


* libc/string/strsignal.c: New file.

-- Jeff J.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]