strnchr needs to be revisited
A multi-threaded-style OS for the Spectrum +3
Brought to you by:
u6c87
The history of this one is that the DOS CATALOG buffer returned is space-padded for each of the 8.3 parts of the filename. Thus the name "HELLO.C" would appear as
"HELLO C "
strnchr() was a quick implementation to allow ls to locate the first space, searching at most 8 (then 3) characters.
There are two issues:
It's been pointed out that technically, NULL should be returned if the character is not found. I can't lay my hands on any official definition of strnchr() so I can't say either way.
It's inefficient, and would probably be better coded directly in assembler.