diff options
| -rw-r--r-- | doc/nissy.1 | 27 | ||||
| -rwxr-xr-x | nissy | bin | 169544 -> 169544 bytes | |||
| -rw-r--r-- | nissy-2.0beta5.tar.gz | bin | 55883 -> 56623 bytes | |||
| -rw-r--r-- | src/shell.c | 26 | ||||
| -rw-r--r-- | src/shell.h | 2 |
5 files changed, 36 insertions, 19 deletions
diff --git a/doc/nissy.1 b/doc/nissy.1 index 992745d..0e2e5cb 100644 --- a/doc/nissy.1 +++ b/doc/nissy.1 | |||
| @@ -6,25 +6,34 @@ | |||
| 6 | .Nd a Rubik's cube solver and FMC assistant | 6 | .Nd a Rubik's cube solver and FMC assistant |
| 7 | . | 7 | . |
| 8 | .Sh SYNOPSIS | 8 | .Sh SYNOPSIS |
| 9 | .Nm | 9 | .Nm Op Fl b |
| 10 | .Nm | 10 | .Nm |
| 11 | .Ar command | 11 | .Ar command |
| 12 | .Op options... | 12 | .Op options... |
| 13 | . | 13 | . |
| 14 | When run without any argument an interactive shell is launched, otherwise | ||
| 15 | the provided | ||
| 16 | .Ar command | ||
| 17 | is executed and nissy terminates. | ||
| 18 | The commands that can be run in the interactive shell are the same that can | ||
| 19 | be run non-interactively and are provided below. | ||
| 20 | . | ||
| 21 | .Sh DESCRIPTION | 14 | .Sh DESCRIPTION |
| 22 | .Nm | 15 | .Nm |
| 23 | is a Rubik's Cube solver. Its optimal solver function uses Kociemba's one-step | 16 | is a Rubik's Cube solver. Its optimal solver function uses Kociemba's one-step |
| 24 | algorithm (huge optimal solver), and its performance is comparable to that | 17 | algorithm (huge optimal solver), and its performance is comparable to that |
| 25 | of Kociemba's implementation in Cube Explorer. | 18 | of Kociemba's implementation in Cube Explorer when using a single CPU |
| 19 | thread, and much faster when using multiple threads. | ||
| 26 | nissy can also solve different substeps of the Thistlethwaite's algorithm | 20 | nissy can also solve different substeps of the Thistlethwaite's algorithm |
| 27 | and more. | 21 | and more. |
| 22 | .Pp | ||
| 23 | When run without any argument an interactive shell is launched, otherwise | ||
| 24 | the provided | ||
| 25 | .Ar command | ||
| 26 | is executed and nissy terminates. If the option | ||
| 27 | .Fl b | ||
| 28 | is given, every argument after it is ignored and the shell is launched without | ||
| 29 | any prompt or welcome message. This can be used to run nissy in batch mode, | ||
| 30 | for example writing a list of commands in a | ||
| 31 | .Ar file | ||
| 32 | (one per line) and running | ||
| 33 | .Ar nissy -b < file | ||
| 34 | .Pp | ||
| 35 | The commands that can be run in the interactive shell are the same that can | ||
| 36 | be run non-interactively and are provided below. | ||
| 28 | . | 37 | . |
| 29 | .Sh COMMANDS | 38 | .Sh COMMANDS |
| 30 | The available | 39 | The available |
| Binary files differ | |||
diff --git a/nissy-2.0beta5.tar.gz b/nissy-2.0beta5.tar.gz index 1fa13b3..78bb536 100644 --- a/nissy-2.0beta5.tar.gz +++ b/nissy-2.0beta5.tar.gz | |||
| Binary files differ | |||
diff --git a/src/shell.c b/src/shell.c index 8bc2e0b..f6f88d9 100644 --- a/src/shell.c +++ b/src/shell.c | |||
| @@ -55,7 +55,7 @@ exec_args(int c, char **v) | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | void | 57 | void |
| 58 | launch() | 58 | launch(bool prompt) |
| 59 | { | 59 | { |
| 60 | int i, shell_argc; | 60 | int i, shell_argc; |
| 61 | char line[MAXLINELEN], **shell_argv; | 61 | char line[MAXLINELEN], **shell_argv; |
| @@ -64,12 +64,15 @@ launch() | |||
| 64 | for (i = 0; i < MAXNTOKENS; i++) | 64 | for (i = 0; i < MAXNTOKENS; i++) |
| 65 | shell_argv[i] = malloc((MAXTOKENLEN+1) * sizeof(char)); | 65 | shell_argv[i] = malloc((MAXTOKENLEN+1) * sizeof(char)); |
| 66 | 66 | ||
| 67 | fprintf(stderr, "Welcome to Nissy "VERSION".\n" | 67 | if (prompt) { |
| 68 | "Type \"commands\" for a list of commands.\n" | 68 | fprintf(stderr, "Welcome to Nissy "VERSION".\n" |
| 69 | ); | 69 | "Type \"commands\" for a list of commands.\n"); |
| 70 | } | ||
| 70 | 71 | ||
| 71 | while (true) { | 72 | while (true) { |
| 72 | fprintf(stdout, "nissy-# "); | 73 | if (prompt) { |
| 74 | fprintf(stdout, "nissy-# "); | ||
| 75 | } | ||
| 73 | if (fgets(line, MAXLINELEN, stdin) == NULL) | 76 | if (fgets(line, MAXLINELEN, stdin) == NULL) |
| 74 | break; | 77 | break; |
| 75 | shell_argc = parseline(line, shell_argv); | 78 | shell_argc = parseline(line, shell_argv); |
| @@ -85,10 +88,15 @@ launch() | |||
| 85 | int | 88 | int |
| 86 | main(int argc, char *argv[]) | 89 | main(int argc, char *argv[]) |
| 87 | { | 90 | { |
| 88 | if (argc > 1) | 91 | if (argc > 1) { |
| 89 | exec_args(argc-1, &argv[1]); | 92 | if (!strcmp(argv[1], "-b")) { |
| 90 | else | 93 | launch(false); |
| 91 | launch(); | 94 | } else { |
| 95 | exec_args(argc-1, &argv[1]); | ||
| 96 | } | ||
| 97 | } else { | ||
| 98 | launch(true); | ||
| 99 | } | ||
| 92 | 100 | ||
| 93 | return 0; | 101 | return 0; |
| 94 | } | 102 | } |
diff --git a/src/shell.h b/src/shell.h index a72d136..bb85ba2 100644 --- a/src/shell.h +++ b/src/shell.h | |||
| @@ -8,6 +8,6 @@ | |||
| 8 | #define MAXNTOKENS 255 | 8 | #define MAXNTOKENS 255 |
| 9 | 9 | ||
| 10 | void exec_args(int c, char **v); | 10 | void exec_args(int c, char **v); |
| 11 | void launch(); | 11 | void launch(bool prompt); |
| 12 | 12 | ||
| 13 | #endif | 13 | #endif |
