コード例 #1
0
ファイル: HTGroup.c プロジェクト: OS2World/APP-INTERNET-Lynx
PRIVATE void print_group_def_list ARGS1(GroupDefList *, group_list)
{
    GroupDefList *cur = group_list;
    GroupDef *group_def;
    
    while (NULL != (group_def = (GroupDef*)HTList_nextObject(cur)))
	HTAA_printGroupDef(group_def);
}
コード例 #2
0
void HTAA_parseProtFile( HTAAProt *prot, FILE *fp )
{
  if ( prot && fp )
  {
    LexItem lex_item;
    char *fieldname = 0;
    do
    {
      lex_item = lex( fp );
      if ( lex_item != LEX_EOF )
      {
        for ( ; lex_item == LEX_REC_SEP;  )
        {
          lex_item = lex( fp );
        }
        if ( lex_item == LEX_EOF )
          goto B7;
        else
        {
          if ( lex_item == LEX_ALPH_STR )
          {
            HTSACopy( &fieldname, HTlex_buffer );
            lex_item = lex( fp );
            if ( lex_item != LEX_FIELD_SEP )
              unlex( lex_item );
            if ( strncasecomp( fieldname, "Auth", 4 ) == 0 )
            {
              lex_item = lex( fp );
              do
              {
                if ( lex_item == LEX_ALPH_STR )
                {
                  HTAAScheme scheme = HTAAScheme_enum( HTlex_buffer );
                  if ( scheme )
                  {
                    if ( prot->valid_schemes == 0 )
                    {
                      prot->valid_schemes = HTList_new( );
                    }
                    HTList_addObject( &prot->valid_schemes, &scheme );
                    if ( WWW_TraceFlag )
                    {
                      fprintf( TraceFP( ), "%s %s `%s'\n", "HTAA_parseProtFile: valid", "authentication scheme:", HTAAScheme_name( scheme ) );
                    }
                  }
                  else
                  if ( WWW_TraceFlag )
                  {
                    fprintf( TraceFP( ), "%s %s `%s'\n", "HTAA_parseProtFile: unknown", "authentication scheme:", HTlex_buffer );
                  }
                  lex( fp );
                  while ( lex_item = lex( fp ), lex_item == LEX_ITEM_SEP )
                  {
                    lex( fp );
                  }
                }
              }
              while ( lex_item != LEX_REC_SEP );
            }
            else
            {
              if ( strncasecomp( fieldname, "mask", 4 ) == 0 )
              {
                prot->mask_group = HTAA_parseGroupDef( fp );
                lex_item = LEX_REC_SEP;
                if ( WWW_TraceFlag )
                {
                  if ( prot->mask_group )
                  {
                    fwrite( "HTAA_parseProtFile: Mask group:\n", 1, 32, TraceFP( ) );
                    HTAA_printGroupDef( &prot->mask_group );
                  }
                  else
                  {
                    fwrite( "HTAA_parseProtFile: Mask group syntax error\n", 1, 44, TraceFP( ) );
                  }
                }
              }
              else
              {
                lex_item = lex( fp );
                if ( lex_item == LEX_ALPH_STR )
                {
                  if ( prot->values == 0 )
                  {
                    prot->values = HTAssocList_new( );
                  }
                  HTAssocList_add( &prot->values, fieldname, HTlex_buffer );
                  lex_item = lex( fp );
                  if ( WWW_TraceFlag )
                  {
                    fprintf( TraceFP( ), "%s `%s' bound to value `%s'\n", "HTAA_parseProtFile: Name", fieldname, HTlex_buffer );
                  }
                }
              }
            }
          }
          if ( lex_item != LEX_EOF && lex_item != LEX_REC_SEP )
          {
            if ( WWW_TraceFlag )
            {
              fprintf( TraceFP( ), "%s %s %d (that line ignored)\n", "HTAA_parseProtFile: Syntax error", "in protection setup file at line", HTlex_line );
            }
            do
            {
              lex_item = lex( fp );
            }
            while ( lex_item != LEX_EOF && lex_item != LEX_REC_SEP );
          }
        }
      }
B7:;
      if ( fieldname == 0 )
        break;
      free( fieldname );
      break;
    }
    while ( lex_item != LEX_REC_SEP );
  }
  return;
}