Patches from Matt with slight mod from me to do without strlen. Also modified lprintf...