Mac OS X: implicit declaration of function 'ioctl' is invalid
Building the latest pv 1.7.24 I encounter this "implicit declaration of function 'ioctl'" issue.
…
gcc -O -I./src/include -Isrc/include -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -c -o src/pv/display.o src/pv/display.c
src/pv/display.c:93:12: warning: implicit declaration of function 'ioctl' is invalid in C99 [-Wimplicit-function-declaration]
if (0 == ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) {
^
1 warning generated.
gcc -O -I./src/include -Isrc/include -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -c -o src/pv/file.o src/pv/file.c
…
It looks like ioctl comes from "<sys/ioctl.h>" here, so I can workaround it by passing CPPFLAGS="-DGWINSZ_IN_SYS_IOCTL" during configure, but it probably should work out of the box. Maybe like this in src/pv/display.c:
#if defined(GWINSZ_IN_SYS_IOCTL) || defined(__APPLE__)
#include <sys/ioctl.h>
#endif
Building the latest **pv 1.7.24** I encounter this "_implicit declaration of function 'ioctl'_" issue. ``` … gcc -O -I./src/include -Isrc/include -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -c -o src/pv/display.o src/pv/display.c src/pv/display.c:93:12: warning: implicit declaration of function 'ioctl' is invalid in C99 [-Wimplicit-function-declaration] if (0 == ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz)) { ^ 1 warning generated. gcc -O -I./src/include -Isrc/include -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -c -o src/pv/file.o src/pv/file.c … ``` It looks like _ioctl_ comes from "<sys/ioctl.h>" here, so I can workaround it by passing `CPPFLAGS="-DGWINSZ_IN_SYS_IOCTL"` during _configure_, but it probably should work out of the box. Maybe like this in `src/pv/display.c`: ``` #if defined(GWINSZ_IN_SYS_IOCTL) || defined(__APPLE__) #include <sys/ioctl.h> #endif ```