inperrc.c: new function `INPstrCat()' to concatenate two strings
This commit is contained in:
parent
e7e16e06e7
commit
8c85064018
|
|
@ -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 *);
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue