/* * c o n c a t . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title concat Concatenate Strings index Concatenate strings synopsis .s.nf char * concat(out, in0, in1, ..., inN, 0); char *out; char *in0, in1, ... inN; .s.f Description Concat concatenates the argument strings. It returns a pointer to the first byte of out. Bugs May not be transportable #endif #define EOS 0 #define NULL 0 char * concat(out, inlist) char *out; char *inlist; /* * Concatenate strings. Somewhat of a hack. */ { register char *op; register char **argp; register char *inp; op = out; for (argp = &inlist; (inp = *argp++) != NULL;) { while ((*op++ = *inp++) != EOS) ; op--; /* Backup to overwrite the EOS */ } *op = EOS; /* Terminate output string even with null args */ return (out); }