1163533Simp/*- 2163533Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3163533Simp * 4163533Simp * Redistribution and use in source and binary forms, with or without 5163533Simp * modification, are permitted provided that the following conditions 6163533Simp * are met: 7163533Simp * 1. Redistributions of source code must retain the above copyright 8163533Simp * notice, this list of conditions and the following disclaimer. 9163533Simp * 2. Redistributions in binary form must reproduce the above copyright 10163533Simp * notice, this list of conditions and the following disclaimer in the 11163533Simp * documentation and/or other materials provided with the distribution. 12163533Simp * 13163533Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14163533Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15163533Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16163533Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17163533Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18163533Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19163533Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20163533Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21163533Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22163533Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23163533Simp * 24163533Simp */ 25163533Simp 26164137Simp#include <sys/cdefs.h> 27164137Simp__FBSDID("$FreeBSD$"); 28164137Simp 29164137Simp/****************************************************************************** 30164137Simp * 31164137Simp * Filename: p_string.c 32164137Simp * 33164137Simp * Instantiation of basic string operations to prevent inclusion of full 34164137Simp * string library. These are simple implementations not necessarily optimized 35164137Simp * for speed, but rather to show intent. 36164137Simp * 37164137Simp * Revision information: 38164137Simp * 39164137Simp * 20AUG2004 kb_admin initial creation 40164137Simp * 12JAN2005 kb_admin minor updates 41164137Simp * 42164137Simp * BEGIN_KBDD_BLOCK 43164137Simp * No warranty, expressed or implied, is included with this software. It is 44164137Simp * provided "AS IS" and no warranty of any kind including statutory or aspects 45164137Simp * relating to merchantability or fitness for any purpose is provided. All 46164137Simp * intellectual property rights of others is maintained with the respective 47164137Simp * owners. This software is not copyrighted and is intended for reference 48164137Simp * only. 49164137Simp * END_BLOCK 50164137Simp *****************************************************************************/ 51164137Simp 52163533Simp#include "lib.h" 53163533Simp 54163533Simp/* 55163533Simp * .KB_C_FN_DEFINITION_START 56163533Simp * int p_strlen(char *) 57163533Simp * This global function returns the number of bytes starting at the pointer 58163533Simp * before (not including) the string termination character ('/0'). 59163533Simp * .KB_C_FN_DEFINITION_END 60163533Simp */ 61163533Simpint 62163533Simpp_strlen(const char *buffer) 63163533Simp{ 64163533Simp const char *ptr = buffer; 65163533Simp while (*ptr++) 66163533Simp continue; 67168005Simp return (ptr - buffer - 1); 68163533Simp} 69