- Timestamp:
- Aug 10, 2008, 5:38:44 PM (16 years ago)
- Branches:
- master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- e9bb404
- Parents:
- d81f8d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
filter.c
r601733d r0504f63 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(owl_filter_get_name(f)); 217 218 g_string_append(out, ": "); 218 219 219 220 if (f->fgcolor!=OWL_COLOR_DEFAULT) { 220 strcat(out, "-c ");221 g_string_append(out, "-c "); 221 222 if (f->fgcolor < 8) { 222 strcat(out, owl_util_color_to_string(f->fgcolor));223 g_string_append(out, owl_util_color_to_string(f->fgcolor)); 223 224 } 224 225 else { 225 char* c = owl_sprintf("%i",f->fgcolor); 226 strcat(out, c); 227 owl_free(c); 228 } 229 strcat(out, " "); 226 g_string_append_printf(out, "%i",f->fgcolor); 227 } 228 g_string_append(out, " "); 230 229 } 231 230 if (f->bgcolor!=OWL_COLOR_DEFAULT) { 232 strcat(out, "-b ");231 g_string_append(out, "-b "); 233 232 if (f->bgcolor < 8) { 234 strcat(out, owl_util_color_to_string(f->bgcolor));233 g_string_append(out, owl_util_color_to_string(f->bgcolor)); 235 234 } 236 235 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"); 236 g_string_append_printf(out, "%i",f->fgcolor); 237 } 238 g_string_append(out, " "); 239 } 240 if(f->root) { 241 owl_filterelement_print(f->root, out); 242 g_string_append(out, "\n"); 243 } 244 245 return g_string_free(out, 0); 246 246 } 247 247 … … 249 249 int owl_filter_equiv(owl_filter *a, owl_filter *b) 250 250 { 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); 251 char *buffa, *buffb; 252 int ret; 253 254 buffa = owl_filter_print(a); 255 buffb = owl_filter_print(b); 256 257 ret = !strcmp(buffa, buffb); 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.