ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit 62d71af7422ef2551904b708931fc42772e4a7a6
parent f4df54a60fc846713c1073000179c741fb5be162
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 14 Feb 2020 18:19:40 +0100

Actually perform the information display refactoring.

Diffstat:
Msrc/ansilove.c | 27++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/ansilove.c b/src/ansilove.c @@ -66,12 +66,6 @@ main(int argc, char *argv[]) bool justDisplaySAUCE = false; bool fileHasSAUCE = false; - /* analyze options and do what has to be done */ - bool fileIsBinary = false; - bool fileIsANSi = false; - bool fileIsPCBoard = false; - bool fileIsTundra = false; - int getoptFlag; char *input = NULL, *output = NULL; @@ -274,18 +268,25 @@ main(int argc, char *argv[]) errx(EXIT_FAILURE, "%s", ansilove_error(&ctx)); /* gather information and report to the command line */ - if (fileIsANSi || fileIsBinary || - fileIsPCBoard || fileIsTundra) { + switch(filetype) { + case ANSILOVE_FILETYPE_ANS: + case ANSILOVE_FILETYPE_BIN: + if (options.icecolors) + fprintf(messages, "iCE Colors: enabled\n"); + + /* FALLTHROUGH */ + case ANSILOVE_FILETYPE_PCB: + case ANSILOVE_FILETYPE_TND: fprintf(messages, "Font: %s\n", font ? font : "80x25"); - fprintf(messages, "Bits: %d\n", options.bits); } - if (options.icecolors && (fileIsANSi || fileIsBinary)) - fprintf(messages, "iCE Colors: enabled\n"); - - if (fileIsANSi || fileIsBinary || fileIsTundra) + switch(filetype) { + case ANSILOVE_FILETYPE_ANS: + case ANSILOVE_FILETYPE_BIN: + case ANSILOVE_FILETYPE_TND: fprintf(messages, "Columns: %d\n", options.columns); + } if (options.scale_factor) fprintf(messages, "Scale factor: %d\n", options.scale_factor);