Category : C Source Code
Archive   : CSRC2.ZIP
Filename : SPAN.C
* s p a n . c
*/
/*)LIBRARY
*/
#ifdef DOCUMENTATION
title span Pattern Match -- Span Required Matching Characters
index Pattern match -- span required matching characters
synopsis
#ifdef vms
#include "c:cset.h"
#else
#include
#endif
char *
span(s,cs)
char s[];
CSET *cs;
description
Span() matches the longest leading substring of s that consists
entirely of characters that are members of the cset cs. It returns
a pointer to the first character after the matched characters.
The null that terminates s is never considered to be a member of the
cset, and is never included in the spanned characters; if all the
other characters in s are members of cs, span() returns a pointer
to the trailing null.
Span() differs from ospan() in that it must find at least one matching
character; otherwise, it returns NULL.
bugs
author
Jerry Leichter
#endif
/*
)EDITLEVEL=01
* Edit history
* 0.0 19-Jul-82 JSL Invention
*/
#ifdef vms
#include "c:cset.h"
#else
#include
#endif
#define NULL 0
char *
span(s,cs)
register char *s;
register CSET *cs;
{ register char *p;
p = s;
while (*s && csmember(cs,*s))
s++;
return((p != s) ? s : NULL);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/