Mercurial > ~dholland > hg > tradcpp > index.cgi
diff output.c @ 143:ed45f2d8d3bc
Don't use the <err.h> functions.
There are still people out there using legacy systems that are missing
them.
author | David A. Holland |
---|---|
date | Sat, 13 Jul 2013 12:47:20 -0400 (2013-07-13) |
parents | 1cda505ddc78 |
children | 16b4451e34b8 |
line wrap: on
line diff
--- a/output.c Sat Jul 13 12:38:54 2013 -0400 +++ b/output.c Sat Jul 13 12:47:20 2013 -0400 @@ -30,7 +30,7 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> -#include <err.h> +#include <errno.h> #include "utils.h" #include "mode.h" @@ -53,7 +53,8 @@ outputfd = open(mode.output_file, O_WRONLY|O_CREAT|O_TRUNC, 0664); if (outputfd < 0) { - warn("%s", mode.output_file); + complain(NULL, "%s: %s", + mode.output_file, strerror(errno)); die(); } } @@ -79,11 +80,13 @@ while (done < len) { result = write(outputfd, buf+done, len-done); if (result == -1) { - warn("%s: write", mode.output_file); + complain(NULL, "%s: write: %s", + mode.output_file, strerror(errno)); complain_failed(); write_errors++; if (write_errors > 5) { - warnx("%s: giving up", mode.output_file); + complain(NULL, "%s: giving up", + mode.output_file); die(); } /* XXX is this really a good idea? */