Hi,
Apparently the error seems to be in /usr/src/usr.bin/grep/util.c at line 400:
if ((!(lflag || cflag)) && ((!(bol || eol)) &&
((lastHalfDot) && ((firstHalfDot < 0) ||
((fg->patternLen - (lastHalfDot + 1)) < firstHalfDot))))) {
fg->reversedSearch = 1;
hasDot = fg->patternLen - (firstHalfDot < 0 ?
firstLastHalfDot : firstHalfDot) - 1;
grep_revstr(fg->pattern, fg->patternLen);
}
If you comment out those lines grep works as expected.
$ pwd
/usr/src/usr.bin/grep
$ echo "stuffb01b02stuff" | ./grep -o b..
b01
b02
Cheers