GRU - Generic Reusable Utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
gru_alt.h
Go to the documentation of this file.
1 /*
2  Copyright 2016 Otavio Rodolfo Piske
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 #ifndef GRU_ALT_H
17 #define GRU_ALT_H
18 
19 #include <string.h>
20 
21 #include "common/gru_base.h"
22 #include "common/gru_portable.h"
23 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef HAVE_STRLCPY
34 
42 gru_export size_t strlcpy(
43  char *gru_restrict dst, const char *gru_restrict src, size_t size);
44 
52 gru_export size_t strlcat(
53  char *gru_restrict dst, const char *gru_restrict src, size_t size);
54 
55 #endif // HAVE_STRLCPY
56 
57 #ifndef HAVE_STRNDUP
58 
64 gru_export char *strndup(const char *source, size_t limit);
65 #endif // HAVE_STRNDUP
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif /* GRU_ALT_H */
#define gru_restrict
Definition: gru_portable.h:20
size_t strlcpy(char *dst, const char *src, size_t len)
Definition: gru_alt.c:19
#define gru_export
Definition: gru_portable.h:19
char * strndup(const char *source, size_t limit)
Poor man&#39;s implementation of strndup (duplicate a string)
Definition: gru_alt.c:54
size_t strlcat(char *gru_restrict dst, const char *gru_restrict src, size_t size)
Poor man&#39;s implementation of strlcat.
Definition: gru_alt.c:37