dparrish / libcli

Libcli provides a shared library for including a Cisco-like command-line interface into other software. It's a telnet interface which supports command-line editing, history, authentication and callbacks for a user-definable function tree.
https://dparrish.com/link/libcli
GNU Lesser General Public License v2.1
289 stars 143 forks source link

Build failure on darwin: `error: implicit declaration of function 'strchrnul' is invalid in C99` #78

Closed trofi closed 6 months ago

trofi commented 2 years ago

Noticed by @bobby285271 in https://github.com/NixOS/nixpkgs/pull/147749 when we attempted to update libcli in NixOS.

Build fails on Darwin libc as:

libcli.c:2521:41: error: implicit declaration of function 'strchrnul' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  if (help && !(c->help = strndup(help, strchrnul(help, '\v') - help))) {

Full build log: https://logs.nix.ci/?key=nixos/nixpkgs.147749&attempt_id=54ba70b3-6044-4233-ab14-a2ecea5c68e8

Looks like strchrnul() needs to be avoided on non-GNU systems.

RobSanders commented 6 months ago

Apologies for the very overdue response. Have recoded to not call strchrnul in that routine. Issue fixed in the 1.10.8 release.