Re: [PATCH v6 1/5] string_copy.7: Add page to document all string-copying functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eric,

On 1/20/23 04:43, Eric Biggers wrote:
On Mon, Dec 19, 2022 at 10:02:05PM +0100, Alejandro Colomar wrote:
diff --git a/man7/string_copy.7 b/man7/string_copy.7
new file mode 100644
index 000000000..a32b93c01
--- /dev/null
+++ b/man7/string_copy.7
@@ -0,0 +1,855 @@
+.\" Copyright 2022 Alejandro Colomar <alx@xxxxxxxxxx>
+.\"
+.\" SPDX-License-Identifier: BSD-3-Clause
+.\"
+.TH string_copy 7 (date) "Linux man-pages (unreleased)"
+.\" ----- NAME :: -----------------------------------------------------/
+.SH NAME
+stpcpy,
+strcpy, strcat,
+stpecpy, stpecpyx,
+strlcpy, strlcat,
+stpncpy,
+strncpy,
+zustr2ustp, zustr2stp,
+strncat,
+ustpcpy, ustr2stp

I happened to come across this new man page, and I'm confused by the inclusion
of functions like "ustpcpy".  These functions don't seem to actually exist, so
why are they documented in the man page?

That page is not documenting the existing libc functions for copying strings, but rather trying to explain all the alternatives, including other systems' ones (such as strlcpy(3bsd)), and custom ones that are not provided by any system (yet). It tries to guide a programmer that knows nothing about string copying to allow him produce quality code, independently of libc support. For documentation of the libc functions we still have the separate pages for each, which have been also updated.

Those specific functions are similar to the old saying of "just use memcpy(3) and forget about string copying functions", which is not so bad of an advice: it's the fastest; however, those functions are a bit safer than directly calling memcpy(3).


- Eric

Cheers,

Alex

--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux