rewritten from the manual page; add Berkeley specific copyright
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 19 Jul 1988 06:31:52 +0000 (22:31 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 19 Jul 1988 06:31:52 +0000 (22:31 -0800)
SCCS-vsn: lib/libc/string/strlen.c 5.3

usr/src/lib/libc/string/strlen.c

index 854b6d4..183fc7d 100644 (file)
@@ -1,19 +1,29 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strlen.c   5.2 (Berkeley) %G%";
-#endif LIBC_SCCS and not lint
-
 /*
 /*
- * Returns the number of
- * non-NULL bytes in string argument.
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
  */
 
-strlen(s)
-register char *s;
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strlen.c   5.3 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
+
+strlen(str)
+       register char *str;
 {
 {
-       register n;
+       register int cnt;
 
 
-       n = 0;
-       while (*s++)
-               n++;
-       return(n);
+       for (cnt = 0; *str; ++cnt, ++str);
+       return(cnt);
 }
 }