add: inc and dec without args
This commit is contained in:
parent
6fa0ea91bd
commit
6b14c50e65
7
src/commands/dec.🗿
Normal file
7
src/commands/dec.🗿
Normal 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
7
src/commands/inc.🗿
Normal 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;
|
||||
}
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user