Import initial code from newsd 1.44 -- October 19, 2005