diff options
author | Benjamin M. Schwartz <bens@alum.mit.edu> | 2010-07-25 23:52:11 (GMT) |
---|---|---|
committer | Benjamin M. Schwartz <bens@alum.mit.edu> | 2010-07-25 23:52:11 (GMT) |
commit | 4bf29465b1956d7069e0f20c37db9a228a06c663 (patch) | |
tree | b4d2dc37ed32ed53e367e3de5e7b99f9e227bd1b | |
parent | aae3e541666bf1bf6e879976f95f027ed59a5fa1 (diff) |
Fix option handling
-rw-r--r-- | capture.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -613,12 +613,13 @@ usage (FILE * fp, "-r | --read Use read() calls\n" "-u | --userp Use application allocated buffers\n" "-n | --numframes Number of frames to acquire (default=1)\n" - "-f | --framerate Frame rate at which to acquire (default: use driver's default)\n" + "-f | --framerate Frame rate at which to acquire (default: unspecified)\n" + "-o | --outfile File in which to dump frames as cat'd PGM\n" "", argv[0]); } -static const char short_options [] = "d:hmrunfo"; +static const char short_options [] = "d:hmrun:f:o:"; static const struct option long_options [] = { @@ -686,6 +687,11 @@ main (int argc, case 'o': output_file = fopen(optarg, "wb"); + if (!output_file){ + fprintf (stderr, "Cannot open '%s': %d, %s\n", + optarg, errno, strerror (errno)); + exit (EXIT_FAILURE); + } break; default: |