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