int main(int ac, char **av) { ty_mmapfile *f1,*f2; int i,j,n,len; unsigned char *buf1,*buf2; int bsize1,bsize2; f1 = mmapfile_open(av[1]); n = atoi(av[2]); len = atoi(av[3]); f2 = mmapfile_open(av[4]); buf1 = mmapfile_getbuf(f1); bsize1 = mmapfile_getsize(f1); buf2 = mmapfile_getbuf(f2); bsize2 = mmapfile_getsize(f2); for(i = 0; i < bsize2-len+1; i++) { j = 0; while ((buf1[n+j] == buf2[i+j]) && (j < len)) { j++; } if (j == len) { printf("%i\n",i); } } }
static MMA_HANDLE* open_bpmf(char* pool_name) { return mmapfile_open(pool_name, bpfile_full_path(mmpool_bpmf_filename(pool_name)), MMA_READ_WRITE, MMF_SHARED); }