Commit 43ecb231 authored by Claes Sjofors's avatar Claes Sjofors

Profibus configurator, gsd parser fix for module name and configdata with no space in between

parent 29e33254
...@@ -446,6 +446,7 @@ int pb_gsd::read( char *filename) ...@@ -446,6 +446,7 @@ int pb_gsd::read( char *filename)
read_line_done = 0; read_line_done = 0;
dcli_trim( line, line);
compress( line); compress( line);
part_cnt = dcli_parse( line, " =", "", (char *)line_part, part_cnt = dcli_parse( line, " =", "", (char *)line_part,
sizeof( line_part) / sizeof( line_part[0]), sizeof( line_part) / sizeof( line_part[0]),
...@@ -585,8 +586,23 @@ int pb_gsd::read( char *filename) ...@@ -585,8 +586,23 @@ int pb_gsd::read( char *filename)
} }
case gsd_Module: { case gsd_Module: {
gsd_sModule *mp; gsd_sModule *mp;
char *s;
gsd_sModule *m = (gsd_sModule *) calloc( 1, sizeof(gsd_sModule)); gsd_sModule *m = (gsd_sModule *) calloc( 1, sizeof(gsd_sModule));
strncpy( m->Mod_Name, line_part[1], sizeof(m->Mod_Name)); strncpy( m->Mod_Name, line_part[1], sizeof(m->Mod_Name));
if ( part_cnt == 2 && line[strlen(line)-1] != '"') {
// No space between module name and config, insert at space
if ( (s = strrchr( line, '"'))) {
char tmp[200];
strncpy( tmp, s+1, sizeof(tmp));
strcpy( s+1, " ");
strcat( s, tmp);
part_cnt = dcli_parse( line, " =", "", (char *)line_part,
sizeof( line_part) / sizeof( line_part[0]),
sizeof( line_part[0]), 0);
strncpy( m->Mod_Name, line_part[1], sizeof(m->Mod_Name));
}
}
if ( part_cnt > 2) if ( part_cnt > 2)
str_to_ostring( &m->Config, line_part[2], 244, &m->config_size); str_to_ostring( &m->Config, line_part[2], 244, &m->config_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment