home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / gnu / emacs-19.28-src.lha / emacs-19.28 / unixlib / src / perror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-03  |  531 b   |  27 lines

  1. #include "amiga.h"
  2. #include <errno.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5.  
  6. void perror(const char *s)
  7. {
  8.   char *err;
  9.   char amiga_err[81];
  10.  
  11.   if (s && *s) 
  12.     {
  13.       write(2, s, strlen(s));
  14.       write(2, ": ", 2);
  15.     }
  16.   if (errno > 0 && errno <= sys_nerr) err = sys_errlist[errno];
  17.   else if (errno == -1) 
  18.     {
  19.       if (Fault(_OSERR, NULL, amiga_err, 81)) err = amiga_err;
  20.       else err = "42";        /* Shouldn't appear ... */
  21.     }
  22.   else err = "Unknown error code";
  23.  
  24.   write(2, err, strlen(err));
  25.   write(2, "\n", 1);
  26. }
  27.