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

Output of file : STRNEND.C contained in archive : ECSTR.ZIP
/* File : strnend.c
Author : Richard A. O'Keefe.
Updated: 1 June 1984
Defines: strnend()

strnend(src, len)
returns a pointer to just after the end of the string src, which is
terminated by a NUL character, or by exhaustion of the length bound
len. That is, strnend(s,L)-s = strnlen(s,L). s+strnlen(s,L) could
of course be used instead, but this is sometimes clearer.
Beware: the asm version works only if 0 <= len < 65535.

#include "strings.h"

#if VaxAsm

char *strnend(src, len)
char *src;
int len;
asm("locc $0,8(ap),*4(ap)");
asm("movl r1,r0");

#else ~VaxAsm

char *strnend(src, len)
register char *src;
register int len;
while (--len >= 0 && *src) src++;
return src;

#endif VaxAsm

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