Initial commit

Start a new clean history from here.
This commit is contained in:
Romain Vimont
2017-12-12 15:12:07 +01:00
commit 54d9148a36
29 changed files with 1537 additions and 0 deletions

14
app/src/strutil.h Normal file
View File

@@ -0,0 +1,14 @@
#include <stddef.h>
// like strncpy, except:
// - it copies at most n-1 chars
// - the dest string is nul-terminated
// - it does not write useless bytes if strlen(src) < n
// - it returns the number of chars actually written (max n-1) if src has
// been copied completely, or n if src has been truncated
size_t xstrncpy(char *dest, const char *src, size_t n);
// join tokens by sep into dst
// returns the number of chars actually written (max n-1) if no trucation
// occurred, or n if truncated
size_t xstrjoin(char *dst, const char *const tokens[], char sep, size_t);