Need strnlen().

Daniel R. Levy levy at ttrdc.UUCP
Tue Nov 19 10:18:49 AEST 1985


In article <562 at scc.UUCP>, steiny at scc.UUCP (Don Steiny) writes:
>**
>
>	Yikes! Too much talk, I have 25 seconds to spare, here:
>

Yikes! Needs a brushup, I have 25 seconds to spare, here: [:-)]

>	int strnlen(str,len)
	^^^
>	char *str;
	
	int len;
	^^^^^^^^

>	{
>		register char *s;
			 ^^^^
>
>		for(s=str;*s && s-str<len;s++) /* Diff of pointers is auto-
						matically cast to int */
>			;
>		return(s-str);
>	}
>	

	/* Did I get it right, Guy?  Huh? Huh??? :-) */
>
>--
>scc!steiny
>Don Steiny @ Don Steiny Software
>109 Torrey Pine Terrace
>Santa Cruz, Calif. 95060
>(408) 425-0382
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!ihnp4!ttrdc!levy



More information about the Comp.lang.c mailing list