From 0752dc1f21632432574aec56bc5ec461d3220d64 Mon Sep 17 00:00:00 2001 From: ciao Date: Sun, 13 Apr 2025 09:53:34 +0800 Subject: [PATCH] feat: implement false command --- README.md | 2 ++ build.zig | 8 +++++++- src/false/main.cpp | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/false/main.cpp diff --git a/README.md b/README.md index 03d9c8a..b500c3d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A project to implement GNU coreutils utilities in `C++` and `Zig`. This is an on - `wc`: Word, line, and byte counting utility - `true`: Do nothing, successfully (exit with status 0) +- `false`: Do nothing, unsuccessfully (exit with status 1) + ## Planned Utilities diff --git a/build.zig b/build.zig index 547f2b1..ce9c3e5 100644 --- a/build.zig +++ b/build.zig @@ -66,6 +66,12 @@ pub fn build(b: *std.Build) void { }, &[_][]const u8{ "src/true", }).build(b, optimize, target, &targets); - + + Executable.init("false", &[_][]const u8{ + "src/false/main.cpp", + }, &[_][]const u8{ + "src/false", + }).build(b, optimize, target, &targets); + zcc.createStep(b, "cdb", targets.toOwnedSlice() catch @panic("OOM")); } diff --git a/src/false/main.cpp b/src/false/main.cpp new file mode 100644 index 0000000..8482dd0 --- /dev/null +++ b/src/false/main.cpp @@ -0,0 +1,3 @@ +int main(void) { + return 1; +} \ No newline at end of file