Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CONCAT.C

 
Output of file : CONCAT.C contained in archive : CSRC2.ZIP
/*
* 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);
}


  3 Responses to “Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CONCAT.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/