comparison src/main.c @ 507:135570a8bd96

Move debug macros from main.h to new debug.h. Make debug_level static to debug.c and add utility functions to manipulate it. Add #include "debug.h" where needed.
author zas_
date Thu, 24 Apr 2008 08:53:39 +0000
parents fc9c8a3e1a8b
children b78a91d0779e
comparison
equal deleted inserted replaced
506:fc9c8a3e1a8b 507:135570a8bd96
14 #include "main.h" 14 #include "main.h"
15 15
16 #include "cache.h" 16 #include "cache.h"
17 #include "collect.h" 17 #include "collect.h"
18 #include "collect-io.h" 18 #include "collect-io.h"
19 #include "debug.h"
19 #include "dnd.h" 20 #include "dnd.h"
20 #include "editors.h" 21 #include "editors.h"
21 #include "filelist.h" 22 #include "filelist.h"
22 #include "fullscreen.h" 23 #include "fullscreen.h"
23 #include "image-overlay.h" 24 #include "image-overlay.h"
743 } 744 }
744 } 745 }
745 } 746 }
746 747
747 if (blank || cmd_list || path) g_string_append(command, " --blank"); 748 if (blank || cmd_list || path) g_string_append(command, " --blank");
748 if (debug) g_string_append(command, " --debug"); 749 if (get_debug_level()) g_string_append(command, " --debug");
749 750
750 g_string_append(command, " &"); 751 g_string_append(command, " &");
751 system(command->str); 752 system(command->str);
752 g_string_free(command, TRUE); 753 g_string_free(command, TRUE);
753 754
1149 { 1150 {
1150 gint cmd_line_len = strlen(cmd_line); 1151 gint cmd_line_len = strlen(cmd_line);
1151 1152
1152 /* we now increment the debug state for verbosity */ 1153 /* we now increment the debug state for verbosity */
1153 if (cmd_line_len == len) 1154 if (cmd_line_len == len)
1154 debug++; 1155 debug_level_add(1);
1155 else if (cmd_line[len] == '=' && g_ascii_isdigit(cmd_line[len+1])) 1156 else if (cmd_line[len] == '=' && g_ascii_isdigit(cmd_line[len+1]))
1156 { 1157 {
1157 gint n = atoi(cmd_line + len + 1); 1158 gint n = atoi(cmd_line + len + 1);
1158 if (n < 0) n = 1; 1159 if (n < 0) n = 1;
1159 debug += n; 1160 debug_level_add(n);
1160 } 1161 }
1161 } 1162 }
1162 } 1163 }
1163 } 1164 }
1164 1165
1165 DEBUG_1("debugging output enabled (level %d)", debug); 1166 DEBUG_1("debugging output enabled (level %d)", get_debug_level());
1166 #endif 1167 #endif
1167 } 1168 }
1168 1169
1169 /* 1170 /*
1170 *----------------------------------------------------------------------------- 1171 *-----------------------------------------------------------------------------