Beispiel #1
0
static int
update_cookie_field (struct cookie *cookie,
		     const char *name_b, const char *name_e,
		     const char *value_b, const char *value_e)
{
  assert (name_b != NULL && name_e != NULL);

  if (!cookie->attr)
    {
      if (!VALUE_EXISTS)
	return 0;
      cookie->attr = strdupdelim (name_b, name_e);
      cookie->value = strdupdelim (value_b, value_e);
      return 1;
    }

  if (NAME_IS ("domain"))
    {
      if (!VALUE_NON_EMPTY)
	return 0;
      FREE_MAYBE (cookie->domain);
      cookie->domain = strdupdelim (value_b, value_e);
      return 1;
    }
  else if (NAME_IS ("path"))
    {
      if (!VALUE_NON_EMPTY)
	return 0;
      FREE_MAYBE (cookie->path);
      cookie->path = strdupdelim (value_b, value_e);
      return 1;
    }
  else if (NAME_IS ("expires"))
    {
      char *value_copy;
      time_t expires;

      if (!VALUE_NON_EMPTY)
	return 0;
      BOUNDED_TO_ALLOCA (value_b, value_e, value_copy);

      expires = http_atotm (value_copy);
      if (expires != -1)
	{
	  cookie->permanent = 1;
	  cookie->expiry_time = (unsigned long)expires;
	}
      else
	/* Error in expiration spec.  Assume default (cookie valid for
	   this session.)  #### Should we return 0 and invalidate the
	   cookie?  */
	;

      /* According to netscape's specification, expiry time in the
	 past means that discarding of a matching cookie is
	 requested.  */
      if (cookie->expiry_time < cookies_now)
	cookie->discard_requested = 1;

      return 1;
    }
  else if (NAME_IS ("max-age"))
    {
      double maxage = -1;
      char *value_copy;

      if (!VALUE_NON_EMPTY)
	return 0;
      BOUNDED_TO_ALLOCA (value_b, value_e, value_copy);

      sscanf (value_copy, "%lf", &maxage);
      if (maxage == -1)
	/* something is wrong. */
	return 0;
      cookie->permanent = 1;
      cookie->expiry_time = (unsigned long)cookies_now + (unsigned long)maxage;

      /* According to rfc2109, a cookie with max-age of 0 means that
	 discarding of a matching cookie is requested.  */
      if (maxage == 0)
	cookie->discard_requested = 1;

      return 1;
    }
  else if (NAME_IS ("secure"))
    {
      /* ignore value completely */
      cookie->secure = 1;
      return 1;
    }
  else
    /* Unrecognized attribute; ignore it. */
    return 1;
}
Beispiel #2
0
void init(int what, int which)
{
	int nu=0;
	
	if(what==PARS) {
	
		DEX("(number of parameters)");
			MOKI=INT+NO;
			NEXT;
		DEX("working path");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_PATH);
			NEXT;
		DEX("working parameters filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_PARSFILE);
			NEXT;
		DEX("minspec filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_MINSPECFILE);
			NEXT;
		DEX("specplex filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_SPECPLEXFILE);
			NEXT;
		DEX("fullplex filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_FULLPLEXFILE);
			NEXT;
		DEX("adsyn control filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_ASCFFILE);
			NEXT;
		DEX("full sco filename");
			MOKI=FNAME+YES;
			ONLY_ON_ALL NAME_IS(DEF_FSCOFILE);
			NEXT;
		DEX("mr-sco filename");
			MOKI=FNAME+YES;
			if(which==ALL) NAME_IS(DEF_MRSCOFILE);
			NEXT;
		DEX("number of points in spec");
			MOKI=INT+NO;
			ONLY_ON_ALL PA_SPECPOI=0;
			NEXT;
		DEX("number of points in fullplex");
			MOKI=INT+NO;
			ONLY_ON_ALL PA_FULLPLEXPOI=0;
			NEXT;
		DEX("maximum x-value in spec/fullplex");
			MOKI=FLOAT+NO;
			ONLY_ON_ALL PA_XMAX=1000.00;
			NEXT;
		DEX("minimum x-value in spec/fullplex");
			MOKI=FLOAT+NO;
			ONLY_ON_ALL PA_XMIN=0.00;
			NEXT;
		DEX("maximum y-value in spec/fullplex");
			MOKI=FLOAT+NO;
			ONLY_ON_ALL PA_YMAX=1000.00;
			NEXT;
		DEX("minimum y-value in spec/fullplex");
			MOKI=FLOAT+NO;
			ONLY_ON_ALL PA_YMIN=0.00;
			NEXT;
		DEX("step increment thru fullplex (positive integer)");
			MOKI=INT+YES;
			PA_STEP=100;
			NEXT;
		DEX("durational unit (in beats)");
			MOKI=FLOAT+YES;
			PA_DURUNIT=1.66F;
			NEXT;
		DEX("max./min. duration multiple/fraction (positive integer)");
			MOKI=INT+YES;
			PA_DURMF=6;
			NEXT;
		DEX("maximum loudness (in dB)");
			MOKI=FLOAT+YES;
			PA_MAXDB=60;
			NEXT;
		DEX("minimum loudness (in dB)");
			MOKI=FLOAT+YES;
			PA_MINDB=40;
			NEXT;
		DEX("minimum [R] pitch (in register.decimal)");
			MOKI=FLOAT+YES;
			PA_MINPCH=5.50F;
			NEXT;
		DEX("maximum [R] pitch (in register.decimal)");
			MOKI=FLOAT+YES;
			PA_MAXPCH=11.00F;
			NEXT;
		DEX("maximum pitch wobble (in percent of pitch value: between 0 and 1)");
			MOKI=FLOAT+YES;
			PA_MAXWOB=.06F;
			NEXT;
		DEX("number of pitch-classes");
			MOKI=INT+YES;
			PA_NPC=12;
			NEXT;
		DEX("minimum distance of sound events (in meters)");
			MOKI=FLOAT+YES;
			PA_MINDIST=2;
			NEXT;
		DEX("maximum distance of sound events (in meters)");
			MOKI=FLOAT+YES;
			PA_MAXDIST=50;
			NEXT;
		DEX("average reverb time (in seconds)");
			MOKI=FLOAT+YES;
			PA_RVBTIME=0.60F;
			NEXT;
		DEX("number of lines on terminal screen");
			MOKI=INT+YES;
			PA_TERMLINES=40;
			NEXT;
		SET_NUMPARAMS;	
	}
	
	if(what==MINSPEC) {
		for(nu=0; nu<MAX_POI; nu++) specxy[nu].x = specxy[nu].y = -1;
		PA_SPECPOI=0;
	}
	
	if(what==SPECPLEX) {
		for(nu=0; nu<MAX_POI; nu++) specplex[nu].x = specplex[nu].y =
								  specplex[nu].hr = specplex[nu].hd = -1;
		PA_SPECPOI=0;
	}
	
	if(what==FULLPLEX) {
		for(nu=0; nu<MAX_POI; nu++) fullplex[nu].x = fullplex[nu].y =
								  fullplex[nu].hr = fullplex[nu].hd = -1;
		PA_FULLPLEXPOI=0;
	}

	if(what==FSCO || what==MRSCO) printf("\n; No need to bother.");
}