From 4e15cb9ff127d32f8886c8bbe4ed891e684b37df Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 2 Aug 2023 17:36:03 +0200 Subject: [PATCH] add: write --- src/commands/write.🗿 | 28 ++++++++++++++++++++++++++++ src/main.🗿 | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/commands/write.🗿 diff --git a/src/commands/write.🗿 b/src/commands/write.🗿 new file mode 100644 index 0000000..286b8ee --- /dev/null +++ b/src/commands/write.🗿 @@ -0,0 +1,28 @@ +puterr(str) +{ + local ptr = str; + + loop + { + if ([ptr] == 0) + break; + err [ptr]; + ptr++; + } + err '\n'; +} + +cmd_write(data, args) +{ + local i = 0; + + if ([data + LOCATION_LENGTH] == 0) + return 0; + loop + { + if (i == [data + LOCATION_LENGTH]) + return 0; + puterr([[[data + LOCATION_ARRAY] + i] + MAP_VALUE]); + i++; + } +} diff --git a/src/main.🗿 b/src/main.🗿 index 15c07b8..aa33fa1 100644 --- a/src/main.🗿 +++ b/src/main.🗿 @@ -170,6 +170,8 @@ main() cmd_delete(data, NULL); else if (strcmp(cmd, "h") == 0) cmd_help(data, NULL); + else if (strcmp(cmd, "w") == 0) + cmd_write(data, NULL); else error(data, "cmd not foud"); free(cmd);