116 lines
3.2 KiB
Plaintext
116 lines
3.2 KiB
Plaintext
|
---
|
||
|
configure | 2 +-
|
||
|
fig2dev/dev/genps.c | 32 ++++++++++++++++++++++----------
|
||
|
fig2dev/dev/genpstex.c | 8 ++++++--
|
||
|
fig2dev/fig2ps2tex.csh | 2 +-
|
||
|
fig2dev/lib/getopt.c | 9 +++++++++
|
||
|
transfig/transfig.c | 2 ++
|
||
|
6 files changed, 41 insertions(+), 14 deletions(-)
|
||
|
|
||
|
--- configure
|
||
|
+++ configure 2021-02-12 08:54:37.958704809 +0000
|
||
|
@@ -2341,7 +2341,7 @@ ac_c_conftest_c99_main='
|
||
|
int dynamic_array[ni.number];
|
||
|
dynamic_array[0] = argv[0][0];
|
||
|
dynamic_array[ni.number - 1] = 543;
|
||
|
-
|
||
|
+ free(ia);
|
||
|
// work around unused variable warnings
|
||
|
ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
|
||
|
|| dynamic_array[ni.number - 1] != 543);
|
||
|
--- fig2dev/dev/genps.c
|
||
|
+++ fig2dev/dev/genps.c 2021-02-12 09:13:56.896176342 +0000
|
||
|
@@ -56,6 +56,7 @@
|
||
|
#include <pwd.h>
|
||
|
#endif
|
||
|
#include <locale.h>
|
||
|
+#include <langinfo.h>
|
||
|
|
||
|
#include "fig2dev.h" /* includes bool.h and object.h */
|
||
|
//#include "object.h" /* NUMSHADES, NUMTINTS */
|
||
|
@@ -958,9 +959,10 @@ genps_start(F_compound *objects)
|
||
|
fprintf(tfp, "%s\n", SPLINE_PS);
|
||
|
#ifdef I18N
|
||
|
if (support_i18n && iso_text_exist(objects)) {
|
||
|
- char *libdir, *locale;
|
||
|
- char localefile_buf[128];
|
||
|
- char *localefile = localefile_buf;
|
||
|
+ char *libdir, *locale, *codeset;
|
||
|
+ char *localefile = NULL;
|
||
|
+ size_t llen;
|
||
|
+ int ret;
|
||
|
FILE *fp;
|
||
|
libdir = getenv("FIG2DEV_LIBDIR");
|
||
|
#ifdef I18N_DATADIR
|
||
|
@@ -968,19 +970,30 @@ genps_start(F_compound *objects)
|
||
|
libdir = I18N_DATADIR;
|
||
|
#endif
|
||
|
locale = setlocale(LC_CTYPE, NULL);
|
||
|
+ llen = strcspn(locale, ".@");
|
||
|
+ codeset = nl_langinfo(CODESET);
|
||
|
if (locale == NULL) {
|
||
|
fprintf(stderr,
|
||
|
"fig2dev: LANG not defined; assuming C locale\n");
|
||
|
locale = "C";
|
||
|
}
|
||
|
- if (strlen(libdir) + strlen(locale) + 5 > sizeof localefile_buf)
|
||
|
- localefile = malloc(strlen(libdir) + strlen(locale) + 5);
|
||
|
- if (localefile != NULL) {
|
||
|
- sprintf(localefile, "%s/%s.ps", libdir, locale);
|
||
|
+ retry:
|
||
|
+ ret = asprintf(&localefile, "%s/%s.ps", libdir, locale);
|
||
|
+ if (ret > 0) {
|
||
|
/* get filename like
|
||
|
``/usr/local/lib/fig2dev/japanese.ps'' */
|
||
|
fp = fopen(localefile, "rb");
|
||
|
if (fp == NULL) {
|
||
|
+ if (strlen(locale) != llen) {
|
||
|
+ free(localefile);
|
||
|
+ locale[llen] = '\0';
|
||
|
+ goto retry;
|
||
|
+ }
|
||
|
+ if (codeset && locale != codeset) {
|
||
|
+ free(localefile);
|
||
|
+ locale = codeset;
|
||
|
+ goto retry;
|
||
|
+ }
|
||
|
fprintf(stderr, "fig2dev: can not open file: %s\n",
|
||
|
localefile);
|
||
|
} else {
|
||
|
@@ -998,11 +1011,10 @@ genps_start(F_compound *objects)
|
||
|
"The output might be broken.\n",
|
||
|
localefile);
|
||
|
}
|
||
|
- fclose(fp);
|
||
|
+ fclose(fp);
|
||
|
}
|
||
|
- }
|
||
|
- if (localefile != localefile_buf)
|
||
|
free(localefile);
|
||
|
+ }
|
||
|
}
|
||
|
#endif /* I18N */
|
||
|
|
||
|
--- fig2dev/fig2ps2tex.csh
|
||
|
+++ fig2dev/fig2ps2tex.csh 2021-02-12 08:54:37.954704887 +0000
|
||
|
@@ -22,7 +22,7 @@
|
||
|
# 2016-07-07 Thomas Loimer
|
||
|
# * use here-document, instead of echo
|
||
|
#
|
||
|
-
|
||
|
+set echo_style = bsd
|
||
|
set bbox = `grep "^%%BoundingBox:" $1`
|
||
|
|
||
|
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
|
||
|
--- transfig/transfig.c
|
||
|
+++ transfig/transfig.c 2021-02-12 08:54:37.954704887 +0000
|
||
|
@@ -26,6 +26,8 @@
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
+#include <string.h>
|
||
|
+#include <unistd.h>
|
||
|
#include "transfig.h"
|
||
|
|
||
|
extern void sysmv(char *file); /* sys.c */
|