1*599546b3Sderaadt /* $OpenBSD: strlen.c,v 1.4 2003/08/11 06:23:09 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 3275db2277Smickey #if defined(LIBC_SCCS) && !defined(lint) 3375db2277Smickey /*static char *sccsid = "from: @(#)strlen.c 5.5 (Berkeley) 1/26/91";*/ 3475db2277Smickey #endif /* LIBC_SCCS and not lint */ 3575db2277Smickey 36f7a3af22Smickey #include "stand.h" 3775db2277Smickey 3875db2277Smickey size_t 39*599546b3Sderaadt strlen(const char *str) 4075db2277Smickey { 41*599546b3Sderaadt const char *s; 4275db2277Smickey 43*599546b3Sderaadt for (s = str; *s; ++s) 44*599546b3Sderaadt ; 4575db2277Smickey return (s - str); 4675db2277Smickey } 4775db2277Smickey 48