Category : C Source Code
Archive   : UNIXSTR.ZIP
Filename : MEMCCPY.C

 
Output of file : MEMCCPY.C contained in archive : UNIXSTR.ZIP
/* File : memccpy.c
Author : Richard A. O'Keefe.
Updated: 25 May 1984
Defines: memccpy()

memccpy(dst, src, chr, len)
copies bytes from src to dst until either len bytes have been moved
or a byte equal to chr has been moved. In the former case it gives
NullS as the value, in the latter a pointer to just after the place
where "chr" was moved to in dst. Note that copying stops after the
first instance of "chr", and that remaining characters in "dst" are
not changed in any way, no NUL being inserted or anything.

See the "Character Comparison" section in the READ-ME file.
*/

#include "strings.h"

char *memccpy(dst, src, chr, len)
register char *dst, *src;
register int chr; /* should be char */
register int len;
{
while (--len >= 0)
if ((*dst++ = *src++) == chr) return dst;
return NullS;
}



  3 Responses to “Category : C Source Code
Archive   : UNIXSTR.ZIP
Filename : MEMCCPY.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/