Subject: Re: how to correct compiler warning "implicit declaration of function ..."
To: Henry Nelson <>
From: Antti Kantee <>
List: netbsd-users
Date: 03/29/2001 11:47:40
On Thu Mar 29 2001 at 18:02:48 +0900, Henry Nelson wrote:
> Keep getting from the compiler (egcs-1.1.1 on NetBSD1.4.2):
>      "warning: implicit declaration of function `strlcat'"  (or `strlcpy')
> The offending code looks like:
>      "strlcat(logformat, argv[i], sizeof(logformat));"
>      (or    "strlcpy(statefn, optarg, sizeof(statefn));")
> How would you tweak the code to avoid the warning?  TIA

     strlcpy() and strlcat() first appeared in OpenBSD 2.4, then in
     NetBSD 1.4.3 and FreeBSD 3.3.0.

If you upgrade your system, you don't have to do anything. Otherwise,
replace the calls to strlcat() with strncat(). Notice, however, that
there are ``ooopsies'' in doing so. Be careful not to cause any buffer

Antti Kantee <>          v          Of course he runs NetBSD             i