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

This commit is contained in:
h_vogt 2013-09-03 16:39:12 +02:00 committed by rlar
parent e7e16e06e7
commit 8c85064018
2 changed files with 22 additions and 0 deletions

View File

@ -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 *);

View File

@ -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);
}