summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/debug.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/server/src/debug.cc b/server/src/debug.cc
index 9c2f268..6207a1e 100644
--- a/server/src/debug.cc
+++ b/server/src/debug.cc
@@ -1,3 +1,20 @@
+/*
+ * This file is part of Pracro.
+ *
+ * Pracro is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Pracro is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Pracro; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
#include <config.h>
@@ -25,7 +42,7 @@ static int __pracro_debug_enabled(const enum __pracro_debug_class cl, const char
unsigned i;
for(i = 0; i < n_debug_channel; i++) {
if(!strcmp(ch, debug_channel[i].name)) {
- return debug_channel[i].flags & (1 << cl);
+ return (debug_channel[i].flags & (1 << cl)) != 0;
}
}
return debug_flags & (1 << cl);
@@ -125,7 +142,7 @@ void pracro_debug_parse(const char *fmt)
int set = 0;
int clr = 0;
unsigned i;
- if((next = strchr(s, ','))) *next++ = '\0';
+ if((next = strchr(opt, ','))) *next++ = '\0';
char *p = opt + strcspn(opt, "+-");
if(!*p) p = opt; /* All chars -> a channel name */
if(p > opt) {
@@ -161,7 +178,7 @@ void pracro_debug_parse(const char *fmt)
break;
}
}
- if(i == n_debug_channel) {
+ if(i == n_debug_channel && n_debug_channel < __PRACRO_DEBUG_CHANNEL_MAX) {
strcpy(debug_channel[i].name, p);
debug_channel[i].flags = (debug_flags & ~clr) | set;
n_debug_channel++;