diff options
Diffstat (limited to 'regress/modpipe.c')
-rwxr-xr-x | regress/modpipe.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/regress/modpipe.c b/regress/modpipe.c index 439be4c9d..b05915b63 100755 --- a/regress/modpipe.c +++ b/regress/modpipe.c | |||
@@ -14,16 +14,44 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* $Id: modpipe.c,v 1.1 2012/12/11 23:54:40 djm Exp $ */ | 17 | /* $Id: modpipe.c,v 1.2 2013/02/19 02:15:08 djm Exp $ */ |
18 | 18 | ||
19 | #include <sys/types.h> | 19 | #include <sys/types.h> |
20 | #include <unistd.h> | 20 | #include <unistd.h> |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <stdarg.h> | ||
23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
24 | #include <err.h> | ||
25 | #include <errno.h> | 25 | #include <errno.h> |
26 | 26 | ||
27 | static void err(int, const char *, ...) __attribute__((format(printf, 2, 3))); | ||
28 | static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3))); | ||
29 | |||
30 | static void | ||
31 | err(int r, const char *fmt, ...) | ||
32 | { | ||
33 | va_list args; | ||
34 | |||
35 | va_start(args, fmt); | ||
36 | fprintf(stderr, "%s: ", strerror(errno)); | ||
37 | vfprintf(stderr, fmt, args); | ||
38 | fputc('\n', stderr); | ||
39 | va_end(args); | ||
40 | exit(r); | ||
41 | } | ||
42 | |||
43 | static void | ||
44 | errx(int r, const char *fmt, ...) | ||
45 | { | ||
46 | va_list args; | ||
47 | |||
48 | va_start(args, fmt); | ||
49 | vfprintf(stderr, fmt, args); | ||
50 | fputc('\n', stderr); | ||
51 | va_end(args); | ||
52 | exit(r); | ||
53 | } | ||
54 | |||
27 | static void | 55 | static void |
28 | usage(void) | 56 | usage(void) |
29 | { | 57 | { |