getconf 0.1

getconf is a C program that can retrieve NAME=VALUE pairs from a configuration file.

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
GPL (GNU General Public License) 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Kevin Waldron
HOMEPAGE:
www.zazzybob.com
CATEGORY:
ROOT \ Utilities
getconf is a C program that can retrieve NAME=VALUE pairs from a configuration file.

Sample:

#include < stdio.h >
#include < stdlib.h >
#include < string.h >
#include "getconf.h"

int main( int argc, char *argv[] )
{
struct config c;
char *vars[MAX_LINES];
char *vals[MAX_LINES];
char *configfile = "getconf_test.conf";
int lines;
int count;

lines = open_file( configfile );
if ( lines < 0 )
{
fprintf( stderr, "Could not read config file %sn", configfile );
exit( EXIT_FAILURE );
}

get_config( &c );

for ( count = 0 ; count < lines ; count++ )
{
*(vars+count)=(char *)malloc(strlen(c.var[count]));
*(vals+count)=(char *)malloc(strlen(c.val[count]));
strcpy( *(vars+count), c.var[count] );
strcpy( *(vals+count), c.val[count] );
printf( "Variable: %sttValue: %sn", *(vars+count), *(vals+count) );
}

/* now cleanup */
for ( count = 0 ; count < lines ; count++ )
{
free( vars[count] );
free( vals[count] );
}
return 0;
}

Last updated on March 13th, 2007

#retrieve NAME #retrieve VALUE #configuration file #getconf #retrieve #NAME #VALUE

Add your review!

SUBMIT