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:
Corinna Vinschen
2015-06-17 11:11:02 +02:00
parent c7af199237
commit 50b00d2b93
7 changed files with 44 additions and 3 deletions

View File

@ -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)