Need strnlen() (???)
Roger L. Cordes Jr.
roger at dedalus.UUCP
Wed Nov 20 05:02:37 AEST 1985
What is the big deal here? How about:
extern int strlen();
static int _nstrnlen_; /* to avoid two calls to strlen() */
#define strnlen(S,N) ( (_nstrnlen_=strlen(S)) > (N) ? (N) : _nstrnlen_ )
or:
int strnlen(s,n)
char *s;
int n;
{
char *c;
int len = 0;
for ( c=s; *c && (len<n); c++, len++ )
;
return(len);
}
Was it a joke? Did I miss something?
Roger L. Cordes, Jr. William G. Daniel & Associates
...!mcnc!ikonas!dedalus!roger 8000 Regency Parkway, Suite 140
(919) 467-9708 Cary, N.C. 27511
More information about the Comp.lang.c
mailing list