Re: [Freeciv-Dev] patch: zstrncpy() (PR#112)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
|
|