perror.c

Go to the documentation of this file.
00001 /*
00002  * perror.c - print an error message on the standard error output
00003  */
00004 /* $Header: /opt/proj/minix/cvsroot/src/lib/stdio/perror.c,v 1.1.1.1 2005/04/21 14:56:36 beng Exp $ */
00005 
00006 #if     defined(_POSIX_SOURCE)
00007 #include        <sys/types.h>
00008 #endif
00009 #include        <stdio.h>
00010 #include        <errno.h>
00011 #include        <stdio.h>
00012 #include        <string.h>
00013 #include        "loc_incl.h"
00014 
00015 ssize_t _write(int d, const char *buf, size_t nbytes);
00016 
00017 void
00018 perror(const char *s)
00019 {
00020         char *p;
00021         int fd;
00022 
00023         p = strerror(errno);
00024         fd = fileno(stderr);
00025         fflush(stdout);
00026         fflush(stderr);
00027         if (s && *s) {
00028                 _write(fd, s, strlen(s));
00029                 _write(fd, ": ", 2);
00030         }
00031         _write(fd, p, strlen(p));
00032         _write(fd, "\n", 1);
00033 }

Generated on Fri Apr 14 22:57:27 2006 for minix by  doxygen 1.4.6