summaryrefslogtreecommitdiff
path: root/source4/param/params.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-25 01:12:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:33 -0500
commitdcd27d550fcc6fc8ddbec2f4a310a862f3fbbffc (patch)
tree48e603b8172393f14df0af969567e58d8675130c /source4/param/params.c
parent2dc45bd4841a0b7ea640d9a41e381f4601809262 (diff)
downloadsamba-dcd27d550fcc6fc8ddbec2f4a310a862f3fbbffc.tar.gz
samba-dcd27d550fcc6fc8ddbec2f4a310a862f3fbbffc.tar.bz2
samba-dcd27d550fcc6fc8ddbec2f4a310a862f3fbbffc.zip
r9602: Add support for reading share_info.tdb and smb.conf.
Add userdata argument to function pointers for pm_process() (This used to be commit 84b2fb34675fa557173621433838c5a7ec0f1283)
Diffstat (limited to 'source4/param/params.c')
-rw-r--r--source4/param/params.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source4/param/params.c b/source4/param/params.c
index d59e11a895..0ce416c00a 100644
--- a/source4/param/params.c
+++ b/source4/param/params.c
@@ -189,7 +189,7 @@ static int Continuation(char *line, int pos )
}
-static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
+static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *, void *), void *userdata )
/* ------------------------------------------------------------------------ **
* Scan a section name, and pass the name to function sfunc().
*
@@ -246,7 +246,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
DEBUG(0, ("%s Empty section name in configuration file.\n", func ));
return( False );
}
- if( !sfunc(InFile->bufr) ) /* Got a valid name. Deal with it. */
+ if( !sfunc(InFile->bufr,userdata) ) /* Got a valid name. Deal with it. */
return( False );
(void)EatComment( InFile ); /* Finish off the line. */
return( True );
@@ -285,7 +285,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
return( False );
} /* Section */
-static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *), int c )
+static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *, void *), int c, void *userdata )
/* ------------------------------------------------------------------------ **
* Scan a parameter name and value, and pass these two fields to pfunc().
*
@@ -429,12 +429,13 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *)
}
InFile->bufr[end] = '\0'; /* End of value. */
- return( pfunc( InFile->bufr, &InFile->bufr[vstart] ) ); /* Pass name & value to pfunc(). */
+ return( pfunc( InFile->bufr, &InFile->bufr[vstart], userdata ) ); /* Pass name & value to pfunc(). */
} /* Parameter */
static BOOL Parse( myFILE *InFile,
- BOOL (*sfunc)(const char *),
- BOOL (*pfunc)(const char *, const char *) )
+ BOOL (*sfunc)(const char *, void *),
+ BOOL (*pfunc)(const char *, const char *, void *),
+ void *userdata )
/* ------------------------------------------------------------------------ **
* Scan & parse the input.
*
@@ -474,7 +475,7 @@ static BOOL Parse( myFILE *InFile,
break;
case '[': /* Section Header. */
- if( !Section( InFile, sfunc ) )
+ if( !Section( InFile, sfunc, userdata ) )
return( False );
c = EatWhitespace( InFile );
break;
@@ -484,7 +485,7 @@ static BOOL Parse( myFILE *InFile,
break;
default: /* Parameter line. */
- if( !Parameter( InFile, pfunc, c ) )
+ if( !Parameter( InFile, pfunc, c, userdata ) )
return( False );
c = EatWhitespace( InFile );
break;
@@ -527,8 +528,9 @@ static myFILE *OpenConfFile( const char *FileName )
} /* OpenConfFile */
BOOL pm_process( const char *FileName,
- BOOL (*sfunc)(const char *),
- BOOL (*pfunc)(const char *, const char *) )
+ BOOL (*sfunc)(const char *, void *),
+ BOOL (*pfunc)(const char *, const char *, void *),
+ void *userdata)
/* ------------------------------------------------------------------------ **
* Process the named parameter file.
*
@@ -554,7 +556,7 @@ BOOL pm_process( const char *FileName,
DEBUG( 3, ("%s Processing configuration file \"%s\"\n", func, FileName) );
if( NULL != InFile->bufr ) /* If we already have a buffer */
- result = Parse( InFile, sfunc, pfunc ); /* (recursive call), then just */
+ result = Parse( InFile, sfunc, pfunc, userdata ); /* (recursive call), then just */
/* use it. */
else /* If we don't have a buffer */
@@ -567,7 +569,7 @@ BOOL pm_process( const char *FileName,
myfile_close(InFile);
return( False );
}
- result = Parse( InFile, sfunc, pfunc );
+ result = Parse( InFile, sfunc, pfunc, userdata );
InFile->bufr = NULL;
InFile->bSize = 0;
}