Following are declarations of C functions available in libc but hidden
by various standards after C89 or hidden by other undefined macros.

See man feature_test_macros(7) for a definitive list of all such
macros.

==================================================================

------------------------------------------------------------------
defs: _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE

   #include <stdio.h>
   int fileno(FILE *stream);
   FILE *fdopen(int fd, const char *mode);
------------------------------------------------------------------
defs:_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <stdio.h>
  int snprintf(char *str, size_t size, const char *format, ...);
------------------------------------------------------------------
std: 4.4BSD, POSIX.1-2001.

  #include <strings.h>
  int strcasecmp(const char *s1, const char *s2);
  int strncasecmp(const char *s1, const char *s2, size_t n);
------------------------------------------------------------------
defs: _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L

  #include <unistd.h>
  int gethostname(char *name, size_t len);
------------------------------------------------------------------
defs: _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600

  #include <stdlib.h>
  int posix_memalign(void **memptr, size_t alignment, size_t size);
------------------------------------------------------------------
defs: _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED

  #include <limits.h>
  #include <stdlib.h>
  char *realpath(const char *path, char *resolved_path);
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  double hypot(double x, double y);
------------------------------------------------------------------
defs:

  #include <stdlib.h>
  srand48(), drand()

  fix: replace with rand()
------------------------------------------------------------------
defs: _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED

  #include <stdlib.h>
  random(), srandom()
------------------------------------------------------------------

defs: _BSD_SOURCE || !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)

  #include <unistd.h>
  getpagesize_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE

  #include <ctype.h>
  isascii_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  isinf_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  isnan_compat.h
------------------------------------------------------------------
std: C99, POSIX.1-2001.

  #include <math.h>
  modff_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
           _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  nextafter_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  nextafterf_compat.h
------------------------------------------------------------------
defs: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
           _POSIX_C_SOURCE >= 200112L;
           or cc -std=c99

  #include <math.h>
  rint_compat.h
------------------------------------------------------------------
stds: SVr4, 4.3BSD, POSIX.1-2001.

  strdup_compat.h
------------------------------------------------------------------

OTHER C89 FIXES documented here:
===============================

------------------------------------------------------------------
   #include <netdb.h>
   struct hostent member 'h_addr' is defined as actual member
   'h_addr_list[0]' (for backward compatibility); that define is
   hidden by macros
     __USE_MISC || defined __USE_GNU

   fix is to substitute 'h_addr_list[0]' for 'h_addr'
   affected several files (fixed):
     ./src/util/ttcp.c
     ./src/libpkg/pkg.c
   also affects (not fixed!):
     ./src/other/tcl/win/tclWinSock.c
------------------------------------------------------------------

  #include <signal.h>
  signal handler struct __sighandler_t is typedef'd differently by several macros:

  #ifdef HAVE_SIGHANDLER_T
  typedef __sighandler_t sighandler_t;
  #endif

  #ifdef HAVE_SIG_T
  typedef __sighandler_t sig_t;
  #endif

  fix is to leverage portable function sigaction(2) in addition to
  signal(2) for platforms that have one but not the other.

  only file affected:
    ./src/libbu/interrupt.c

------------------------------------------------------------------

  #define _GNU_SOURCE
  #include <errno.h>

  extern char *program_invocation_name;
  extern char *program_invocation_short_name;

  not portable

  proper fix is to use a bu_* function that does not use them

  fixed by turning off its use for strict compatibility checks

------------------------------------------------------------------

#endif /* BRLCAD_SRC_COMPAT_H */
