forked from koniifer/ableos
relocate
This commit is contained in:
parent
19f908dac2
commit
80ac635ceb
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,4 +3,6 @@ ableos/target
|
||||||
aos_wasm_stress_test/target
|
aos_wasm_stress_test/target
|
||||||
facepalm/target
|
facepalm/target
|
||||||
shadeable/target
|
shadeable/target
|
||||||
qprofiler
|
qprofiler
|
||||||
|
userland/*/target
|
||||||
|
|
||||||
|
|
2
userland/README.md
Normal file
2
userland/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# ableOS userland
|
||||||
|
|
7
userland/rname/Cargo.lock
generated
Normal file
7
userland/rname/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rname"
|
||||||
|
version = "0.1.0"
|
8
userland/rname/Cargo.toml
Normal file
8
userland/rname/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "rname"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
44
userland/rname/src/main.rs
Normal file
44
userland/rname/src/main.rs
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//! An implementation of the uname command.
|
||||||
|
//!
|
||||||
|
use crate::Arch::*;
|
||||||
|
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
|
// an example string "Darwin Roadrunner.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386"
|
||||||
|
pub struct RName {
|
||||||
|
pub arch: Arch,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut rname_string = "".to_string();
|
||||||
|
|
||||||
|
rname_string.push_str("ableOS");
|
||||||
|
|
||||||
|
let arch = Some(X86_64);
|
||||||
|
if let Some(arch) = arch {
|
||||||
|
let fmt_str = format!(" {:?}", arch);
|
||||||
|
rname_string.push_str(&fmt_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("{}", rname_string);
|
||||||
|
}
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub enum Arch {
|
||||||
|
X86,
|
||||||
|
X86_64,
|
||||||
|
ARM,
|
||||||
|
ARM64,
|
||||||
|
PPC,
|
||||||
|
PPC64,
|
||||||
|
MIPS,
|
||||||
|
MIPS64,
|
||||||
|
SPARC,
|
||||||
|
SPARC64,
|
||||||
|
Unknown,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Arch {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{:?}", self)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue