File: debian.patch

package info (click to toggle)
xcolors 1.5a-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: ansic: 1,185; makefile: 14
file content (78 lines) | stat: -rw-r--r-- 2,358 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- xcolors-1.5a.orig/xcolors.c
+++ xcolors-1.5a/xcolors.c
@@ -28,7 +28,7 @@
 #include <math.h>		/* for sqrt() */
 
 #ifndef RGB_TXT
-#define RGB_TXT "/usr/lib/X11/rgb.txt"
+#define RGB_TXT "/etc/X11/rgb.txt"
 #endif
 
 String fallback_resources[] = {
@@ -285,29 +285,35 @@ colordemo(parent, startcolor, nearcolor,
     
     prev_r = prev_g = prev_b = -1;
     save_colorname[0] = '\0';
-    while (4 == fscanf(rgb, "%d %d %d %[^\n]\n", &r, &g, &b, colorname)) {
-	if (startcolor)
-	  if (l_strcasecmp(colorname, startcolor))
-	    continue;		/* haven't reached starting point yet */
-	  else
-	    startcolor = (char *)NULL;
-	if (r != prev_r  ||  g != prev_g  ||  b != prev_b) {
-	    if (nearcolor.flags) {
-		double ourdist =
-		    sqrt((double)((nearcolor.red-r)*(nearcolor.red-r)
+    while (!feof(rgb)) {
+        char str[1024];
+        
+        fgets(str, 1024L, rgb);
+        if (*str != '!') /* comment */ {
+          sscanf(str, "%d %d %d %[^\n]\n", &r, &g, &b, colorname);
+  	  if (startcolor)
+	    if (l_strcasecmp(colorname, startcolor))
+	      continue;		/* haven't reached starting point yet */
+	    else
+	      startcolor = (char *)NULL;
+	  if (r != prev_r  ||  g != prev_g  ||  b != prev_b) {
+	      if (nearcolor.flags) {
+		  double ourdist =
+		      sqrt((double)((nearcolor.red-r)*(nearcolor.red-r)
 				  + (nearcolor.green-g)*(nearcolor.green-g)
 				  + (nearcolor.blue-b)*(nearcolor.blue-b)));
-		if (ourdist > ddist)
-		    continue;
-	    }
-	    if (save_colorname[0] != '\0') /* skip first time through */
-	      if (!do_color(parent, save_colorname))
-		return;
-	    prev_r = r;
-	    prev_g = g;
-	    prev_b = b;
+		  if (ourdist > ddist)
+		      continue;
+	      }
+	      if (save_colorname[0] != '\0') /* skip first time through */
+	        if (!do_color(parent, save_colorname))
+		  return;
+	      prev_r = r;
+	      prev_g = g;
+	      prev_b = b;
+	  }
+	  strcpy(save_colorname, colorname);
 	}
-	strcpy(save_colorname, colorname);
     }
     if (save_colorname[0] != '\0')
       (void)do_color(parent, save_colorname);
--- xcolors-1.5a.orig/xcolors.man
+++ xcolors-1.5a/xcolors.man
@@ -95,7 +95,7 @@ Xcolors \fIxcolors\fP
 .fi
 .SH FILES
 .TP
-.I /usr/lib/X11/rgb.txt
+.I /etc/X11/rgb.txt
 X color names and values.
 .SH BUGS
 Assumes that all names for the same color are consecutive in the