strerror.c 610 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Part of Scheme 48 1.9. See file COPYING for notices and license.
  3. *
  4. * Authors: Richard Kelsey, Jonathan Rees
  5. */
  6. /*
  7. * If the system doesn't have a strerror procedure, we provide our own.
  8. * Note, this depends on sys_nerr and sys_errlist being provided.
  9. * If your system doesn't provide that either, you can replace this
  10. * procedure with one that always returns "Unknown error".
  11. */
  12. #include "sysdep.h"
  13. extern int sys_nerr;
  14. extern char *sys_errlist[];
  15. char *
  16. strerror(int errnum)
  17. {
  18. if ((0 <= errnum)
  19. && (errnum < sys_nerr))
  20. return (sys_errlist[errnum]);
  21. else
  22. return ("Unknown error");
  23. }