From e4dd0c00e2d8c6ca37ceb78f4e3a8e86aaf96e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Tue, 6 May 2014 02:04:54 +0000 Subject: [PATCH] In gpbs, removed barely used, overly complex and almost certainly buggy logging code. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37842 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 ++++ Tools/gpbs.m | 67 +--------------------------------------------------- 2 files changed, 6 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36f8e85..189701d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-05-06 Ivan Vucica + + * Tools/gpbs.m: Removed barely used, overly complex and almost + certainly buggy logging code. + 2014-05-05 Ivan Vucica * ChangeLog: Corrected year for some recent commits. diff --git a/Tools/gpbs.m b/Tools/gpbs.m index c93f7bf..f631969 100644 --- a/Tools/gpbs.m +++ b/Tools/gpbs.m @@ -51,67 +51,9 @@ static BOOL is_daemon = NO; /* Currently running as daemon. */ static BOOL auto_stop = NO; /* Stop when all connections closed. */ -static char ebuf[2048]; static NSMutableArray *connections = nil; -#ifdef HAVE_SYSLOG - -static int log_priority = LOG_DEBUG; - -static void -gpbs_log (int prio) -{ - if (is_daemon) - { - syslog (log_priority | prio, ebuf); - } - else if (prio == LOG_INFO) - { - write (1, ebuf, strlen (ebuf)); - write (1, "\n", 1); - } - else - { - write (2, ebuf, strlen (ebuf)); - write (2, "\n", 1); - } - - if (prio == LOG_CRIT) - { - if (is_daemon) - { - syslog (LOG_CRIT, "exiting."); - } - else - { - fprintf (stderr, "exiting.\n"); - fflush (stderr); - } - exit(EXIT_FAILURE); - } -} -#else - -#define LOG_CRIT 2 -#define LOG_DEBUG 0 -#define LOG_ERR 1 -#define LOG_INFO 0 -#define LOG_WARNING 0 -void -gpbs_log (int prio) -{ - write (2, ebuf, strlen (ebuf)); - write (2, "\n", 1); - if (prio == LOG_CRIT) - { - fprintf (stderr, "exiting.\n"); - fflush (stderr); - exit(EXIT_FAILURE); - } -} -#endif - @class PasteboardServer; @class PasteboardObject; @@ -1114,7 +1056,6 @@ if (beenHere == YES) static void init(int argc, char** argv, char **env) { - NSUserDefaults *defs; NSProcessInfo *pInfo; NSMutableArray *args; unsigned count; @@ -1209,19 +1150,13 @@ init(int argc, char** argv, char **env) } NS_HANDLER { - gpbs_log(LOG_CRIT); + NSLog(@"An exception has ocurred."); DESTROY(t); } NS_ENDHANDLER exit(EXIT_FAILURE); } - /* - * Make gpbs logging go to syslog unless overridden by user. - */ - defs = [NSUserDefaults standardUserDefaults]; - [defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys: - @"YES", @"GSLogSyslog", nil]]; }