switched from getchar to read, allowing reading from any fd