OQUFLYFABSJIESLURHVVQLIGCKRT2T66IMEAVSIKT3PPTEN22PAAC
CN2CI25XYZMVKYBKTSIVKO5GNDFXQ3CE2ZKS623D5EULTPTKFHDQC
RPECDMZ4O7MMU32H6Z7EW75GRVEQ6IJYNPWSV54HUPTCX5H7I26QC
KWR2TS2D7YN4LCGMQZ35V4WBLQDHAVSZJV3SZAIR5HQRSJAWLWCQC
BQFOYJRTLAFIBZ3SOERSUB2ZXMXJUAROXOGMGWHJW4CVBRT4R5QAC
AYQYCR7JKWTAZASLQTY5DPVI6A5MN6X4XMPC3GBS5KJRH3EGRPIQC
LSQ7OPL7Z5WJDO7ZZS3D4UPMEEWUUF2LNQ3FZUWWFUVZEXA7CIOAC
F3IDYEIHR2FA7SCE2MYVQSUQ5SOPGJ5IKBTS2V3HLM52SWGQ322AC
/*
* Walk through the screens untill the x and y are contained within a screen
* TODO: Use macros to avoid the insane amount of repetition
*/
/// Walk through the screens untill the x and y are contained within a screen
/// TODO: Use macros to avoid the insane amount of repetition
use std::{net, ptr};
use libc::{getifaddrs, freeifaddrs, AF_INET, AF_INET6};
/// Obtain the host's name
pub fn get_host_name() -> Result<String, nix::Error> {
let mut buf = [0; 255];
match gethostname(&mut buf) {
Ok(_) => {
let len = unsafe { strlen(mem::transmute(&buf as *const u8)) };
Ok(String::from_utf8_lossy(&buf[..len]).into_owned())
},
Err(err) => Err(err),
}
}