SHA256
1
0
forked from pool/transfig
transfig/transfig-3.2.6.dif

140 lines
4.1 KiB
Plaintext

---
fig2dev/dev/genps.c | 29 ++++++++++++++++++++++++-----
fig2dev/dev/genpstex.c | 8 ++++++--
fig2dev/fig2ps2tex.csh | 2 +-
fig2dev/getopt.c | 9 +++++++++
transfig/transfig.c | 2 ++
5 files changed, 42 insertions(+), 8 deletions(-)
--- fig2dev/dev/genps.c
+++ fig2dev/dev/genps.c 2018-05-07 08:16:40.161130640 +0000
@@ -59,6 +59,7 @@
#include <pwd.h>
#endif
#include <locale.h>
+#include <langinfo.h>
#include "pi.h"
#include "fig2dev.h" /* includes "bool.h" */
@@ -844,8 +845,9 @@ genps_start(F_compound *objects)
fprintf(tfp, "%s\n", SPLINE_PS);
#ifdef I18N
if (support_i18n && iso_text_exist(objects)) {
- char *libdir, *locale;
+ char *libdir, *locale, *codeset;
char localefile[512], str[512];
+ size_t llen;
FILE *fp;
libdir = getenv("FIG2DEV_LIBDIR");
#ifdef I18N_DATADIR
@@ -853,18 +855,35 @@ 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";
}
- sprintf(localefile, "%s/%s.ps", libdir, locale);
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
/* get filename like ``/usr/local/lib/fig2dev/japanese.ps'' */
fp = fopen(localefile, "rb");
if (fp == NULL) {
- fprintf(stderr, "fig2dev: can not open file: %s\n",
- localefile);
- } else {
+ fprintf(stderr, "fig2dev: can not open file: %s\n", localefile);
+ }
+ if (fp == NULL && strlen(locale) != llen) {
+ locale[llen] = '\0';
+ /* get filename like ``/usr/local/lib/fig2dev/de_DE.ps'' */
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, locale);
+ fp = fopen(localefile, "rb");
+ if (fp == NULL)
+ fprintf(stderr, "fig2dev: B can't open file: %s\n", localefile);
+ }
+ if (fp == NULL && codeset) {
+ /* get filename like ``/usr/local/lib/fig2dev/ISO-8859-9.ps'' */
+ snprintf(localefile, sizeof(localefile)-1, "%s/%s.ps", libdir, codeset);
+ fp = fopen(localefile, "rb");
+ if (fp == NULL)
+ fprintf(stderr, "fig2dev: C can't open file: %s\n", localefile);
+ }
+ if (fp) {
while (fgets(str, sizeof(str), fp)) {
if (strstr(str, "CompositeRoman"))
enable_composite_font = true;
--- fig2dev/dev/genpstex.c
+++ fig2dev/dev/genpstex.c 2018-05-07 08:10:27.872048970 +0000
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <sys/stat.h>
#include "fig2dev.h"
#include "object.h" /* does #include <X11/xpm.h> */
@@ -63,10 +64,13 @@ extern void
genps_spline(F_spline *s),
genlatex_option(char opt, char *optarg),
genlatex_text(F_text *t),
- genps_text(F_text *t);
+ genps_text(F_text *t),
+ genpdf_option(char opt, char *optarg),
+ genpdf_start(F_compound *objects);
extern int
genlatex_end(void),
- genps_end(void);
+ genps_end(void),
+ genpdf_end(void);
extern void genpdf_option(char opt, char *optarg); /* genpdf.c */
extern void genpdf_start(F_compound *objects); /* genpdf.c */
--- fig2dev/fig2ps2tex.csh
+++ fig2dev/fig2ps2tex.csh 2018-05-07 08:11:38.206742453 +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`
--- fig2dev/getopt.c
+++ fig2dev/getopt.c 2018-05-07 08:13:44.400397232 +0000
@@ -48,6 +48,7 @@ static char sccsfid[] = "@(#) getopt.c 5
#define EMSG ""
#define ENDARGS "--"
+#ifndef __GLIBC__
/*
* get option letter from argument vector
*/
@@ -94,3 +95,11 @@ fig_getopt(int nargc, char **nargv, char
}
return optc; /* dump back option letter */
}
+#else
+#include <unistd.h>
+int
+fig_getopt(int nargc, char * const nargv[], const char *ostr)
+{
+ return getopt(nargc, nargv, ostr);
+}
+#endif
--- transfig/transfig.c
+++ transfig/transfig.c 2018-05-07 08:01:42.105796359 +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 */