]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/stpcpy.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / stpcpy.3
index e2de57be981ade758331282330096405498a0d87..e611a84fd58bb04c10bebb191f679f45fdec9570 100644 (file)
@@ -1,7 +1,6 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
-.TH STPCPY 3  2009-02-04 "GNU" "Linux Programmer's Manual"
+.TH STPCPY 3  2016-03-15 "GNU" "Linux Programmer's Manual"
 .SH NAME
 stpcpy \- copy a string returning a pointer to its end
 .SH SYNOPSIS
 .nf
-.B #define _GNU_SOURCE
-.br
 .B #include <string.h>
-.sp
+.PP
 .BI "char *stpcpy(char *" dest ", const char *" src );
 .fi
+.PP
+.in -4n
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.in
+.PP
+.BR stpcpy ():
+.PD 0
+.ad l
+.RS 4
+.TP 4
+Since glibc 2.10:
+_POSIX_C_SOURCE\ >=\ 200809L
+.TP
+Before glibc 2.10:
+_GNU_SOURCE
+.RE
+.ad
+.PD
 .SH DESCRIPTION
 The
 .BR stpcpy ()
-function copies the string pointed to by \fIsrc\fP
-(including the terminating \(aq\\0\(aq character) to the array pointed to by
-\fIdest\fP.
+function copies the string pointed to by
+.I src
+(including the terminating null byte (\(aq\\0\(aq)) to the array pointed to by
+.IR dest .
 The strings may not overlap, and the destination string
-\fIdest\fP must be large enough to receive the copy.
-.SH "RETURN VALUE"
+.I dest
+must be large enough to receive the copy.
+.SH RETURN VALUE
 .BR stpcpy ()
-returns a pointer to the \fBend\fP of the string
-\fIdest\fP (that is, the address of the terminating null byte)
+returns a pointer to the
+.B end
+of the string
+.I dest
+(that is, the address of the terminating null byte)
 rather than the beginning.
-.SH "CONFORMING TO"
-This function is not part of the C or POSIX.1 standards, and is
-not customary on Unix systems, but is not a GNU invention either.
-Perhaps it comes from MS-DOS.
-Nowadays, it is also present on the BSDs.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR stpcpy ()
+T}     Thread safety   MT-Safe
+.TE
+.SH CONFORMING TO
+This function was added to POSIX.1-2008.
+Before that, it was not part of
+the C or POSIX.1 standards, nor customary on UNIX systems.
+It first appeared at least as early as 1986,
+in the Lattice C AmigaDOS compiler,
+then in the GNU fileutils and GNU textutils in 1989,
+and in the GNU C library by 1992.
+It is also present on the BSDs.
+.SH BUGS
+This function may overrun the buffer
+.IR dest .
 .SH EXAMPLE
 For example, this program uses
 .BR stpcpy ()
-to concatenate \fBfoo\fP and
-\fBbar\fP to produce \fBfoobar\fP, which it then prints.
-.in +4n
-.nf
-
+to concatenate
+.B foo
+and
+.B bar
+to produce
+.BR foobar ,
+which it then prints.
+.PP
+.EX
+#define _GNU_SOURCE
 #include <string.h>
+#include <stdio.h>
 
 int
-main (void)
+main(void)
 {
+    char buffer[20];
     char *to = buffer;
+
     to = stpcpy(to, "foo");
     to = stpcpy(to, "bar");
     printf("%s\\n", buffer);
 }
-.fi
-.in
-.SH "SEE ALSO"
+.EE
+.SH SEE ALSO
 .BR bcopy (3),
 .BR memccpy (3),
 .BR memcpy (3),
 .BR memmove (3),
+.BR stpncpy (3),
 .BR strcpy (3),
-.BR wcpcpy (3),
-.BR feature_test_macros (7)
+.BR string (3),
+.BR wcpcpy (3)