Index: apps/plugins/disktidy.c =================================================================== --- apps/plugins/disktidy.c (revision 28296) +++ apps/plugins/disktidy.c (working copy) @@ -36,6 +36,7 @@ #define MAX_TYPES 64 struct tidy_type { char filestring[64]; + int length; bool directory; bool remove; } tidy_types[MAX_TYPES]; @@ -54,6 +55,7 @@ } else tidy_types[index].directory = false; + tidy_types[index].length = rb->strlen(tidy_types[index].filestring); } static int find_file_string(const char *file, char *last_group) { @@ -89,9 +91,7 @@ /* shift items up one */ for (i=tidy_type_count;i>idx_last_group;i--) { - rb->strcpy(tidy_types[i].filestring, tidy_types[i-1].filestring); - tidy_types[i].directory = tidy_types[i-1].directory; - tidy_types[i].remove = tidy_types[i-1].remove; + rb->memcpy(&tidy_types[i], &tidy_types[i-1], sizeof(struct tidy_type)); } tidy_type_count++; add_item(file, idx_last_group+1); @@ -136,16 +136,25 @@ { int i; char *file; + int siz, item_len; bool ret = false, rem = false; + item_len = rb->strlen(item); for (i=0; ret == false && i < tidy_type_count; i++) { file = tidy_types[i].filestring; - if (file[rb->strlen(file)-1] == '*') + siz = tidy_types[i].length - 1; + if (file[siz] == '*') { - if (!rb->strncmp(file, item, rb->strlen(file)-1)) + if (item_len - siz >= 0 && !rb->strncmp(file, item, siz)) rem = true; } - else if (!rb->strcmp(file, item)) + else if (file[0] == '*') + { + if (item_len - siz >= 0 && + !rb->strncmp(file + 1, item + item_len - siz, siz)) + rem = true; + } + else if ((siz+1) == item_len && !rb->strcmp(file, item)) rem = true; if (rem) {