cider.c 666 B

1234567891011121314151617181920212223242526272829303132
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include "args.h"
  4. #include "io.h"
  5. #include "parse.h"
  6. bool break_print_loop = false;
  7. int main(int argc, char** argv) {
  8. struct arguments args;
  9. args.mode = PIPE;
  10. args.ist = stdin;
  11. argp_parse(&argp, argc, argv, 0, 0, &args);
  12. void (*process_next_line)(struct arguments*);
  13. switch(args.mode) {
  14. case PIPE: case SCRIPTED:
  15. {
  16. process_next_line = &getline_wrapper;
  17. }
  18. break;
  19. default:
  20. process_next_line = &no_read;
  21. }
  22. do {
  23. process_next_line(&args);
  24. } while(!feof(args.ist) && !break_print_loop);
  25. return 0;
  26. }