I'm trying to use select() to determine if there is input available. I do
not quite understand the man page. I simply want to know if a command has
been executed with redirection from a file:
$ cmd # here there is no input file specified, so how do I know?
$ cmd < file # I have specifed a valid file. Will select know? How?
since I am quering read on stdin wouldn't the select be:
memset(&tv, 0, sizeof(tv));
FD_SET(0, &rdfd_set); /* do I have to set this bit to ensure proper op? */
nfdready = select(1, &rdfd_set, NULL, NULL, &tv);
if (FD_ISSET(0, &rdfd_set)) printf("Input waiting to be read!\n");
else printf("No input specified");