Subversion Repositories Kolibri OS

Rev

Rev 7746 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. bool GetNextParam()
  2. {
  3.         byte  quotes = NULL;
  4.         int   i;
  5.        
  6.         if (!tagparam) return false;
  7.  
  8.         if (debug_mode) {
  9.                 debug("tag: "); debugln(#tag);
  10.                 debug("tagparam: "); debugln(#tagparam);
  11.         }
  12.        
  13.         i = strlen(#tagparam) - 1;
  14.  
  15.         if (tagparam[i] == '/') i--;
  16.  
  17.         while (i>0) && (__isWhite(tagparam[i])) i--;
  18.  
  19.         if (tagparam[i] == '"') || (tagparam[i] == '\'')
  20.         {
  21.                 //find VAL end
  22.                 quotes = tagparam[i];
  23.                 tagparam[i] = '\0'; i--;
  24.  
  25.                 //find VAL start and copy
  26.                 i = strrchr(#tagparam, quotes);
  27.                 strlcpy(#val, #tagparam + i, sizeof(val)-1);
  28.                 tagparam[i] = '\0'; i--;
  29.  
  30.                 //find ATTR end
  31.                 while (i > 0) && (tagparam[i] != '=') i--;
  32.                 tagparam[i+1] = '\0';
  33.         }
  34.         else
  35.         {
  36.                 //find VAL end
  37.                 //already have
  38.  
  39.                 //find VAL start and copy
  40.                 while (i > 0) && (tagparam[i] != '=') i--;
  41.                 i++;
  42.                 strlcpy(#val, #tagparam + i, sizeof(val)-1);
  43.                 // tagparam[i] = '\0';
  44.  
  45.                 //find ATTR end
  46.                 //already have
  47.         }
  48.  
  49.         //find ATTR start and copy
  50.         while (i>0) && (!__isWhite(tagparam[i])) i--;
  51.         strlcpy(#attr, #tagparam + i + 1, sizeof(attr)-1);
  52.         tagparam[i] = '\0';
  53.  
  54.         //fix case: src=./images/KolibriOS_logo2.jpg?sid=e8ece8b38b
  55.         i = strchr(#attr,'=');
  56.         if (!quotes) && (i) {
  57.                 strlcpy(#val, i+1, sizeof(val)-1);
  58.                 ESBYTE[i+1] = '\0';
  59.         }
  60.  
  61.         strlwr(#attr);
  62.  
  63.         if (debug_mode) {
  64.                 debug("val: "); debugln(#val);
  65.                 debug("attr: "); debugln(#attr);
  66.                 debugln(" ");
  67.         }
  68.  
  69.         return true;
  70. }
  71.  
  72.  
  73.