Fixed access violation
Fixed memory leak
Changed use of fprintf to fputc for single char as it was sometimes
causing segfaults when running in dbx with --debug enabled on Solaris
Removed file locking from fgetln implementation

The realloc was causing segfaults on Solaris and not locking the stdin
file handle seemed to help