csname.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* return host name given address
* if addr==0 then permanent pointer to local host name returned
* otherwise temporary pointer returned
* `.' qualification deleted if possible
*/
#if defined(__STDPP__directive) && defined(__STDPP__hide)
#else
#define gethostname ______gethostname
#endif
#include "cslib.h"
#if _lib_uname && _sys_utsname
#endif
#if defined(__STDPP__directive) && defined(__STDPP__hide)
#else
#endif
#if _lib_gethostname
extern int gethostname(char*, size_t);
#endif
#if !CS_LIB_LOCAL && CS_LIB_SOCKET
/*
* keep host db connection alive
* the lib should make hidden fd's close-on-exec
*/
void
{
register int fd;
register int i;
{
sethostent(1);
gethostbyname("localhost");
if (fd >= 0)
}
}
#endif
/*
* return host name for addr
*/
char*
{
register char* s;
#if CS_LIB_LOCAL
#else
if (addr)
{
{
#if CS_LIB_SOCKET
#endif
#if CS_LIB_SOCKET || CS_LIB_V10
#if CS_LIB_SOCKET
#else
#endif
{
{
register char* t;
if (t = strchr(s, '.'))
{
}
}
return s;
}
#endif
return s;
}
}
#endif
{
#if _lib_gethostname
#else
#if _lib_uname && _sys_utsname
/*
* NOTE: uname(2) may return >0 on success -- go ask your dad
*/
else
#else
int fd;
int n;
{
}
else
#endif
#endif
{
}
}
}
char*
{
}