Changes were made to bring this function into line with Perl:
The "a" code now retains trailing NULL bytes.
The "A" code now strips all trailing ASCII whitespace (spaces, tabs,
newlines, carriage returns, and NULL bytes).
The "Z" code was added for NULL-padded strings, and removes trailing
NULL bytes.