X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrsignal.c;h=12cd881fa3ecfc8d8a0035122d22ef5b4170f389;hb=v0.0-8062-g6b24f60;hp=a7adaba956037635326ee4c383619ce51fc820b7;hpb=fcf43c8d327b5608a7fc5baa9729848e5147b87b;p=gnulib.git diff --git a/lib/strsignal.c b/lib/strsignal.c index a7adaba95..12cd881fa 100644 --- a/lib/strsignal.c +++ b/lib/strsignal.c @@ -1,29 +1,30 @@ -/* Copyright (C) 1991, 1994-2002, 2005, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, + Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef _LIBC # include #endif +/* Specification. */ +#include + #include #include #include -#include #ifdef _LIBC # include @@ -55,7 +56,9 @@ extern const char *const _sys_siglist_internal[] attribute_hidden; #else /* !_LIBC */ /* NetBSD declares sys_siglist in unistd.h. */ -# include +# if HAVE_UNISTD_H +# include +# endif # define INTUSE(x) (x) @@ -77,7 +80,7 @@ static __libc_key_t key; /* If nonzero the key allocation failed and we should better use a static buffer than fail. */ -#define BUFFERSIZ 100 +#define BUFFERSIZ 100 static char local_buf[BUFFERSIZ]; static char *static_buf; @@ -108,16 +111,16 @@ strsignal (int signum) int len; #ifdef SIGRTMIN if (signum >= SIGRTMIN && signum <= SIGRTMAX) - len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), - signum - SIGRTMIN); + len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), + signum - (int) SIGRTMIN); else #endif - len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), - signum); + len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), + signum); if (len >= BUFFERSIZ) - buffer = NULL; + buffer = NULL; else - buffer[len] = '\0'; + buffer[len] = '\0'; return buffer; } @@ -179,18 +182,18 @@ getbuffer (void) else { /* We don't use the static buffer and so we have a key. Use it - to get the thread-specific buffer. */ + to get the thread-specific buffer. */ result = __libc_getspecific (key); if (result == NULL) - { - /* No buffer allocated so far. */ - result = malloc (BUFFERSIZ); - if (result == NULL) - /* No more memory available. We use the static buffer. */ - result = local_buf; - else - __libc_setspecific (key, result); - } + { + /* No buffer allocated so far. */ + result = malloc (BUFFERSIZ); + if (result == NULL) + /* No more memory available. We use the static buffer. */ + result = local_buf; + else + __libc_setspecific (key, result); + } } return result;