aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--src/alg.c14
-rw-r--r--src/alg.h4
-rw-r--r--src/commands.c12
-rw-r--r--src/solve.c3
5 files changed, 18 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index f4a407d..0f0a0a1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
1# See LICENSE file for copyright and license details. 1# See LICENSE file for copyright and license details.
2 2
3VERSION = 2.0.7 3VERSION = 2.0.7-next
4 4
5PREFIX = /usr/local 5PREFIX = /usr/local
6MANPREFIX = ${PREFIX}/share/man 6MANPREFIX = ${PREFIX}/share/man
diff --git a/src/alg.c b/src/alg.c
index f00453d..fbe1105 100644
--- a/src/alg.c
+++ b/src/alg.c
@@ -423,7 +423,7 @@ on_inverse(Alg *alg)
423} 423}
424 424
425void 425void
426print_alg(Alg *alg, bool l) 426print_alg(FILE *out, Alg *alg, bool l)
427{ 427{
428 char fill[4]; 428 char fill[4];
429 int i; 429 int i;
@@ -437,25 +437,25 @@ print_alg(Alg *alg, bool l)
437 if (niss == alg->inv[i]) 437 if (niss == alg->inv[i])
438 strcpy(fill, i == 0 ? "" : " "); 438 strcpy(fill, i == 0 ? "" : " ");
439 439
440 printf("%s%s", fill, move_string(alg->move[i])); 440 fprintf(out, "%s%s", fill, move_string(alg->move[i]));
441 niss = alg->inv[i]; 441 niss = alg->inv[i];
442 } 442 }
443 443
444 if (niss) 444 if (niss)
445 printf(")"); 445 fprintf(out, ")");
446 if (l) 446 if (l)
447 printf(" (%d)", alg->len); 447 fprintf(out, " (%d)", alg->len);
448 448
449 printf("\n"); 449 fprintf(out, "\n");
450} 450}
451 451
452void 452void
453print_alglist(AlgList *al, bool l) 453print_alglist(FILE *out, AlgList *al, bool l)
454{ 454{
455 AlgListNode *i; 455 AlgListNode *i;
456 456
457 for (i = al->first; i != NULL; i = i->next) 457 for (i = al->first; i != NULL; i = i->next)
458 print_alg(i->alg, l); 458 print_alg(out, i->alg, l);
459} 459}
460 460
461static void 461static void
diff --git a/src/alg.h b/src/alg.h
index 7d11a7d..5eead22 100644
--- a/src/alg.h
+++ b/src/alg.h
@@ -32,8 +32,8 @@ void moveset_to_list(Moveset ms, Move *lst);
32Alg * new_alg(char *str); 32Alg * new_alg(char *str);
33AlgList * new_alglist(void); 33AlgList * new_alglist(void);
34Alg * on_inverse(Alg *alg); 34Alg * on_inverse(Alg *alg);
35void print_alg(Alg *alg, bool l); 35void print_alg(FILE *out, Alg *alg, bool l);
36void print_alglist(AlgList *al, bool l); 36void print_alglist(FILE *out, AlgList *al, bool l);
37void sort_alglist(AlgList *al); 37void sort_alglist(AlgList *al);
38void swapmove(Move *m1, Move *m2); 38void swapmove(Move *m1, Move *m2);
39Alg * unniss(Alg *alg); 39Alg * unniss(Alg *alg);
diff --git a/src/commands.c b/src/commands.c
index 1e5dd07..c65cc5f 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -435,7 +435,7 @@ solve_exec(CommandArgs *args)
435 printf("%d\n", sols->len); 435 printf("%d\n", sols->len);
436 } else { 436 } else {
437 sort_alglist(sols); 437 sort_alglist(sols);
438 print_alglist(sols, args->opts->print_number); 438 print_alglist(stdout, sols, args->opts->print_number);
439 } 439 }
440 440
441 free_alglist(sols); 441 free_alglist(sols);
@@ -543,7 +543,7 @@ scramble_exec(CommandArgs *args)
543 free_alg(aux); 543 free_alg(aux);
544 free_alg(ruf); 544 free_alg(ruf);
545 } 545 }
546 print_alg(scr, false); 546 print_alg(stdout, scr, false);
547 free_alg(scr); 547 free_alg(scr);
548 } 548 }
549} 549}
@@ -570,7 +570,7 @@ invert_exec(CommandArgs *args)
570 Alg *inv; 570 Alg *inv;
571 571
572 inv = inverse_alg(args->scramble); 572 inv = inverse_alg(args->scramble);
573 print_alg(inv, false); 573 print_alg(stdout, inv, false);
574 574
575 free_alg(inv); 575 free_alg(inv);
576} 576}
@@ -645,7 +645,7 @@ twophase_exec(CommandArgs *args)
645 c = apply_alg(args->scramble, (Cube){0}); 645 c = apply_alg(args->scramble, (Cube){0});
646 sol = solve_2phase(c, 1); 646 sol = solve_2phase(c, 1);
647 647
648 print_alg(sol, false); 648 print_alg(stdout, sol, false);
649 free_alg(sol); 649 free_alg(sol);
650} 650}
651 651
@@ -685,7 +685,7 @@ cleanup_exec(CommandArgs *args)
685 init_moves(); 685 init_moves();
686 686
687 alg = cleanup(args->scramble); 687 alg = cleanup(args->scramble);
688 print_alg(alg, false); 688 print_alg(stdout, alg, false);
689 689
690 free_alg(alg); 690 free_alg(alg);
691} 691}
@@ -696,7 +696,7 @@ unniss_exec(CommandArgs *args)
696 Alg *aux; 696 Alg *aux;
697 697
698 aux = unniss(args->scramble); 698 aux = unniss(args->scramble);
699 print_alg(aux, false); 699 print_alg(stdout, aux, false);
700 free(aux); 700 free(aux);
701} 701}
702 702
diff --git a/src/solve.c b/src/solve.c
index 5581964..1078816 100644
--- a/src/solve.c
+++ b/src/solve.c
@@ -156,7 +156,8 @@ dfs_check_solved(DfsArg *arg)
156 inplace(unniss, arg->sols->last->alg); 156 inplace(unniss, arg->sols->last->alg);
157 157
158 if (arg->opts->verbose) 158 if (arg->opts->verbose)
159 print_alg(arg->sols->last->alg, false); 159 print_alg(stderr,
160 arg->sols->last->alg, false);
160 } 161 }
161 162
162 pthread_mutex_unlock(arg->sols_mutex); 163 pthread_mutex_unlock(arg->sols_mutex);

Generated with cgit - Back to sebastiano.tronto.net