aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/nissy.127
-rwxr-xr-xnissybin169544 -> 169544 bytes
-rw-r--r--nissy-2.0beta5.tar.gzbin55883 -> 56623 bytes
-rw-r--r--src/shell.c26
-rw-r--r--src/shell.h2
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.
14When run without any argument an interactive shell is launched, otherwise
15the provided
16.Ar command
17is executed and nissy terminates.
18The commands that can be run in the interactive shell are the same that can
19be run non-interactively and are provided below.
20.
21.Sh DESCRIPTION 14.Sh DESCRIPTION
22.Nm 15.Nm
23is a Rubik's Cube solver. Its optimal solver function uses Kociemba's one-step 16is a Rubik's Cube solver. Its optimal solver function uses Kociemba's one-step
24algorithm (huge optimal solver), and its performance is comparable to that 17algorithm (huge optimal solver), and its performance is comparable to that
25of Kociemba's implementation in Cube Explorer. 18of Kociemba's implementation in Cube Explorer when using a single CPU
19thread, and much faster when using multiple threads.
26nissy can also solve different substeps of the Thistlethwaite's algorithm 20nissy can also solve different substeps of the Thistlethwaite's algorithm
27and more. 21and more.
22.Pp
23When run without any argument an interactive shell is launched, otherwise
24the provided
25.Ar command
26is executed and nissy terminates. If the option
27.Fl b
28is given, every argument after it is ignored and the shell is launched without
29any prompt or welcome message. This can be used to run nissy in batch mode,
30for example writing a list of commands in a
31.Ar file
32(one per line) and running
33.Ar nissy -b < file
34.Pp
35The commands that can be run in the interactive shell are the same that can
36be run non-interactively and are provided below.
28. 37.
29.Sh COMMANDS 38.Sh COMMANDS
30The available 39The available
diff --git a/nissy b/nissy
index 58bb540..4c759f5 100755
--- a/nissy
+++ b/nissy
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
57void 57void
58launch() 58launch(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()
85int 88int
86main(int argc, char *argv[]) 89main(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
10void exec_args(int c, char **v); 10void exec_args(int c, char **v);
11void launch(); 11void launch(bool prompt);
12 12
13#endif 13#endif

Generated with cgit - Back to sebastiano.tronto.net