Initial Commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal file
@ -0,0 +1,6 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "eof"
|
||||
version = "0.1.0"
|
||||
|
||||
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "eof"
|
||||
version = "0.1.0"
|
||||
authors = ["Joakim Hulthe <joakim@hulthe.net>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
21
src/main.rs
Normal file
21
src/main.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use std::io::{self, Write};
|
||||
|
||||
fn main() {
|
||||
let stdin = io::stdin();
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
let mut lines: Vec<String> = vec![];
|
||||
loop {
|
||||
let mut buf = String::new();
|
||||
stdin.read_line(&mut buf)
|
||||
.expect("Could not read from stdin");
|
||||
if buf == "EOF\n" {
|
||||
break;
|
||||
}
|
||||
lines.push(buf);
|
||||
}
|
||||
for line in lines {
|
||||
stdout.write(line.as_bytes())
|
||||
.expect("Could not write to stdout");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user