#system-information #clucompany #hostname #uname

nightly cluuname

Library for displaying information about the system

9 releases

0.1.9 Dec 9, 2018
0.1.8 Oct 23, 2018
0.1.7 Jul 28, 2018
0.1.5 May 17, 2018
0.1.2 Apr 16, 2018

#1298 in Development tools

Apache-2.0

35KB
791 lines

Uname

Build Status Apache licensed Documentation

Library for displaying information about the system. Implemented only for Linux.

Print

extern crate cluuname;
use cluuname::uname;

fn main() {
	let uname = uname().unwrap();
	println!("{}", uname);
	//Linux cluComp 4.15.15-1-zen #1 ZEN SMP PREEMPT Sat Mar 31 23:59:18 UTC 2018 x86_64
}

2Print

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;
use cluuname::build;

fn main() {
	let uname = uname().unwrap();
	nodename(uname);
	//NODENAME "R510"

	let custom_uname = build::linux_216_86();
	nodename(custom_uname);
	//NODENAME "cluComp"
}

fn nodename<T: UtsName>(uname: T) {
	println!("NODENAME {}", uname.display_nodename());
}

CustomPrint

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;

fn main() {
	let uname = uname().unwrap();

	let sysname = uname.display_sysname();
	let nodename = uname.display_nodename();
	let release = uname.display_release();
	let version = uname.display_version();
	let machine = uname.display_machine();

	println!("{} {} {} {} {}", sysname, nodename, release, version, machine);
	//Linux cluComp 4.15.15-1-zen #1 ZEN SMP PREEMPT Sat Mar 31 23:59:18 UTC 2018 x86_64
}

Hash + Hash Version

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;

fn main() {
		let uname = uname().unwrap();

		let machine_all_hash = uname.uname_hash();
		let machive_version_hash = uname.version_hash();

		println!("UNAME_HASH {}", machine_all_hash);
		//12821596144084292007
		println!("UNAME_V_HASH {}", machive_version_hash);
		//2978006705337010168
}

CustomUname

#![feature(plugin)]
#![plugin(clucstr)]
extern crate cluuname;
use cluuname::build;

use std::ffi::CStr;

fn main() {
	let uname = build::custom(
		cstr!("Linux"),
		cstr!("cluComp"),
		cstr!("2.16-localhost"),
		cstr!("#1 SMP PREEMPT Sat Mar 31 23:59:18 UTC 2008"),
		cstr!("x86"),
	);
	println!("{}", uname);
	//Linux cluComp 2.16-localhost #1 SMP PREEMPT Sat Mar 31 23:59:18 UTC 2008 x86
}

Flags

enable_domainname - Additional item domainname

[dependencies] cluuname = { version = "*", features = ["enable_domainname"] }

License

Copyright 2018 #UlinProject Денис Котляров

Licensed under the Apache License, Version 2.0

Dependencies

~45KB