Support match-failure reporting for string input.
On failed match, assign the empty-string value to the target.
Prior handling did not modify the target,
which in context like char s[10]; sin | exclude("\n", s); ,
left s uninitialized, and invalid for strlen , when the input's next character is a newline.
In this case, scanf offers the return value, the count of output arguments written,
to say, "I did not write to your buffer," a feature lost in the pipe abstraction.
Add tests to exercise such cases.
(Prior "leave uninitialized" treatment was discovered by surprise, while debugging a test program for an upcoming commit.)
|