Initial Commit

This commit is contained in:
2020-02-10 23:13:19 +01:00
commit 27af298f1d
4 changed files with 36 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
**/*.rs.bk

6
Cargo.lock generated Normal file
View 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
View 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
View 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");
}
}