|
|
@ -37,7 +37,6 @@ struct Item { |
|
|
|
Item *next; /* traverses all items */ |
|
|
|
Item *next; /* traverses all items */ |
|
|
|
Item *left, *right; /* traverses items matching current search pattern */ |
|
|
|
Item *left, *right; /* traverses items matching current search pattern */ |
|
|
|
char *text; |
|
|
|
char *text; |
|
|
|
Bool matched; |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* forward declarations */ |
|
|
|
/* forward declarations */ |
|
|
@ -89,6 +88,7 @@ Item *next = NULL; |
|
|
|
Item *prev = NULL; |
|
|
|
Item *prev = NULL; |
|
|
|
Item *curr = NULL; |
|
|
|
Item *curr = NULL; |
|
|
|
Window root, win; |
|
|
|
Window root, win; |
|
|
|
|
|
|
|
int (*fstrncmp)(const char *, const char *, size_t n) = strncmp; |
|
|
|
char *(*fstrstr)(const char *, const char *) = strstr; |
|
|
|
char *(*fstrstr)(const char *, const char *) = strstr; |
|
|
|
|
|
|
|
|
|
|
|
Item * |
|
|
|
Item * |
|
|
@ -97,7 +97,6 @@ appenditem(Item *i, Item *last) { |
|
|
|
item = i; |
|
|
|
item = i; |
|
|
|
else |
|
|
|
else |
|
|
|
last->right = i; |
|
|
|
last->right = i; |
|
|
|
i->matched = True; |
|
|
|
|
|
|
|
i->left = last; |
|
|
|
i->left = last; |
|
|
|
i->right = NULL; |
|
|
|
i->right = NULL; |
|
|
|
last = i; |
|
|
|
last = i; |
|
|
@ -506,12 +505,9 @@ match(char *pattern) { |
|
|
|
item = j = NULL; |
|
|
|
item = j = NULL; |
|
|
|
nitem = 0; |
|
|
|
nitem = 0; |
|
|
|
for(i = allitems; i; i = i->next) |
|
|
|
for(i = allitems; i; i = i->next) |
|
|
|
i->matched = False; |
|
|
|
if(!fstrncmp(pattern, i->text, plen)) |
|
|
|
for(i = allitems; i; i = i->next) |
|
|
|
|
|
|
|
if(!i->matched && !strncasecmp(pattern, i->text, plen)) |
|
|
|
|
|
|
|
j = appenditem(i, j); |
|
|
|
j = appenditem(i, j); |
|
|
|
for(i = allitems; i; i = i->next) |
|
|
|
else if(fstrstr(i->text, pattern)) |
|
|
|
if(!i->matched && fstrstr(i->text, pattern)) |
|
|
|
|
|
|
|
j = appenditem(i, j); |
|
|
|
j = appenditem(i, j); |
|
|
|
curr = prev = next = sel = item; |
|
|
|
curr = prev = next = sel = item; |
|
|
|
calcoffsets(); |
|
|
|
calcoffsets(); |
|
|
@ -662,8 +658,10 @@ main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
|
|
|
|
/* command line args */ |
|
|
|
/* command line args */ |
|
|
|
for(i = 1; i < argc; i++) |
|
|
|
for(i = 1; i < argc; i++) |
|
|
|
if(!strcmp(argv[i], "-i")) |
|
|
|
if(!strcmp(argv[i], "-i")) { |
|
|
|
|
|
|
|
fstrncmp = strncasecmp; |
|
|
|
fstrstr = cistrstr; |
|
|
|
fstrstr = cistrstr; |
|
|
|
|
|
|
|
} |
|
|
|
else if(!strcmp(argv[i], "-fn")) { |
|
|
|
else if(!strcmp(argv[i], "-fn")) { |
|
|
|
if(++i < argc) font = argv[i]; |
|
|
|
if(++i < argc) font = argv[i]; |
|
|
|
} |
|
|
|
} |
|
|
|