help
| Rev | Line | |
|---|
| [0214596] | 1 | #include <stdlib.h> |
|---|
| 2 | #include <string.h> |
|---|
| 3 | #include "common.h" |
|---|
| 4 | |
|---|
| 5 | FILE* inputf=stdin; |
|---|
| 6 | FILE* outputf=stdout; |
|---|
| 7 | FILE* failedf=stdout; |
|---|
| 8 | bool copy_processed=0; |
|---|
| 9 | |
|---|
| 10 | void process_common_options(gengetopt_args_info args) |
|---|
| 11 | { |
|---|
| 12 | if(args.help_given) |
|---|
| 13 | cmdline_parser_print_help (); |
|---|
| 14 | |
|---|
| 15 | if(args.input_given) |
|---|
| 16 | if(!(inputf=fopen(args.input_arg,"r"))) |
|---|
| 17 | { |
|---|
| 18 | fprintf(stderr,"No such file: %s.\n", args.input_arg); |
|---|
| 19 | exit(1); |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | if(args.output_given) |
|---|
| 23 | if(!(outputf=fopen(args.output_arg,"w"))) |
|---|
| 24 | { |
|---|
| 25 | fprintf(stderr,"Cannot open output file: %s.\n", args.output_arg); |
|---|
| 26 | exit(1); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | if(args.failed_given) |
|---|
| 30 | if(!(failedf=fopen(args.failed_arg,"w"))) |
|---|
| 31 | { |
|---|
| 32 | fprintf(stderr,"Cannot open output file: %s.\n", args.failed_arg); |
|---|
| 33 | exit(1); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | if(args.copy_given) |
|---|
| 38 | copy_processed=true; |
|---|
| 39 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.