1*0008cc64Sderaadt /* $OpenBSD: strlen.c,v 1.5 2012/07/13 16:09:49 deraadt Exp $ */
275db2277Smickey
375db2277Smickey /*-
475db2277Smickey * Copyright (c) 1990 The Regents of the University of California.
575db2277Smickey * All rights reserved.
675db2277Smickey *
775db2277Smickey * Redistribution and use in source and binary forms, with or without
875db2277Smickey * modification, are permitted provided that the following conditions
975db2277Smickey * are met:
1075db2277Smickey * 1. Redistributions of source code must retain the above copyright
1175db2277Smickey * notice, this list of conditions and the following disclaimer.
1275db2277Smickey * 2. Redistributions in binary form must reproduce the above copyright
1375db2277Smickey * notice, this list of conditions and the following disclaimer in the
1475db2277Smickey * documentation and/or other materials provided with the distribution.
1529295d1cSmillert * 3. Neither the name of the University nor the names of its contributors
1675db2277Smickey * may be used to endorse or promote products derived from this software
1775db2277Smickey * without specific prior written permission.
1875db2277Smickey *
1975db2277Smickey * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2075db2277Smickey * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2175db2277Smickey * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2275db2277Smickey * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2375db2277Smickey * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2475db2277Smickey * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2575db2277Smickey * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2675db2277Smickey * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2775db2277Smickey * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2875db2277Smickey * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2975db2277Smickey * SUCH DAMAGE.
3075db2277Smickey */
3175db2277Smickey
32f7a3af22Smickey #include "stand.h"
3375db2277Smickey
3475db2277Smickey size_t
strlen(const char * str)35599546b3Sderaadt strlen(const char *str)
3675db2277Smickey {
37599546b3Sderaadt const char *s;
3875db2277Smickey
39599546b3Sderaadt for (s = str; *s; ++s)
40599546b3Sderaadt ;
4175db2277Smickey return (s - str);
4275db2277Smickey }
4375db2277Smickey
44