Date: Thu, 15 Nov 2001 21:47:53 +0100 (CET) From: Helge Oldach <send-pr@oldach.net> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/32016: ports/graphics/ppmcaption font file path fix Message-ID: <200111152047.fAFKlrR36128@sep.oldach.net>
next in thread | raw e-mail | index | archive | help
>Number: 32016 >Category: ports >Synopsis: ports/graphics/ppmcaption font file path fix >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Nov 15 12:50:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Helge Oldach >Release: FreeBSD 4.4-STABLE i386 >Organization: >Environment: System: FreeBSD sep.oldach.net 4.4-STABLE FreeBSD 4.4-STABLE #4: Sat Nov 3 16:16:29 CET 2001 toor@sep.oldach.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: ppmcaption has a compiled-in list of color names. Unfortunately some of the color names don't match the common X color database, however X would be the usual environment to use ppmcaption with. This mismatch should be removed. The suggested change is to make ppmcaption browse through the standard X color databases and apply their color definitions instead. The patch below looks for a standard X color database in the file pointed to by the environment variable RGBDEF (name stolen from pbmlib which is being used by ppmcaption anyway), or the usual places for assorted X installations (in that order). Only if an X color database isn't found it will (silently) query the built-in database. The patch has been submitted to the original ppmcaption author a while ago but without response so far. >How-To-Repeat: >Fix: --- ppmcaption.c.ORIG Thu May 24 03:17:08 2001 +++ ppmcaption.c Mon Jun 11 16:24:50 2001 @@ -133,8 +133,31 @@ static unsigned long parse_color (const char *color) { - const char *s; + const char *s, *rgbdef, colorname[1024]; + char buf[1024], errbuf[1024+100]; int i; + unsigned long r, g, b; + FILE *f; + + if (((rgbdef = getenv("RGBDEF")) != NULL && (f = fopen(rgbdef, "r")) != NULL) || + (f = fopen("/usr/lib/X11/rgb.txt", "r")) != NULL || + (f = fopen("/usr/openwin/lib/rgb.txt", "r")) != NULL || + (f = fopen("/usr/X11R6/lib/X11/rgb.txt", "r")) != NULL) + { + while (fgets(buf, sizeof(buf), f) != NULL) + { + if (buf[0] == '\0' || buf[0] == '!' || buf[0] == '#') + continue; + if (sscanf(buf, "%ld %ld %ld %[^\n]", &r, &g, &b, colorname) != 4 ) + { + sprintf(errbuf, "%s: can't parse color names database line - \"%s\"", progname, buf); + perror(errbuf); + exit (1); + } + if (!strcasecmp(color, colorname)) + return (r << 16) | (g << 8) | b; + } + } for (i = 0; i < countof(color_names); i++) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111152047.fAFKlrR36128>