dovecot-2.0: rawlog: Use the lib-master API calls.

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 23 22:38:34 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/d4effbfae49c
changeset: 12883:d4effbfae49c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 23 22:38:24 2011 +0300
description:
rawlog: Use the lib-master API calls.

diffstat:

 src/util/rawlog.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (53 lines):

diff -r 030394c74f54 -r d4effbfae49c src/util/rawlog.c
--- a/src/util/rawlog.c	Tue Aug 23 22:14:38 2011 +0300
+++ b/src/util/rawlog.c	Tue Aug 23 22:38:24 2011 +0300
@@ -11,6 +11,7 @@
 #include "ostream.h"
 #include "process-title.h"
 #include "restrict-access.h"
+#include "master-service.h"
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -361,16 +362,13 @@
 int main(int argc, char *argv[])
 {
 	char *executable, *p;
-	enum rawlog_flags flags;
+	enum rawlog_flags flags =
+		RAWLOG_FLAG_LOG_INPUT | RAWLOG_FLAG_LOG_OUTPUT;
 	int c;
 
-	flags = RAWLOG_FLAG_LOG_INPUT | RAWLOG_FLAG_LOG_OUTPUT;
-
-	lib_init();
-	i_set_failure_internal();
-	process_title_init(&argv);
-
-	while ((c = getopt(argc, argv, "+iobt")) > 0) {
+	master_service = master_service_init("rawlog", 0,
+					     &argc, &argv, "+iobt");
+	while ((c = master_getopt(master_service)) > 0) {
 		switch (c) {
 		case 'i':
 			flags &= ~RAWLOG_FLAG_LOG_OUTPUT;
@@ -385,8 +383,7 @@
 			flags |= RAWLOG_FLAG_LOG_TIMESTAMPS;
 			break;
 		default:
-			argc = 0;
-			break;
+			return FATAL_DEFAULT;
 		}
 	}
 	argc -= optind;
@@ -395,6 +392,9 @@
 	if (argc < 1)
 		i_fatal("Usage: rawlog [-i | -o] [-b] [-t] <binary> <arguments>");
 
+	master_service_init_log(master_service, "rawlog: ");
+	master_service_init_finish(master_service);
+
 	executable = argv[0];
 	rawlog_open(flags);
 


More information about the dovecot-cvs mailing list