Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Utilities

    getconf 0.1

    Download button

    No screenshots available
    Downloads: 1,507  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kevin Waldron | More programs
    GPL / FREE
    March 13th, 2007, 15:53 GMT
    ROOT / Utilities

     Read user reviews (0)  Refer to a friend  Subscribe

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

    Product's homepage

      


    TAGS:

    retrieve NAME | retrieve VALUE | configuration file | getconf | retrieve | NAME

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM