Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

libtre users, please help me

Name: Anonymous 2009-08-12 9:10

Hi /prog/raiders, did you ever use libtre? If so can you tell me what's wrong with my code? It segfaults at row 37


 18 #define REMATCH 3
 19
 20 int main(int argc, char **argv)
 21 {
 22     assert(argc > 1);
 23     regex_t re;
 24     regmatch_t pmatch[REMATCH];
 25     const char *str = argv[1];
 26     const char regex[] = "^\\.text\\.(.*)$";
 27     int ret;
 28     printf("Regex: %s\n", regex);
 29
 30     if ((ret = regcomp(&re, regex, REG_EXTENDED)) != 0) {
 31         printf("FAIL! %d\n", ret);
 32         exit(EXIT_FAILURE);
 33     } else {
 34         printf("Compile ok, %d\n", ret);
 35     }
 36
 37     if (regexec(&re, str, REMATCH, pmatch, 0) == 0) {
 38         printf("SUCCESS!\n");
 39     }
 40     printf("LOL\n");
 41
 42     regfree(&re);
 43     exit(EXIT_SUCCESS);
 44 }

Name: Anonymous 2011-11-24 11:51

>>11
nice doubles bro

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List