@ -28,7 +28,7 @@
*/
*/
# if defined(LIBC_SCCS) && !defined(lint)
# if defined(LIBC_SCCS) && !defined(lint)
static char * rcsid = " $OpenBSD: __strsignal.c,v 1.9 2005/03/30 20:13:52 otto Exp $ " ;
static char * rcsid = " $OpenBSD: __strsignal.c,v 1.10 2005/05/01 19:39:02 tom Exp $ " ;
# endif /* LIBC_SCCS and not lint */
# endif /* LIBC_SCCS and not lint */
# ifdef NLS
# ifdef NLS
@ -45,17 +45,18 @@ static char *rcsid = "$OpenBSD: __strsignal.c,v 1.9 2005/03/30 20:13:52 otto Exp
# include <signal.h>
# include <signal.h>
# include <string.h>
# include <string.h>
static char * itoa ( int num )
static char *
itoa ( char * buffer , size_t buffer_size , unsigned int num )
{
{
static char buffer [ 11 ] ;
char * p ;
char * p = buffer + buffer_size ;
p = buffer + 4 ;
while ( num > = 10 ) {
* - - p = ' \0 ' ;
while ( num > = 10 & & p > buffer + 1 ) {
* - - p = ( num % 10 ) + ' 0 ' ;
* - - p = ( num % 10 ) + ' 0 ' ;
num / = 10 ;
num / = 10 ;
}
}
* p = ( num % 10 ) + ' 0 ' ;
/* num < 10 || p == buffer + 1 */
* - - p = ( num % 10 ) + ' 0 ' ;
return p ;
return p ;
}
}
@ -79,12 +80,15 @@ __strsignal(int num, char *buf)
return ( ( char * ) sys_siglist [ signum ] ) ;
return ( ( char * ) sys_siglist [ signum ] ) ;
# endif
# endif
} else {
} else {
# define MAXINTDIGS 11
char str [ MAXINTDIGS ] ;
# ifdef NLS
# ifdef NLS
strlcpy ( buf , catgets ( catd , 1 , 0xffff , UPREFIX ) , NL_TEXTMAX ) ;
strlcpy ( buf , catgets ( catd , 1 , 0xffff , UPREFIX ) , NL_TEXTMAX ) ;
# else
# else
strlcpy ( buf , UPREFIX , NL_TEXTMAX ) ;
strlcpy ( buf , UPREFIX , NL_TEXTMAX ) ;
# endif
# endif
strlcat ( buf , itoa ( signum ) , NL_TEXTMAX ) ;
strlcat ( buf , itoa ( str , sizeof ( str ) , s ignum ) , NL_TEXTMAX ) ;
}
}
# ifdef NLS
# ifdef NLS