From 204362044e4f7ef04248058ba07df3f3a976dcd2 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 17 Jan 2010 14:49:42 +0000 Subject: [PATCH] .gllobal bug --- ChangeLog | 3 +++ src/frontend/subckt.c | 38 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae7cb5c49..a04772b8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-01-17 Holger Vogt + * subckt.c: .global bug by R. Larice + 2010-01-16 Dietmar Warning * tests/transmission: Only few tests should be easier, more examples under examples/TransmissionLine at next diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 0b2991a36..a5085ff44 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -245,26 +245,28 @@ inp_subcktexpand(struct line *deck) /* Added by H.Tanaka to find global nodes */ for(i=0;i<128;i++) strcpy(node[i],"");/* Clear global node holder */ for (c = deck; c; c = c->li_next) { - if (ciprefix(".global", c->li_line)) { - s = c->li_line; - txfree(gettok(&s)); - numgnode=0; - while(*s) { - i=0; - t=s; - for (/*s*/; *s && !isspace(*s); s++) i++; - strncpy(node[numgnode],t,i+1); /* i+1: include \0 character */ - while (isspace(*s)) s++; - numgnode++; - } /* node[] holds name of global node */ + if (ciprefix(".global", c->li_line)) { + s = c->li_line; + txfree(gettok(&s)); + numgnode=0; + while(*s) { + i=0; + t=s; + for (/*s*/; *s && !isspace(*s); s++) i++; + strncpy(node[numgnode],t,i); + if(i>0 && t[i-1] != '\0') + node[numgnode][i] = '\0'; + while (isspace(*s)) s++; + numgnode++; + } /* node[] holds name of global node */ #ifdef TRACE - printf("***Global node option has been found.***\n"); - for(i=0;ili_line[0] = '*'; /* comment it out */ - }/* if(ciprefix.. */ + c->li_line[0] = '*'; /* comment it out */ + }/* if(ciprefix.. */ } /* for(c=deck.. */ /* Let's do a few cleanup things... Get rid of ( ) around node