r17090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17089‎ | r17090 | r17091 >
Date:18:03, 18 October 2006
Author:river
Status:old
Tags:
Comment:
fix wlogwriter build
Modified paths:
  • /trunk/willow/src/wlogwriter/Makefile.in (modified) (history)
  • /trunk/willow/src/wlogwriter/wlogwriter.c (deleted) (history)
  • /trunk/willow/src/wlogwriter/wlogwriter.cc (added) (history)
  • /trunk/willow/src/wlogwriter/wlogwriter.cc (added) (history)

Diff [purge]

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 @@
22 PROGRAM = wlogwriter
33
4 -SRCS = wlogwriter.c
5 -BINDIR=@libexecdir@
 4+SRCS = wlogwriter.cc
 5+OBJS = wlogwriter.o
 6+BINDIR = @libexecdir@
 7+CPPFLAGS = -I../include
68
7 -EXTRA_DIST=Makefile.in
 9+EXTRA_DIST = Makefile.in
810
 11+default: all
 12+
913 @include@ @q@@top_srcdir@/mk/prog.mk@q@