Category : C Source Code
Archive   : ECSTR.ZIP
Filename : STRRPT.C

 
Output of file : STRRPT.C contained in archive : ECSTR.ZIP
/* File : strrpt.c
Author : Richard A. O'Keefe.
Updated: 20 April 1984
Defines: strrpt()

strrpt(dst, src, k) "RePeaTs" the string src into dst k times. E.g.
strrpt(dst, "hack ", 2) will move "hack hack" to dst. If k <= 0 it
does nothing. The result is the number of characters moved, except
for the closing NUL. src may be "" but may not of course be NullS.
*/

#include "strings.h"

int strrpt(dst, src, k)
register char *dst;
char *src;
int k;
{
char *save;

for (save = dst; --k >= 0; --dst) {
register char *p;
for (p = src; *dst++ = *p++; ) ;
}
return dst-save;
}



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