Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // test parse
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #define BUF 256
- int
- main(void)
- {
- char *test = "lol blah blah blablablabla bha bla a href=/site.php?pass=1234 aas href=\"lol.jsp\" blah blah";
- int href = *(int *)"href";
- char *p, *s=(char *)malloc(sizeof(char)*BUF);
- register i, x;
- i = 0;
- p = test;
- do{
- x = *(int *)p;
- if(x == href && p[4] == '=')
- {
- p += 5;
- do{
- s[i] = *p;
- p++;
- i++;
- }while(*p != ' ' && i < BUF-1);
- s[i] = '\n';
- i++;
- }
- p++;
- }while(p[5] != '\0' && i < BUF-1);
- puts(s);
- free(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment