From 98b8339bceb833eb2419bc349547cb8342e4be1a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 27 Feb 2024 18:33:31 +0100 Subject: Print solutions to stderr when using -v --- src/alg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/alg.c') 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) } void -print_alg(Alg *alg, bool l) +print_alg(FILE *out, Alg *alg, bool l) { char fill[4]; int i; @@ -437,25 +437,25 @@ print_alg(Alg *alg, bool l) if (niss == alg->inv[i]) strcpy(fill, i == 0 ? "" : " "); - printf("%s%s", fill, move_string(alg->move[i])); + fprintf(out, "%s%s", fill, move_string(alg->move[i])); niss = alg->inv[i]; } if (niss) - printf(")"); + fprintf(out, ")"); if (l) - printf(" (%d)", alg->len); + fprintf(out, " (%d)", alg->len); - printf("\n"); + fprintf(out, "\n"); } void -print_alglist(AlgList *al, bool l) +print_alglist(FILE *out, AlgList *al, bool l) { AlgListNode *i; for (i = al->first; i != NULL; i = i->next) - print_alg(i->alg, l); + print_alg(out, i->alg, l); } static void -- cgit v1.3