summaryrefslogtreecommitdiff
path: root/stage3/shell.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 02:44:05 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 02:44:05 +0100
commiteb29366545ea0679eee057e8275a0457d9f8e556 (patch)
treea982916c90eb9aa3c2b99f45ecccb79b6e9d859e /stage3/shell.c
parent85fad639f02176e2dbf47869abb227ad3f34672b (diff)
downloadcuddles-eb29366545ea0679eee057e8275a0457d9f8e556.tar.xz
love command
Diffstat (limited to 'stage3/shell.c')
-rw-r--r--stage3/shell.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/stage3/shell.c b/stage3/shell.c
index f635e30..244a247 100644
--- a/stage3/shell.c
+++ b/stage3/shell.c
@@ -137,6 +137,27 @@ static void cmd_clear(str arg)
font_clear_screen();
}
+static void cmd_love(str arg)
+{
+ if (arg.len == 0)
+ arg = S("anna");
+
+ str f = fs_read(S("uwu.txt"));
+ if (f.data == nil) {
+ print(S("love: missing file uwu.txt\n"));
+ } else {
+ isize start = 172-arg.len/2;
+ if (start < 0 || start + arg.len > f.len) {
+ print(S("love: argument too long (owo it's too big for me)\n"));
+ } else {
+ memcpy(f.data+start, arg.data, arg.len);
+ print(f);
+ }
+
+ free(f.data);
+ }
+}
+
typedef struct {
str name;
void (*fn)(str arg);
@@ -152,6 +173,7 @@ static command registry[] = {
{ S("run"), &cmd_run },
{ S("loadkeys"), &cmd_loadkeys },
{ S("clear"), &cmd_clear },
+ { S("love"), &cmd_love },
};
void shell_run_cmd(str cmd)