$ ./xclip < .
./xclip: (stdin): Is a directory
$ ./xclip .
./xclip: .: Is a directory
$ xclip .
^C
also, by reordering the loop and the condition this way, we only allocate more if we know there's more,
and only check for EOF if we encountered an EOF or error.
Correctly detect errors from stdio:
also, by reordering the loop and the condition this way, we only allocate more if we know there's more, and only check for EOF if we encountered an EOF or error.