00001 /// 00002 /// \file strnlen.c 00003 /// Implementation of strnlen() call, for systems that 00004 /// don't have GNU. 00005 /// 00006 00007 /* 00008 Copyright (C) 2007-2010, Net Direct Inc. (http://www.netdirect.ca/) 00009 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 00019 See the GNU General Public License in the COPYING file at the 00020 root directory of this project for more details. 00021 */ 00022 00023 #include "strnlen.h" 00024 00025 size_t barry_strnlen(const char *s, size_t maxlen) 00026 { 00027 size_t len = 0; 00028 while( len < maxlen && s[len] ) 00029 len++; 00030 return len; 00031 } 00032