Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <pcre.h>
- #define OVECCOUNT 30 /* should be a multiple of 3 */
- int main(int argc, char **argv)
- {
- pcre *blankline,*re;
- const char *error;
- int erroffset;
- int ovector[OVECCOUNT];
- FILE *infile;
- char buf[BUFSIZ];
- char blank[] = "^\\s*$";
- if (argc != 2)
- {
- printf("Filename required\n");
- return 1;
- }
- blankline = pcre_compile(blank,PCRE_CASELESS,&error,&erroffset,NULL);
- if (!(infile = fopen(argv[1], "r"))) {
- printf("Could not open input file");
- exit(1);
- }
- while (fgets(buf, sizeof (buf), infile)) {
- int n= strlen(buf);
- buf[n - 1] = 0;
- puts(buf);
- rc = pcre_exec( blankline, NULL, buf, n, 0, 0, ovector, OVECCOUNT);
- if (rc > 0){
- break;
- }
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement