dos.library: move special handling of NIL: to one function