transfig/fig2dev-3.2.6a-RGBFILE.patch

33 lines
973 B
Diff

From: Roland Rosenfeld <roland@debian.org>
Subject: rgb.txt can not be located via FIG2DEV_RGBFILE environment variable.
This allows to run the test suite without the package being installed before.
--- a/fig2dev/colors.c
+++ b/fig2dev/colors.c
@@ -27,6 +27,7 @@
#include "pi.h"
#include "fig2dev.h"
+#include <stdlib.h>
struct color_db {
char *name;
@@ -108,10 +109,15 @@ read_colordb(void)
char s[100], s1[100], *c1, *c2;
unsigned short r,g,b;
struct color_db *col;
+ char *rgbfile;
- fp = fopen(RGB_FILE, "r");
+ rgbfile = getenv("FIG2DEV_RGBFILE");
+ if (rgbfile == NULL) {
+ rgbfile = RGB_FILE;
+ }
+ fp = fopen(rgbfile, "r");
if (fp == NULL) {
- fprintf(stderr,"Couldn't open the RGB database file '%s'\n", RGB_FILE);
+ fprintf(stderr,"Couldn't open the RGB database file '%s'\n", rgbfile);
return -1;
}
if ((Xcolors = (struct color_db*) malloc(maxcolors*sizeof(struct color_db)))