fix Windows build: move hostname to net/
parent
b9f3f2d622
commit
251e32948e
|
@ -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.
|
// home_dir returns path to user's home directory.
|
||||||
pub fn home_dir() string {
|
pub fn home_dir() string {
|
||||||
|
|
Loading…
Reference in New Issue