#ifndef VXWORKS_CFG
#include <stdio.h>

extern int errno;
extern int sys_nerr;
#ifdef LINUX_CFG
	     extern __const char *__const _sys_errlist[];
#else
	     extern char *sys_errlist[];
#endif

char *errorstr()
{
 char *msg;

 if (errno < sys_nerr)
  { msg = sys_errlist[errno];
  }
 else
  { static char buf[64];
    msg = buf;
    sprintf(msg,"Unknown error (%d)",errno);
  }
 return(msg);
}
#else
#include <vxWorks.h>
#include <symLib.h>

static char msgBuf[256];

char *errorstr()
{
	extern SYMTAB *statSymTbl;
	int error;
	int val;
	
	error = errnoGet();
	if (symFindByValue(statSymTbl, error, msgBuf, &val, NULL) == ERROR ||
	    val != error)
	 { sprintf (msgBuf, "Unknown error (0x%x)", error);
	 }
	return (msgBuf);
}
#endif
