From owner-svn-src-all@FreeBSD.ORG Mon Jan 12 06:10:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FC45106566C; Mon, 12 Jan 2009 06:10:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02CA38FC1C; Mon, 12 Jan 2009 06:10:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0C6Amkq055461; Mon, 12 Jan 2009 06:10:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0C6AmjM055460; Mon, 12 Jan 2009 06:10:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200901120610.n0C6AmjM055460@svn.freebsd.org> From: Xin LI Date: Mon, 12 Jan 2009 06:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187091 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2009 06:10:49 -0000 Author: delphij Date: Mon Jan 12 06:10:48 2009 New Revision: 187091 URL: http://svn.freebsd.org/changeset/base/187091 Log: o Language improvements from OpenBSD; o Use an ISC-style license as did by the author. Obtained from: OpenBSD Modified: head/lib/libc/string/strlcpy.3 Modified: head/lib/libc/string/strlcpy.3 ============================================================================== --- head/lib/libc/string/strlcpy.3 Mon Jan 12 06:09:34 2009 (r187090) +++ head/lib/libc/string/strlcpy.3 Mon Jan 12 06:10:48 2009 (r187091) @@ -1,18 +1,18 @@ -.\" $OpenBSD: strlcpy.3,v 1.5 1999/06/06 15:17:32 aaron Exp $ +.\" $OpenBSD: strlcpy.3,v 1.19 2007/05/31 19:19:32 jmc Exp $ .\" -.\" Copyright (c) 1998 Todd C. Miller -.\" All rights reserved. +.\" Copyright (c) 1998, 2000 Todd C. Miller .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY @@ -64,7 +64,7 @@ is larger than 0 or, in the case of .Fn strlcat , as long as there is at least one byte free in .Fa dst ) . -Note that you should include a byte for the NUL in +Note that a byte for the NUL should be included in .Fa size . Also note that .Fn strlcpy @@ -121,7 +121,7 @@ that means the initial length of plus the length of .Fa src . -While this may seem somewhat confusing it was done to make +While this may seem somewhat confusing, it was done to make truncation detection simple. .Pp Note however, that if @@ -168,8 +168,8 @@ if (strlcat(pname, file, sizeof(pname)) goto toolong; .Ed .Pp -Since we know how many characters we copied the first time, we can -speed things up a bit by using a copy instead of an append: +Since it is known how many characters were copied the first time, things +can be sped up a bit by using a copy instead of an append .Bd -literal -offset indent char *dir, *file, pname[MAXPATHLEN]; size_t n;