From 1c7e86e92bf13632dc3cc69e4335d7be2fe0d378 Mon Sep 17 00:00:00 2001 From: minhtrannhat Date: Wed, 26 Jul 2023 17:02:49 -0400 Subject: [PATCH] Feat: Rust rewrite of GNU cat program - Added README.md --- .cargo/config.toml | 3 +++ .gitignore | 1 + Cargo.lock | 7 +++++++ Cargo.toml | 8 ++++++++ README.md | 11 +++++++++++ src/main.rs | 3 +++ tests/inputs/empty.txt | 0 tests/inputs/fox.txt | 1 + tests/inputs/spiders.txt | 3 +++ tests/inputs/the-bustle.txt | 9 +++++++++ 10 files changed, 46 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 src/main.rs create mode 100644 tests/inputs/empty.txt create mode 100644 tests/inputs/fox.txt create mode 100644 tests/inputs/spiders.txt create mode 100644 tests/inputs/the-bustle.txt diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..76c7b82 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=/bin/mold"] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3f56043 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "catr" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e5e84a0 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "catr" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c23f0f --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Rust rewrite of GNU cat + +## Dependencies +- `mold` - a high speed linker +- `clang` + +## Build +`cargo build` + +## Test +`cargo test` diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/inputs/empty.txt b/tests/inputs/empty.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/inputs/fox.txt b/tests/inputs/fox.txt new file mode 100644 index 0000000..2fe6575 --- /dev/null +++ b/tests/inputs/fox.txt @@ -0,0 +1 @@ +The quick brown fox jumps over the lazy dog. diff --git a/tests/inputs/spiders.txt b/tests/inputs/spiders.txt new file mode 100644 index 0000000..c29ddb0 --- /dev/null +++ b/tests/inputs/spiders.txt @@ -0,0 +1,3 @@ +Don't worry, spiders, +I keep house +casually. diff --git a/tests/inputs/the-bustle.txt b/tests/inputs/the-bustle.txt new file mode 100644 index 0000000..a1fccbb --- /dev/null +++ b/tests/inputs/the-bustle.txt @@ -0,0 +1,9 @@ +The bustle in a house +The morning after death +Is solemnest of industries +Enacted upon earth,— + +The sweeping up the heart, +And putting love away +We shall not want to use again +Until eternity.