openpkg/rplstrnlen.c

Tue, 31 Jul 2012 12:27:54 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 31 Jul 2012 12:27:54 +0200
changeset 429
b363f8ef6dcb
permissions
-rw-r--r--

Correct '-rpath /opkg/lib64' because OpenPKG fails to support multiarch.

michael@427 1 //
michael@427 2 // Stubfunc - Stubs to replace missing functions in third party projects
michael@427 3 // Copyright © 2012 Michael Schloh von Bennewitz <michael@schloh.com>
michael@427 4 //
michael@427 5 // Stubfunc is free software: you can redistribute it and/or modify
michael@427 6 // it under the terms of the GNU General Public License as published
michael@427 7 // by the Free Software Foundation, either version 3 of the License,
michael@427 8 // or (at your option) any later version.
michael@427 9 //
michael@427 10 // Stubfunc is distributed in the hope that it will be useful,
michael@427 11 // but WITHOUT ANY WARRANTY; without even the implied warranty
michael@427 12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
michael@427 13 // the GNU General Public License for more details.
michael@427 14 //
michael@427 15 // You should have received a copy of the GNU General Public License
michael@427 16 // along with Stubfunc. If not, see <http://www.gnu.org/licenses/>.
michael@427 17 //
michael@427 18 // This file implements a stub function and is part of a larger project,
michael@427 19 // explanations of which can be found at http://dev.europalab.com/.
michael@427 20 //
michael@427 21 // rplstrnlen.c: ISO C99 implementation
michael@427 22 //
michael@427 23
michael@427 24 #include <stdio.h>
michael@427 25
michael@427 26
michael@427 27 ///* replacement for strnlen(3), missing in some POSIX distributions */
michael@427 28 //status size_t strnlen(const char *pckInstring, size_t Maxsize) {
michael@427 29 // register const char *prckIdx;
michael@427 30 // for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx);
michael@427 31 // return(prckIdx - pckInstring);
michael@427 32 //}
michael@427 33
michael@427 34 /* replacement for strnlen(3), missing in some POSIX distributions */
michael@427 35 extern size_t rpl_strnlen(const char *pckInstring, size_t Maxsize) {
michael@427 36 register const char *prckIdx;
michael@427 37 for(prckIdx = pckInstring; *prckIdx && Maxsize--; ++prckIdx);
michael@427 38 return(prckIdx - pckInstring);
michael@427 39 }

mercurial