Browse Source

inperrc.c: new function `INPstrCat()' to concatenate two strings

pre-master-46
h_vogt 13 years ago
committed by rlar
parent
commit
8c85064018
  1. 1
      src/include/ngspice/inpdefs.h
  2. 21
      src/spicelib/parser/inperrc.c

1
src/include/ngspice/inpdefs.h

@ -95,6 +95,7 @@ char *INPdevParse(char **, CKTcircuit *, int, GENinstance *, double *, int *, IN
char *INPdomodel(CKTcircuit *, card *, INPtables *);
void INPdoOpts(CKTcircuit *, JOB *, card *, INPtables *);
char *INPerrCat(char *, char *);
char *INPstrCat(char *, char *, char *);
char *INPerror(int);
double INPevaluate(char **, int *, int);
char *INPfindLev(char *, int *);

21
src/spicelib/parser/inperrc.c

@ -34,3 +34,24 @@ char *INPerrCat(char *a, char *b)
} else /* a null, so return b */
return (b);
}
char *INPstrCat(char *a, char *b, char *c)
{
if (a != NULL) {
if (b == NULL) { /* a valid, b null, return a */
return (a);
} else { /* both valid - hard work... */
register char *strtmp;
strtmp =
TMALLOC(char, strlen(a) + strlen(b) + 2);
(void) strcpy(strtmp, a);
(void) strcat(strtmp, c); /* single character only! */
(void) strcat(strtmp, b);
FREE(a);
FREE(b);
return (strtmp);
}
} else /* a null, so return b */
return (b);
}
Loading…
Cancel
Save