diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-12-17 13:56:39 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-12-17 13:56:39 +0100 |
commit | 613f7aca26f2797badac9c105b59aaaea8346c09 (patch) | |
tree | 709a52fe0ce858fd628cdfb7933fd0cd14a04699 | |
parent | 8fc434911f85a40ed4182d6588d1a10b3a014055 (diff) |
string_copying.7: EXAMPLES: st[rp]ncpy(3): Use fwrite(3) instead of a loop
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man7/string_copying.7 | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/man7/string_copying.7 b/man7/string_copying.7 index bf31cbb53..281fff8be 100644 --- a/man7/string_copying.7 +++ b/man7/string_copying.7 @@ -646,8 +646,7 @@ p = stpncpy(u->ut_user, "alx", NITEMS(u->ut_user)); if (NITEMS(u->ut_user) < strlen("alx")) goto toolong; len = p \- u->ut_user; -for (size_t i = 0; i < NITEMS(u->ut_user); i++) - putchar(u->ut_user[i]); +fwrite(u->ut_user, 1, len, stdout); .EE .\" ----- EXAMPLES :: strncpy(3) --------------------------------------/ .TP @@ -657,8 +656,7 @@ strncpy(u->ut_user, "alx", NITEMS(u->ut_user)); if (NITEMS(u->ut_user) < strlen("alx")) goto toolong; len = strnlen(u->ut_user, NITEMS(u->ut_user)); -for (size_t i = 0; i < NITEMS(u->ut_user); i++) - putchar(u->ut_user[i]); +fwrite(u->ut_user, 1, len, stdout); .EE .\" ----- EXAMPLES :: mempcpy(dst, src, strnlen(src, NITEMS(src))) ----/ .TP |