From d7eb2b3d4303285b5733554e65bbc6163bf95c89 Mon Sep 17 00:00:00 2001 From: dtb Date: Sun, 26 Jun 2022 16:50:41 -0400 Subject: [PATCH] true(1) --- Makefile | 6 +++++- bin/cscript | 14 -------------- bin/true | 0 src/true.c | 1 + 4 files changed, 6 insertions(+), 15 deletions(-) delete mode 100755 bin/cscript delete mode 100755 bin/true create mode 100644 src/true.c diff --git a/Makefile b/Makefile index 128cd2e..90b8d86 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ cleanprograms: $(RM) bin/rlencode $(RM) bin/roll $(RM) bin/tail + $(RM) bin/true libraries: libio libshell stdbool sysexits @@ -56,7 +57,7 @@ sysexits_bin: src/sysexits.c sysexits: sysexits_bin bin/sysexits >include/sysexits.h -programs: echo false id lowercase nonzero simexec sleep streq str +programs: echo false id lowercase nonzero roll simexec sleep streq str true calculate: libstr sysexits src/calculate.c $(CC) $(CFLAGS) -o src/calculate.o -c src/calculate.c @@ -136,6 +137,9 @@ tail.o: libio src/tail.c tail: libio tail.o $(CC) $(CFLAGS) -o bin/tail build/libio.o build/tail.o +true: src/true.c + $(CC) $(CFLAGS) -o bin/true src/true.c + usefulmacros: include/usefulmacros.h which: libshell src/which.c diff --git a/bin/cscript b/bin/cscript deleted file mode 100755 index d3678d1..0000000 --- a/bin/cscript +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e - -TMPDIR="/tmp/cscript/" -TMPSRC="$TMPDIR/script.c" -TMPOUT="$TMPDIR/a.out" - -[ -d "$TMPDIR" ] || mkdir -p "$TMPDIR" - -printf "%s" "$1" >"$TMPSRC" - -cc -o "$TMPOUT" "$TMPSRC" - -dd bs=1 2>/dev/null | "$TMPOUT" diff --git a/bin/true b/bin/true deleted file mode 100755 index e69de29..0000000 diff --git a/src/true.c b/src/true.c new file mode 100644 index 0000000..1075f35 --- /dev/null +++ b/src/true.c @@ -0,0 +1 @@ +int main(){ return 0; }