bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

commit b8f01af403b6984e9034463571b414e411ef2fda
parent 233ea60e96d5d95756143a3f800a1beefa0a6760
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 27 Mar 2020 22:50:38 +0100

Add an error() function to wrap errx() calls.

Diffstat:
Msrc/bdf2sfd.c | 20+++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/bdf2sfd.c b/src/bdf2sfd.c @@ -4,7 +4,7 @@ * https://github.com/fcambus/bdf2sfd * * Created: 2019-11-21 - * Last Updated: 2020-03-20 + * Last Updated: 2020-03-27 * * bdf2sfd is released under the BSD 2-Clause license * See LICENSE file for details @@ -60,6 +60,12 @@ displayUsage() " -v Display version.\n"); } +void +error(const char *str) +{ + errx(EXIT_FAILURE, "%s", str); +} + int main(int argc, char *argv[]) { @@ -176,7 +182,7 @@ main(int argc, char *argv[]) width = strtonum(value, 0, 32, &errstr); if (errstr) - errx(EXIT_FAILURE, "Invalid value for FONTBOUNDINGBOX."); + error("Invalid value for FONTBOUNDINGBOX."); value = strtok(NULL, " \t"); @@ -184,10 +190,10 @@ main(int argc, char *argv[]) height = strtonum(value, 0, 64, &errstr); if (errstr) - errx(EXIT_FAILURE, "Invalid value for FONTBOUNDINGBOX."); + error("Invalid value for FONTBOUNDINGBOX."); if (!width || !height) - errx(EXIT_FAILURE, "Invalid value for FONTBOUNDINGBOX."); + error("Invalid value for FONTBOUNDINGBOX."); xlength = 512.0 / width; ylength = 1024.0 / height; @@ -203,7 +209,7 @@ main(int argc, char *argv[]) if (!errstr) font.ascent = ascent * ylength; else - errx(EXIT_FAILURE, "Invalid value for FONT_ASCENT."); + error("Invalid value for FONT_ASCENT."); continue; @@ -213,7 +219,7 @@ main(int argc, char *argv[]) if (!errstr) font.descent = descent * ylength; else - errx(EXIT_FAILURE, "Invalid value for FONT_DESCENT."); + error( "Invalid value for FONT_DESCENT."); continue; @@ -228,7 +234,7 @@ main(int argc, char *argv[]) if (font.chars) header(stdout, &font); else - errx(EXIT_FAILURE, "Invalid value for CHARS."); + error("Invalid value for CHARS."); continue;