ansilove

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

commit 7559b71c2450c601681d443ca418abcbfeaeaed1
parent 28682b1be12457fae676f258bd53f052cbd33b45
Author: ByteProject <ByteProject@users.noreply.github.com>
Date:   Sat, 22 Apr 2017 18:17:49 +0200

prevent .png appendix with -o flag

Diffstat:
Msrc/main.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -75,7 +75,7 @@ void listExamples(void) { printf(" ansilove file.ans (output path/name identical to input, no options)\n" " ansilove -i file.ans (enable iCE colors)\n" " ansilove -r file.ans (adds Retina @2x output file)\n" - " ansilove -o dir/file file.ans (custom path/name for output)\n" + " ansilove -o dir/file.ans file.png (custom path/name for output)\n" " ansilove -s file.bin (just display SAUCE record, don't generate output)\n" " ansilove -m transparent file.ans (render with transparent background)\n" " ansilove -f amiga file.txt (custom font)\n" @@ -237,15 +237,16 @@ int main(int argc, char *argv[]) { if (!output) { outputName = input; - } else { + // appending ".png" extension to output file name + int outputLen = strlen(outputName) + 5; + outputFile = malloc(outputLen); + snprintf(outputFile, outputLen, "%s%s", outputName, ".png"); + } + else { outputName = output; + outputFile = outputName; } - // appending ".png" extension to output file name - int outputLen = strlen(outputName) + 5; - outputFile = malloc(outputLen); - snprintf(outputFile, outputLen, "%s%s", outputName, ".png"); - if (createRetinaRep) { int retinaLen = strlen(outputName) + 8; retinaout = malloc(retinaLen);