summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-12-02 14:23:32 +0100
committerAnton Kling <anton@kling.gg>2024-12-02 14:23:32 +0100
commit7d67bd2d9e690a662c1c8b51b245e83f2c6c5c74 (patch)
treeabc7f2b6eeb29c4b6ba43b8a1ee2297fcf63b363
parenteed6ff683cf124f43a21191ffa11278d9dbd7ff3 (diff)
minibox: Add true, false
-rwxr-xr-xmeta/userland.sh2
-rw-r--r--userland/minibox/Makefile2
-rw-r--r--userland/minibox/minibox.c2
-rw-r--r--userland/minibox/utilities/false.c7
-rw-r--r--userland/minibox/utilities/include.h2
-rw-r--r--userland/minibox/utilities/true.c7
6 files changed, 20 insertions, 2 deletions
diff --git a/meta/userland.sh b/meta/userland.sh
index 4df07f3..b403215 100755
--- a/meta/userland.sh
+++ b/meta/userland.sh
@@ -55,4 +55,6 @@ ln -s ./minibox ./kill
ln -s ./minibox ./sha1sum
ln -s ./minibox ./rdate
ln -s ./minibox ./sh
+ln -s ./minibox ./true
+ln -s ./minibox ./false
cd ..
diff --git a/userland/minibox/Makefile b/userland/minibox/Makefile
index a3a7a77..3301186 100644
--- a/userland/minibox/Makefile
+++ b/userland/minibox/Makefile
@@ -1,6 +1,6 @@
CC="i686-sb-gcc"
CFLAGS=-Wall -Wextra -pedantic -Wimplicit-fallthrough -g -O0
-OBJ=minibox.o utilities/cat.o utilities/echo.o utilities/yes.o utilities/minibox.o utilities/ascii.o utilities/wc.o utilities/init.o utilities/ls.o utilities/touch.o utilities/ed.o utilities/sh/sh.o utilities/sh/lexer.o utilities/sh/ast.o utilities/kill.o utilities/sha1sum.o utilities/rdate.o
+OBJ=minibox.o utilities/cat.o utilities/echo.o utilities/yes.o utilities/minibox.o utilities/ascii.o utilities/wc.o utilities/init.o utilities/ls.o utilities/touch.o utilities/ed.o utilities/sh/sh.o utilities/sh/lexer.o utilities/sh/ast.o utilities/kill.o utilities/sha1sum.o utilities/rdate.o utilities/true.o utilities/false.o
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) $(LIBS) -c $< -o $@
diff --git a/userland/minibox/minibox.c b/userland/minibox/minibox.c
index f8492cc..c010f37 100644
--- a/userland/minibox/minibox.c
+++ b/userland/minibox/minibox.c
@@ -22,7 +22,7 @@ Command utilities[] = {COMMAND(minibox), COMMAND(ascii), COMMAND(echo),
COMMAND(cat), COMMAND(yes), COMMAND(wc),
COMMAND(init), COMMAND(ls), COMMAND(touch),
COMMAND(ed), COMMAND(sh), COMMAND(kill),
- COMMAND(sha1sum), COMMAND(rdate)};
+ COMMAND(sha1sum), COMMAND(rdate), COMMAND(true), COMMAND(false)};
char *parse_filename(char *str) {
char *tmp = NULL, *is = str;
diff --git a/userland/minibox/utilities/false.c b/userland/minibox/utilities/false.c
new file mode 100644
index 0000000..4559f59
--- /dev/null
+++ b/userland/minibox/utilities/false.c
@@ -0,0 +1,7 @@
+#include "include.h"
+
+int false_main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
+ return 1;
+}
diff --git a/userland/minibox/utilities/include.h b/userland/minibox/utilities/include.h
index ba30474..844559a 100644
--- a/userland/minibox/utilities/include.h
+++ b/userland/minibox/utilities/include.h
@@ -42,3 +42,5 @@ int kill_main(int argc, char **argv);
int init_main(void);
int sha1sum_main(int argc, char **argv);
int rdate_main(int argc, char **argv);
+int true_main(int argc, char **argv);
+int false_main(int argc, char **argv);
diff --git a/userland/minibox/utilities/true.c b/userland/minibox/utilities/true.c
new file mode 100644
index 0000000..604521a
--- /dev/null
+++ b/userland/minibox/utilities/true.c
@@ -0,0 +1,7 @@
+#include "include.h"
+
+int true_main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
+ return 0;
+}