Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] patch: zstrncpy() (PR#112)
Home

Re: [Freeciv-Dev] patch: zstrncpy() (PR#112)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Freeciv-Dev] patch: zstrncpy() (PR#112)
From: Alex Zepeda <jazepeda@xxxxxxxxxxx>
Date: Wed, 25 Aug 1999 16:19:22 -0700 (PDT)

On Wed, 25 Aug 1999, David Pfitzner wrote:

> This patch adds and uses a new function zstrncpy:
> 
> /******************************************************************
>  * zstrncpy():
>  *
>  * Like strncpy(), but with some features to make it easier to
>  * keep strings null-terminated.  In particular, always writes
>  * a terminating null, including when input is longer than n.

Have you seen strlcpy and strlcat?

I think it's already in OpenBSD and NetBSD, and will most likely make an
entrance in FreeBSD 3.3.

A simple

#ifdef HAVE_STRLCPY
return strlcpy(dest, src, n);
#endif

seems like a good idea at-a-glance.


For the man page:

http://www.freebsd.org/cgi-bin/man.cgi
(Select OpenBSD 2.5, and strlcat)

- alex


[Prev in Thread] Current Thread [Next in Thread]