]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/strcpy.3
des_crypt.3: Minor wording fix in VERSIONS
[thirdparty/man-pages.git] / man3 / strcpy.3
index 1596a95f59b974c331ce1af20071bc45ae6f0dfa..7da5b9796958c56cf1969540c819e39c1a1f9ba4 100644 (file)
@@ -32,7 +32,7 @@
 .\" 2007-06-15, Marc Boyer <marc.boyer@enseeiht.fr> + mtk
 .\"     Improve discussion of strncpy().
 .\"
-.TH STRCPY 3  2017-09-15 "GNU" "Linux Programmer's Manual"
+.TH STRCPY 3  2019-03-06 "GNU" "Linux Programmer's Manual"
 .SH NAME
 strcpy, strncpy \- copy a string
 .SH SYNOPSIS
@@ -48,7 +48,7 @@ The
 .BR strcpy ()
 function copies the string pointed to by
 .IR src ,
-including the terminating null byte (\(aq\\0\(aq),
+including the terminating null byte (\(aq\e0\(aq),
 to the buffer pointed to by
 .IR dest .
 The strings may not overlap, and the destination string
@@ -96,10 +96,10 @@ strncpy(char *dest, const char *src, size_t n)
 {
     size_t i;
 
-    for (i = 0; i < n && src[i] != \(aq\\0\(aq; i++)
+    for (i = 0; i < n && src[i] != \(aq\e0\(aq; i++)
         dest[i] = src[i];
     for ( ; i < n; i++)
-        dest[i] = \(aq\\0\(aq;
+        dest[i] = \(aq\e0\(aq;
 
     return dest;
 }
@@ -146,7 +146,7 @@ One valid (and intended) use of
 .BR strncpy ()
 is to copy a C string to a fixed-length buffer
 while ensuring both that the buffer is not overflowed
-and that unused bytes in the target buffer are zeroed out
+and that unused bytes in the destination buffer are zeroed out
 (perhaps to prevent information leaks if the buffer is to be
 written to media or transmitted to another process via an
 interprocess communication technique).
@@ -166,9 +166,10 @@ you can force termination using something like the following:
 .PP
 .in +4n
 .EX
-strncpy(buf, str, buflen \- 1);
-if (buflen > 0)
-    buf[buflen \- 1]= \(aq\\0\(aq;
+if (buflen > 0) {
+    strncpy(buf, str, buflen \- 1);
+    buf[buflen \- 1]= \(aq\e0\(aq;
+}
 .EE
 .in
 .PP
@@ -194,7 +195,7 @@ but it copies at most
 bytes to
 .IR dest ,
 always adds a terminating null byte,
-and does not pad the target with (further) null bytes.
+and does not pad the destination with (further) null bytes.
 This function fixes some of the problems of
 .BR strcpy ()
 and