ansilove

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

commit 553fcbb8929703293fb2345154c2b45f4cac37ed
parent 59f5abe0db5b2753508abaa1a64fac478f2a1ab8
Author: Frederic Cambus <fred@statdns.com>
Date:   Sun, 16 Feb 2020 23:04:24 +0100

Exit with error if the specified file type doesn't match any loader.

Diffstat:
Msrc/ansilove.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ansilove.c b/src/ansilove.c @@ -242,9 +242,12 @@ main(int argc, char *argv[]) break; } } + + if (!loader) + errx(EXIT_FAILURE, "Unknown file type."); } - /* fall back on file extension if no loader was found */ + /* use file extension to find a suitable loader */ if (!loader) { for (size_t loop = 0; loop < TYPES; loop++) { if (!strcmp(types[loop], fext)) { @@ -255,6 +258,7 @@ main(int argc, char *argv[]) } } + /* default to ANSI if file extension is unknown */ if (!loader) { loader = ansilove_ansi; filetype = ANSILOVE_FILETYPE_ANS;