(mm) | A library to read MS style ini files | ||||||||||
Home | Software | Count | |||||||||||
Software: GWT GWTOAuthLogin iPhone/iPad iOSExamples BiteByteConverter X/Motif ansi xterm grabc mdgclock miv mplaymidi mppp mxascii mcmap mxcmap mxconsole mxkill mxshowfont qtip xmastm yrolo Web privategpt mhttpd web counter upload.pl TimeTrack.pl mod_auth_ldap Games fltkmm iphonemm Go (cross-platform) go-xbuild-go mailsend-go markdown-toc-go gomail-fork githubdownloadcount genmake-go github-profilegen-go hod-go applehealth2csv Java cdcl cdclgwt jdgclock Libraries libcalen libmcfg libsll libmsock Java cdcl cdclgwt jdgclock Libraries libcalen libmcfg libsll libmsock Misc cubic-fix bangla font dpr genmake hod smtp.pl vhtml phones_ldap showpic_ldap mbasecalc fluid_hack kdialppp strip2csv googlecode-upload mrdialog RNCryptor-C MS Windows mwinclip.pl mbasecalc mailsend wiv mouse_mover |
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.
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: |
||||||||||
back | Page updated: Thu Oct 9 05:02:23 2025 GMT Copyright © 2025 muquit@gmail.com. |