Advertisement
captmicro

Untitled

Aug 8th, 2010
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. void ParseLuaTags(char *html)
  2. {
  3.     char *ptr = html;
  4.     char *luastart = NULL;
  5.     char *luaend = NULL;
  6.     int lualen = -1;
  7.  
  8.     while (*ptr != NULL)
  9.     {
  10.         if (luastart == NULL)
  11.         {
  12.             if (*ptr == '<' && *++ptr == 'l' && *++ptr == 'u' &&
  13.                 *++ptr == 'a' && *++ptr == '>')
  14.             {
  15.                 luastart = ptr;
  16.             }
  17.         } else {
  18.             if (*ptr == '<' && *++ptr == '/' && *++ptr == 'l' &&
  19.                 *++ptr == 'u' && ++ptr == 'a' && *++ptr == '>')
  20.             {
  21.                 luaend = ptr - 7;
  22.             }
  23.         }
  24.         *ptr++;
  25.     }
  26.  
  27.     lualen = luaend - luastart;
  28.     char *luastr = (char*)halloc(lualen + 1);
  29.     lstrcpynA(luastr, luastart, lualen);
  30.     printf("Lua: %X %X %d\n%s\n", luastart, luaend, lualen, luastr);
  31.     hfree(luastr);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement