@@ -207,37 +207,35 @@ void text_color_init (int enable_color)
207
207
g_enable_color = enable_color ;
208
208
209
209
210
+ if (g_enable_color == 0 ) {
211
+ return ;
212
+ }
210
213
#if __WIN32__
211
214
212
215
213
- if (g_enable_color ) {
214
216
215
- HANDLE h ;
216
- CONSOLE_SCREEN_BUFFER_INFO csbi ;
217
- WORD attr = BACKGROUND_WHITE ;
218
- DWORD length ;
219
- COORD coord ;
220
- DWORD nwritten ;
217
+ HANDLE h ;
218
+ CONSOLE_SCREEN_BUFFER_INFO csbi ;
219
+ WORD attr = BACKGROUND_WHITE ;
220
+ DWORD length ;
221
+ COORD coord ;
222
+ DWORD nwritten ;
221
223
222
- h = GetStdHandle (STD_OUTPUT_HANDLE );
223
- if (h != NULL && h != INVALID_HANDLE_VALUE ) {
224
+ h = GetStdHandle (STD_OUTPUT_HANDLE );
225
+ if (h != NULL && h != INVALID_HANDLE_VALUE ) {
224
226
225
- GetConsoleScreenBufferInfo (h , & csbi );
227
+ GetConsoleScreenBufferInfo (h , & csbi );
226
228
227
- length = csbi .dwSize .X * csbi .dwSize .Y ;
228
- coord .X = 0 ;
229
- coord .Y = 0 ;
230
- FillConsoleOutputAttribute (h , attr , length , coord , & nwritten );
231
- }
229
+ length = csbi .dwSize .X * csbi .dwSize .Y ;
230
+ coord .X = 0 ;
231
+ coord .Y = 0 ;
232
+ FillConsoleOutputAttribute (h , attr , length , coord , & nwritten );
232
233
}
233
-
234
234
#else
235
- if (g_enable_color ) {
236
- //printf ("%s", clear_eos);
237
- printf ("%s" , background_white );
238
- printf ("%s" , clear_eos );
239
- printf ("%s" , black );
240
- }
235
+ //printf ("%s", clear_eos);
236
+ printf ("%s" , background_white );
237
+ printf ("%s" , clear_eos );
238
+ printf ("%s" , black );
241
239
#endif
242
240
}
243
241
0 commit comments