2607

grep_s21_grep.h

Dec 5th, 2021
616
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef SRC_GREP_S21_GREP_H_
  2. #define SRC_GREP_S21_GREP_H_
  3.  
  4. #define GREP "s21_grep"
  5. #define MAX_LEN 1024
  6.  
  7. #define DESTROY(VALUE) if (VALUE) free(VALUE)
  8.  
  9. struct opts {
  10.     int e;
  11.     int i;
  12.     int v;
  13.     int c;
  14.     int l;
  15.     int n;
  16.     int h;
  17.     int s;
  18.     int o;
  19.     int f;
  20.     char pattern[MAX_LEN];
  21.     char file[MAX_LEN];
  22. };
  23.  
  24. int create_pattern(struct opts* grep_opt);
  25.  
  26. int regular(const char* str, const char* pattern, int opt_i);
  27. int regular_prn(const char* str, const char* grep_file, const size_t num_str, struct opts grep_opt);
  28.  
  29. int output(const char* grep_file, struct opts grep_opt);
  30. void print_str(const char* str, const char* grep_file, const size_t num_str, struct opts grep_opt);
  31. void promt();
  32.  
  33. #endif  // SRC_GREP_S21_GREP_H_
RAW Paste Data