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:
parent
b9f3f2d622
commit
251e32948e
13
vlib/net/net.v
Normal file
13
vlib/net/net.v
Normal 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)
|
||||
}
|
11
vlib/os/os.v
11
vlib/os/os.v
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user