Advertisement
Guest User

Untitled

a guest
May 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. int gg_parselink_getuin(char *arg)
  2. {
  3.     char *num_table = "1234567890";
  4.     char *tmp       = NULL;
  5.     char *token     = NULL;
  6.     int parse_start, parse_length = 0;
  7.    
  8.     // remember - put checks what to do when number is not found, with strcspn & strspn, etc
  9.    
  10.     // token link
  11.     // here will be first trying to get uin from token
  12.     //MessageBox(NULL, arg,"Testing Window ARG",MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
  13.     token = strtok (arg, "?&");
  14.     while (token != NULL)
  15.     {
  16.     //  MessageBox(NULL, token,"Testing Window TOKEN",MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
  17.         tmp = strstr(token, "ggid=");
  18.         if (tmp != NULL)
  19.         {
  20.     //      MessageBox(NULL, tmp,"Testing Window TMP",MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
  21.  
  22.             parse_length    = strspn(arg + *tmp + 5, num_table);
  23.             strncpy (tmp, arg + *tmp + 5, parse_length);
  24.             return atoi(tmp);
  25.            
  26.         }
  27.         token = strtok (NULL, "?&");
  28.     }
  29.    
  30.     // otherwise get first number found in link
  31.     parse_start     = strcspn(arg, num_table);
  32.     parse_length    = strspn(arg + parse_start, num_table);
  33.     strncpy(tmp, arg + parse_start, parse_length);
  34.     tmp[parse_length] = '\0';
  35.    
  36.     return atoi(tmp);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement