From 04923fb1ad97b55e5c92a18d7a9b639d2dd06405 Mon Sep 17 00:00:00 2001 From: emma Date: Mon, 15 Jan 2024 16:53:34 -0700 Subject: [PATCH] Makefile, true(1), false(1): ported true and false back to C for simplicity and size --- Makefile | 10 +++++----- src/{true.rs => false.c} | 4 +--- src/{false.rs => true.c} | 7 +------ 3 files changed, 7 insertions(+), 14 deletions(-) rename src/{true.rs => false.c} (78%) rename src/{false.rs => true.c} (64%) diff --git a/Makefile b/Makefile index 6105e26..a99bdb9 100644 --- a/Makefile +++ b/Makefile @@ -67,11 +67,11 @@ libgetopt: src/getopt-rs/lib.rs $(RUSTC) $(RUSTCFLAGS) --crate-type=lib --crate-name=getopt \ -o build/o/libgetopt.rlib src/getopt-rs/lib.rs -dj: src/dj.c build_dir +dj: src/dj.c build $(CC) $(CFLAGS) -o build/bin/dj src/dj.c -false: src/false.rs build - $(RUSTC) $(RUSTFLAGS) -o build/bin/false src/false.rs +false: src/false.c build + $(CC) $(CFLAGS) -o build/bin/false src/false.c fop: src/fop.rs build libgetopt sysexits $(RUSTC) $(RUSTFLAGS) --extern getopt=build/o/libgetopt.rlib \ @@ -89,5 +89,5 @@ str: src/str.c build strcmp: src/strcmp.c build $(CC) $(CFLAGS) -o build/bin/strcmp src/strcmp.c -true: src/true.rs build - $(RUSTC) $(RUSTFLAGS) -o build/bin/true src/true.rs +true: src/true.c build + $(CC) $(CFLAGS) -o build/bin/true src/true.c diff --git a/src/true.rs b/src/false.c similarity index 78% rename from src/true.rs rename to src/false.c index d320fd6..3b6ec2a 100644 --- a/src/true.rs +++ b/src/false.c @@ -1,5 +1,4 @@ /* - * Copyright (c) 2023 DTB * Copyright (c) 2023 Emma Tebibyte * SPDX-License-Identifier: CC0 * @@ -7,5 +6,4 @@ * . */ - -fn main() { } +int main() { return 1; } diff --git a/src/false.rs b/src/true.c similarity index 64% rename from src/false.rs rename to src/true.c index 2c382b8..ab8da96 100644 --- a/src/false.rs +++ b/src/true.c @@ -1,5 +1,4 @@ /* - * Copyright (c) 2023 DTB * Copyright (c) 2023 Emma Tebibyte * SPDX-License-Identifier: CC0 * @@ -7,8 +6,4 @@ * . */ -use std::process::ExitCode; - -fn main() -> ExitCode { - ExitCode::from(1) -} +int main() {}