Changes in filter.c [af1920fd:cdc6ff1]
Legend:
- Unmodified
- Added
- Removed
-
filter.c
raf1920fd rcdc6ff1 29 29 while ( argc>=2 && ( !strcmp(argv[0], "-c") || 30 30 !strcmp(argv[0], "-b") ) ) { 31 if (owl_util_string_to_color(argv[1])== -1) {31 if (owl_util_string_to_color(argv[1])==OWL_COLOR_INVALID) { 32 32 owl_function_error("The color '%s' is not available, using default.", argv[1]); 33 33 } else { … … 212 212 213 213 214 void owl_filter_print(owl_filter *f, char *out) 215 { 216 strcpy(out, owl_filter_get_name(f)); 217 strcat(out, ": "); 214 char* owl_filter_print(owl_filter *f) 215 { 216 GString *out = g_string_new(""); 218 217 219 218 if (f->fgcolor!=OWL_COLOR_DEFAULT) { 220 strcat(out, "-c ");219 g_string_append(out, "-c "); 221 220 if (f->fgcolor < 8) { 222 strcat(out, owl_util_color_to_string(f->fgcolor));221 g_string_append(out, owl_util_color_to_string(f->fgcolor)); 223 222 } 224 223 else { 225 char* c = owl_sprintf("%i",f->fgcolor); 226 strcat(out, c); 227 owl_free(c); 228 } 229 strcat(out, " "); 224 g_string_append_printf(out, "%i",f->fgcolor); 225 } 226 g_string_append(out, " "); 230 227 } 231 228 if (f->bgcolor!=OWL_COLOR_DEFAULT) { 232 strcat(out, "-b ");229 g_string_append(out, "-b "); 233 230 if (f->bgcolor < 8) { 234 strcat(out, owl_util_color_to_string(f->bgcolor));231 g_string_append(out, owl_util_color_to_string(f->bgcolor)); 235 232 } 236 233 else { 237 char* c = owl_sprintf("%i",f->bgcolor); 238 strcat(out, c); 239 owl_free(c); 240 } 241 strcat(out, " "); 242 } 243 if(!f->root) return; 244 owl_filterelement_print(f->root, out); 245 strcat(out, "\n"); 234 g_string_append_printf(out, "%i",f->fgcolor); 235 } 236 g_string_append(out, " "); 237 } 238 if(f->root) { 239 owl_filterelement_print(f->root, out); 240 g_string_append(out, "\n"); 241 } 242 243 return g_string_free(out, 0); 246 244 } 247 245 … … 249 247 int owl_filter_equiv(owl_filter *a, owl_filter *b) 250 248 { 251 char buff[LINE], buff2[LINE]; 252 253 owl_filter_print(a, buff); 254 owl_filter_print(b, buff2); 255 256 if (!strcmp(buff, buff2)) return(1); 257 return(0); 249 char *buffa, *buffb; 250 int ret; 251 252 buffa = owl_filter_print(a); 253 buffb = owl_filter_print(b); 254 255 ret = !strcmp(buffa, buffb); 256 ret = ret && !strcmp(owl_filter_get_name(a), 257 owl_filter_get_name(b)); 258 259 owl_free(buffa); 260 owl_free(buffb); 261 262 return ret; 258 263 } 259 264
Note: See TracChangeset
for help on using the changeset viewer.