getconfgetconf is a C program that can retrieve NAME=VALUE pairs from a configuration file. | |
Download |
getconf Ranking & Summary
Advertisement
- License:
- GPL
- Price:
- FREE
- Publisher Name:
- Kevin Waldron
- Publisher web site:
- http://www.zazzybob.com/sh_config.html
getconf Tags
getconf Description
getconf is a C program that can retrieve NAME=VALUE pairs from a configuration file. 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; char *vals; 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)); *(vals+count)=(char *)malloc(strlen(c.val)); strcpy( *(vars+count), c.var ); strcpy( *(vals+count), c.val ); printf( "Variable: %sttValue: %sn", *(vars+count), *(vals+count) ); } /* now cleanup */ for ( count = 0 ; count < lines ; count++ ) { free( vars ); free( vals ); } return 0;}
getconf Related Software