diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2008-06-10 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2008-06-10 08:01:00 -0700 |
commit | 9d09f583b6ea1181ebd5af1654acd3432c427445 (patch) | |
tree | 2ea6fb1cc6f70871f861dd0ccbe7f8522c34c765 /src/map/mio/mioRead.c | |
parent | 9604ecb1745da3bde720cd7be5ee8f89dc6bd5ff (diff) | |
download | abc-9d09f583b6ea1181ebd5af1654acd3432c427445.tar.gz abc-9d09f583b6ea1181ebd5af1654acd3432c427445.tar.bz2 abc-9d09f583b6ea1181ebd5af1654acd3432c427445.zip |
Version abc80610
Diffstat (limited to 'src/map/mio/mioRead.c')
-rw-r--r-- | src/map/mio/mioRead.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index 13c2cdcd..dc665050 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -265,7 +265,7 @@ Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, bool fExtendedFormat ) // then rest of the expression pToken = strtok( NULL, ";" ); - pGate->pForm = Extra_UtilStrsav( pToken ); + pGate->pForm = chomp( pToken ); // read the pin info // start the linked list of pins @@ -392,21 +392,27 @@ Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, bool fExtendedFormat ) SeeAlso [] ***********************************************************************/ -char *chomp( char *s ) +char * chomp( char *s ) { - char *b = ALLOC(char, strlen(s)+1), *c = b; - while (*s && isspace(*s)) - ++s; - while (*s && !isspace(*s)) - *c++ = *s++; - *c = 0; - return b; + char *a, *b, *c; + // remove leading spaces + for ( b = s; *b; b++ ) + if ( !isspace(*b) ) + break; + // strsav the string + a = strcpy( ALLOC(char, strlen(b)+1), b ); + // remove trailing spaces + for ( c = a+strlen(a); c > a; c-- ) + if ( *c == 0 || isspace(*c) ) + *c = 0; + else + break; + return a; } /**Function************************************************************* - Synopsis [Duplicates string and returns it with leading and - trailing spaces removed.] + Synopsis [] Description [] |