(mm) A library to read MS style ini files
Home | Software | Count
Software:
GWT
  GWTOAuthLogin
X/Motif
  ansi xterm
  grabc
  mdgclock
  miv
  mplaymidi
  mppp
  mxascii
  mcmap
  mxcmap
  mxconsole
  mxkill
  mxshowfont
  qtip
  xmastm
  yrolo
Web
  mhttpd
  web counter
  upload.pl
  TimeTrack.pl
  mod_auth_ldap
Games
  fltkmm
  iphonemm
Java
   cdcl
   cdclgwt
   jdgclock
Libraries
  libcalen
  libmcfg
  libsll
  libmsock
Misc
  bangla font
  dpr
  genmake
  hod
  smtp.pl
  vhtml
  phones_ldap
  showpic_ldap
  mbasecalc
  fluid_hack
  kdialppp
  strip2csv
  googlecode-upload
MS Windows
  mwinclip.pl
  mbasecalc
  mailsend
  wiv
libmcfg is a library to read MS style configuraton files. The routines are taken and modified from SAMBA source code. However, do not bug anyone in SAMBA team if you've any question regarding the library, ask me instead. The access poin to the library is:
    int paramProcess(char *filename,int style,int (*sfunc)(char *secname),
                     int (*pfunc)(char *secname,char *paramname));
To look at a real life example of the use of this library, look at the file cfg.c WWW Hompage Counter source code.

  • Download:
    Source
    File: libmcfg.tar.gz
    Size: 5861 bytes
    MD5 Checksum: 5f285475c483ced802f5f8d44c4fbf92
    Last updated: ?

    Example:


    #include <stdio.h>
    #include <string.h>
    
    #include "mcfg.h"
    
    static int doSection(char *sec_name);
    static int doParameter(char *param_name,char *param_value);
    
    static char
        *cursec=(char *) NULL;
    
    static void RegSection(s)
    char
        **s;
    {
        if (cursec != (char *) NULL)
        {
            (void) free(cursec);
            cursec=(char *) NULL;
        }
        if (*s)
            cursec=strdup(*s);
    }
    
    char *GetCurrentSection()
    {
        return(cursec);
    }
    
    static int doSection(char *sec_name)
    {
        int
            rc=0;
        RegSection(&sec_name);
    
        /*
        (void) fprintf(stderr,"[%s]\n",sec_name);
        */
        return(rc);
    }
    
    static int doParameter(char *param_name,char *param_value)
    {
        if (strcmp(param_name,param_value) == 0)
            (void) fprintf(stderr," (%s)\"%s\"\n",
                           GetCurrentSection(),param_name,param_value);
        else
            (void) fprintf(stderr," (%s) \"%s\" \"%s\"\n",
                           GetCurrentSection(),param_name,param_value);
        return(0);
    }
    
    int main (int argc,char **argv) 
    {
        int
            rc;
    
        if (argc != 2)
        {
            (void) fprintf(stderr,"usage: %s <conf file>\n",argv[0]);
            exit(0);
        }
        rc=paramProcess(argv[1],NOT_MS_STYLE,doSection,doParameter);
        if (rc < 0)
        (void) fprintf(stderr," rc=%d\n",rc);
        exit(0);
    }
    

    URL of this page: http://www.muquit.com/muquit/software/libmcfg/libmcfg.html

  • back Page updated: Sun Mar 31 01:59:56 2013 GMT   Copyright © 2013 muquit@muquit.com.