ntohs() defintion issues with HP-UX 11.X
|Reported by:||Richard Lloyd||Owned by:|
|Component version:||Operating system type:||Other|
|Operating system version:||HP-UX 11.X|
HP-UX 11.X has an annoying habit of putting function or macro declarations of the same functions in more than one system header file and then documenting which header file to include in the man page, dependent on the compiler flags you use. Yes, it is barmy and, unfortunately, ntohs() is one of those functions.
"man ntohs" says that #include <netinet/in.h> should be used to declare the ntohs() function *unless* _XOPEN_SOURCE_EXTENDED is defined, in which case #include <arpa/inet.h> is included instead. I've been compiling the FileZilla Client 3.1.6 with -D_XOPEN_SOURCE_EXTENDED in HP-UX 11.X, so the #include <netinet/in.h> in src/engine/socket.cpp isn't good enough to declare ntohs(). Here's a fix I inserted just above the include in src/engine/socket.cpp (line 24 or so):
#if defined(hpux) && defined(_XOPEN_SOURCE_EXTENDED)
You may find a more elegant way to do this (e.g. if all systems have <arpa/inet.h>, you might not need the defined(hpux) bit).