Add sethostname
* net.cc (sethostname): New function. * common.din (sethostname): Export * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2001. (CYGWIN_VERSION_DLL_MINOR): Set to 0. * new-features.xml (ov-new): Rename from ov-new1.7. (ov-new2.1): Add new section. Document sethostname. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -1095,6 +1095,20 @@ cygwin_gethostname (char *name, size_t len)
|
||||
return res;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
sethostname (const char *name, size_t len)
|
||||
{
|
||||
WCHAR wname[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
|
||||
sys_mbstowcs (wname, MAX_COMPUTERNAME_LENGTH + 1, name, len);
|
||||
if (!SetComputerNameExW (ComputerNamePhysicalDnsHostname, wname))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* exported as gethostbyname: standards? */
|
||||
extern "C" struct hostent *
|
||||
cygwin_gethostbyname (const char *name)
|
||||
|
Reference in New Issue
Block a user