integrate Steve Hayman's version; now POSIX 1003.2 D11.2 compliant