Beispiel #1
0
static void extrmultipartdata(unsigned char *inbuf, char *partsep,
			      formfield **fields, int maxcount,int *count)
{
  formfield *temparray;
  formfield *tempfield;
  unsigned char *p;
  unsigned char *dstart, *dend;
  int i,len;

  temparray=(formfield *)malloc(maxcount*sizeof(formfield));
  p=inbuf;
  *count=0;
  while(((p=skipsep(p, partsep))!=NULL) && (*count<maxcount)) {
    (*count)++;
    tempfield=&temparray[*count-1];

    getfieldinfo(p,&tempfield->name, &tempfield->attr);
    //    printf("f: %s<br>\n",tempfield->name);

    dstart=skippartheader(p);
    //    printf("d: %c%c%c%c<br>\n",dstart[0],dstart[1],dstart[2],dstart[3]);

    dend=skipdata(dstart,partsep);
    len=dend-dstart;

    tempfield->len=len;
    tempfield->data=(unsigned char *)malloc(len+1);
    for(i=0; i<len; i++) 
      tempfield->data[i]=dstart[i];
    tempfield->data[len]=0;

    p=dend+2;
  }
  
  (*fields)=(formfield *)malloc((*count)*sizeof(formfield));
  for(i=0; i<*count; i++)
    (*fields)[i]=temparray[i];
  free(temparray);
}
Beispiel #2
0
// scan the next symbol
void nextsym() 
{
  // continue until symbol found
  bool symfnd;
  do 
  {
    symfnd = true;
    skipsep();
    symptr = inptr;

    if (inLetters( ch)) // ident or reserved word
    { 
      scanident();
    }
    else 
    {
      if (inDigits( ch)) // number
        scannum();
      else 
      {
        switch( ch) 
        {
          case '"':
          	strToMatch = '"';
          	scanstr();
            break;
          case '\'': 
          	strToMatch = '\'';
            scanstr();
            break;
          case '.':
            sym = per;
            nextchar();
            if ( ch == '.') 
            {
              sym = doubledot;
              nextchar();
            }
            break;
          case ':':
            idassign();
            break;
          case '<': // fall through to case '>', both call relop
          case '>':
            idrelop();
            break;
          case '(': // check for comment
            nextchar();
            if ( ch != '*')
              sym = lparen;
            else // now we know it's a comment
            { 
              symfnd = false;
              nextchar();
              rcomment();
            }
            break;
          case EOF:
            sym = eof_sym;
            break;
          default: // then should be in one of the "special" chars (star, slash, etc.)
            sym = spsym[ ch];
            nextchar();
            break;
        } // end switch
      }   // end if
    }     // end do
  } while (!symfnd);

  // TODO
  //writesym();

} // end nextsym