syslog_daemon: Style cleanups, no functional change.

This commit is contained in:
Axel Dörfler
2015-07-22 20:39:57 +02:00
parent 035e3e77ed
commit e489a80da0
4 changed files with 69 additions and 59 deletions
+19 -13
View File
@@ -1,12 +1,13 @@
/* /*
* Copyright 2003-2006, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2015, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include "SyslogDaemon.h" #include "SyslogDaemon.h"
#include "listener_output.h"
#include "syslog_output.h" #include <stdio.h>
#include <string.h>
#include <Alert.h> #include <Alert.h>
#include <Catalog.h> #include <Catalog.h>
@@ -15,17 +16,20 @@
#include <Path.h> #include <Path.h>
#include <TextView.h> #include <TextView.h>
#include <stdio.h> #include "listener_output.h"
#include <string.h> #include "syslog_output.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "SyslogDaemon" #define B_TRANSLATION_CONTEXT "SyslogDaemon"
const char* kSignature = "application/x-vnd.Haiku-SystemLogger"; const char* kSignature = "application/x-vnd.Haiku-SystemLogger";
SyslogDaemon::SyslogDaemon() SyslogDaemon::SyslogDaemon()
: BApplication(kSignature), :
BApplication(kSignature),
fHandlerLock("handler lock") fHandlerLock("handler lock")
{ {
} }
@@ -62,7 +66,8 @@ SyslogDaemon::AboutRequested()
"at \"%s\".\n\n"), name.String(), path.Path()); "at \"%s\".\n\n"), name.String(), path.Path());
message.UnlockBuffer(); message.UnlockBuffer();
BAlert *alert = new BAlert(name.String(), message.String(), B_TRANSLATE("OK")); BAlert* alert = new BAlert(name.String(), message.String(),
B_TRANSLATE("OK"));
BTextView* view = alert->TextView(); BTextView* view = alert->TextView();
BFont font; BFont font;
@@ -91,26 +96,26 @@ SyslogDaemon::QuitRequested()
void void
SyslogDaemon::MessageReceived(BMessage *msg) SyslogDaemon::MessageReceived(BMessage* message)
{ {
switch (msg->what) { switch (message->what) {
case SYSLOG_ADD_LISTENER: case SYSLOG_ADD_LISTENER:
{ {
BMessenger messenger; BMessenger messenger;
if (msg->FindMessenger("target", &messenger) == B_OK) if (message->FindMessenger("target", &messenger) == B_OK)
add_listener(&messenger); add_listener(&messenger);
break; break;
} }
case SYSLOG_REMOVE_LISTENER: case SYSLOG_REMOVE_LISTENER:
{ {
BMessenger messenger; BMessenger messenger;
if (msg->FindMessenger("target", &messenger) == B_OK) if (message->FindMessenger("target", &messenger) == B_OK)
remove_listener(&messenger); remove_listener(&messenger);
break; break;
} }
default: default:
BApplication::MessageReceived(msg); BApplication::MessageReceived(message);
} }
} }
@@ -137,7 +142,8 @@ SyslogDaemon::Daemon()
} }
// if we don't get what we want, ignore it // if we don't get what we want, ignore it
if (bytesRead < (ssize_t)sizeof(syslog_message) || code != SYSLOG_MESSAGE) if (bytesRead < (ssize_t)sizeof(syslog_message)
|| code != SYSLOG_MESSAGE)
continue; continue;
// add terminating null byte // add terminating null byte
+4 -3
View File
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2015, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _SYSLOG_DAEMON_H_ #ifndef _SYSLOG_DAEMON_H_
#define _SYSLOG_DAEMON_H_ #define _SYSLOG_DAEMON_H_
@@ -24,7 +24,7 @@ class SyslogDaemon : public BApplication {
virtual void ReadyToRun(); virtual void ReadyToRun();
virtual void AboutRequested(); virtual void AboutRequested();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *msg); virtual void MessageReceived(BMessage* message);
void AddHandler(handler_func function); void AddHandler(handler_func function);
@@ -39,4 +39,5 @@ class SyslogDaemon : public BApplication {
BList fHandlers; BList fHandlers;
}; };
#endif /* _SYSLOG_DAEMON_H_ */ #endif /* _SYSLOG_DAEMON_H_ */
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2015, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
+6 -3
View File
@@ -1,11 +1,13 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2015, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _LISTENER_OUTPUT_H_ #ifndef _LISTENER_OUTPUT_H_
#define _LISTENER_OUTPUT_H_ #define _LISTENER_OUTPUT_H_
#include <Messenger.h> #include <Messenger.h>
#include "SyslogDaemon.h" #include "SyslogDaemon.h"
@@ -13,4 +15,5 @@ void init_listener_output(SyslogDaemon *daemon);
void add_listener(BMessenger* messenger); void add_listener(BMessenger* messenger);
void remove_listener(BMessenger* messenger); void remove_listener(BMessenger* messenger);
#endif /* _SYSLOG_OUTPUT_H_ */
#endif /* _LISTENER_OUTPUT_H_ */