version 1.1.1.2, 2013/10/14 07:51:14
|
version 1.1.1.3, 2021/03/17 00:32:36
|
Line 1
|
Line 1
|
/* This modules is based on the params.c module from Samba, written by Karl Auer |
/* This modules is based on the params.c module from Samba, written by Karl Auer |
and much modifed by Christopher Hertel. */ | and much modified by Christopher Hertel. */ |
|
|
/* |
/* |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
Line 59
|
Line 59
|
* beginning with either a semicolon (';') or a pound sign ('#'). |
* beginning with either a semicolon (';') or a pound sign ('#'). |
* |
* |
* All whitespace in section names and parameter names is compressed |
* All whitespace in section names and parameter names is compressed |
* to single spaces. Leading and trailing whitespace is stipped from | * to single spaces. Leading and trailing whitespace is stripped from |
* both names and values. |
* both names and values. |
* |
* |
* Only the first equals sign in a parameter line is significant. |
* Only the first equals sign in a parameter line is significant. |
Line 153 static int EatComment( FILE *InFile )
|
Line 153 static int EatComment( FILE *InFile )
|
|
|
static int Continuation( char *line, int pos ) |
static int Continuation( char *line, int pos ) |
/* ------------------------------------------------------------------------ ** |
/* ------------------------------------------------------------------------ ** |
* Scan backards within a string to discover if the last non-whitespace | * Scan backwards within a string to discover if the last non-whitespace |
* character is a line-continuation character ('\\'). |
* character is a line-continuation character ('\\'). |
* |
* |
* Input: line - A pointer to a buffer containing the string to be |
* Input: line - A pointer to a buffer containing the string to be |
Line 212 static BOOL Section( FILE *InFile, BOOL (*sfunc)(char
|
Line 212 static BOOL Section( FILE *InFile, BOOL (*sfunc)(char
|
{ |
{ |
bSize += BUFR_INC; |
bSize += BUFR_INC; |
bufr = realloc_array( bufr, char, bSize ); |
bufr = realloc_array( bufr, char, bSize ); |
if( NULL == bufr ) |
|
{ |
|
rprintf(FLOG, "%s Memory re-allocation failure.", func); |
|
return( False ); |
|
} |
|
} |
} |
|
|
/* Handle a single character. */ |
/* Handle a single character. */ |
Line 306 static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(cha
|
Line 301 static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(cha
|
{ |
{ |
bSize += BUFR_INC; |
bSize += BUFR_INC; |
bufr = realloc_array( bufr, char, bSize ); |
bufr = realloc_array( bufr, char, bSize ); |
if( NULL == bufr ) |
|
{ |
|
rprintf(FLOG, "%s Memory re-allocation failure.", func) ; |
|
return( False ); |
|
} |
|
} |
} |
|
|
switch( c ) |
switch( c ) |
Line 382 static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(cha
|
Line 372 static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(cha
|
{ |
{ |
bSize += BUFR_INC; |
bSize += BUFR_INC; |
bufr = realloc_array( bufr, char, bSize ); |
bufr = realloc_array( bufr, char, bSize ); |
if( NULL == bufr ) |
|
{ |
|
rprintf(FLOG, "%s Memory re-allocation failure.", func) ; |
|
return( False ); |
|
} |
|
} |
} |
|
|
switch( c ) |
switch( c ) |
Line 639 int pm_process( char *FileName,
|
Line 624 int pm_process( char *FileName,
|
{ /* allocate one, then parse, */ |
{ /* allocate one, then parse, */ |
bSize = BUFR_INC; /* then free. */ |
bSize = BUFR_INC; /* then free. */ |
bufr = new_array( char, bSize ); |
bufr = new_array( char, bSize ); |
if( NULL == bufr ) |
|
{ |
|
rprintf(FLOG, "%s memory allocation failure.\n", func); |
|
fclose(InFile); |
|
return( False ); |
|
} |
|
result = Parse( InFile, sfunc, pfunc ); |
result = Parse( InFile, sfunc, pfunc ); |
free( bufr ); |
free( bufr ); |
bufr = NULL; |
bufr = NULL; |