summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:58 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:58 +0000
commitda58b20fd4fd40bccb34ce2e8f1401fc994c973c (patch)
treeb098ff39ebd5a573d3cd6ee5cf219cb5eb8a8cc7
parent1f2079d6943e2c85edbeeb4309f7ec5e216ee640 (diff)
-rw-r--r--rgb.c15
-rw-r--r--showrgb.c28
-rw-r--r--showrgb.man7
3 files changed, 33 insertions, 17 deletions
diff --git a/rgb.c b/rgb.c
index 2c6cf47..a881eb9 100644
--- a/rgb.c
+++ b/rgb.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/rgb/rgb.c,v 3.9 2002/10/09 16:56:47 tsi Exp $ */
/* reads from standard input lines of the form:
@@ -36,7 +37,7 @@ from The Open Group.
#ifdef NDBM
#include <ndbm.h>
#else
-#ifdef SVR4
+#if defined(SVR4) && !defined(SCO325)
#include <rpcsvc/dbm.h>
#else
#include <dbm.h>
@@ -48,6 +49,7 @@ from The Open Group.
#undef NULL
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Xos.h>
#include "rgb.h"
#include "site.h"
@@ -55,10 +57,6 @@ from The Open Group.
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
char *ProgramName;
char *SysError ()
@@ -67,6 +65,7 @@ char *SysError ()
return s ? s : "?";
}
+int
main(argc, argv)
int argc;
char **argv;
@@ -100,7 +99,7 @@ main(argc, argv)
if (fd < 0) {
fprintf (stderr,
"%s: unable to create dbm file \"%s\" (error %d, %s)\n",
- ProgramName, name, errno, SysError());
+ ProgramName, name, errno, strerror(errno));
exit (1);
}
(void) close (fd);
@@ -111,7 +110,7 @@ main(argc, argv)
if (fd < 0) {
fprintf (stderr,
"%s: unable to create dbm file \"%s\" (error %d, %s)\n",
- ProgramName, name, errno, SysError());
+ ProgramName, name, errno, strerror(errno));
exit (1);
}
(void) close (fd);
@@ -120,7 +119,7 @@ main(argc, argv)
if (!rgb_dbm) {
fprintf (stderr,
"%s: unable to open dbm database \"%s\" (error %d, %s)\n",
- ProgramName, dbname, errno, SysError());
+ ProgramName, dbname, errno, strerror(errno));
exit (1);
}
diff --git a/showrgb.c b/showrgb.c
index 98a8c34..1762dcb 100644
--- a/showrgb.c
+++ b/showrgb.c
@@ -26,11 +26,13 @@ in this Software without prior written authorization from The Open Group.
* Author: Jim Fulton, MIT X Consortium
*/
+/* $XFree86: xc/programs/rgb/showrgb.c,v 3.9 2002/05/31 18:46:08 dawes Exp $ */
+
#ifndef USE_RGB_TXT
#ifdef NDBM
#include <ndbm.h>
#else
-#ifdef SVR4
+#if defined(SVR4) && !defined(SCO325)
#include <rpcsvc/dbm.h>
#else
#include <dbm.h>
@@ -45,15 +47,16 @@ in this Software without prior written authorization from The Open Group.
#undef NULL
#include <stdio.h>
#include <X11/Xos.h>
+#include <stdlib.h>
#include "rgb.h" /* off in server/include/ */
#include "site.h"
#include <X11/Xfuncs.h>
char *ProgramName;
+static void dumprgb(char *filename);
-main (argc, argv)
- int argc;
- char *argv[];
+int
+main (int argc, char *argv[])
{
char *dbname = RGB_DB;
@@ -66,7 +69,7 @@ main (argc, argv)
}
#ifndef USE_RGB_TXT
-
+static void
dumprgb (filename)
char *filename;
{
@@ -116,7 +119,7 @@ dumprgb (filename)
}
#else /* USE_RGB_TXT */
-
+static void
dumprgb (filename)
char *filename;
{
@@ -126,10 +129,17 @@ dumprgb (filename)
char name[BUFSIZ];
int lineno = 0;
int red, green, blue;
-
+
+#ifdef __UNIXOS2__
+ char *root = (char*)getenv("X11ROOT");
+ sprintf(line,"%s%s.txt",root,filename);
+ path = (char *)malloc(strlen(line) + 1);
+ strcpy(path,line);
+#else
path = (char *)malloc(strlen(filename) + 5);
strcpy(path, filename);
strcat(path, ".txt");
+#endif
if (!(rgb = fopen(path, "r"))) {
fprintf (stderr, "%s: unable to open rgb database \"%s\"\n",
@@ -140,7 +150,11 @@ dumprgb (filename)
while(fgets(line, sizeof(line), rgb)) {
lineno++;
+#ifndef __UNIXOS2__
if (sscanf(line, "%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4) {
+#else
+ if (sscanf(line, "%d %d %d %[^\n\r]\n", &red, &green, &blue, name) == 4) {
+#endif
if (red >= 0 && red <= 0xff &&
green >= 0 && green <= 0xff &&
blue >= 0 && blue <= 0xff) {
diff --git a/showrgb.man b/showrgb.man
index dd90fd1..c0b5756 100644
--- a/showrgb.man
+++ b/showrgb.man
@@ -22,7 +22,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
-.TH SHOWRGB 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.8 2002/10/12 16:06:45 herrb Exp $
+.\"
+.TH SHOWRGB 1 __xorgversion__
.SH NAME
showrgb \- uncompile an rgb color-name database
.SH SYNOPSIS
@@ -41,5 +44,5 @@ the command line. Specify the database name without
the \fI.pag\fP or \fI.dir\fP suffix.
.SH FILES
.TP 20
-<XRoot>/lib/X11/rgb
+.I __projectroot__/lib/X11/rgb
default database.