1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(LIBC_SCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)perror.c	5.2 (Berkeley) 3/9/86";
   9: #endif LIBC_SCCS and not lint
  10: 
  11: /*
  12:  * Print the error indicated
  13:  * in the cerror cell.
  14:  */
  15: #include <sys/types.h>
  16: #include <sys/uio.h>
  17: 
  18: int errno;
  19: int sys_nerr;
  20: char    *sys_errlist[];
  21: perror(s)
  22:     char *s;
  23: {
  24:     struct iovec iov[4];
  25:     register struct iovec *v = iov;
  26: 
  27:     if (s && *s) {
  28:         v->iov_base = s;
  29:         v->iov_len = strlen(s);
  30:         v++;
  31:         v->iov_base = ": ";
  32:         v->iov_len = 2;
  33:         v++;
  34:     }
  35:     v->iov_base = errno < sys_nerr ? sys_errlist[errno] : "Unknown error";
  36:     v->iov_len = strlen(v->iov_base);
  37:     v++;
  38:     v->iov_base = "\n";
  39:     v->iov_len = 1;
  40:     writev(2, iov, (v - iov) + 1);
  41: }

Defined functions

perror defined in line 21; used 1368 times

Defined variables

errno defined in line 18; used 590 times
sccsid defined in line 8; never used
sys_errlist defined in line 20; used 109 times
Last modified: 1986-03-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1516
Valid CSS Valid XHTML 1.0 Strict