nissy

Where is nissy?
git clone https://git.tronto.net/nissy
Download | Log | Files | Refs | README

commit bedc3ef9af6bc54f3ede135f1ad72565a8494f84
parent 8595bd0aa8d55b698f2de15b28c20b482df366c3
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Sat, 25 Dec 2021 00:06:50 +0100

Better error message when option for solve is unrecognized

Diffstat:
MTODO.md | 1+
Anissy | 0
Msrc/commands.c | 15++++++++++++---
3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -33,6 +33,7 @@ It's more of a personal reminder than anything else. * configure max ram to be used (via config file and/or command line option) * command to transform cube and alg * command notation to list available moves +* ## Distribution diff --git a/nissy b/nissy Binary files differ. diff --git a/src/commands.c b/src/commands.c @@ -385,15 +385,24 @@ read_scramble(int c, char **v, CommandArgs *args) int i, k, n; unsigned int j; char *algstr; + Alg *aux; - if (c < 1 || new_alg(v[0])->len == 0) { - fprintf(stderr, "Error reading scramble\n"); + if (c < 1) { + fprintf(stderr, "Error: no scramble given?\n"); return false; } n = 0; - for(i = 0; i < c; i++) + for(i = 0; i < c; i++) { + aux = new_alg(v[i]); + if (aux->len == 0) { + fprintf(stderr, "Error: %s unrecognized\n", v[i]); + free(aux); + return false; + } + free(aux); n += strlen(v[i]); + } algstr = malloc((n + 1) * sizeof(char)); k = 0;