//
// 
//	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
// 
//	This program is free software; you can redistribute it 
//	and/or modify it under the terms of the GLOBALBASE 
//	Library General Public License (G-LGPL) as published by 
//
//	http://www.globalbase.org/
// 
//	This program is distributed in the hope that it will be 
//	useful, but WITHOUT ANY WARRANTY; without even the 
//	implied warranty of MERCHANTABILITY or FITNESS FOR A 
//	PARTICULAR PURPOSE.
//
//

extern "C" {

#include	<LInternetAddress.h>
#include	"netutils.h"

static LInternetAddress localhost;
static char localhostname[100] = "127.0.0.1";

void
get_localhostname(char * buf)
{
Str255 pstr;
	if (localhostname[0]) goto last;
	localhost.SetIPAddress(get_localhostip());
	localhost.GetDNSAddress(pstr);
	p2cstrcpy(localhostname, pstr);
last:
	strncpy(buf, localhostname, 100);
}


} // extern "C"