home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / math / pac / ierror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  907 b   |  37 lines

  1. /* ierror.c */
  2. /**********************************************************************
  3. *    Function      : perror, writes into global string buffer "ierbuf"
  4. *    Author        : Istvan Mohos, 1987
  5. ***********************************************************************/
  6.  
  7. #include <stdio.h>
  8. extern int errno, sys_nerr;
  9. extern char *sys_errlist[];
  10. extern char ierbuf[];
  11.  
  12. ierror(ustr, badnum)
  13. char *ustr;
  14. int badnum;
  15. {
  16.     register char *cp = NULL;
  17.  
  18.     if (errno > 0 && errno < sys_nerr) {
  19.         badnum = errno;
  20.         cp = sys_errlist[errno];
  21.     }
  22.  
  23.     if (ustr != (char *)NULL)
  24.         if (cp != (char *)NULL)
  25.             sprintf(ierbuf, "%s: %s", cp, ustr);
  26.         else
  27.             strcpy(ierbuf, ustr);
  28.     else
  29.         if (cp != (char *)NULL)
  30.             sprintf(ierbuf, "%s:", cp);
  31.         else
  32.             *ierbuf = '\0';
  33.  
  34.     errno = 0;
  35.     return(badnum);
  36. }
  37.