diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/search.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index 8eb13c5842..450b05c778 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -40,6 +40,16 @@ static int line_end; /* Index of the end of line */ | |||
40 | char resultfile[MAX_PATH]; | 40 | char resultfile[MAX_PATH]; |
41 | char path[MAX_PATH]; | 41 | char path[MAX_PATH]; |
42 | 42 | ||
43 | static int strpcasecmp(const char *s1, const char *s2) | ||
44 | { | ||
45 | while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) { | ||
46 | s1++; | ||
47 | s2++; | ||
48 | } | ||
49 | |||
50 | return (*s1 == '\0') ; | ||
51 | } | ||
52 | |||
43 | static void fill_buffer(int pos) | 53 | static void fill_buffer(int pos) |
44 | { | 54 | { |
45 | int numread; | 55 | int numread; |
@@ -84,11 +94,12 @@ static void fill_buffer(int pos) | |||
84 | default: | 94 | default: |
85 | if (!found && tolower(buffer[i]) == tolower(search_string[0])) | 95 | if (!found && tolower(buffer[i]) == tolower(search_string[0])) |
86 | { | 96 | { |
87 | found = rb->strcasecmp(&search_string[0],&buffer[i]) ; | 97 | found = strpcasecmp(&search_string[0],&buffer[i]) ; |
88 | } | 98 | } |
89 | break; | 99 | break; |
90 | } | 100 | } |
91 | } | 101 | } |
102 | DEBUGF("\n-------------------\n"); | ||
92 | } | 103 | } |
93 | 104 | ||
94 | static void search_buffer(void) | 105 | static void search_buffer(void) |
@@ -103,6 +114,8 @@ static void search_buffer(void) | |||
103 | 114 | ||
104 | static bool search_init(char* file) | 115 | static bool search_init(char* file) |
105 | { | 116 | { |
117 | rb->memset(search_string, 0, sizeof(search_string)); | ||
118 | |||
106 | if (!rb->kbd_input(search_string,sizeof search_string)) | 119 | if (!rb->kbd_input(search_string,sizeof search_string)) |
107 | { | 120 | { |
108 | rb->lcd_clear_display(); | 121 | rb->lcd_clear_display(); |
@@ -141,8 +154,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
141 | 154 | ||
142 | rb = api; | 155 | rb = api; |
143 | 156 | ||
157 | DEBUGF("%s - %s\n", parameter, &filename[rb->strlen(filename)-4]); | ||
144 | /* Check the extension. We only allow .m3u files. */ | 158 | /* Check the extension. We only allow .m3u files. */ |
145 | if(!rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) { | 159 | if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) { |
146 | rb->splash(HZ, true, "Not a .m3u file"); | 160 | rb->splash(HZ, true, "Not a .m3u file"); |
147 | return PLUGIN_ERROR; | 161 | return PLUGIN_ERROR; |
148 | } | 162 | } |