Among four submissions, this commit based on the port sent by
Ernst de Haan <ernst@jollem.com> at ports/24291.
PR: 21435, 23368, 24291
Submitted by: Leo Kim <leo@florida.sarang.net>,
Dave Glowacki <dglo@ssec.wisc.edu>,
Sean Blakey <sean@beastie.bellevue.virtualtek.com>,
Ernst de Haan <ernst@jollem.com>
Also thanks to: Palle Girgensohn <girgen@partitur.se>,
Richard Stockley <rws@procopia.demon.co.uk>,
Kees Jan Koster <kjkoster@kjkoster.org>