tr(1): backslash(): fix octal escape parsing
There are two bugs in backslash():
1. 8 and 9 are not octal digits. If we see '8' or '9' we should
terminate the octal escape.
2. We return octal escape values larger than UCHAR_MAX even though
tr(1) is (currently) a byte-oriented program and values larger
than UCHAR_MAX make no sense.
So, fix them both. In particular, (a) stop parsing if we see
characters outside of '0'-'7' and (b) escaped octal values larger than
UCHAR_MAX are a terminal error.
While here, some cleanup:
- Check for empty escapes at the top of the function. This simplifies
later cases.
- Use the for-loop conditional to terminate octal escape parsing after
three characters.
- Use an ANSI-style function definition.
We can fix the switch-statement indentation later, in a larger KNF
patch.
ok millert@