Wanted: String Concatenation
utzoo!decvax!genradbo!mitccc!jfw
utzoo!decvax!genradbo!mitccc!jfw
Thu Jan 13 18:20:09 AEST 1983
Such a function would probably depend on the particular machine you are running
on (witness the hairiness of printf).
Here is a version for PDP-11 V7's (this is being written off the top of
my pointy little head, so I don't entirely guarantee it, though I have
just tested it, and it seems to work):
char *strcatx(dest,srcs)
char *dest;
{
char **srcn = &srcs,*p = dest;
/* advance p to end of dest. string */
while (*p++)
continue;
p--;
/* now, start catting each pointer on stack */
for ( ; *srcn != 0; srcn++ ) {
/* strcpy(p,**srcn) */
while (*p++ = *(*srcn)++)
continue;
p--;
}
return dest;
}
- John Woods, ...!genradbo!mitccc!jfw, JFW%MIT-CCC at MIT-MC
PS: It took about 15 minutes to write, test, and debug.
More information about the Comp.sources.unix
mailing list