Index: trunk/willow/src/wlogwriter/wlogwriter.c |
— | — | @@ -1,58 +0,0 @@ |
2 | | -/* @(#) $Header$ */ |
3 | | -/* This source code is in the public domain. */ |
4 | | -/* |
5 | | - * Willow: Lightweight HTTP reverse-proxy. |
6 | | - * wlogwriter: child process for log writing. |
7 | | - */ |
8 | | - |
9 | | -#if defined __SUNPRO_C || defined __DECC || defined __HP_cc |
10 | | -# pragma ident "@(#)$Header$" |
11 | | -#endif |
12 | | - |
13 | | -#include <stdio.h> |
14 | | -#include <unistd.h> |
15 | | -#include <errno.h> |
16 | | -#include <string.h> |
17 | | -#include <stdlib.h> |
18 | | -#include <signal.h> |
19 | | - |
20 | | -#include "config.h" |
21 | | - |
22 | | -int |
23 | | -main(argc, argv) |
24 | | - int argc; |
25 | | - char **argv; |
26 | | -{ |
27 | | - FILE *outf; |
28 | | - char *line; |
29 | | - size_t lnsz; |
30 | | - |
31 | | - lnsz = 8192; |
32 | | - line = malloc(lnsz); |
33 | | - |
34 | | - (void)signal(SIGPIPE, SIG_IGN); |
35 | | - |
36 | | - if (argc < 2) { |
37 | | - (void)fprintf(stderr, "not enough arguments\n"); |
38 | | - exit(8); |
39 | | - } |
40 | | - |
41 | | -#ifdef HAVE_SETPROCTITLE |
42 | | - setproctitle("log writer: %s", argv[1]); |
43 | | -#endif |
44 | | - |
45 | | - /*LINTED unsafe fopen*/ |
46 | | - if ((outf = fopen(argv[1], "a")) == NULL) { |
47 | | - perror(argv[1]); |
48 | | - exit(8); |
49 | | - } |
50 | | - |
51 | | - while (fgets(line, lnsz, stdin)) { |
52 | | - if (fputs(line, outf) == EOF || fflush(outf) == EOF) { |
53 | | - exit(8); |
54 | | - } |
55 | | - } |
56 | | - |
57 | | - exit(0); |
58 | | - /*NOTREACHED*/ |
59 | | -} |
Index: trunk/willow/src/wlogwriter/wlogwriter.cc |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +/* @(#) $Header$ */ |
| 3 | +/* This source code is in the public domain. */ |
| 4 | +/* |
| 5 | + * Willow: Lightweight HTTP reverse-proxy. |
| 6 | + * wlogwriter: child process for log writing. |
| 7 | + */ |
| 8 | + |
| 9 | +#if defined __SUNPRO_C || defined __DECC || defined __HP_cc |
| 10 | +# pragma ident "@(#)$Header$" |
| 11 | +#endif |
| 12 | + |
| 13 | +#include <stdio.h> |
| 14 | +#include <unistd.h> |
| 15 | +#include <errno.h> |
| 16 | +#include <string.h> |
| 17 | +#include <stdlib.h> |
| 18 | +#include <signal.h> |
| 19 | + |
| 20 | +#include "config.h" |
| 21 | + |
| 22 | +int |
| 23 | +main(int argc, char **argv) |
| 24 | +{ |
| 25 | + FILE *outf; |
| 26 | + char *line; |
| 27 | + size_t lnsz; |
| 28 | + |
| 29 | + lnsz = 8192; |
| 30 | + line = new char[lnsz]; |
| 31 | + |
| 32 | + (void)signal(SIGPIPE, SIG_IGN); |
| 33 | + |
| 34 | + if (argc < 2) { |
| 35 | + (void)fprintf(stderr, "not enough arguments\n"); |
| 36 | + exit(8); |
| 37 | + } |
| 38 | + |
| 39 | +#ifdef HAVE_SETPROCTITLE |
| 40 | + setproctitle("log writer: %s", argv[1]); |
| 41 | +#endif |
| 42 | + |
| 43 | + /*LINTED unsafe fopen*/ |
| 44 | + if ((outf = fopen(argv[1], "a")) == NULL) { |
| 45 | + perror(argv[1]); |
| 46 | + exit(8); |
| 47 | + } |
| 48 | + |
| 49 | + while (fgets(line, lnsz, stdin)) { |
| 50 | + if (fputs(line, outf) == EOF || fflush(outf) == EOF) { |
| 51 | + exit(8); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + exit(0); |
| 56 | + /*NOTREACHED*/ |
| 57 | +} |
Index: trunk/willow/src/wlogwriter/Makefile.in |
— | — | @@ -1,8 +1,12 @@ |
2 | 2 | PROGRAM = wlogwriter |
3 | 3 | |
4 | | -SRCS = wlogwriter.c |
5 | | -BINDIR=@libexecdir@ |
| 4 | +SRCS = wlogwriter.cc |
| 5 | +OBJS = wlogwriter.o |
| 6 | +BINDIR = @libexecdir@ |
| 7 | +CPPFLAGS = -I../include |
6 | 8 | |
7 | | -EXTRA_DIST=Makefile.in |
| 9 | +EXTRA_DIST = Makefile.in |
8 | 10 | |
| 11 | +default: all |
| 12 | + |
9 | 13 | @include@ @q@@top_srcdir@/mk/prog.mk@q@ |