comparison src/debug.c @ 260:156cf548c764

adding more debug code
author Carl Byington <carl@five-ten-sg.com>
date Sun, 17 Apr 2011 14:07:25 -0700
parents 2f38c4ce606f
children cc8ee701f190
comparison
equal deleted inserted replaced
259:78e95fab9a8b 260:156cf548c764
37 37
38 void pst_debug_init(const char* fname, void* output_mutex) { 38 void pst_debug_init(const char* fname, void* output_mutex) {
39 #ifdef HAVE_SEMAPHORE_H 39 #ifdef HAVE_SEMAPHORE_H
40 debug_mutex = (sem_t*)output_mutex; 40 debug_mutex = (sem_t*)output_mutex;
41 #endif 41 #endif
42 memset(indent, ' ', MAX_DEPTH); 42 memset(indent, ' ', MAX_DEPTH*4);
43 indent[MAX_DEPTH] = '\0'; 43 indent[MAX_DEPTH*4] = '\0';
44 if (debug_fp) pst_debug_close(); 44 if (debug_fp) pst_debug_close();
45 if (!fname) return; 45 if (!fname) return;
46 if ((debug_fp = fopen(fname, "wb")) == NULL) { 46 if ((debug_fp = fopen(fname, "wb")) == NULL) {
47 fprintf(stderr, "Opening of file %s failed\n", fname); 47 fprintf(stderr, "Opening of file %s failed\n", fname);
48 exit(1); 48 exit(1);