diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-13 12:12:42 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-13 12:12:42 +0100 |
| commit | 97c9dba402d6d4097cbdc4c44c00222c53122033 (patch) | |
| tree | f604aa049737b5e486924c88f86d91106428ec24 /src/commands.c | |
| parent | ac458f4de9a1d5fa203bed7b57de05ea65451788 (diff) | |
| download | nissy-97c9dba402d6d4097cbdc4c44c00222c53122033.tar.gz nissy-97c9dba402d6d4097cbdc4c44c00222c53122033.zip | |
Fixed bug in reading scrambles with unmatched parentheses
Diffstat (limited to '')
| -rw-r--r-- | src/commands.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/commands.c b/src/commands.c index 740736c..d9d6b50 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -519,25 +519,14 @@ read_scramble(int c, char **v, CommandArgs *args) | |||
| 519 | int i, k, n; | 519 | int i, k, n; |
| 520 | unsigned int j; | 520 | unsigned int j; |
| 521 | char *algstr; | 521 | char *algstr; |
| 522 | Alg *aux; | ||
| 523 | 522 | ||
| 524 | if (c < 1) { | 523 | if (c < 1) { |
| 525 | fprintf(stderr, "Error: no scramble given?\n"); | 524 | fprintf(stderr, "Error: no scramble given?\n"); |
| 526 | return false; | 525 | return false; |
| 527 | } | 526 | } |
| 528 | 527 | ||
| 529 | n = 0; | 528 | for(n = 0, i = 0; i < c; i++) |
| 530 | for(i = 0; i < c; i++) { | ||
| 531 | aux = new_alg(v[i]); | ||
| 532 | if (aux->len == 0) { | ||
| 533 | fprintf(stderr, "Error: %s or its argument" | ||
| 534 | "unrecognized\n", v[i]); | ||
| 535 | free(aux); | ||
| 536 | return false; | ||
| 537 | } | ||
| 538 | free(aux); | ||
| 539 | n += strlen(v[i]); | 529 | n += strlen(v[i]); |
| 540 | } | ||
| 541 | 530 | ||
| 542 | algstr = malloc((n + 1) * sizeof(char)); | 531 | algstr = malloc((n + 1) * sizeof(char)); |
| 543 | k = 0; | 532 | k = 0; |
