Am trying to build xinetd on my solaris system am using sun workshop c++/c to compile the code but I keep getting the following errors
error: `sys_nerr` underclared (first use in this function)
error: (each undeclared identifier is reported only once
error: for each function is appears in.)
error: `sys_errlist undeclared (first use in this function)
here the full code.
#ifndef lint
static const char rcsid[] =
"$FreeBSD: src/lib/libc/string/strerror.c,v 1.3 2001/05/24 08:47:41 obrien Exp $";
#endif
#include <stdio.h>
#include <string.h>
char *strerror(num) int num;
{
#define UPREFIX "Unknown error: "
static char ebuf[40] = UPREFIX; /* 64-bit number + slop */
register unsigned int errnum;
register char *p, *t;
char tmp[40];
errnum = num; /* convert to unsigned */
if (errnum < sys_nerr)
return ((char *)sys_errlist[errnum]);
/* Do this by hand, so we don't link to stdio(3). */
t = tmp;
if (num < 0)
errnum = -errnum;
do {
*t++ = "0123456789"[errnum % 10];
} while (errnum /= 10);
if (num < 0)
*t++ = '-';
for (p = ebuf + sizeof(UPREFIX) - 1;;) {
*p++ = *--t;
if (t <= tmp)
break;
}
*p = '\0';
return (ebuf);
}
#endif /* HAVE_STRERROR */
Thanks alot :)