add getopt;read from stdin if not file was specified.