finga
9666e0788d
The `list` command was refactored a little bit as well and the man page and readme were updated.
25 lines
502 B
Rust
25 lines
502 B
Rust
use anyhow::Result;
|
|
use clap::Clap;
|
|
use std::{
|
|
fs::File,
|
|
io::{BufRead, BufReader},
|
|
};
|
|
|
|
/// Print a list of existing message queues
|
|
#[derive(Clap, Debug)]
|
|
pub struct List {}
|
|
|
|
impl List {
|
|
pub fn run(&self) -> Result<()> {
|
|
for line in BufReader::new(File::open("/proc/sysvipc/msg")?).lines() {
|
|
for field in line?.split_whitespace().collect::<Vec<&str>>() {
|
|
print!("{0: <10}", field);
|
|
}
|
|
|
|
println!();
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
}
|