diff options
-rw-r--r-- | apps/plugins/searchengine/parser.c | 14 | ||||
-rw-r--r-- | apps/plugins/searchengine/searchengine.c | 10 | ||||
-rw-r--r-- | apps/plugins/searchengine/token.h | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/apps/plugins/searchengine/parser.c b/apps/plugins/searchengine/parser.c index cbedeb3041..ad2e4ee538 100644 --- a/apps/plugins/searchengine/parser.c +++ b/apps/plugins/searchengine/parser.c | |||
@@ -148,11 +148,19 @@ unsigned char *parseCompareString() { | |||
148 | rb->snprintf(errormsg,250,"'%d' found where STRING/STRINGID expected\n",currentToken->kind); | 148 | rb->snprintf(errormsg,250,"'%d' found where STRING/STRINGID expected\n",currentToken->kind); |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | 151 | ||
152 | contains=currentToken->kind==TOKEN_CONTAINS; | ||
153 | if(currentToken->kind==TOKEN_CONTAINS || | 152 | if(currentToken->kind==TOKEN_CONTAINS || |
154 | currentToken->kind==TOKEN_EQUALS) | 153 | currentToken->kind==TOKEN_EQUALS) { |
154 | if(currentToken->kind==TOKEN_CONTAINS) { | ||
155 | contains=1; | ||
156 | PUTS("Contains"); | ||
157 | } | ||
158 | else { | ||
159 | contains=0; | ||
160 | PUTS("Equals"); | ||
161 | } | ||
155 | parser_acceptIt(); | 162 | parser_acceptIt(); |
163 | } | ||
156 | else { | 164 | else { |
157 | syntaxerror=1; | 165 | syntaxerror=1; |
158 | rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind); | 166 | rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind); |
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c index 0cb090e141..3926b15eac 100644 --- a/apps/plugins/searchengine/searchengine.c +++ b/apps/plugins/searchengine/searchengine.c | |||
@@ -54,7 +54,7 @@ void setmallocpos(void *pointer) | |||
54 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 54 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
55 | { | 55 | { |
56 | unsigned char *result,buf[500]; | 56 | unsigned char *result,buf[500]; |
57 | int parsefd; | 57 | int parsefd,hits; |
58 | /* this macro should be called as the first thing you do in the plugin. | 58 | /* this macro should be called as the first thing you do in the plugin. |
59 | it test that the api version and model the plugin was compiled for | 59 | it test that the api version and model the plugin was compiled for |
60 | matches the machine it is running on */ | 60 | matches the machine it is running on */ |
@@ -78,14 +78,20 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
78 | rb->snprintf(buf,250,"Retval: 0x%x",result); | 78 | rb->snprintf(buf,250,"Retval: 0x%x",result); |
79 | PUTS(buf); | 79 | PUTS(buf); |
80 | rb->close(parsefd); | 80 | rb->close(parsefd); |
81 | hits=0; | ||
81 | if(result!=0) { | 82 | if(result!=0) { |
82 | int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC); | 83 | int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC); |
83 | int i; | 84 | int i; |
84 | for(i=0;i<rb->tagdbheader->filecount;i++) | 85 | for(i=0;i<rb->tagdbheader->filecount;i++) |
85 | if(result[i]) | 86 | if(result[i]) { |
87 | hits++; | ||
86 | rb->fdprintf(fd,"%s\n",getfilename(i)); | 88 | rb->fdprintf(fd,"%s\n",getfilename(i)); |
89 | } | ||
87 | /* rb->write(fd,result,rb->tagdbheader->filecount);*/ | 90 | /* rb->write(fd,result,rb->tagdbheader->filecount);*/ |
88 | rb->close(fd); | 91 | rb->close(fd); |
89 | } | 92 | } |
93 | rb->snprintf(buf,250,"Hits: %d",hits); | ||
94 | PUTS(buf); | ||
95 | rb->sleep(HZ*3); | ||
90 | return PLUGIN_OK; | 96 | return PLUGIN_OK; |
91 | } | 97 | } |
diff --git a/apps/plugins/searchengine/token.h b/apps/plugins/searchengine/token.h index 0ce27162d3..0df4a6ec5f 100644 --- a/apps/plugins/searchengine/token.h +++ b/apps/plugins/searchengine/token.h | |||
@@ -51,7 +51,7 @@ | |||
51 | struct token { | 51 | struct token { |
52 | unsigned char kind; | 52 | unsigned char kind; |
53 | char spelling[256]; | 53 | char spelling[256]; |
54 | int intvalue; | 54 | long intvalue; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | char *getstring(struct token *token); | 57 | char *getstring(struct token *token); |