diff options
Diffstat (limited to 'converter/ppm/ppmtoterm.c')
-rw-r--r-- | converter/ppm/ppmtoterm.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/converter/ppm/ppmtoterm.c b/converter/ppm/ppmtoterm.c index d388f77d..b1d94fa2 100644 --- a/converter/ppm/ppmtoterm.c +++ b/converter/ppm/ppmtoterm.c @@ -19,6 +19,7 @@ ** */ +#include <stdbool.h> #include <assert.h> #include <string.h> @@ -43,7 +44,6 @@ parseCommandLine(int argc, const char ** argv, struct cmdlineInfo * const cmdlineP) { optEntry * option_def; - /* Instructions to OptParseOptions3 on how to parse our options */ optStruct3 opt; unsigned int option_def_index; @@ -54,10 +54,10 @@ parseCommandLine(int argc, const char ** argv, OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); opt.opt_table = option_def; - opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ - opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ + opt.short_allowed = false; /* We have no short (old-fashioned) options */ + opt.allowNegNum = false; /* We have no parms that are negative numbers */ - pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); + pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ if (argc-1 < 1) @@ -86,7 +86,7 @@ parseCommandLine(int argc, const char ** argv, static void -generatePalette(unsigned char rgb[NUM_COLORS][3], +generatePalette(unsigned char rgb[NUM_COLORS][3], char ansiCode[NUM_COLORS][MAX_ANSI_STR_LEN], unsigned int * const paletteSizeP) { /*---------------------------------------------------------------------------- @@ -150,7 +150,7 @@ generatePalette(unsigned char rgb[NUM_COLORS][3], static void lookupInPalette(pixel const pixel, pixval const maxval, - unsigned char rgb[NUM_COLORS][3], + unsigned char rgb[NUM_COLORS][3], unsigned int const palLen, unsigned int * const paletteIdxP) { /*---------------------------------------------------------------------------- @@ -166,7 +166,7 @@ lookupInPalette(pixel const pixel, unsigned int paletteIdxSoFar; unsigned int dist; unsigned int i; - + /* The following loop calculates the index that corresponds to the minimum color distance between the given RGB values and the values available in the palette. @@ -200,18 +200,18 @@ main(int argc, const char ** argv) { unsigned char rgb[NUM_COLORS][3]; char ansiCode[NUM_COLORS][MAX_ANSI_STR_LEN]; - pm_proginit(&argc, argv); + pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); ifP = pm_openr(cmdline.inputFileName); - + pixels = ppm_readppm(ifP, &cols, &rows, &maxval); pm_close(ifP); - + generatePalette(rgb, ansiCode, &palLen); - + for (row = 0; row < rows; ++row) { unsigned int col; for (col = 0; col < cols; ++col) { @@ -227,6 +227,9 @@ main(int argc, const char ** argv) { printf(ESC "\x30m"); ppm_freearray(pixels, rows); - + return 0; } + + + |