bug 922, bug 925, bug 926, bug 927

Have a generic api for this now in util-misc.h