| 1231 | COMMANDF(listlen, "s", (char *l) { intret(listlen(l)); }); |
| 1232 | |
| 1233 | int find(char *s, const char *key) |
| 1234 | { |
| 1235 | whitespaceskip; |
| 1236 | int len = strlen(key); |
| 1237 | for(int i = 0; *s; i++) |
| 1238 | { |
| 1239 | char *e = s; |
| 1240 | elementskip; |
| 1241 | char *a = s; |
| 1242 | if(*e == '"') |
| 1243 | { |
| 1244 | e++; |
| 1245 | if(s[-1] == '"') --s; |
| 1246 | if(s - e >= len) |
| 1247 | { |
| 1248 | *s = '\0'; |
| 1249 | #ifndef STANDALONE |
| 1250 | filterrichtext(e, e, s - e); |
| 1251 | #endif |
| 1252 | if(int(strlen(e)) == len && !strncmp(e, key, len)) return i; |
| 1253 | *s = ' '; |
| 1254 | } |
| 1255 | } |
| 1256 | else if(s - e == len && !strncmp(e, key, s - e)) return i; |
| 1257 | s = a; |
| 1258 | whitespaceskip; |
| 1259 | } |
| 1260 | return -1; |
| 1261 | } |
| 1262 | COMMANDF(findlist, "ss", (char *s, char *key) { intret(find(s, key)); }); |
| 1263 | |
| 1264 | #ifndef STANDALONE |
no test coverage detected