2016-09-23 14:11:02 +02:00
|
|
|
---
|
|
|
|
fig2dev/dev/genps.c | 26 +++++++++++++++++++++++---
|
|
|
|
fig2dev/dev/genpstex.c | 8 ++++++--
|
|
|
|
fig2dev/fig2ps2tex.csh | 2 +-
|
|
|
|
fig2dev/getopt.c | 10 ++++++++++
|
|
|
|
transfig/transfig.c | 2 ++
|
2017-02-02 15:06:14 +01:00
|
|
|
5 files changed, 42 insertions(+), 6 deletions(-)
|
2016-09-23 14:11:02 +02:00
|
|
|
|
|
|
|
--- fig2dev/dev/genps.c
|
2017-02-02 15:06:14 +01:00
|
|
|
+++ fig2dev/dev/genps.c 2017-02-02 13:47:11.888588548 +0000
|
|
|
|
@@ -56,6 +56,7 @@
|
2016-09-23 14:11:02 +02:00
|
|
|
#include <pwd.h>
|
|
|
|
#endif
|
|
|
|
#include <locale.h>
|
|
|
|
+#include <langinfo.h>
|
2017-02-02 15:06:14 +01:00
|
|
|
#include "bool.h"
|
|
|
|
#include "pi.h"
|
2016-09-23 14:11:02 +02:00
|
|
|
|
2017-02-02 15:06:14 +01:00
|
|
|
@@ -801,8 +802,9 @@ genps_start(F_compound *objects)
|
2016-09-23 14:11:02 +02:00
|
|
|
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
|
2017-02-02 15:06:14 +01:00
|
|
|
@@ -810,16 +812,34 @@ genps_start(F_compound *objects)
|
2016-09-23 14:11:02 +02:00
|
|
|
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't open file: %s\n", localefile);
|
|
|
|
- } else {
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
fputs(str, tfp);
|
|
|
|
--- fig2dev/dev/genpstex.c
|
2017-02-02 15:06:14 +01:00
|
|
|
+++ fig2dev/dev/genpstex.c 2017-02-02 13:47:38.580050694 +0000
|
|
|
|
@@ -44,6 +44,7 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
2016-09-23 14:11:02 +02:00
|
|
|
+#include <sys/stat.h>
|
2017-02-02 15:06:14 +01:00
|
|
|
#include "bool.h"
|
|
|
|
|
2016-09-23 14:11:02 +02:00
|
|
|
#include "fig2dev.h"
|
2017-02-02 15:06:14 +01:00
|
|
|
@@ -61,10 +62,13 @@ extern void
|
2016-09-23 14:11:02 +02:00
|
|
|
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
|
2017-02-02 15:06:14 +01:00
|
|
|
+++ fig2dev/fig2ps2tex.csh 2017-02-02 13:43:20.089154382 +0000
|
2016-09-23 14:11:02 +02:00
|
|
|
@@ -21,7 +21,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
|
2017-02-02 15:06:14 +01:00
|
|
|
+++ fig2dev/getopt.c 2017-02-02 13:43:20.089154382 +0000
|
2016-09-23 14:11:02 +02:00
|
|
|
@@ -45,6 +45,7 @@ static char sccsfid[] = "@(#) getopt.c 5
|
|
|
|
#define EMSG ""
|
|
|
|
#define ENDARGS "--"
|
|
|
|
|
|
|
|
+#ifndef __GLIBC__
|
|
|
|
/*
|
|
|
|
* get option letter from argument vector
|
|
|
|
*/
|
|
|
|
@@ -89,3 +90,12 @@ 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
|
2017-02-02 15:06:14 +01:00
|
|
|
+++ transfig/transfig.c 2017-02-02 13:43:20.089154382 +0000
|
2016-09-23 14:11:02 +02:00
|
|
|
@@ -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 */
|