int
p4_find_local (char *nm, int l)
{
int i;
if (! *PFE.locals)
return 0;
if (! LOWER_CASE)
{
for (i = 0; i < *PFE.locals; i++)
if (strncmp (nm, PFE.local[i], l) == 0 && PFE.local[i][l] == 0)
return i + 1;
return 0;
}
if (LOWER_CASE)
{
for (i = 0; i < *PFE.locals; i++)
{
if (strncmp (nm, PFE.local[i], l) == 0 && PFE.local[i][l] == 0)
return i + 1;
if (p4_strncmpi (nm, PFE.local[i], l) == 0 && PFE.local[i][l] == 0)
{
# if defined _K12_SOURCE && defined VXWORKS
p4_outf ("(WARN: input '%.*s' hits '%.*s' local: bad spelling)"
, l, nm, l, PFE.local[i]);
# endif
P4_warn4 ("WARN: input '%.*s' hits '%.*s' local: bad spelling"
, l, nm, l, PFE.local[i]);
P4_info ("forth locals should be case-correct, always" );
return i + 1;
}
}
}
return 0;
} |