Mercurial > hg > Members > kono > nitros9-code
view 3rdparty/packages/ed/find.c @ 1124:c2b85c18a13a
Makefiles now use os9 attr
author | boisy |
---|---|
date | Sun, 13 Apr 2003 22:26:31 +0000 |
parents | bef1844de0dc |
children |
line wrap: on
line source
/* find.c */ #include <stdio.h> #include "tools.h" #include "ed.h" int find(pat, dir) TOKEN *pat; int dir; { int i, num; char lin[MAXLINE]; LINE *ptr; num = curln; ptr = getptr(curln); num = (dir ? nextln(num) : prevln(num)); ptr = (dir ? ptr->l_next : ptr->l_prev); for (i = 0; i < lastln; i++) { if (num == 0) { num = (dir ? nextln(num) : prevln(num)); ptr = (dir ? ptr->l_next : ptr->l_prev); } strcpy(lin, ptr->l_buff); strcat(lin, "\n"); if (matchs(lin, pat, 0)) { return(num); } num = (dir ? nextln(num) : prevln(num)); ptr = (dir ? ptr->l_next : ptr->l_prev); } return(ERR); }