Skip to content

Commit

Permalink
Added macro FINDALL
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Knigge committed Oct 27, 2022
1 parent 1248f72 commit 5b93c7e
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions macros/findall.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
void findall(void)
{
int Start;
int End;
int Col;
int Len;
char *Word;
char *Text;

Text = SpfService("query", "line_data");
Col = SpfService("query", "col_number");
Len = SpfService("query", "line_length");

if(Text && Col >= 1 && Col <= Len)
{
while(Col > 1 && StrGetSubstr(Text, Col, 1) != " ")
Col--;

if(StrGetSubstr(Text, Col, 1) == " ")
Col++;

Start = Col;
End = StrFindSubstr(Text, " ", Start);

if(End <= Start)
{
if(Start > 1)
Start--;

End = Len;
}

Len = End - Start + 1;
Word = StrGetSubstr(Text, Start, Len);

StrStripLeading(Word, " ");
StrStripTrailing(Word, " ");

if(Start == 7)
StrStripTrailing(Word, ".");

SpfService("cmd", StrCompose("FIND '", Word, "' ALL"));
}
}

0 comments on commit 5b93c7e

Please sign in to comment.