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-12-16 21:55:18 +01:00
parent d49aa4a645
commit c2395a5b5a
+17 -2
View File
@@ -4730,9 +4730,24 @@ int get_number_terminals(char *c)
break; break;
} }
#ifdef OSDI #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; break;
} }
#endif #endif