1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/openpkg/rplstrnlen.c Tue Jul 31 12:12:54 2012 +0200 1.3 @@ -0,0 +1,39 @@ 1.4 +// 1.5 +// Stubfunc - Stubs to replace missing functions in third party projects 1.6 +// Copyright © 2012 Michael Schloh von Bennewitz <michael@schloh.com> 1.7 +// 1.8 +// Stubfunc is free software: you can redistribute it and/or modify 1.9 +// it under the terms of the GNU General Public License as published 1.10 +// by the Free Software Foundation, either version 3 of the License, 1.11 +// or (at your option) any later version. 1.12 +// 1.13 +// Stubfunc is distributed in the hope that it will be useful, 1.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty 1.15 +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 1.16 +// the GNU General Public License for more details. 1.17 +// 1.18 +// You should have received a copy of the GNU General Public License 1.19 +// along with Stubfunc. If not, see <http://www.gnu.org/licenses/>. 1.20 +// 1.21 +// This file implements a stub function and is part of a larger project, 1.22 +// explanations of which can be found at http://dev.europalab.com/. 1.23 +// 1.24 +// rplstrnlen.c: ISO C99 implementation 1.25 +// 1.26 + 1.27 +#include <stdio.h> 1.28 + 1.29 + 1.30 +///* replacement for strnlen(3), missing in some POSIX distributions */ 1.31 +//status size_t strnlen(const char *pckInstring, size_t Maxsize) { 1.32 +// register const char *prckIdx; 1.33 +// for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx); 1.34 +// return(prckIdx - pckInstring); 1.35 +//} 1.36 + 1.37 +/* replacement for strnlen(3), missing in some POSIX distributions */ 1.38 +extern size_t rpl_strnlen(const char *pckInstring, size_t Maxsize) { 1.39 + register const char *prckIdx; 1.40 + for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx); 1.41 + return(prckIdx - pckInstring); 1.42 +}