1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix Windows build: move hostname to net/

This commit is contained in:
Alexander Medvednikov 2019-07-17 13:50:58 +02:00
parent b9f3f2d622
commit 251e32948e
2 changed files with 13 additions and 11 deletions

13
vlib/net/net.v Normal file
View File

@ -0,0 +1,13 @@
module net
// hostname returns the host name reported by the kernel.
pub fn hostname() ?string {
mut name := [256]byte
// https://www.ietf.org/rfc/rfc1035.txt
// The host name is returned as a null-terminated string.
res := C.gethostname(&name, 256)
if res != 0 {
return error('os.hostname() cannot get the host name')
}
return tos_clone(name)
}

View File

@ -484,17 +484,6 @@ pub fn user_os() string {
}
// hostname returns the host name reported by the kernel.
pub fn hostname() ?string {
mut name := [256]byte
// https://www.ietf.org/rfc/rfc1035.txt
// The host name is returned as a null-terminated string.
res := C.gethostname(&name, 256)
if res != 0 {
return error('os.hostname() cannot get the host name')
}
return tos_clone(name)
}
// home_dir returns path to user's home directory.
pub fn home_dir() string {