char *opt, *next, *options;
unsigned int i;
+ fprintf(stdout, "Enabled debug channels: [%s]\n", str);
+
if (!(options = g_strdup(str))) {
return;
}
debug = getenv("DEBUGCH");
} else {
if ((tmp = (char *)malloc(1024 + 1)) == NULL){
+ fprintf(stderr, "failed to malloc()\n");
nb_debug_options = -1;
fclose(fp);
return;
nb_debug_options = -1;
return;
}
+ /*
+ * Announcement
+ * This code designed that calls fgets() only once.
+ * So if you want to use DEBUGCH file for debuging,
+ * you should make it to single line, comma separated, no blank space.
+ */
const char* str = fgets(tmp, 1024, fp);
if (str) {
- tmp[strlen(tmp) - 1] = 0;
+ if (tmp[strlen(tmp) - 1] == '\n') {
+ tmp[strlen(tmp) - 1] = '\0';
+ }
debug = tmp;
}
if (!g_strcmp0(debug, "help")) {
debug_usage();
}
+ fprintf(stdout, "DEBUGCH has enabled.\n");
parse_options(debug);
}