diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-25 00:06:50 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-25 00:06:50 +0100 |
| commit | bedc3ef9af6bc54f3ede135f1ad72565a8494f84 (patch) | |
| tree | 6384e576ab87441344f71c789c9387fe4d233e02 | |
| parent | 8595bd0aa8d55b698f2de15b28c20b482df366c3 (diff) | |
| download | nissy-bedc3ef9af6bc54f3ede135f1ad72565a8494f84.tar.gz nissy-bedc3ef9af6bc54f3ede135f1ad72565a8494f84.zip | |
Better error message when option for solve is unrecognized
| -rw-r--r-- | TODO.md | 1 | ||||
| -rwxr-xr-x | nissy | bin | 0 -> 321848 bytes | |||
| -rw-r--r-- | src/commands.c | 15 |
3 files changed, 13 insertions, 3 deletions
| @@ -33,6 +33,7 @@ It's more of a personal reminder than anything else. | |||
| 33 | * configure max ram to be used (via config file and/or command line option) | 33 | * configure max ram to be used (via config file and/or command line option) |
| 34 | * command to transform cube and alg | 34 | * command to transform cube and alg |
| 35 | * command notation to list available moves | 35 | * command notation to list available moves |
| 36 | * | ||
| 36 | 37 | ||
| 37 | ## Distribution | 38 | ## Distribution |
| 38 | 39 | ||
| Binary files differ | |||
diff --git a/src/commands.c b/src/commands.c index 6afd5cd..d515042 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -385,15 +385,24 @@ read_scramble(int c, char **v, CommandArgs *args) | |||
| 385 | int i, k, n; | 385 | int i, k, n; |
| 386 | unsigned int j; | 386 | unsigned int j; |
| 387 | char *algstr; | 387 | char *algstr; |
| 388 | Alg *aux; | ||
| 388 | 389 | ||
| 389 | if (c < 1 || new_alg(v[0])->len == 0) { | 390 | if (c < 1) { |
| 390 | fprintf(stderr, "Error reading scramble\n"); | 391 | fprintf(stderr, "Error: no scramble given?\n"); |
| 391 | return false; | 392 | return false; |
| 392 | } | 393 | } |
| 393 | 394 | ||
| 394 | n = 0; | 395 | n = 0; |
| 395 | for(i = 0; i < c; i++) | 396 | for(i = 0; i < c; i++) { |
| 397 | aux = new_alg(v[i]); | ||
| 398 | if (aux->len == 0) { | ||
| 399 | fprintf(stderr, "Error: %s unrecognized\n", v[i]); | ||
| 400 | free(aux); | ||
| 401 | return false; | ||
| 402 | } | ||
| 403 | free(aux); | ||
| 396 | n += strlen(v[i]); | 404 | n += strlen(v[i]); |
| 405 | } | ||
| 397 | 406 | ||
| 398 | algstr = malloc((n + 1) * sizeof(char)); | 407 | algstr = malloc((n + 1) * sizeof(char)); |
| 399 | k = 0; | 408 | k = 0; |
