From a1189fb0b348525d553d4c216f76c362747f3e35 Mon Sep 17 00:00:00 2001 From: arjen Date: Tue, 31 May 2005 05:47:33 +0000 Subject: [PATCH] Configuration file in /etc, status files in /var/lib --- src/gcm_input/logrunner.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/gcm_input/logrunner.cpp b/src/gcm_input/logrunner.cpp index 4968579..f4d0ecd 100644 --- a/src/gcm_input/logrunner.cpp +++ b/src/gcm_input/logrunner.cpp @@ -2,7 +2,7 @@ * logrunner.c * (c) Peter Roozemaal, feb 2003 * - * $Id: logrunner.cpp,v 1.1 2003-08-11 16:56:16 arjen Exp $ + * $Id: logrunner.cpp,v 1.2 2005-05-31 05:47:33 arjen Exp $ * * 1) compile, * 2) create 'logrunner.conf' containing a list of filenames and types of the @@ -49,9 +49,9 @@ struct fileinfo { off_t position; }; -static const char* confname = "logrunner.conf"; -static const char* statusname = "logrunner.status"; -static const char* newstatusname = "logrunner.status.new"; +String confname = "/etc/logrunner.conf"; +static const char* statusname = "/var/lib/logrunner.status"; +static const char* newstatusname = "/var/lib/logrunner.status.new"; static const char *hostname = NULL; static int port = 2996; /* random magic number */ @@ -143,15 +143,12 @@ void xml_footer(void) void output(const char* str) { - write(2, str, strlen(str)); + std::cerr << str; } void output_error(const char* str) { - char error[80]; - sprintf(error, " errno=%d\n", errno); - output(str); - output(error); + std::cerr << str << " errno=" << errno << "\n"; } void write_status_file(struct fileinfo* fl) @@ -263,9 +260,7 @@ void read_config() conffile = fopen(confname, "r"); if ( !conffile ) { - fprintf(stderr, - "logrunner: can\'t open configuration file \'%s\': ", - confname); + std::cerr << "logrunner: can\'t open configuration file \'" << confname << "\': "; perror(""); exit(2); } -- 2.11.0