#include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int fd; struct stat s; void *p = 0; FILE *a; regex_t *_rezs; regmatch_t _rmzs[100]; if (argc < 2) return 1; a = fopen(argv[1], "r"); fd = open(argv[1], O_RDONLY); // if ((fd = open(argv[1], O_RDONLY)) < 0) { // fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno)); // return 1; // } // fstat(a->fd, &s); /* if ((p = mmap(0, s.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno)); return 1; } */ regcomp(_rezs, argv[2], REG_ICASE); regexec(_rezs, "string to match pattern", 100, _rmzs, REG_NOTEOL); // write(1, p, s.st_size); // munmap(p, s.st_size); return 0; }