KNF, de-register, fix other minor grumbles
Copy the parts of libocurses that are needed directly to here. Wecontinue using the libocurses varient, since it is smaller.tested by guenther, ok millert