summaryrefslogtreecommitdiffstats
path: root/source/param/params.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/param/params.c')
-rw-r--r--source/param/params.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/source/param/params.c b/source/param/params.c
index bc93a1fedfe..a1f9e6bc23c 100644
--- a/source/param/params.c
+++ b/source/param/params.c
@@ -191,13 +191,27 @@ static int EatComment( myFILE *InFile )
*
*****************************************************************************/
-static int Continuation(char *line, int pos )
+static int Continuation( char *line, int pos )
{
- pos--;
- while( (pos >= 0) && isspace((int)line[pos]))
- pos--;
-
- return (((pos >= 0) && ('\\' == line[pos])) ? pos : -1 );
+ int pos2 = 0;
+
+ pos--;
+ while( (pos >= 0) && isspace((int)line[pos]) )
+ pos--;
+
+ /* we should recognize if `\` is part of a multibyte character or not. */
+ while(pos2 <= pos) {
+ size_t skip = 0;
+ skip = get_character_len(line[pos2]);
+ if (skip) {
+ pos2 += skip;
+ } else if (pos == pos2) {
+ return( ((pos >= 0) && ('\\' == line[pos])) ? pos : -1 );
+ } else {
+ pos2++;
+ }
+ }
+ return (-1);
}
@@ -237,7 +251,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
if( i > (bSize - 2) )
{
char *tb;
-
+
tb = Realloc( bufr, bSize +BUFR_INC );
if( NULL == tb )
{
@@ -258,7 +272,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
DEBUG(0, ("%s Empty section name in configuration file.\n", func ));
return( False );
}
- if( !sfunc(bufr) ) /* Got a valid name. Deal with it. */
+ if( !sfunc( unix_to_dos(bufr) ) ) /* Got a valid name. Deal with it. */
return( False );
(void)EatComment( InFile ); /* Finish off the line. */
return( True );
@@ -334,7 +348,7 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
if( i > (bSize - 2) ) /* Ensure there's space for next char. */
{
char *tb;
-
+
tb = Realloc( bufr, bSize + BUFR_INC );
if( NULL == tb )
{
@@ -401,16 +415,13 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
if( i > (bSize - 2) ) /* Make sure there's enough room. */
{
- char *tb;
-
- tb = Realloc( bufr, bSize + BUFR_INC );
- if( NULL == tb )
+ bSize += BUFR_INC;
+ bufr = Realloc( bufr, bSize );
+ if( NULL == bufr )
{
DEBUG(0, ("%s Memory re-allocation failure.", func) );
return( False );
}
- bufr = tb;
- bSize += BUFR_INC;
}
switch( c )