Compare commits

..

2 Commits

Author SHA1 Message Date
573a366766 Add README.md 2023-10-03 18:03:57 +02:00
6b14c50e65 add: inc and dec without args 2023-08-02 17:51:17 +02:00
4 changed files with 20 additions and 0 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# GolemED
A clone of the famous ED text editor in ![golem](https://golem.re/)

7
src/commands/dec.🗿 Normal file
View File

@ -0,0 +1,7 @@
cmd_dec(data, args)
{
if ([data + LOCATION_CURRENT_LINE] != 0)
error("no line");
else
[data + LOCATION_CURRENT_LINE] = [data + LOCATION_CURRENT_LINE] - 1;
}

7
src/commands/inc.🗿 Normal file
View File

@ -0,0 +1,7 @@
cmd_inc(data, args)
{
if ([data + LOCATION_CURRENT_LINE] == [data + LOCATION_LENGTH])
error(data, "no line");
else
[data + LOCATION_CURRENT_LINE] = [data + LOCATION_CURRENT_LINE] + 1;
}

View File

@ -172,6 +172,10 @@ main()
cmd_help(data, NULL);
else if (strcmp(cmd, "w") == 0)
cmd_write(data, NULL);
else if (strcmp(cmd, "+") == 0)
cmd_inc(data, NULL);
else if (strcmp(cmd, "-") == 0)
cmd_dec(data, NULL);
else
error(data, "cmd not foud");
}