Ejemplo n.º 1
0
/*	Load one line of configuration
 *	------------------------------
 *
 *	Call this, for example, to load a X resource with config info.
 *
 * returns	0 OK, < 0 syntax error.
 */
int HTSetConfiguration(char *config)
{
    HTRuleOp op;
    char *line = NULL;
    char *pointer = line;
    char *word1;
    const char *word2;
    const char *word3;
    const char *cond_op = NULL;
    const char *cond = NULL;
    float quality, secs, secs_per_byte;
    int maxbytes;
    int status;

    StrAllocCopy(line, config);
    {
	char *p = strchr(line, '#');	/* Chop off comments */

	if (p)
	    *p = 0;
    }
    pointer = line;
    word1 = HTNextField(&pointer);
    if (!word1) {
	FREE(line);
	return 0;
    };				/* Comment only or blank */

    word2 = HTNextField(&pointer);

    if (0 == strcasecomp(word1, "defprot") ||
	0 == strcasecomp(word1, "protect"))
	word3 = pointer;	/* The rest of the line to be parsed by AA module */
    else
	word3 = HTNextField(&pointer);	/* Just the next word */

    if (!word2) {
	fprintf(stderr, "HTRule: %s %s\n", RULE_NEEDS_DATA, line);
	FREE(line);
	return -2;		/*syntax error */
    }

    if (0 == strcasecomp(word1, "suffix")) {
	char *encoding = HTNextField(&pointer);

	if (pointer)
	    status = sscanf(pointer, "%f", &quality);
	else
	    status = 0;
	HTSetSuffix(word2, word3,
		    encoding ? encoding : "binary",
		    status >= 1 ? quality : (float) 1.0);

    } else if (0 == strcasecomp(word1, "presentation")) {
	if (pointer)
	    status = sscanf(pointer, "%f%f%f%d",
			    &quality, &secs, &secs_per_byte, &maxbytes);
	else
	    status = 0;
	HTSetPresentation(word2, word3, NULL,
			  status >= 1 ? quality : 1.0,
			  status >= 2 ? secs : 0.0,
			  status >= 3 ? secs_per_byte : 0.0,
			  status >= 4 ? maxbytes : 0,
			  mediaCFG);

    } else if (0 == strncasecomp(word1, "htbin", 5) ||
	       0 == strncasecomp(word1, "bindir", 6)) {
	StrAllocCopy(HTBinDir, word2);	/* Physical /htbin location */

    } else if (0 == strncasecomp(word1, "search", 6)) {
	StrAllocCopy(HTSearchScript, word2);	/* Search script name */

    } else {
	op = 0 == strcasecomp(word1, "map") ? HT_Map
	    : 0 == strcasecomp(word1, "pass") ? HT_Pass
	    : 0 == strcasecomp(word1, "fail") ? HT_Fail
	    : 0 == strcasecomp(word1, "redirect") ? HT_Redirect
	    : 0 == strncasecomp(word1, "redirectperm", 12) ? HT_RedirectPerm
	    : 0 == strcasecomp(word1, "redirecttemp") ? HT_Redirect
	    : 0 == strcasecomp(word1, "permitredirection") ? HT_PermitRedir
	    : 0 == strcasecomp(word1, "useproxy") ? HT_UseProxy
	    : 0 == strcasecomp(word1, "alert") ? HT_Alert
	    : 0 == strcasecomp(word1, "alwaysalert") ? HT_AlwaysAlert
	    : 0 == strcasecomp(word1, "progress") ? HT_Progress
	    : 0 == strcasecomp(word1, "usermsg") ? HT_UserMsg
	    : 0 == strcasecomp(word1, "infomsg") ? HT_InfoMsg
	    : 0 == strcasecomp(word1, "defprot") ? HT_DefProt
	    : 0 == strcasecomp(word1, "protect") ? HT_Protect
	    : HT_Invalid;
	if (op == HT_Invalid) {
	    fprintf(stderr, "HTRule: %s '%s'\n", RULE_INCORRECT, config);
	} else {
	    switch (op) {
	    case HT_Fail:	/* never a or other 2nd parameter */
	    case HT_PermitRedir:
		cond_op = word3;
		if (cond_op && *cond_op) {
		    word3 = NULL;
		    cond = HTNextField(&pointer);
		}
		break;

	    case HT_Pass:	/* possibly a URL2 */
		if (word3 && (!strcasecomp(word3, "if") ||
			      !strcasecomp(word3, "unless"))) {
		    cond_op = word3;
		    word3 = NULL;
		    cond = HTNextField(&pointer);
		    break;
		}
		/* else fall through */
	    case HT_Map:	/* always a URL2 (or other 2nd parameter) */
	    case HT_Redirect:
	    case HT_RedirectPerm:
	    case HT_UseProxy:
		cond_op = HTNextField(&pointer);
		/* check for extra status word in "Redirect" */
		if (op == HT_Redirect && 0 == strcasecomp(word1, "redirect") &&
		    cond_op &&
		    strcasecomp(cond_op, "if") &&
		    strcasecomp(cond_op, "unless")) {
		    if (0 == strcmp(word2, "301") ||
			0 == strcasecomp(word2, "permanent")) {
			op = HT_RedirectPerm;
		    } else if (!(0 == strcmp(word2, "302") ||
				 0 == strcmp(word2, "303") ||
				 0 == strcasecomp(word2, "temp") ||
				 0 == strcasecomp(word2, "seeother"))) {
			CTRACE((tfp, "Rule: Ignoring `%s' in Redirect\n", word2));
		    }
		    word2 = word3;
		    word3 = cond_op;	/* cond_op isn't condition op after all */
		    cond_op = HTNextField(&pointer);
		}
		if (cond_op && *cond_op)
		    cond = HTNextField(&pointer);
		break;

	    case HT_Progress:
	    case HT_InfoMsg:
	    case HT_UserMsg:
	    case HT_Alert:
	    case HT_AlwaysAlert:
		cond_op = HTNextField(&pointer);
		if (cond_op && *cond_op)
		    cond = HTNextField(&pointer);
		if (word3) {	/* Fix string with too may %s - kw */
		    const char *cp = word3;
		    char *cp1, *cp2;

		    while ((cp1 = strchr(cp, '%'))) {
			if (cp1[1] == '\0') {
			    *cp1 = '\0';
			    break;
			} else if (cp1[1] == '%') {
			    cp = cp1 + 2;
			    continue;
			} else
			    while ((cp2 = strchr(cp1 + 2, '%'))) {
				if (cp2[1] == '\0') {
				    *cp2 = '\0';
				    break;
				} else if (cp2[1] == '%') {
				    cp1 = cp2;
				} else {
				    *cp2 = '?';		/* replace bad % */
				    cp1 = cp2;
				}
			    }
			break;
		    }
		}
		break;

	    default:
		break;
	    }
	    if (cond_op && cond && *cond && !strcasecomp(cond_op, "unless")) {
		cond_op = "unless";
	    } else if (cond_op && cond && *cond &&
		       !strcasecomp(cond_op, "if")) {
		cond_op = "if";
	    } else if (cond_op || cond) {
		fprintf(stderr, "HTRule: %s '%s'\n", RULE_INCORRECT, config);
		FREE(line);	/* syntax error, condition is a mess - kw */
		return -2;	/* NB unrecognized cond passes here - kw */
	    }
	    if (cond && !strncasecomp(cond, "redirected", strlen(cond))) {
		cond = "redirected";	/* recognized, canonical case - kw */
	    } else if (cond && strlen(cond) >= 8 &&
		       !strncasecomp(cond, "userspecified", strlen(cond))) {
		cond = "userspec";	/* also allow abbreviation - kw */
	    }
	    HTAddRule(op, word2, word3, cond_op, cond);
	}
    }
    FREE(line);
    return 0;
}
Ejemplo n.º 2
0
void HTFormatInit( void )
{
  AcceptMedia media = mediaEXT;
  if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
  {
    fprintf( TraceFP( ), "HTFormatInit\n" );
  }
  if ( LYgetXDisplay( ) )
  {
    HTSetPresentation( "application/postscript", "ghostview %s&", 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
    if ( XLoadImageCommand && XLoadImageCommand[0] )
    {
      HTSetPresentation( "image/gif", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-xbm", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-xbitmap", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-png", XLoadImageCommand, 0, 2.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/png", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-rgb", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/x-tiff", XLoadImageCommand, 0, 2.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/tiff", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
      HTSetPresentation( "image/jpeg", XLoadImageCommand, 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
    }
    HTSetPresentation( "video/mpeg", "mpeg_play %s &", 0, 1.000000000000, 3.000000000000, 0.000000000000, 0, media );
  }
  HTSetPresentation( "application/x-csh", "csh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  HTSetPresentation( "application/x-sh", "sh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  HTSetPresentation( "application/x-ksh", "ksh %s", 0, 999.000000000000, 3.000000000000, 0.000000000000, 0, media );
  media = mediaINT;
  HTSetConversion( "message/x-http-redirection", "*", &HTMIMERedirect, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "message/x-http-redirection", "www/present", &HTMIMERedirect, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "message/x-http-redirection", "www/debug", &HTMIMERedirect, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/present", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/download", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/source", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/mime", "www/dump", &HTMIMEConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/download", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/present", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/source", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/compressed", "www/dump", &HTCompressed, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "text/x-c", &HTMLToC, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/css", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/xhtml+xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/html", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/present", &HTWSRCConvert, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/download", &HTWSRCConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "application/x-wais-source", "www/dump", &HTWSRCConvert, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "www/source", "www/present", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/source", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/download", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "*", &HTSaveToFile, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "www/source", "www/dump", &HTDumpToStdout, 1.000000000000, 3.000000000000, 0.0, 0, 2 );
  HTSetConversion( "text/x-sgml", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/x-sgml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/sgml", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/sgml", "www/present", &HTMLPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/css", "www/present", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/plain", "www/present", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/plain", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "www/source", &HTPlainPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "text/x-c", &HTMLToC, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "text/plain", &HTMLToPlain, 0.500000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/html", "www/present", &HTMLPresent, 1.000000000000, 0.0, 0.0, 0, 1 );
  HTSetConversion( "text/xml", "www/present", &HTMLPresent, 2.000000000000, 0.0, 0.0, 0, 1 );
  if ( LYisAbsPath( global_type_map ) & 255 )
    HTLoadTypesConfigFile( global_type_map, 16 );
  if ( ( IsOurFile( LYAbsOrHomePath( &personal_type_map ) ) & 255 ) && ( LYCanReadFile( personal_type_map ) & 255 ) )
    HTLoadTypesConfigFile( personal_type_map, 8 );
  HTReorderPresentation( HTAtom_for( "text/plain" ), HTAtom_for( "www/present" ) );
  HTReorderPresentation( HTAtom_for( "text/html" ), HTAtom_for( "www/present" ) );
  HTFilterPresentations( );
  return;
}
Ejemplo n.º 3
0
int ProcessMailcapEntry( FILE *fp, struct MailcapEntry *mc, AcceptMedia media )
{
  size_t rawentryalloc = 2000;
  size_t len;
  size_t need;
  char *rawentry, *s, *t;
  char *LineBuf = 0;
  rawentry = malloc( ( rawentryalloc ) * sizeof( char ) );
  if ( rawentry == 0 )
  {
    ExitWithError( gettext( "Memory exhausted!  Program aborted!" ) );
  }
  rawentry[0] = 0;
  while ( LYSafeGets( &LineBuf, fp ) == 0 )
  {
    LYTrimNewline( LineBuf );
    if ( LineBuf[0] != '#' && LineBuf[0] )
    {
      len = strlen( LineBuf );
      need = len + strlen( rawentry ) + 1;
      if ( rawentryalloc < need )
      {
        rawentryalloc = rawentryalloc + need + 2000;
        rawentry = realloc( rawentry, ( rawentryalloc ) * sizeof( char ) );
        if ( rawentry == 0 )
        {
          ExitWithError( gettext( "Memory exhausted!  Program aborted!" ) );
        }
      }
      if ( len && LineBuf[ len + -1 ] == '\\' )
      {
        LineBuf[ len + -1 ] = 0;
        strcat( rawentry, LineBuf );
      }
      else
      {
        strcat( rawentry, LineBuf );
        break;
      }
    }
  }
  if ( LineBuf )
  {
    free( LineBuf );
    LineBuf = 0;
  }
  t = s = LYSkipBlanks( rawentry );
  if ( s[0] == 0 )
  {
    if ( rawentry )
    {
      free( rawentry );
      rawentry = 0;
    }
    return 0;
  }
  else
  {
    s = strchr( rawentry, ';' );
    if ( s == 0 )
    {
      if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
      {
        fprintf( TraceFP( ), "ProcessMailcapEntry: Ignoring invalid mailcap entry: %s\n", rawentry );
      }
      if ( rawentry )
      {
        free( rawentry );
        rawentry = 0;
      }
      return 0;
    }
    else
    {
      s[0] = 0;
      s++;
      if ( strncasecomp( t, "text/html", 9 ) == 0 || strncasecomp( t, "text/plain", 10 ) == 0 )
      {
        s = &s[ -1 ];
        s[0] = ';';
        if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
        {
          fprintf( TraceFP( ), "ProcessMailcapEntry: Ignoring mailcap entry: %s\n", rawentry );
        }
        if ( rawentry )
        {
          free( rawentry );
          rawentry = 0;
        }
        return 0;
      }
      else
      {
        LYRemoveBlanks( rawentry );
        LYLowerCase( rawentry );
        *(int*)&mc->needsterminal = 0;
        *(int*)&mc->copiousoutput = 0;
        *(int*)&mc->needtofree = 1;
        *(int*)&mc->testcommand = 0;
        *(int*)&mc->label = 0;
        *(int*)&mc->printcommand = 0;
        *(int*)&mc->contenttype[0] = 0;
        HTSACopy( &mc->contenttype, rawentry );
        *(int*)&mc->quality = 0x3f800000;
        *(int*)&mc->maxbytes = 0;
        t = GetCommand( s, &mc->command );
        if ( t )
        {
          s = LYSkipBlanks( t );
          for ( ; s;  )
          {
            char *arg, *eq, *mallocd_string;
            t = GetCommand( s, &mallocd_string );
            arg = mallocd_string;
            eq = strchr( arg, '=' );
            if ( eq )
            {
              eq[0] = 0;
              eq++;
              eq = LYSkipBlanks( eq );
            }
            if ( arg && arg[0] )
            {
              arg = Cleanse( arg );
              if ( strcmp( arg, "needsterminal" ) == 0 )
                *(int*)&mc->needsterminal = 1;
              else
              {
                if ( strcmp( arg, "copiousoutput" ) == 0 )
                  *(int*)&mc->copiousoutput = 1;
                else
                if ( eq && strcmp( arg, "test" ) == 0 )
                {
                  *(int*)&mc->testcommand = 0;
                  HTSACopy( &mc->testcommand, eq );
                  TrimCommand( &mc->testcommand );
                  if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
                  {
                    fprintf( TraceFP( ), "ProcessMailcapEntry: Found testcommand:%s\n", &mc->testcommand );
                  }
                }
                else
                if ( eq && strcmp( arg, "description" ) == 0 )
                  mc->label = eq;
                else
                if ( eq && strcmp( arg, "label" ) == 0 )
                  mc->label = eq;
                else
                if ( eq && strcmp( arg, "print" ) == 0 )
                  mc->printcommand = eq;
                else
                if ( eq == 0 || strcmp( arg, "textualnewlines" ) )
                {
                  if ( eq && strcmp( arg, "q" ) == 0 )
                  {
                    mc->quality = atof( eq );
                    if ( mc->quality > 0 && mc->quality < 0.001000000000 )
                      *(int*)&mc->quality = 0x3a83126f;
                  }
                  else
                  if ( eq && strcmp( arg, "mxb" ) == 0 )
                  {
                    mc->maxbytes = atol( eq );
                    if ( mc->maxbytes < 0 )
                      *(int*)&mc->maxbytes = 0;
                  }
                  else
                  {
                    if ( strcmp( arg, "notes" ) && arg[0] && WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
                    {
                      fprintf( TraceFP( ), "ProcessMailcapEntry: Ignoring mailcap flag '%s'.\n", arg );
                    }
                  }
                }
              }
            }
            if ( mallocd_string )
            {
              free( mallocd_string );
              mallocd_string = 0;
            }
            s = t;
          }
        }
        if ( rawentry )
        {
          free( rawentry );
          rawentry = 0;
        }
        if ( PassesTest( mc ) )
        {
          if ( WWW_TraceFlag && ( WWW_TraceMask & 8 ) )
          {
            fprintf( TraceFP( ), "ProcessMailcapEntry Setting up conversion %s : %s\n", &mc->contenttype[0], &mc->command );
          }
          HTSetPresentation( &mc->contenttype[0], &mc->command, &mc->testcommand, mc->quality, 3.000000000000, 0.000000000000, mc->maxbytes, media );
        }
        if ( mc->command )
        {
          free( &mc->command );
          *(int*)&mc->command = 0;
        }
        if ( mc->testcommand )
        {
          free( &mc->testcommand );
          *(int*)&mc->testcommand = 0;
        }
        if ( mc->contenttype[0] )
        {
          free( &mc->contenttype[0] );
          *(int*)&mc->contenttype[0] = 0;
        }
        return 1;
      }
    }
  }
}
Ejemplo n.º 4
0
/*	Load one line of configuration
**	------------------------------
**
**	Call this, for example, to load a X resource with config info.
**
** returns	0 OK, < 0 syntax error.
*/
PUBLIC int HTSetConfiguration ARGS1(CONST char *, config)
{
    HTRuleOp op;
    char * line = NULL;
    char * pointer = line;
    char *word1, *word2, *word3;
    float quality, secs, secs_per_byte;
    int status;
    
    StrAllocCopy(line, config);
    {
	char * p = strchr(line, '#');	/* Chop off comments */
	if (p) *p = 0;
    }
    pointer = line;
    word1 = HTNextField(&pointer);
    if (!word1) {
    	free(line);
	return 0;
    } ;	/* Comment only or blank */

    word2 = HTNextField(&pointer);
    word3 = HTNextField(&pointer);

    if (!word2) {
	fprintf(stderr, "HTRule: Insufficient operands: %s\n", line);
	free(line);
	return -2;	/*syntax error */
    }

    if (0==strcasecomp(word1, "suffix") ||
	0==strcasecomp(word1, "addtype")) {
        char * encoding = HTNextField(&pointer);
	if (pointer) status = sscanf(pointer, "%f", &quality);
	else status = 0;
	HTAddType(word2,	word3,
				encoding ? encoding : "binary",
				status >= 1? quality : 1.0);

    } else if (0==strcasecomp(word1, "addencoding")) {
	if (pointer)
	    status = sscanf(pointer, "%f", &quality);
	else status = 0;
	HTAddEncoding(word2, word3,
		      status >= 1 ? quality : 1.0);

    } else if (0==strcasecomp(word1, "addlanguage")) {
	if (pointer)
	    status = sscanf(pointer, "%f", &quality);
	else status = 0;
	HTAddLanguage(word2, word3,
		      status >= 1 ? quality : 1.0);

    } else if (0==strcasecomp(word1, "presentation")) {
        if (pointer) status = sscanf(pointer, "%f%f%f",
			    &quality, &secs, &secs_per_byte);
        else status = 0;
	if (!HTConversions) HTConversions = HTList_new();
	HTSetPresentation(HTConversions, word2, word3,
		    status >= 1? quality 		: 1.0,
		    status >= 2 ? secs 			: 0.0,
		    status >= 3 ? secs_per_byte 	: 0.0 );

    } else {
	op =	0==strcasecomp(word1, "map")  ?	HT_Map
	    :	0==strcasecomp(word1, "pass") ?	HT_Pass
	    :	0==strcasecomp(word1, "fail") ?	HT_Fail
	    :					HT_Invalid;
	if (op==HT_Invalid) {
	    CTRACE(stderr, "HTRule: Bad rule `%s'\n", config);
	} else {  
	    HTAddRule(op, word2, word3);
	} 
    }
    free(line);
    return 0;
}