Site Root : gethostbyname_r

Autoconf test and demo for gethostname_r

Purpose

This is a small demonstration of an autoconf test package to determine the right way to call gethostbyname_r under different oses.

Notes

  1. Add the ac_c_gethostbyname_r.m4 test to your autoconf's aclocal directory (probably in /usr/local/share/aclocal
  2. get acx_pthread.m4 from http://www.gnu.org/software/ac-archive/ and put it in your autoconf's aclocal dir
  3. add to acconfig.h the following lines
    • #undef HAVE_FUNC_GETHOSTBYNAME_R_6
    • #undef HAVE_FUNC_GETHOSTBYNAME_R_5
    • #undef HAVE_FUNC_GETHOSTBYNAME_R_3
  4. add gethostname.c to your project
  5. add gethostname.h to your project
  6. use the gethostname_re api instead of gethostbyname_r. Follow the example in test.c, note that you should initialize the variable as shown there, and do clean up after the final gethostname call as shown.

Perhaps in the future this little package should have the rest of the nonstandaized network _r calls with appropiate autoconf tests and interfaces, feel free to send on any thoughts on that.

Known to work under at least Solaris, OSF/1 and Linux

Caolan McNamara (2000) <caolan@skynet.ie>

Download Package

gethostbyname_r/gethostbyname_r-1.01.tar.gz
Last generated at Sun Feb 7 00:44:59 2016 Caolán McNamara <caolan@skynet.ie> Created with WebMake/0.5