This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Copying and concatenating strings with str5 functions
- From: Eric Sanchis <eric dot sanchis at iut-rodez dot fr>
- To: libc-help at sourceware dot org
- Date: Sat, 1 Nov 2014 14:49:49 +0100
- Subject: Copying and concatenating strings with str5 functions
- Authentication-results: sourceware.org; auth=none
Dear maintainers,
Today, string copy/concatenation remains a problem. I suggest an
alternative to strncpy/strncat (strn) and strlcpy/strlcat (strl)
functions.
Str5cpy/str5cat functions are:
- C89 compliant
- Safer and easier to use than strn/strl functions
- Transparent (no silent unwanted behaviour) and orthogonal (uniform behaviour).
They return a meaningful return value and produce auto-documented source code.
Please, take a look to the str5 functions and the companion document:
http://aral.iut-rodez.fr/en/sanchis/miscellaneous/str5/str5.html
Using strcpy/strcat in simple cases and str5cpy/str5cat in tricky
situations could be a good compromise.
Sincerely yours,
Eric Sanchis
University of Toulouse Capitole (IUT de Rodez)