commit 39a5ef697479b56db0ac69ef00e0735e51f6150a
parent 5ca725cdd08814791bd57f30e5066d63cc7babc1
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date: Mon, 27 Jul 2020 15:55:46 +0200
added command clear
Diffstat:
4 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/docs/clear.txt b/docs/clear.txt
@@ -0,0 +1,9 @@
+
+HELP PAGE FOR COMMAND clear
+
+SYNTAX
+clear
+
+DESCRIPTION
+Resets all saved scrambles and output sequences.
+
diff --git a/docs/pre.txt b/docs/pre.txt
@@ -1,18 +0,0 @@
-
-HELP PAGE FOR COMMAND pre
-
-SYNTAX
-pre [MOVES|$ID1|@ID1] $ID2
-
-DESCRIPTION
-Prepends either MOVES, the scramble memorized under $ID1 or the output sequence
-memorized under @ID1 at the beginning of the scramble memorized under $ID2. If
-none of MOVES, $ID1 or @ID1 is specified, the user will be asked to type the
-moves.
-Menmonic: "pre(pend) x to y" or just "pre(pend) to y".
-
-EXAMPLES
-add $1
- The user is required to type the moves that will be prepended to $1.
-add F R B $1
- Prepends the moves F R B to scramble $1. Now scramble $1 begins with F R B.
diff --git a/nissy b/nissy
Binary files differ.
diff --git a/src/main.c b/src/main.c
@@ -32,6 +32,8 @@ char *commands[][10] = {
"Solves a scramble."},
{"replace", "[MOVES|$ID|@ID]",
"Find non-optimal subsequences."},
+ {"clear", "",
+ "Delete saved scrambles and output sequences."},
{"eo", "[MOVES|$ID|@ID]",
"Solves EO."},
{"dr", "[MOVES|$ID|@ID]",
@@ -459,6 +461,14 @@ void replace_cmd(int n, char cmdtok[][100]) {
}
}
+void clear_cmd(int n, char cmdtok[][100]) {
+ if (n > 1 || cmdtok[0][0] != 'c') { /* Avoid unused variable warning */
+ printf("clear: syntax error.\n");
+ return;
+ }
+ scr_count = tmp_count = 1;
+}
+
void eo_cmd(int n, char cmdtok[][100]) {
/* Default values */
@@ -818,7 +828,7 @@ void exit_quit_cmd(int n, char cmdtok[][100]) {
void (*cmd_list[])(int n, char cmdtok[][100]) = {
help_cmd, scramble_cmd, save_cmd, change_cmd, print_cmd,
add_cmd, invert_cmd, unniss_cmd, pic_cmd,
- solve_cmd, replace_cmd,
+ solve_cmd, replace_cmd, clear_cmd,
eo_cmd, dr_cmd, htr_cmd,
drfinish_cmd, htrfinish_cmd, drcorners_cmd,
exit_quit_cmd, exit_quit_cmd, NULL