Commit Graph

34 Commits

Author SHA1 Message Date
Conrad Meyer
b7e471c2b2 strcpy.3: Improve legibility and clarity
In the DESCRIPTION, put the more commonly used functions first in the
corresponding sentence, to help catch the eye.

Pull out the note about overlapping buffers to its own paragraph, as it
applies to all routines documented by this page.

Emphasize the potentially surprising strncpy(3) behavior of zero-filling the
remainder of a buffer larger than the source string.

Encourage strlcpy use; remove portability note about strlcpy(3).  Adapting a
strlcpy-using code base to a platform that does not provide strlcpy in libc
is so trivial as to not be worth mentioning.  (Just copy strlcpy.c out of
any BSD libc, or include and link the pre-packaged libbsd library on non-BSD
platforms.)

Likewise, expand the page's warning about ease of potential misuse to cover
all functions documented herein, and explicitly suggest using strlcpy most
of the time.  The text was mostly cribbed from a similar suggestion in
gets(3).

Finally, document the remaining valid use of strncpy -- the rare
fixed-length record with no expectation of nul-termination.

Sponsored by:	Dell EMC Isilon
2018-06-06 20:09:21 +00:00
Edward Tomasz Napierala
604f1c416c Don't put multiple names on a single .Nm line. This fixes apropos(1)
output, from this:

strnlen, strlen, strlen,(3) - find length of string                                                                                                                                                     │·······

... to this:

strlen, strnlen(3) - find length of string

PR:		223525
MFC after:	2 weeks
2018-04-17 09:05:46 +00:00
Warner Losh
50a717a67b Add notes about overlapping copies.
Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Sponsored by: Netflix
2017-11-13 17:04:44 +00:00
Eitan Adler
063aa3dfd2 libc man pages: Remove reference to non-existent FreeBSD Security
Architecture

MFC After:	3 days
2014-03-07 15:35:54 +00:00
Ed Maste
3fb3b97c4d Renumber clauses to reduce diffs to other versions
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
2013-05-28 20:57:40 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Edward Tomasz Napierala
5174a6a262 Add wide character variants of string manipulations routines to 'SEE ALSO'.
Approved by:	rwatson (mentor)
2009-04-07 13:42:53 +00:00
David Schultz
69099ba2ec - Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
  if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
  getline()) cause issues with ports.

Reviewed by:	standards@
2009-02-28 06:00:58 +00:00
Warner Losh
c879ae3536 Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.
2007-01-09 00:28:16 +00:00
Tim J. Robbins
6595b51a7f Remove references to nonexistent "FreeBSD Security Architecture" document. 2005-09-05 09:49:33 +00:00
Ruslan Ermilov
2efeeba554 mdoc(7) police: "The .Fa argument.". 2002-12-19 09:40:28 +00:00
Ruslan Ermilov
1fae73b137 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +00:00
Ruslan Ermilov
1798791d24 mdoc(7) police: formatting nits.
Approved by:	re
2002-11-29 15:57:50 +00:00
Dag-Erling Smørgrav
02edf2208d Translate to English. 2002-10-23 08:55:14 +00:00
Robert Drehmel
5d38e85ded Fix another spelling mistake. 2002-10-10 14:16:08 +00:00
Robert Drehmel
73fbee5795 Correct a spelling mistake. 2002-10-10 14:14:44 +00:00
David E. O'Brien
8269e8c887 Add stpcpy(3). 2002-10-03 19:39:20 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Robert Drehmel
ad90696815 - Add the 'restrict' qualifier to the definitions of the string
concatenation and copy functions using the '__restrict' macro.
   This is to satisfy IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions.
 - Add the 'restrict' keyword to the manual pages, too.
2002-08-14 22:59:22 +00:00
Ruslan Ermilov
ce9df6eefc mdoc(7) police:
Stop abusing the .%J macro for where the .Pa macro should have been used.
2002-01-09 14:01:22 +00:00
Chris Costello
80080d642e Include a section cross-reference to EXAMPLES' in SECURITY
CONSIDERATIONS' as a source for relevant sample code.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-05 20:36:47 +00:00
Chris Costello
8680aaea87 Remove the example from SECURITY CONSIDERATIONS. This is mostly
duplicated code from EXAMPLES.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-05 20:24:38 +00:00
Chris Costello
17dc85f4d0 Copy the sample `SECURITY CONSIDERATIONS' section from sec-doc.7.
This will be trimmed as the FreeBSD Security Architecture document
is fleshed out and committed.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-01-02 19:56:57 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Mike Barcroft
107d3f78b0 o Various mdoc fixes.
o Replace strncpy examples with less confusing ones from
  OpenBSD.  These examples give more detail and also suggest
  using strlcpy(3).

Reviewed by:	des, ru, sheldonh
Obtained from:	OpenBSD
MFC after:	3 days
2001-08-09 17:10:48 +00:00
Dima Dorfman
df523897ea Don't claim that strncpy() is the same as strcpy().
PR:		29002
Submitted by:	Joseph Mallett <jmallett@xMach.org>
2001-07-19 11:26:52 +00:00
Ruslan Ermilov
e3745c75e6 mdoc(7) police: Add strncpy() to the NAME section. 2001-07-16 12:47:34 +00:00
Ruslan Ermilov
a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Ruslan Ermilov
588a200ce1 .St -ansiC -> .St -isoC 2001-02-26 13:23:47 +00:00
Alexey Zelkin
25bb73e063 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
Warner Losh
4e2abf95a3 Xref strlcat, strlcpy
Inspired by: NetBSD commit message describing this.
1999-09-28 04:11:47 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Nik Clayton
fbc400a67a Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:50:10 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00