ref: 1ef2d33d7af26144ea8109e1017b745b98f49846
dir: /strnaive.c/
#include <u.h> #include <libc.h> #include "asif.h" VArray * naivestrfind(String text, String word) { int n; VArray *v; n = text.n - word.n + 1; if(n <= 0) return nil; v = valloc(n, sizeof int); for(i=0; i<n; i++) if(strcmp(text.s+i, word.s) == 0) v = vinsert(v, &i); return v; }