perror.c 320 B

12345678910111213141516171819
  1. /*
  2. * perror.c - print an error message on the standard error output
  3. */
  4. /* $Id$ */
  5. #include <errno.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8. void
  9. perror(const char *s)
  10. {
  11. if (s && *s) {
  12. (void) fputs(s, stderr);
  13. (void) fputs(": ", stderr);
  14. }
  15. (void) fputs(strerror(errno), stderr);
  16. (void) fputs("\n", stderr);
  17. }