yac
/
coreutils
Archived
2
0
Fork 0
This repository has been archived on 2024-01-01. You can view files and clone it, but cannot push or open issues or pull requests.
coreutils/src/bin/cat.rs

24 lines
457 B
Rust

// Copyright (c) 2022 Emma Tebibyte
// SPDX-License-Identifier: AGPL-3.0-or-later
use std::fs::read_to_string;
use std::io::{stdout, Write};
use std::env;
use std::process;
fn main() {
let args: Vec<String> = env::args().skip(1).collect();
for i in args {
let mut arg = i.as_str();
match arg {
"-u" => process::exit(1),
_ => {
print!("{}", read_to_string(arg).unwrap())
},
};
}
stdout().flush().unwrap();
}