summaryrefslogtreecommitdiff
path: root/xc
diff options
context:
space:
mode:
authorjg <empty>1985-08-19 11:28:29 +0000
committerjg <empty>1985-08-19 11:28:29 +0000
commit0d0ad63237618270e48503a37ce542139d7abab5 (patch)
tree00f22ed6670c992a87bc615d96de344deb5cec3c /xc
Initial revision
Diffstat (limited to 'xc')
-rw-r--r--xc/programs/rgb/rgb.c65
-rw-r--r--xc/programs/rgb/rgb.txt136
2 files changed, 201 insertions, 0 deletions
diff --git a/xc/programs/rgb/rgb.c b/xc/programs/rgb/rgb.c
new file mode 100644
index 000000000..a8d2500cb
--- /dev/null
+++ b/xc/programs/rgb/rgb.c
@@ -0,0 +1,65 @@
+/* reads from standard input lines of the form:
+ red green blue name
+ where red/green/blue are decimal values, and inserts them in a database.
+ */
+
+#include <dbm.h>
+#undef NULL
+#include <stdio.h>
+#include <sys/file.h>
+#include "../X/rgb.h"
+
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ char *dbname;
+ char line[512];
+ int red, green, blue;
+ RGB rgb;
+ datum key, content;
+ char name[512];
+ int items;
+ int lineno;
+
+ if (argc == 2)
+ dbname = argv[1];
+ else
+ dbname = RGB_DB;
+ strcpy (name, dbname);
+ strcat (name, ".dir");
+ close (open (name, O_WRONLY|O_CREAT, 0666));
+ strcpy (name, dbname);
+ strcat (name, ".pag");
+ close (open (name, O_WRONLY|O_CREAT, 0666));
+ if (dbminit (dbname))
+ exit (1);
+ key.dptr = name;
+ content.dptr = (char *) &rgb;
+ content.dsize = sizeof (rgb);
+ lineno = 0;
+ while (fgets (line, sizeof (line), stdin)) {
+ lineno++;
+ items = sscanf (line, "%d %d %d %[^\n]\n", &red, &green, &blue, name);
+ if (items != 4) {
+ fprintf (stderr, "syntax error on line %d\n", lineno);
+ fflush (stderr);
+ continue;
+ }
+ if (red < 0 || red > 0xff ||
+ green < 0 || green > 0xff ||
+ blue < 0 || blue > 0xff) {
+ fprintf (stderr, "value for %s out of range\n", name);
+ fflush (stderr);
+ continue;
+ }
+ key.dsize = strlen (name);
+ rgb.red = red << 8;
+ rgb.green = green << 8;
+ rgb.blue = blue << 8;
+ if (store (key, content)) {
+ fprintf (stderr, "store of %s failed\n", name);
+ fflush (stderr);
+ }
+ }
+}
diff --git a/xc/programs/rgb/rgb.txt b/xc/programs/rgb/rgb.txt
new file mode 100644
index 000000000..db1727516
--- /dev/null
+++ b/xc/programs/rgb/rgb.txt
@@ -0,0 +1,136 @@
+112 219 147 aquamarine
+112 219 147 Aquamarine
+50 204 153 medium aquamarine
+50 204 153 MediumAquamarine
+0 0 0 black
+0 0 0 Black
+0 0 255 blue
+0 0 255 Blue
+95 159 159 cadet blue
+95 159 159 CadetBlue
+66 66 111 cornflower blue
+66 66 111 CornflowerBlue
+107 35 142 dark slate blue
+107 35 142 DarkSlateBlue
+191 216 216 light blue
+191 216 216 LightBlue
+143 143 188 light steel blue
+143 143 188 LightSteelBlue
+50 50 204 medium blue
+50 50 204 MediumBlue
+127 0 255 medium slate blue
+127 0 255 MediumSlateBlue
+47 47 79 midnight blue
+47 47 79 MidnightBlue
+35 35 142 navy blue
+35 35 142 NavyBlue
+35 35 142 navy
+35 35 142 Navy
+50 153 204 sky blue
+50 153 204 SkyBlue
+0 127 255 slate blue
+0 127 255 SlateBlue
+35 107 142 steel blue
+35 107 142 SteelBlue
+255 127 0 coral
+255 127 0 Coral
+0 255 255 cyan
+0 255 255 Cyan
+142 35 35 firebrick
+142 35 35 Firebrick
+204 127 50 gold
+204 127 50 Gold
+219 219 112 goldenrod
+219 219 112 Goldenrod
+234 234 173 medium goldenrod
+234 234 173 MediumGoldenrod
+0 255 0 green
+0 255 0 Green
+47 79 47 dark green
+47 79 47 DarkGreen
+79 79 47 dark olive green
+79 79 47 DarkOliveGreen
+35 142 35 forest green
+35 142 35 ForestGreen
+50 204 50 lime green
+50 204 50 LimeGreen
+107 142 35 medium forest green
+107 142 35 MediumForestGreen
+66 111 66 medium sea green
+66 111 66 MediumSeaGreen
+127 255 0 medium spring green
+127 255 0 MediumSpringGreen
+143 188 143 pale green
+143 188 143 PaleGreen
+35 142 107 sea green
+35 142 107 SeaGreen
+0 255 127 spring green
+0 255 127 SpringGreen
+153 204 50 yellow green
+153 204 50 YellowGreen
+47 79 79 dark slate grey
+47 79 79 DarkSlateGrey
+47 79 79 dark slate gray
+47 79 79 DarkSlateGray
+84 84 84 dim grey
+84 84 84 DimGrey
+84 84 84 dim gray
+84 84 84 DimGray
+168 168 168 light grey
+168 168 168 LightGrey
+168 168 168 light gray
+168 168 168 LightGray
+159 159 95 khaki
+159 159 95 Khaki
+255 0 255 magenta
+255 0 255 Magenta
+142 35 107 maroon
+142 35 107 Maroon
+204 50 50 orange
+204 50 50 Orange
+219 112 219 orchid
+219 112 219 Orchid
+153 50 204 dark orchid
+153 50 204 DarkOrchid
+147 112 219 medium orchid
+147 112 219 MediumOrchid
+188 143 143 pink
+188 143 143 Pink
+234 173 234 plum
+234 173 234 Plum
+255 0 0 red
+255 0 0 Red
+79 47 47 indian red
+79 47 47 IndianRed
+219 112 147 medium violet red
+219 112 147 MediumVioletRed
+255 0 127 orange red
+255 0 127 OrangeRed
+204 50 153 violet red
+204 50 153 VioletRed
+111 66 66 salmon
+111 66 66 Salmon
+142 107 35 sienna
+142 107 35 Sienna
+219 147 112 tan
+219 147 112 Tan
+216 191 216 thistle
+216 191 216 Thistle
+173 234 234 turquoise
+173 234 234 Turquoise
+112 147 219 dark turquoise
+112 147 219 DarkTurquoise
+112 219 219 medium turquoise
+112 219 219 MediumTurquoise
+79 47 79 violet
+79 47 79 Violet
+159 95 159 blue violet
+159 95 159 BlueViolet
+216 216 191 wheat
+216 216 191 Wheat
+252 252 252 white
+252 252 252 White
+255 255 0 yellow
+255 255 0 Yellow
+147 219 112 green yellow
+147 219 112 GreenYellow