Commit 31a9e182 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix bug in table reading routine.

* The name field might be whitespace only (and for echam4 in one case is).
parent abad5f27
......@@ -221,30 +221,35 @@ decodeForm2(char *pline, char *name, char *longname, char *units)
pline++;
while ( isspace((int) *pline) ) pline++;
pend = strchr(pline, '|');
if ( ! pend )
if (*pline != '|')
{
pend = pline;
while ( ! isspace((int) *pend) ) pend++;
len = (size_t)(pend - pline);
if ( len > 0 )
{
memcpy(name, pline, len);
name[len] = 0;
}
return (0);
pend = strchr(pline, '|');
if ( ! pend )
{
pend = pline;
while ( ! isspace((int) *pend) ) pend++;
len = (size_t)(pend - pline);
if ( len > 0 )
{
memcpy(name, pline, len);
name[len] = 0;
}
return (0);
}
else
{
pend--;
while ( isspace((int) *pend) ) pend--;
len = (size_t)(pend - pline + 1);
if ( len > 0 )
{
memcpy(name, pline, len);
name[len] = 0;
}
}
}
else
{
pend--;
while ( isspace((int) *pend) ) pend--;
len = (size_t)(pend - pline + 1);
if ( len > 0 )
{
memcpy(name, pline, len);
name[len] = 0;
}
}
name[0] = '\0';
pline = strchr(pline, '|');
pline++;
......
Supports Markdown
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