rustftechh 0.1.1

A blazingly fast, highly extensible, and feature-rich system information tool written in Rust with fastfetch parity and multi-distro logos
1
2
3
4
5
6
7
8
9
10
11
12
use crate::utils::clean;
use std::ffi::CStr;

pub fn detect_kernel() -> Option<String> {
    let mut uts: libc::utsname = unsafe { std::mem::zeroed() };
    if unsafe { libc::uname(&mut uts) } != 0 {
        return None;
    }
    let sysname = unsafe { CStr::from_ptr(uts.sysname.as_ptr()) }.to_string_lossy();
    let release = unsafe { CStr::from_ptr(uts.release.as_ptr()) }.to_string_lossy();
    Some(format!("{} {}", clean(&sysname), clean(&release)))
}