#include <xtend/string.h>
-lxtend
size_t strsqueeze(char *dest, const char *src, size_t dstsize)
dest: Pointer to a character array of at least len dstsize, where
the possibly modified string is stored.
src: Point to a character array containing the string to compact
dstsize: Length of the dest array
Copy string src to dest, reducing to a maximum length of dstsize if necessary by
replacing the center portion of the string with "...".
The length of the original string (like strlcpy(3))
#define MAXLEN 127
char limited_str[MAXLEN + 1],
original_str[SOME_OTHER_LEN + 1];
strsqueeze(limited_str, original_str, MAXLEN + 1);