1: /*
   2:  * Print the error indicated
   3:  * in the cerror cell.
   4:  */
   5: 
   6: int errno;
   7: int sys_nerr;
   8: char    *sys_errlist[];
   9: perror(s)
  10: char *s;
  11: {
  12:     register char *c;
  13:     register n;
  14: 
  15:     c = "Unknown error";
  16:     if(errno < sys_nerr)
  17:         c = sys_errlist[errno];
  18:     n = strlen(s);
  19:     if(n) {
  20:         write(2, s, n);
  21:         write(2, ": ", 2);
  22:     }
  23:     write(2, c, strlen(c));
  24:     write(2, "\n", 1);
  25: }
  26: 
  27: /*
  28:  * Return the number of bytes in a string
  29:  */
  30: 
  31: strlen(str)
  32: char *str;
  33: {
  34:     register char *s;
  35: 
  36:     s = str;
  37:     while(*s++)
  38:         ;
  39:     return(s-str-1);
  40: }

Defined functions

strlen defined in line 31; used 2 times

Defined variables

errno defined in line 6; used 2 times
sys_errlist defined in line 8; used 1 times
  • in line 17
sys_nerr defined in line 7; used 1 times
  • in line 16
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 699
Valid CSS Valid XHTML 1.0 Strict