Preliminary fix to get_number_terminals:

check for tokens with '=' to stop and get number of nodes by
stepping back.
This commit is contained in:
Holger Vogt 2022-10-31 15:29:44 +01:00
parent d49aa4a645
commit c2395a5b5a
1 changed files with 17 additions and 2 deletions

View File

@ -4730,9 +4730,24 @@ int get_number_terminals(char *c)
break;
}
#ifdef OSDI
case 'a':
case 'a': /* Recognize an unknown number of nodes by stopping at tokens with '=' */
{
return 5;
i = 0;
char* cc, * ccfree;
cc = copy(c);
/* required to make m= 1 a single token m=1 */
ccfree = cc = inp_remove_ws(cc);
/* find the first token with "off", "tnodeout", "thermal" or "=" in the line*/
while ((i < 20) && (*cc != '\0')) {
char* inst = gettok_instance(&cc);
strncpy(nam_buf, inst, sizeof(nam_buf) - 1);
txfree(inst);
if (i > 2 && (strchr(nam_buf, '=')))
break;
i++;
}
tfree(ccfree);
return i - 2;
break;
}
#endif