/* * c p y s t r . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title cpystr String Copy index String copy synopsis .s.nf char * cpystr(out, in); char *out; char *in; .s.f Description Copy "in" to "out". Return a pointer to the end of out. This allows the following usage: char *ptr; char buffer[BUFSIZ]; extern char *cpystr(); ... ptr = cpystr(buffer, text); ptr = cpystr(ptr, more_text); The above sequence appends more_text to the copy of text already moved into the buffer. Bugs cpystr is not present on other C libraries. #endif #define EOS 0 char * cpystr(out, in) register char *out; register char *in; /* * Copy in to out, return &out[strlen(in)] */ { while ((*out++ = *in++) != EOS) ; return (out - 1); }