putw is supposed to return 0 (not the value written) on success this is not a standard but it's the traditional behavior and it's more useful because the caller can reliably detect errors.
make sure getw/putw agree with prototypes by defining _GNU_SOURCE
initial check-in, version 0.5.0