Browse Source

Print diagnostic and debug messages to stderr

git-svn-id: https://klish.googlecode.com/svn/trunk@129 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
d73ac6dd8f
1 changed files with 8 additions and 6 deletions
  1. 8 6
      bin/konfd.c

+ 8 - 6
bin/konfd.c

@@ -200,10 +200,12 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 		konf_query_free(query);
 		return NULL;
 	}
-	printf("----------------------\n");
-	printf("REQUEST: %s\n", str);
+#ifdef DEBUG
+	fprintf(stderr, "----------------------\n");
+	fprintf(stderr, "REQUEST: %s\n", str);
 /*	konf_query_dump(query);
 */
+#endif
 
 	/* Go through the pwd */
 	iconf = conf;
@@ -217,7 +219,7 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 	}
 
 	if (!iconf) {
-		printf("Unknown path\n");
+		fprintf(stderr, "Unknown path\n");
 		konf_query_free(query);
 		return NULL;
 	}
@@ -259,7 +261,7 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 
 #ifdef DEBUG
 	/* Print whole tree */
-	konf_tree_fprintf(conf, stdout, NULL, -1, 0);
+	konf_tree_fprintf(conf, stderr, NULL, -1, 0);
 #endif
 
 	/* Free resources */
@@ -310,7 +312,7 @@ static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query)
 	if (!filename) {
 		fprintf(fd, "-t\n");
 #ifdef DEBUG
-		printf("ANSWER: -t\n");
+		fprintf(stderr, "ANSWER: -t\n");
 #endif
 	}
 	konf_tree_fprintf(conf, fd, konf_query__get_pattern(query),
@@ -318,7 +320,7 @@ static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query)
 	if (!filename) {
 		fprintf(fd, "\n");
 #ifdef DEBUG
-		printf("SEND DATA: \n");
+		fprintf(stderr, "SEND DATA: \n");
 #endif
 	}