SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char *remove_scripts(char *html, size_t len, size_t *rlen) {
  2.     char *ret = malloc(sizeof(char)*len);
  3.     *rlen = 0;
  4.     size_t it = 0;
  5.     const char *nxtSpacePointer = NULL;
  6.     const char *startPointer = NULL;
  7.     while (it < len) {
  8.         if (html[it] != '<') {
  9.             ret[(*rlen)++] = html[it++];
  10.             continue;
  11.         }
  12.         startPointer = &(html[it]);
  13.         nxtSpacePointer = strchr(start, ' ');
  14.         if (nxtSpacePointer == NULL || nxtSpacePointer - start == sizeof(char)) {
  15.             ret[(*rlen)++] = html[it++];
  16.             continue;
  17.         }
  18.         int tagNameLen = nxtSpacePointer - startPointer;
  19.         // script
  20.         if (tagNameLen == 6 && strncmp(startPointer+1, "script", 6)) {
  21.             // try to find something like: </script.*>
  22.            
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top