Change io crate & add a small shell

This commit is contained in:
2026-03-25 20:45:11 +01:00
parent f966a1239e
commit ae0593c972
98 changed files with 11102 additions and 810 deletions

View File

@@ -4,5 +4,4 @@ version = "0.1.0"
edition = "2024"
[dependencies]
# shared = { path = "../../crates/shared", features = ["user"] }
# core = { path = "../../crates/std/crates/core" }
winnow = "1.0.0"

View File

@@ -1,11 +1,57 @@
// use std::io::_print;
// #![feature(survos_std)]
use std::io::{Read, Write, stdin, stdout};
fn main() {
let a = std::env::args();
for a in a {
println!("Argument: {}", a);
}
println!(
"Hello from PIC program loaded dynamically with custom std and a better justfile, and syscalls ! "
);
std::process::Command::new("fastfetch")
.spawn()
.unwrap()
.wait()
.unwrap();
let mut current_command = String::new();
fn new_line() {
print!("> ");
stdout().flush().unwrap();
}
new_line();
loop {
let mut test = [0; 4];
let len = stdin().read(&mut test).unwrap();
let input = str::from_utf8(&test[..len as usize]).unwrap();
for c in input.chars() {
if c == '\n' {
println!();
let mut args = current_command.split(" ");
std::process::Command::new(args.next().unwrap())
.args(args)
.spawn()
.unwrap()
.wait()
.unwrap();
current_command.clear();
new_line();
} else {
if if c == '\x08' {
current_command.pop().is_some()
} else {
current_command.push_str(input);
true
} {
print!("{}", input);
}
}
}
stdout().flush().unwrap();
}
}
// fn parse_command(input: &mut &str) {}