/builddir/build/BUILD/gru-0.1.0/src/string/gru_alt.h File Reference
#include <string.h>
#include "common/gru_base.h"
#include "common/gru_portable.h"
Go to the source code of this file.
Functions |
gru_export size_t | strlcpy (char *gru_restrict dst, const char *gru_restrict src, size_t size) |
| Very simple alternatives to some safer string variables.
|
gru_export size_t | strlcat (char *gru_restrict dst, const char *gru_restrict src, size_t size) |
| Poor man's implementation of strlcat.
|
gru_export char * | strndup (const char *source, size_t limit) |
| Poor man's implementation of strndup (duplicate a string).
|
Function Documentation
gru_export size_t strlcat |
( |
char *gru_restrict |
dst, |
|
|
const char *gru_restrict |
src, |
|
|
size_t |
size | |
|
) |
| | |
Poor man's implementation of strlcat.
- Parameters:
-
| dst | destination buffer |
| src | source buffer |
| size | amount of bytes to copy |
- Returns:
- The total length of the string they tried to create
gru_export size_t strlcpy |
( |
char *gru_restrict |
dst, |
|
|
const char *gru_restrict |
src, |
|
|
size_t |
size | |
|
) |
| | |
Very simple alternatives to some safer string variables.
Do not use unless libbsd or other more mature alternatives are not available Poor man's implementation of strlcpy (works just like strncpy, but copies size - 1)
- Parameters:
-
| dst | destination buffer |
| src | source buffer |
| size | amount of bytes to copy |
- Returns:
- The amount of bytes copied
gru_export char* strndup |
( |
const char * |
source, |
|
|
size_t |
limit | |
|
) |
| | |
Poor man's implementation of strndup (duplicate a string).
- Parameters:
-
| source | source string |
| limit | maximum number of bytes to copy |