A
download grubconf.c
Language: C
License: GPL
Copyright: (C) 2001, Grub, Inc. */
LOC: 30
Project Info
grub.org - Distributed Internet Crawler(grub)
Server: SourceForge
Type: cvs
...ge\g\grub\grub\client\util\
   alt_ftw.c
   alt_ftw.h
   bin_test_util.dsp
   clog.cpp
   clog.h
   ConfigFileInfo.h
   crc.h
   crc_32.c
   crc_32.cpp
   crc_32.h
   crc_test.c
   crc_test.cpp
   crc32.c
   crc32.h
   dbl_list.c
   dbl_list.h
   delay.cpp
   delay.h
   diagnose.h
   fc32.c
   file_data.c
   file_data.h
   getopt.c
   getopt.h
   grubconf.c
   grubconf.h
   GrubExp.cpp
   GrubExp.h
   Gui.cpp
   Gui.h
   intl.h
   lib_util.dsp
   lockfile.cpp
   lockfile.h
   Makefile.am
   parsecfg.c
   parsecfg.h
   platform.h
   rmfiles.c
   rmfiles.h
   ServerSettings.cpp
   ServerSettings.h
   sniptype.h
   StatusInterface.cpp
   StatusInterface.h
   strip_url.c
   strip_url.h
   test_util.cpp

/**************************************************************************/
/*                                                                        */
/*  grubcfg - module to parse the client configuration file               */
/*  Uses parsecfg library written by Yuuki Ninomiya <gm@debian.org.jp>    */
/*  Based on simple.c code written by Yuuki Ninomiya <gm@debian.org.jp>   */
/*                                                                        */
/*  Copyright (C) 2001, Grub, Inc.                                        */
/*  Author: Kord Campbell <kord@grub.org>                                 */
/*                                                                        */
/*  This program is free software; you can redistribute it and/or modify  */
/*  it under the terms of the GNU General Public License as published by  */
/*  the Free Software Foundation; either version 2, or (at your option)   */
/*  any later version.                                                    */
/*                                                                        */
/*  This program is distributed in the hope that it will be useful,       */
/*  but WITHOUT ANY WARRANTY; without even the implied warranty of        */
/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         */
/*  GNU General Public License for more details.                          */
/*                                                                        */
/*  You should have received a copy of the GNU General Public License     */
/*  along with this program; if not, write to the                         */
/*  Free Software Foundation, Inc., 59 Temple Place - Suite 330,          */
/*  Boston, MA 02111-1307, USA.                                           */
/*                                                                        */
/**************************************************************************/ 

#include "grubconf.h"

/* extern this variable and set it to the proper path and file */
char *grub_config_file = NULL;

int readGrubConfig(struct Config_Info *Config_File_Info)
{

  int cfg_int;
  char *cfg_str;	/* pointer to string (stored real string is allocated dynamically.) */


  cfgStruct cfg[]={	/* this must be initialized */
	/* parameter		type		address of variable */
	{"ClientID"		,CFG_INT	,&Config_File_Info->ClientID  },
	{"AltClientID"		,CFG_UINT	,&Config_File_Info->AltClientID  },
	{"ClientPassword"	,CFG_STRING	,&Config_File_Info->ClientPassword },
	{"MaxAmountOfBandwidth"	,CFG_INT	,&Config_File_Info->MaxAmountOfBandwidth },
	{"NumOfCrawlersToRun"	,CFG_INT	,&Config_File_Info->NumOfCrawlersToRun },
	{"ThreadsPerHost"	,CFG_INT	,&Config_File_Info->ThreadsPerHost },
	{"PortNumber"		,CFG_INT	,&Config_File_Info->PortNumber },
	{"Proxy"		,CFG_STRING	,&Config_File_Info->Proxy },
	{"ProxyUserName"	,CFG_STRING	,&Config_File_Info->ProxyUserName },
	{"ProxyPassword"	,CFG_STRING	,&Config_File_Info->ProxyPassword},
	{"ProxyPort"		,CFG_INT	,&Config_File_Info->ProxyPort },
	{"GrubLogLevel"		,CFG_INT	,&Config_File_Info->GrubLogLevel },
	{NULL ,CFG_END ,NULL}	/* no more parameters */
  };

  if ( ! grub_config_file ) {

	fprintf( stderr, "grub: grub config file is not set -- BUG??\n" );
	return 1;
  }

  if (cfgParse(grub_config_file,cfg,CFG_SIMPLE)==-1){
	return 1;
  }

  return(0);
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us