1234567891011121314151617181920212223242526272829303132 |
- #include <stdio.h>
- #include <stdbool.h>
- #include "args.h"
- #include "io.h"
- #include "parse.h"
- bool break_print_loop = false;
- int main(int argc, char** argv) {
- struct arguments args;
- args.mode = PIPE;
- args.ist = stdin;
- argp_parse(&argp, argc, argv, 0, 0, &args);
- void (*process_next_line)(struct arguments*);
- switch(args.mode) {
- case PIPE: case SCRIPTED:
- {
- process_next_line = &getline_wrapper;
- }
- break;
- default:
- process_next_line = &no_read;
- }
- do {
- process_next_line(&args);
- } while(!feof(args.ist) && !break_print_loop);
- return 0;
- }
|