diff -r c9323ebe0764 -r 71503088f51b openpkg/rplstrnlen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openpkg/rplstrnlen.c Tue Jul 31 12:12:54 2012 +0200 @@ -0,0 +1,39 @@ +// +// Stubfunc - Stubs to replace missing functions in third party projects +// Copyright © 2012 Michael Schloh von Bennewitz +// +// Stubfunc is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published +// by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// Stubfunc is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +// the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Stubfunc. If not, see . +// +// This file implements a stub function and is part of a larger project, +// explanations of which can be found at http://dev.europalab.com/. +// +// rplstrnlen.c: ISO C99 implementation +// + +#include + + +///* replacement for strnlen(3), missing in some POSIX distributions */ +//status size_t strnlen(const char *pckInstring, size_t Maxsize) { +// register const char *prckIdx; +// for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx); +// return(prckIdx - pckInstring); +//} + +/* replacement for strnlen(3), missing in some POSIX distributions */ +extern size_t rpl_strnlen(const char *pckInstring, size_t Maxsize) { + register const char *prckIdx; + for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx); + return(prckIdx - pckInstring); +}