1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/*
* tclUnixCompat.c
*
* Written by: Zoran Vasiljevic (vasiljevic@users.sourceforge.net).
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclUnixCompat.c,v 1.8.6.4 2007/09/07 03:15:23 dgp Exp $
*
*/
#include "tclInt.h"
#include <pwd.h>
#include <grp.h>
#include <errno.h>
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/*
* tclUnixCompat.c
*
* Written by: Zoran Vasiljevic (vasiljevic@users.sourceforge.net).
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclUnixCompat.c,v 1.8.6.5 2007/11/16 08:07:30 dgp Exp $
*
*/
#include "tclInt.h"
#include <pwd.h>
#include <grp.h>
#include <errno.h>
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
#if defined(HAVE_GETHOSTBYNAME_R_5)
int h_errno;
return gethostbyname_r(name, &tsdPtr->hent, tsdPtr->hbuf,
sizeof(tsdPtr->hbuf), &h_errno);
#elif defined(HAVE_GETHOSTBYNAME_R_6)
struct hostent *hePtr;
int h_errno;
return (gethostbyname_r(name, &tsdPtr->hent, tsdPtr->hbuf,
sizeof(tsdPtr->hbuf), &hePtr, &h_errno) == 0)
? &tsdPtr->hent : NULL;
#elif defined(HAVE_GETHOSTBYNAME_R_3)
struct hostent_data data;
return (gethostbyname_r(name, &tsdPtr->hent, &data) == 0)
? &tsdPtr->hent : NULL;
|
|
|
|
|
|
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
#if defined(HAVE_GETHOSTBYNAME_R_5)
int h_errno;
return gethostbyname_r(name, &tsdPtr->hent, tsdPtr->hbuf,
sizeof(tsdPtr->hbuf), &h_errno);
#elif defined(HAVE_GETHOSTBYNAME_R_6)
struct hostent *hePtr = NULL;
int h_errno, result;
result = gethostbyname_r(name, &tsdPtr->hent, tsdPtr->hbuf,
sizeof(tsdPtr->hbuf), &hePtr, &h_errno);
return (result == 0) ? hePtr : NULL;
#elif defined(HAVE_GETHOSTBYNAME_R_3)
struct hostent_data data;
return (gethostbyname_r(name, &tsdPtr->hent, &data) == 0)
? &tsdPtr->hent : NULL;
|