Ensure original ncopts value is retained.
Small tweaks to make "gcc -Wall" happier: ensure all functions are prototyped, ensure "%ld" is used to format long int, remove unused variables, add parentheses.