diff options
Diffstat (limited to 'Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc')
-rw-r--r-- | Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc b/Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc index 67e635f662a..67d403d3d2b 100644 --- a/Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-src/mmafm/main.cc @@ -1,6 +1,6 @@ /* main.cc -- driver for mmafm program * - * Copyright (c) 1997-2019 Eddie Kohler + * Copyright (c) 1997-2023 Eddie Kohler * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -30,19 +30,19 @@ # include <time.h> #endif -#define WEIGHT_OPT 300 -#define WIDTH_OPT 301 -#define OPSIZE_OPT 302 -#define STYLE_OPT 303 -#define N1_OPT 304 -#define N2_OPT 305 -#define N3_OPT 306 -#define N4_OPT 307 -#define VERSION_OPT 308 -#define HELP_OPT 309 -#define OUTPUT_OPT 310 -#define PRECISION_OPT 311 -#define KERN_PREC_OPT 312 +#define WEIGHT_OPT 300 +#define WIDTH_OPT 301 +#define OPSIZE_OPT 302 +#define STYLE_OPT 303 +#define N1_OPT 304 +#define N2_OPT 305 +#define N3_OPT 306 +#define N4_OPT 307 +#define VERSION_OPT 308 +#define HELP_OPT 309 +#define OUTPUT_OPT 310 +#define PRECISION_OPT 311 +#define KERN_PREC_OPT 312 const Clp_Option options[] = { { "1", '1', N1_OPT, Clp_ValDouble, 0 }, @@ -216,6 +216,7 @@ usage_error(const char *error_message, ...) errh->xmessage(ErrorHandler::e_error, error_message, val); errh->message("Type %s --help for more information.", program_name); exit(1); + va_end(val); } static void @@ -307,11 +308,11 @@ main(int argc, char *argv[]) case OUTPUT_OPT: if (output_file) errh->fatal("output file already specified"); if (strcmp(clp->vstr, "-") == 0) - output_file = stdout; + output_file = stdout; else { - output_file = fopen(clp->vstr, "wb"); - if (!output_file) - errh->fatal("%s: %s", clp->vstr, strerror(errno)); + output_file = fopen(clp->vstr, "wb"); + if (!output_file) + errh->fatal("%s: %s", clp->vstr, strerror(errno)); } break; @@ -322,7 +323,7 @@ main(int argc, char *argv[]) case VERSION_OPT: printf("mmafm (LCDF typetools) %s\n", VERSION); - printf("Copyright (C) 1997-2019 Eddie Kohler\n\ + printf("Copyright (C) 1997-2023 Eddie Kohler\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty, not even for merchantability or fitness for a\n\ particular purpose.\n"); @@ -349,8 +350,9 @@ particular purpose.\n"); MultipleMasterSpace *mmspace = amfm->mmspace(); #if MMAFM_RUN_MMPFB if (!mmspace->check_intermediate()) { - char *buf = new char[amfm->font_name().length() + 30]; - sprintf(buf, "mmpfb -q --amcp-info '%s'", amfm->font_name().c_str()); + size_t bufsz = amfm->font_name().length() + 30; + char *buf = new char[bufsz]; + snprintf(buf, bufsz, "mmpfb -q --amcp-info '%s'", amfm->font_name().c_str()); FILE *f = popen(buf, "r"); if (f) { @@ -391,7 +393,7 @@ particular purpose.\n"); // components are unknown. if (!KNOWN(design[0])) errh->fatal("must specify %s%,s %s coordinate", amfm->font_name().c_str(), - mmspace->axis_type(0).c_str()); + mmspace->axis_type(0).c_str()); Metrics *m = amfm->interpolate(design, weight, errh); if (m) { @@ -404,12 +406,13 @@ particular purpose.\n"); time_t cur_time = time(0); char *time_str = ctime(&cur_time); int time_len = strlen(time_str) - 1; - char *buf = new char[strlen(VERSION) + time_len + 100]; - sprintf(buf, "Interpolated by mmafm-%s on %.*s.", VERSION, - time_len, time_str); + size_t bufsz = strlen(VERSION) + time_len + 100; + char* buf = new char[bufsz]; + snprintf(buf, bufsz, "Interpolated by mmafm-%s on %.*s.", VERSION, + time_len, time_str); #else - char *buf = new char[strlen(VERSION) + 100]; - sprintf(buf, "Interpolated by mmafm-%s.", VERSION); + char* buf = new char[strlen(VERSION) + 100]; + snprintf(buf, strlen(VERSION) + 100, "Interpolated by mmafm-%s.", VERSION); #endif afm_xt->opening_comments.push_back(buf); |