getconf

Software Screenshot:
getconf
Software Details:
Version: 0.1
Upload Date: 2 Jun 15
Developer: Kevin Waldron
Distribution Type: Freeware
Downloads: 2

Rating: nan/5 (Total Votes: 0)

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;
}

Other Software of Developer Kevin Waldron

uname
uname

2 Jun 15

ZMsgServer
ZMsgServer

3 Jun 15

Comments to getconf

Comments not found
Add Comment
Turn on images!