6730028 Moving /usr/openwin/lib/mkcookie to /usr/X11/lib
6730024 Moving /usr/openwin/bin/cmap_compact to /usr/X11/bin/cmap_compact
6730015 Moving /usr/openwin/bin/cmap_alloc to /usr/X11/bin/
--- a/open-src/app/Makefile Mon Sep 22 13:27:21 2008 -0700
+++ b/open-src/app/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -28,7 +28,7 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
-# @(#)Makefile 1.81 08/09/19
+# @(#)Makefile 1.82 08/09/30
#
###############################################################################
@@ -39,6 +39,8 @@
appres \
bdftopcf \
bitmap \
+ cmap_alloc \
+ cmap_compact \
constype \
editres \
fbconsole \
@@ -52,6 +54,7 @@
luit \
kbd_mode \
mesa-demos \
+ mkcookie \
mkfontdir \
mkfontscale \
oclock \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_alloc/COPYING Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,27 @@
+Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+Use subject to license terms.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_alloc/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,60 @@
+###############################################################################
+#
+# cmap_alloc 1.x module Makefile
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+#
+
+# Package name used in tarballs
+MODULE_NAME=cmap_alloc
+
+# No upstream sources, only local sources
+MODULE_VERSION=src
+SOURCE_TARBALL_NAME=NONE
+SOURCE_TARBALL_NAME_SET=yes
+ADDITIONAL_SOURCE_DIR=sun-src
+
+# Man pages to apply Sun footer to & attributes to list
+SUNTOUCHED_MANPAGES= # None
+SUN_PACKAGE=SUNWxwplt
+MODULE_STABILITY=Committed
+
+# No configure script to run
+CONFIGURE_TARGETS=
+CONFIGURE_TARGETS_SET=yes
+
+# Since we don't have a configure script, pass configure flags to make
+MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+
+include ../Makefile.inc
+
+source_gen:: $(LNDIR)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_alloc/sun-src/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,40 @@
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+
+SRCS = cmap_alloc.c
+OBJS = $(SRCS:.c=.o)
+
+cmap_alloc: $(OBJS)
+ $(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) -lX11
+
+install: cmap_alloc
+ mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
+ $(INSTALL) cmap_alloc $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) cmap_alloc.1 $(DESTDIR)$(PREFIX)/share/man/man1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_alloc/sun-src/cmap_alloc.1 Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,119 @@
+.\" Copyright 1994 Sun Microsystems, Inc. All rights reserved.
+.\" Use subject to license terms.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, and/or sell copies of the Software, and to permit persons
+.\" to whom the Software is furnished to do so, provided that the above
+.\" copyright notice(s) and this permission notice appear in all copies of
+.\" the Software and that both the above copyright notice(s) and this
+.\" permission notice appear in supporting documentation.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+.\" INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of a copyright holder
+.\" shall not be used in advertising or otherwise to promote the sale, use
+.\" or other dealings in this Software without prior written authorization
+.\" of the copyright holder.
+.\" @(#)cmap_alloc.1 9.7 89/01/13 SMI;
+.TH cmap_alloc 1 "18 March 1992"
+.IX cmap_alloc "" "\f3cmap_alloc\f1(1) \(em colormap utility" ""
+.IX "color" "defa" "color" "default colormap allocation \(em \f3cmap_alloc\f1(1)" ""
+.SH NAME
+cmap_alloc \- allocate default colormaps for non-default visuals
+.SH SYNOPSIS
+.B cmap_alloc
+[
+.B \-display
+.I display:n.screen
+] [
+.B \-force
+] [
+.B \-allscreens
+]
+[
+.BI \-depth \ n
+] [
+.B \-visual
+.I class
+] [
+.B \-verbose
+] [
+.B
+\-help
+]
+.SH DESCRIPTION
+.LP
+.B cmap_alloc
+creates empty colormaps for non-default dynamic visuals that are suitable
+for use as default colormaps. An X11 server has only one default colormap,
+and it is associated with the default visual. Clients that need to access
+non-default visuals have to create their own colormaps. This can lead
+to gratuitous colormap flashing if a lot of applications are running
+in non-default visuals.
+.B cmap_alloc
+will create colormaps that can be used by such applications as the default
+colormap for the given visual.
+Once the colormap has been created for a given visual, it will place
+the colormap's XID into the
+.SM RGB_DEFAULT_MAP
+property on the root window of the display. Clients that need to access
+non-default dynamic visuals should search this property using
+.SM XGetRBGColormaps()
+for a suitable colormap to use.
+.SH OPTIONS
+.IP "\f3\-display \fIdisplay:n.screen\f1" 1i
+Indicates which X11 server to use. The default is to use the value
+set in the
+.SM DISPLAY
+environment variable.
+.IP "\f3\-force\f1" 1i
+Create a colormap even if a suitable colormap is already listed in the
+.SM RGB_DEFAULT_MAP
+property.
+.IP "\f3\-allscreens\f1" 1i
+Create default colormaps for all screens of the display. Without this
+option, colormaps will only be created for the default screen.
+.IP "\f3\-depth \fIn\f1" 1i
+Create default colormaps only for those visuals that have depth
+.I n.
+The default is to create colormaps for visuals of all depths
+.IP "\f3\-visual \fIclass\f1" 1i
+Create default colormaps only for those visuals that are of class
+.I class.
+Where
+.I class
+is one of the following:
+.SM GrayScale, PsuedoColor, DirectColor
+\. The default is to create colormaps for all visual classes.
+.IP "\f3\-verbose\f1" 1i
+Print out diagnostic messages useful for debugging.
+.IP "\f3\-help\f1" 1i
+Print out a short usage message and exit.
+.SH "SEE ALSO"
+.BR xstdcmap (1) ,
+.BR cmap_compact (1)
+.sp
+.SH DIAGNOSTICS
+.TP 20n
+\f3can't open display ...\f1
+Error in connecting to the X11 server. Check
+.SM DISPLAY
+environment variable.
+.TP 20n
+\f3unknown depth\f1
+Invalid depth specified for the \f3\-depth\f1 command line option
+.TP 20n
+\f3unknown visual class\f1
+Invalid visual class specified for the \f3\-visual\f1
+command line option
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_alloc/sun-src/cmap_alloc.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,397 @@
+/*
+*
+* cmap_alloc.c 1.x
+*
+* Copyright 2000 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*/
+
+#pragma ident "@(#)cmap_alloc.c 35.3 08/09/30 SMI"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+#include <X11/Xatom.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define All -1
+#define DYNAMIC_VISUAL(class) (((class) % 2) ? True : False)
+
+char *prog_name;
+char *display_name = NULL;
+int force = False;
+int all_screens = False;
+int depth = All;
+int visual_class = All;
+int verbose = False;
+
+int created_colormap = False;
+XStandardColormap *allocated_cmaps;
+int num_cmaps;
+XVisualInfo *available_visuals;
+int num_visuals;
+
+static void alloc_cmaps_for_screen();
+static void alloc_cmap_for_visual();
+static void create_colormap();
+static char *visual_class_name();
+static void parse_cmdline();
+static int string_to_depth();
+static int string_to_visual();
+static void usage();
+
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ Display *display;
+ int screen;
+
+ /* Take care of command line options */
+ parse_cmdline(argc, argv);
+
+ /* Try to open the display */
+ if ((display = XOpenDisplay(display_name)) == NULL) {
+ (void)fprintf(stderr, "Error %s: can't open display \"%s\".\n",
+ argv[0], XDisplayName(display_name));
+ exit(0);
+ }
+
+ /* Handle all necessary screens */
+ if (all_screens)
+ for (screen = 0; screen < ScreenCount(display); screen++)
+ alloc_cmaps_for_screen(display, screen);
+ else
+ alloc_cmaps_for_screen(display, DefaultScreen(display));
+
+ /* If we created any colormaps, we need to ensure
+ * that they live after the program exits.
+ */
+ if (created_colormap)
+ XSetCloseDownMode(display, RetainPermanent);
+
+ XCloseDisplay(display);
+ return (1);
+}
+
+
+static void
+alloc_cmaps_for_screen(display, screen)
+ Display *display;
+ int screen;
+{
+ XVisualInfo vinfo_template;
+ XVisualInfo *vinfo;
+ VisualID default_visualid;
+ int v;
+
+ if (verbose)
+ (void)printf("Creating colormaps for screen #%d:\n", screen);
+
+ /* Find out if any colormaps already exist in the property */
+ if (!XGetRGBColormaps(display, RootWindow(display, screen),
+ &allocated_cmaps, &num_cmaps, XA_RGB_DEFAULT_MAP))
+ num_cmaps = 0;
+
+ /* Find the available visuals on the screen */
+ vinfo_template.screen = screen;
+ available_visuals = XGetVisualInfo(display, VisualScreenMask, &vinfo_template, &num_visuals);
+
+ default_visualid = XVisualIDFromVisual(DefaultVisual(display, screen));
+
+ /* Only try the specified visual */
+ if ((visual_class != All) && (depth != All)) {
+ v = 0;
+ vinfo = NULL;
+ while (!vinfo && (v < num_visuals))
+ if ((available_visuals[v].class == visual_class) &&
+ (available_visuals[v].depth == depth))
+ vinfo = &available_visuals[v];
+ else
+ v++;
+ if (vinfo)
+ if (vinfo->visualid == default_visualid) {
+ fprintf(stderr, "%s: no need to create a colormap for the default visual\n",
+ prog_name);
+ exit(0);
+ } else
+ alloc_cmap_for_visual(display, screen, vinfo);
+ }
+
+ /* Try all visuals of visual_class with any depth */
+ else if (visual_class != All) {
+ for (v = 0; v < num_visuals; v++)
+ if ((visual_class == available_visuals[v].class) &&
+ (available_visuals[v].visualid != default_visualid))
+ alloc_cmap_for_visual(display, screen, &available_visuals[v]);
+ }
+
+ /* Try all visuals of depth and any dynamic class */
+ else if (depth != All) {
+ for (v = 0; v < num_visuals; v++)
+ if ((depth == available_visuals[v].depth) &&
+ DYNAMIC_VISUAL(available_visuals[v].class) &&
+ (available_visuals[v].visualid != default_visualid))
+ alloc_cmap_for_visual(display, screen, &available_visuals[v]);
+ }
+
+ /* Try all visuals */
+ else
+ for (v = 0; v < num_visuals; v++)
+ if (DYNAMIC_VISUAL(available_visuals[v].class) &&
+ (available_visuals[v].visualid != default_visualid))
+ alloc_cmap_for_visual(display, screen, &available_visuals[v]);
+}
+
+
+static void
+alloc_cmap_for_visual(display, screen, vinfo)
+ Display *display;
+ int screen;
+ XVisualInfo *vinfo;
+{
+ int c = 0;
+ XStandardColormap *std_cmap = NULL;
+ XStandardColormap new_cmap;
+
+ if (verbose)
+ (void)printf(" Creating a colormap for the %s %d bit visual...",
+ visual_class_name(vinfo->class), vinfo->depth);
+
+ /* Check to see if one already exists */
+ while (!std_cmap && (c < num_cmaps))
+ if ((allocated_cmaps[c].visualid == vinfo->visualid) &&
+ (allocated_cmaps[c].red_max == 0) &&
+ (allocated_cmaps[c].red_mult == 0) &&
+ (allocated_cmaps[c].green_max == 0) &&
+ (allocated_cmaps[c].green_mult == 0) &&
+ (allocated_cmaps[c].blue_max == 0) &&
+ (allocated_cmaps[c].blue_mult == 0))
+ std_cmap = &allocated_cmaps[c];
+ else
+ c++;
+
+ if (std_cmap && !force && verbose)
+ (void)printf("one already exists\n");
+ else if (!std_cmap || force) {
+ /* Create the colormap */
+ create_colormap(display, vinfo, &new_cmap);
+
+ /* append it to the property on the root window */
+ XChangeProperty(display, RootWindow(display, screen),
+ XA_RGB_DEFAULT_MAP, XA_RGB_COLOR_MAP,
+ 32, PropModeAppend, (unsigned char *)(&new_cmap),
+ 10);
+ if (verbose)
+ (void)printf("done\n new colormap id = 0x%x\n", new_cmap.colormap);
+ }
+}
+
+
+static void
+create_colormap(display, vinfo, std_colormap)
+ Display *display;
+ XVisualInfo *vinfo;
+ XStandardColormap *std_colormap; /* RETURN */
+{
+ Colormap colormap;
+ XColor color;
+
+ colormap = XCreateColormap(display, RootWindow(display, vinfo->screen),
+ vinfo->visual, AllocNone);
+
+ /* Allocate black from the colormap */
+ color.red = color.green = color.blue = 0;
+ XAllocColor(display, colormap, &color);
+
+ /* Fill out the standard colormap information */
+ std_colormap->colormap = colormap;
+ std_colormap->red_max = 0;
+ std_colormap->red_mult = 0;
+ std_colormap->green_max = 0;
+ std_colormap->green_mult = 0;
+ std_colormap->blue_max = 0;
+ std_colormap->blue_mult = 0;
+ std_colormap->base_pixel = color.pixel;
+ std_colormap->visualid = vinfo->visualid;
+
+ /* We don't want anybody pulling the colormap out from
+ * under running clients, so set the killid to 0.
+ */
+ std_colormap->killid = 0;
+
+ created_colormap = True;
+}
+
+
+static char *
+visual_class_name(class)
+ int class;
+{
+ char *name;
+
+ switch (class) {
+ case StaticGray:
+ name = "StaticGray";
+ break;
+ case GrayScale:
+ name = "GrayScale";
+ break;
+ case StaticColor:
+ name = "StaticColor";
+ break;
+ case PseudoColor:
+ name = "PseudoColor";
+ break;
+ case TrueColor:
+ name = "TrueColor";
+ break;
+ case DirectColor:
+ name = "DirectColor";
+ break;
+ default:
+ name = "";
+ break;
+ }
+ return name;
+}
+
+
+static void
+parse_cmdline(argc, argv)
+ int argc;
+ char **argv;
+{
+ int option = 1;
+
+ if (argc)
+ prog_name = argv[0];
+
+ while (option < argc) {
+ if (!strcmp(argv[option], "-display"))
+ if (++option < argc)
+ display_name = argv[option];
+ else
+ usage();
+
+ else if (!strcmp(argv[option], "-force"))
+ force = True;
+
+ else if (!strcmp(argv[option], "-allscreens"))
+ all_screens = True;
+
+ else if (!strcmp(argv[option], "-depth"))
+ if (++option < argc) {
+ depth = string_to_depth(argv[option]);
+ if (depth == All) {
+ fprintf(stderr, "%s: unknown depth %s\n", prog_name, argv[option]);
+ usage();
+ }
+ } else
+ usage();
+
+ else if (!strcmp(argv[option], "-visual"))
+ if (++option < argc) {
+ visual_class = string_to_visual(argv[option]);
+ if (visual_class == All) {
+ fprintf(stderr, "%s: unknown visual class %s\n", prog_name, argv[option]);
+ usage();
+ } else if (!DYNAMIC_VISUAL(visual_class)) {
+ fprintf(stderr, "%s: no need to create a colormap for a static visual\n", prog_name);
+ exit(0);
+ }
+ } else
+ usage();
+
+ else if (!strcmp(argv[option], "-verbose"))
+ verbose = True;
+
+ else if (!strcmp(argv[option], "-help"))
+ usage();
+
+ else {
+ (void)fprintf(stderr, "%s: unknown command line option \"%s\"\n",
+ prog_name, argv[option]);
+ usage();
+ }
+ option++;
+ }
+}
+
+
+static int
+string_to_depth(str)
+ char *str;
+{
+ int depth;
+
+ if ((sscanf(str, "%d", &depth) != 1) || (depth < 1))
+ depth = All;
+
+ return depth;
+}
+
+
+static int
+string_to_visual(str)
+ char *str;
+{
+ int visual_class;
+
+ if (!strcmp(str, "StaticGray"))
+ visual_class = StaticGray;
+ else if (!strcmp(str, "GrayScale"))
+ visual_class = GrayScale;
+ else if (!strcmp(str, "StaticColor"))
+ visual_class = StaticColor;
+ else if (!strcmp(str, "PseudoColor"))
+ visual_class = PseudoColor;
+ else if (!strcmp(str, "TrueColor"))
+ visual_class = TrueColor;
+ else if (!strcmp(str, "DirectColor"))
+ visual_class = DirectColor;
+ else
+ visual_class = All;
+
+ return visual_class;
+}
+
+
+static void
+usage()
+{
+ (void)fprintf(stderr, "Usage: %s [-display <display:n.screen>]\n", prog_name);
+ (void)fprintf(stderr, "\t\t[-force] [-allscreens]\n");
+ (void)fprintf(stderr, "\t\t[-depth <n>] [-visual <class>]\n");
+ (void)fprintf(stderr, "\t\t[-verbose] [-help]\n");
+ exit(0);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/COPYING Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,27 @@
+Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+Use subject to license terms.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,60 @@
+###############################################################################
+#
+# cmap_compact 1.x module Makefile
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+#
+
+# Package name used in tarballs
+MODULE_NAME=cmap_compact
+
+# No upstream sources, only local sources
+MODULE_VERSION=src
+SOURCE_TARBALL_NAME=NONE
+SOURCE_TARBALL_NAME_SET=yes
+ADDITIONAL_SOURCE_DIR=sun-src
+
+# Man pages to apply Sun footer to & attributes to list
+SUNTOUCHED_MANPAGES= # None
+SUN_PACKAGE=SUNWxwplt
+MODULE_STABILITY=Committed
+
+# No configure script to run
+CONFIGURE_TARGETS=
+CONFIGURE_TARGETS_SET=yes
+
+# Since we don't have a configure script, pass configure flags to make
+MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+
+include ../Makefile.inc
+
+source_gen:: $(LNDIR)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,49 @@
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+
+SRCS = \
+ cmc.c \
+ cmcdealloc.c \
+ cmcinit.c \
+ cmcshow.c \
+ cmcNeWSinit.c \
+ cmcdiscard.c \
+ cmcsave.c \
+ cmcutil.c
+
+OBJS = $(SRCS:.c=.o)
+
+cmap_compact: $(OBJS)
+ $(LD) -g -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) -lX11
+
+install: cmap_compact
+ mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
+ $(INSTALL) cmap_compact $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) cmap_compact.1 $(DESTDIR)$(PREFIX)/share/man/man1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmap_compact.1 Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,149 @@
+.\" Copyright 1995 Sun Microsystems, Inc. All rights reserved.
+.\" Use subject to license terms.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, and/or sell copies of the Software, and to permit persons
+.\" to whom the Software is furnished to do so, provided that the above
+.\" copyright notice(s) and this permission notice appear in all copies of
+.\" the Software and that both the above copyright notice(s) and this
+.\" permission notice appear in supporting documentation.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+.\" INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of a copyright holder
+.\" shall not be used in advertising or otherwise to promote the sale, use
+.\" or other dealings in this Software without prior written authorization
+.\" of the copyright holder.
+.TH cmap_compact 1 "11 July 1995"
+.IX "cmap_comapct" "" "\f3cmap_compact\f1(1) \(em utility to reduce colormap flashing" ""
+.IX "color" "prev" "color" "preventing flashing \(em \f3cmap_compact\f1(1)" ""
+.SH NAME
+cmap_compact \- colormap configuration utility to reduce colormap flashing.
+.SH SYNOPSIS
+.B cmap_compact
+[
+.B \\fIop\f1
+] [
+.B \-display
+.I dpyname
+]
+.SH DESCRIPTION
+.LP
+.B cmap_compact
+is a utility which allows certain colors to be designated as special
+and to be promoted to the high end of the default colormap (toward pixel 255).
+This reduces colormap flashing in many situations.
+.PP
+This technique has no effect for monochrome screens; it applies only to
+color screens.
+.SH OPTIONS
+.TP
+\f3-display\f1 \fIdpyname\f1
+Indicates the X11 display to use. ':0' is the default.
+.LP
+\fIop\f1 can be one of the following operations:
+.TP
+.B save
+Records the RGB color values of all shareable (read-only) colors in the
+default colormap for each active screen and saves these values on
+the file \f3~/.owcolors\f1.
+.PP
+The black and white pixels (typically at pixels 254 and 255) are ignored
+during the save.
+.PP
+Note that all colors are ignored for screens with a StaticColor default colormap.
+Note also that the server is grabbed during the save.
+.TP
+.B init
+Reads the colors which have been saved in \f3~/.owcolors\f1 and allocates
+them as read-only colors at the high-end of the default colormap.
+The color allocations for those applications which use these colors
+will be derived from these high colors.
+If there is no \f3~/.owcolors\f1 file, nothing happens and no message
+is printed out.
+.PP
+The colors are allocated in reverse order of the order in which they
+were saved. Thus, the lowest pixel in the colormap at save time
+becomes the highest pixel at initialization time.
+.PP
+This operation is typically invoked from \f3~/.xinitrc\f1 prior to
+starting the color applications.
+.PP
+This operation creates on the root window of each screen a property named
+\fIXA_COMPACTED_COLORS_COUNT\f1 of type XA_INTEGER.
+The value of this property specifies the number of initialized colors for that screen.
+Note: this value also includes the black and white pixels.
+.PP
+An X11 \fIclose down mode\f1 of \f3RetainPermanent\f1 is set so that
+the colors this program allocates will stay around after \f3cmap_compact\f1
+exits. These colors may be freed by calling \f3cmap_compact\ dealloc\f1 .
+Before this program allocates its colors, it frees any colors left
+over from a previous invocation.
+.PP
+If there are more saved colors than can fit in the default colormap,
+as many colors as will fit are allocated and a warning message
+is printed out. This situation, for example, might occur if the
+the default visual were switched from an 8-bit to a 4-bit visual
+without discarding saved colors.
+.PP
+Note: no allocations occur for screens with a StaticColor default colormap.
+.br
+Note: The server is grabbed during the initialization.
+.TP
+.B discard
+This operation removes the file \f3~/.owcolors\f1.
+.TP
+.B dealloc
+This operation frees colors allocated by a previous invocation of
+.BR cmap_compact\ init .
+.TP
+.B show
+This operation prints out the RGB values of the saved colors for each screen.
+.\" .SH EFFECT ON THE X11 SERVER
+.\" .LP
+.\" The
+.\" .BR Xsun (1)
+.\" server also reads the file \f3~/.owcolors\f1 to
+.\" determine the amount that it should shift down the color cube
+.\" in the StaticColor colormap (this is called the \fIcube offset\f1).
+.\" .PP
+.\" Because there is only a single StaticColor colormap in the server,
+.\" a decision must be made about how to handle different numbers of
+.\" saved workspace colors on different screens. The server currently
+.\" takes the simplest approach: the cube offset is the number of
+.\" saved colors for the screen with the largest number of colors.
+.\" .PP
+.\" The cube offset does not include the black and white pixels because
+.\" these pixels are not shifted down with the rest of the cube; these
+.\" pixels stay at the high end of the StaticColor colormap.
+.\" .PP
+.\" No matter what the value of the cube offset, the base pixel of the cube
+.\" is always greater or equal to 0.
+.\" .PP
+.\" In addition to shifting the StaticColor color cube downward (toward 0)
+.\" to avoid flashing with the saved colors, the black and white pixels
+.\" which are allocated in the default colormap are moved to the high
+.\" end of the default colormap (toward 255).
+.SH FILES
+.TP
+\f3~/.owcolors\f1
+The file which is generated by
+.BR cmap_compact\ save .
+Contains a list of saved, read-only workspace colors for all screens.
+.SH SEE ALSO
+.BR Xsun (1)
+.br
+.SH BUGS
+Currently does not support using the same \f3~/.owcolors\f1 file
+for different machine architectures.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmc.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,161 @@
+/*
+*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#pragma ident "@(#)cmc.c 35.4 08/09/30 CMAP_COMPACT SMI"
+
+#include <stdio.h>
+#include "cmc.h"
+
+
+/*
+** Options and Arguments
+*/
+
+char *display_name = NULL; /* -display */
+int warn = 0; /* -warn */
+char *basename = NULL; /* optional argument */
+
+char *program;
+
+
+/*VARARGS1*/
+void
+fatal_error (format, arg1, arg2, arg3, arg4)
+char *format;
+
+{
+ (void) fprintf(stderr, "%s: error: ", program);
+ (void) fprintf(stderr, format, arg1, arg2, arg3, arg4);
+ (void) fprintf(stderr, "\n");
+ exit(1);
+}
+
+
+/*VARARGS1*/
+void
+warning (format, arg1, arg2, arg3, arg4)
+char *format;
+
+{
+ (void) fprintf(stderr, "Warning: ");
+ (void) fprintf(stderr, format, arg1, arg2, arg3, arg4);
+ (void) fprintf(stderr, "\n");
+ exit(1);
+}
+
+static void
+usage ()
+
+{
+ /* Note: optional filename arg explicitly not documented */
+ fprintf(stderr, "usage: %s <op> [-display name] [-warn]\n", program);
+ fprintf(stderr, "<op> = save | init | discard | dealloc | show | NeWSinit\n");
+ exit(1);
+}
+
+
+/*
+** Parse arguments
+*/
+
+void
+process_arguments (argv)
+char **argv;
+
+{
+ register char **a;
+
+ for (a = argv; *a; a++) {
+ if (**a == '-') {
+ if (!strcmp(*a, "-warn")) {
+ warn = 1;
+ } else if (!strcmp(*a, "-display")) {
+ if (*++a)
+ display_name = *a;
+ else {
+ fprintf(stderr, "error: -display needs an argument\n");
+ usage();
+ }
+ } else {
+ fprintf(stderr, "error: unrecognized option '%s'\n", *a);
+ usage();
+ }
+ } else {
+ if (basename) {
+ fprintf(stderr, "error: unrecognized argument '%s'\n", *a);
+ usage();
+ } else
+ basename = *a;
+ }
+ }
+}
+
+
+/*ARGSUSED*/
+void
+main (argc,argv)
+int argc;
+char **argv;
+
+{
+ void (*op)();
+
+ /* Initialize error handling */
+ program = argv[0];
+
+ /* determine operation */
+ if (argc <= 1)
+ usage();
+ ++argv;
+ if (!strcmp("save", *argv))
+ op = cmc_save;
+ else if (!strcmp("init", *argv))
+ op = cmc_init;
+ else if (!strcmp("show", *argv))
+ op = cmc_show;
+ else if (!strcmp("discard", *argv))
+ op = cmc_discard;
+ else if (!strcmp("dealloc", *argv))
+ op = cmc_dealloc;
+ else if (!strcmp("NeWSinit", *argv))
+ op = cmc_NeWSinit;
+ else
+ usage();
+
+ /* parse rest of arguments */
+ process_arguments(++argv);
+
+ /* invoke operation */
+ op();
+
+ exit(0);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmc.h Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,65 @@
+/*
+*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+/* @(#)cmc.h 35.2 08/09/30 */
+
+/*
+** Definitions for all Colormap compacting operations
+*/
+
+#ifndef CMC_INCLUDE
+#define CMC_INCLUDE
+
+
+/*
+** External Data
+*/
+
+extern char *display_name;
+extern char *basename;
+extern int warn;
+
+
+/*
+** External Functions
+*/
+
+extern void fatal_error();
+extern void cmc_save();
+extern void cmc_init();
+extern void cmc_show();
+extern void cmc_discard();
+extern void cmc_dealloc();
+extern void cmc_NeWSinit();
+
+
+#endif !CMC_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcNeWSinit.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,84 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*/
+
+#pragma ident "@(#)cmcNeWSinit.c 35.4 08/09/30 CMAP_COMPACT SMI"
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+
+/*
+** For each screen, generates NeWS PostScript commands on stdio
+** capable of doing X11/NeWS-specific initialization when executed.
+**
+** Output is of the form:
+**
+** <scr_num> <ncolors> cmap_compact_rearrange_scr
+** <scr_num> <ncolors> cmap_compact_rearrange_scr
+** ...
+**
+** where <scr_num> is the screen index of each screen,
+** <ncolors> is the number of saved colors, and 'cmap_compact_rearrange_scr'
+** is a NeWS routine which performs rearrangement of various predefined
+** colors to further reduce colormap flashing with other X11/NeWS
+** programs.
+*/
+
+void
+cmc_NeWSinit ()
+
+{
+ char *filename;
+ FILE *f;
+
+ filename = comp_colors_filename(basename);
+ if ((f = fopen(filename, "r")) == NULL)
+ exit(0);
+
+ /* Check magic number and version */
+ cmc_header_test(f);
+
+ for (;;) {
+ int scr_num;
+ int ncolors;
+ XColor *colors;
+
+ if (!cmc_read(f, &scr_num, &ncolors, &colors))
+ break;
+
+ printf("%d %d cmap_compact_rearrange_scr\n", scr_num, ncolors);
+
+ free((char *)colors);
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcdealloc.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,57 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#ifndef lint
+static char sccsid[] = "@(#)cmcdealloc.c 35.3 08/09/30";
+#endif
+
+#include <X11/Xlib.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+/*
+** Deallocates the colors allocated by a previous cmc client.
+*/
+
+void
+cmc_dealloc ()
+
+{
+ Display *dpy;
+
+ /* Open display */
+ if (!(dpy = open_display(display_name)))
+ fatal_error("cannot open display '%s'\n", display_name);
+
+ resource_discard(dpy);
+
+ XCloseDisplay(dpy);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcdiscard.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,56 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#ifndef lint
+static char sccsid[] = "@(#)cmcdiscard.c 35.3 08/09/30";
+#endif
+
+
+#include <sys/fcntl.h>
+#include <X11/Xlib.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+
+/*
+** Removes the file containing the shared workspace colors,
+** if it exists.
+*/
+
+void
+cmc_discard ()
+
+{
+ char *filename = comp_colors_filename(basename);
+
+ if (unlink(filename) < 0)
+ fatal_error("cannot remove file '%s'", filename);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcinit.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,206 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#pragma ident "@(#)cmcinit.c 35.4 08/09/30 CMAP_COMPACT SMI"
+
+#include <stdio.h>
+#ifndef SYSV
+#include <alloca.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+
+static void
+cmc_alloc (screen, ncolors, colors)
+Screen *screen;
+int ncolors;
+XColor *colors;
+
+{
+ register Colormap cmap = DefaultColormapOfScreen(screen);
+ register Pixel *p;
+ register XColor *c;
+ register int nalloc;
+ register int total_alloc = 0;
+ register int ntotal;
+ int mask;
+ Pixel *pixels;
+ int nc;
+
+ ntotal = 1<<PlanesOfScreen(screen);
+#ifdef SYSV
+ pixels = (Pixel *) malloc(ntotal * sizeof(Pixel));
+#else
+ pixels = (Pixel *) alloca(ntotal * sizeof(Pixel));
+#endif
+
+ /* Grab as many private cells as we can */
+ for (nalloc=ntotal, p=pixels; nalloc > 0; nalloc>>=1) {
+ if (!XAllocColorCells(DisplayOfScreen(screen), cmap, 0, &mask, 0,
+ p, nalloc))
+ continue;
+ p += nalloc;
+ total_alloc += nalloc;
+ }
+
+ /*
+ ** May not be able to get as many colors as requested.
+ */
+ nc = MIN(ncolors, total_alloc);
+ if (nc != ncolors) {
+ (void) fprintf(stderr, "Warning: can only allocate %d of the requested %d colors.\n", nc, ncolors);
+ (void) fprintf(stderr, "Continuing anyway.\n");
+ }
+ ncolors = nc;
+
+ /* Free enough space for workspace colors */
+ nalloc = total_alloc - ncolors;
+ XFreeColors(DisplayOfScreen(screen), cmap, pixels+nalloc, ncolors, 0);
+
+ /* Allocate the workspace colors */
+ for (c=colors+ncolors-1; c>=colors; c--)
+ if (!XAllocColor(DisplayOfScreen(screen), cmap, c))
+ fatal_error("attempt to allocate color failed");
+
+ /* Free placeholder pixels */
+ XFreeColors(DisplayOfScreen(screen), cmap, pixels, nalloc, 0);
+
+ /*
+ ** Tell everybody how many workspace colors there are.
+ ** Be sure to include white/black if they're at the
+ ** high end.
+ */
+ { Visual *vis = DefaultVisualOfScreen(screen);
+ int cmap_size = vis->map_entries;
+ if (WhitePixelOfScreen(screen) == cmap_size-1 ||
+ WhitePixelOfScreen(screen) == cmap_size-2)
+ ncolors++;
+ if (BlackPixelOfScreen(screen) == cmap_size-1 ||
+ BlackPixelOfScreen(screen) == cmap_size-2)
+ ncolors++;
+ prop_update(DisplayOfScreen(screen), RootWindowOfScreen(screen),
+ COUNT_PROP_NAME, XA_INTEGER, 32, ncolors, 1);
+ }
+#ifdef SYSV
+ free(pixels);
+#endif
+}
+
+
+static void
+cmc_alloc_protected (screen, ncolors, colors)
+Screen *screen;
+int ncolors;
+XColor *colors;
+
+{
+ XGrabServer(DisplayOfScreen(screen));
+ cmc_alloc(screen, ncolors, colors);
+ XUngrabServer(DisplayOfScreen(screen));
+}
+
+
+/*
+** For each screen for which there is saved workspace colors,
+** allocates these colors as high as possible in the default
+** colormap of the screen.
+*/
+
+void
+cmc_init ()
+
+{
+ Display *dpy;
+ FILE *f;
+ char *filename;
+
+ /* Open display */
+ if (!(dpy = open_display(display_name)))
+ fatal_error("cannot open display '%s'\n", display_name);
+
+ /* For some strange reason, cmc_alloc_protected fails if not
+ run synchronously */
+ XSynchronize(dpy, 1);
+
+ /* Open file where workspace colors are stored */
+ filename = comp_colors_filename(basename);
+ if ((f = fopen(filename, "r")) == NULL)
+ /* Do nothing if not found */
+ return;
+
+ /* Check magic number and version */
+ cmc_header_test(f);
+
+ /* Abandon any previously allocated workspace colors (all screens) */
+ resource_discard(dpy);
+
+ /* For each screen of display ... */
+ for (;;) {
+ Screen *screen;
+ int scr_num;
+ int ncolors;
+ XColor *colors;
+
+ if (!cmc_read(f, &scr_num, &ncolors, &colors))
+ break;
+
+ /* See if screen is still present */
+ if (scr_num >= ScreenCount(dpy)) {
+ warning("Warning: cannot allocated saved colors for screen %d because\nthe display no longer has this many screens\n", scr_num);
+ continue;
+ }
+ screen = ScreenOfDisplay(dpy, scr_num);
+
+ /*
+ ** Existence of workspace colors for the screen implies
+ ** that its default visual was dynamic indexed. Make sure
+ ** it still is.
+ */
+ if (!dynamic_indexed_default_visual(screen)) {
+ warning("default visual for screen %d is no longer dynamic indexed\nsaved colors not allocated for screen %d", scr_num, scr_num);
+ continue;
+ }
+
+ /* Allocate workspace colors at high end of colormap */
+ cmc_alloc_protected(screen, ncolors, colors);
+ free((char *)colors);
+ }
+
+ /* Preserve newly allocated client resources */
+ resource_preserve(dpy);
+
+ XCloseDisplay(dpy);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcsave.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,275 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#pragma ident "@(#)cmcsave.c 35.4 08/09/30 CMAP_COMPACT SMI"
+
+#include <stdio.h>
+#ifndef SYSV
+#include <alloca.h>
+#endif
+#include <X11/Xlib.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+#define CELL_IGNORE 0
+#define CELL_READONLY 1
+
+
+/*
+** Handle I/O errors when opening display
+*/
+
+static int badaccess_error;
+
+/*
+** Handle X request errors.
+** Just set a flag to let the routine making an X
+** call know that the call resulted in a BadAccess error.
+** Any other errors are processed normally.
+*/
+
+static void
+bad_handler (dpy, err)
+Display *dpy;
+XErrorEvent *err;
+{
+ if (err->error_code == BadAccess)
+ badaccess_error = 1;
+ else
+ _XDefaultError(dpy,err);
+}
+
+
+/*
+** Examines the given colormap to determine the number of
+** read-only cells, their locations, and their color values.
+**
+** All non-read-only cells (privately allocated, unallocated
+** or reserved) are ignored.
+*/
+
+static void
+cmc_record (screen, ncolors, colors)
+Screen *screen;
+int *ncolors;
+XColor **colors;
+
+{
+ register Colormap cmap = DefaultColormapOfScreen(screen);
+ register int i, nalloc;
+ register int *p;
+ register XColor *c;
+ int totalpix;
+ int masks; /* NOTUSED */
+ Pixel *pixels;
+ int *pixtype;
+ XColor color;
+
+ /* start out assuming all are read-only */
+ totalpix = 1<<PlanesOfScreen(screen);
+
+ /* allocate local scratch memory */
+#ifdef SYSV
+ if (!(pixels = (Pixel *) malloc(totalpix * sizeof(Pixel))))
+ fatal_error("cannot allocate memory ");
+ if (!(pixtype = (int *) malloc(totalpix * sizeof(Pixel))))
+ fatal_error("cannot allocate memory ");
+#else
+ if (!(pixels = (Pixel *) alloca(totalpix * sizeof(Pixel))))
+ fatal_error("cannot allocate memory on stack");
+ if (!(pixtype = (int *) alloca(totalpix * sizeof(Pixel))))
+ fatal_error("cannot allocate memory on stack");
+#endif
+ for (i=0, p=pixtype; i<totalpix; i++, p++)
+ *p = CELL_READONLY;
+ *ncolors = totalpix;
+
+ /*
+ ** First, find the free cells by allocating them all private.
+ ** We allocate by decreasing powers of 2 so the allocation
+ ** time will be proportional to the number of display planes
+ ** instead of the number of display cells.
+ **
+ ** Mark the free cells we find. These allocations will
+ ** be freed when the connection is closed.
+ */
+ for (nalloc=totalpix; nalloc > 0; nalloc >>= 1) {
+ if(!XAllocColorCells(DisplayOfScreen(screen), cmap, 0, &masks, 0,
+ pixels, nalloc))
+ continue;
+ for (i=0; i<nalloc; i++) {
+ pixtype[pixels[i]] = CELL_IGNORE;
+ }
+ *ncolors -= nalloc;
+ }
+
+ /*
+ ** Find the read-only cells (excluding white/black).
+ **
+ ** Get the Hardware color for the color of each allocated cell.
+ ** This can only work if the returned color is a previously
+ ** allocated r/o cell (we have all cells allocated).
+ */
+ XSetErrorHandler(bad_handler);
+ for(i=0, p=pixtype; i<totalpix; i++, p++) {
+ if(*p != CELL_IGNORE) {
+ color.pixel = i;
+
+ /* Eliminate reserved cells */
+ badaccess_error = 0;
+ XQueryColor(DisplayOfScreen(screen), cmap, &color);
+ XSync(DisplayOfScreen(screen), 0); /* make sure any error is reported */
+ if (badaccess_error) {
+ pixtype[color.pixel] = CELL_IGNORE;
+ (*ncolors)--;
+ } else {
+ badaccess_error = 0;
+ XStoreColor(DisplayOfScreen(screen), cmap, &color);
+ if (!badaccess_error) {
+ /* Eliminate read/write cells */
+ pixtype[color.pixel] = CELL_IGNORE;
+ (*ncolors)--;
+ } else if (WHITE(&color) || BLACK(&color)) {
+ /* Eliminate white/black cells */
+ pixtype[color.pixel] = CELL_IGNORE;
+ (*ncolors)--;
+ }
+ /* else if alloc succeeded, it must be read-only */
+ }
+ }
+ }
+ XSync(DisplayOfScreen(screen), 0);
+ XSetErrorHandler(NULL);
+
+ /* allocate the memory for the read-only cells */
+ if (!(*colors = (XColor *) calloc(*ncolors, sizeof(XColor))))
+ fatal_error("not enough memory");
+
+ /*
+ ** Get the color values for the read-only cells, ignoring private
+ ** cells, reserved cells, and white/black.
+ */
+ for (i=0, c=*colors; i<totalpix; i++) {
+ if (pixtype[i] != CELL_IGNORE) {
+ (c++)->pixel = i;
+ }
+ }
+ XQueryColors(DisplayOfScreen(screen), cmap, *colors, *ncolors);
+#ifdef SYSV
+ free(pixels);
+ free(pixtype);
+#endif
+}
+
+
+/*
+** Examines the default colormap with the server grabbed
+** to prevent changes during the examination process.
+*/
+
+static void
+cmc_record_protected (screen, ncolors, colors)
+Screen *screen;
+int *ncolors;
+XColor **colors;
+
+{
+ XGrabServer(DisplayOfScreen(screen));
+ cmc_record(screen, ncolors, colors);
+ XUngrabServer(DisplayOfScreen(screen));
+}
+
+
+/*
+** For each screen for which the default colormap is dynamic indexed
+** record all read-only color cells in the default colormap.
+*/
+
+void
+cmc_save ()
+
+{
+ register int scr_num;
+ Display *dpy;
+ FILE *f;
+ char *filename;
+
+ /* Open display */
+ if (!(dpy = open_display(display_name)))
+ fatal_error("cannot open display '%s'", display_name);
+
+ /* For some strange reason, colorscells_get_protected fails if not
+ run synchronously */
+ XSynchronize(dpy, 1);
+
+ /* Open file to save in */
+ filename = comp_colors_filename(basename);
+ if ((f = fopen(filename, "w")) == NULL)
+ fatal_error("cannot open file '%s' for writing", filename);
+
+ /* Save magic number and version */
+ cmc_header_write(f);
+
+ /* For each screen of display ... */
+ for (scr_num = 0; scr_num < ScreenCount(dpy); scr_num++) {
+ Screen *screen = ScreenOfDisplay(dpy, scr_num);
+ int ncolors;
+ XColor *colors;
+
+ /* Do nothing if default visual is not dynamic */
+ if (!dynamic_indexed_default_visual(screen)) {
+ if (warn) {
+ warning("default visual for screen %d is not dynamic indexed",
+ scr_num);
+ warning("no colors saved for screen %d", scr_num );
+ }
+ continue;
+ }
+
+ /*
+ ** Discover what read-only cells are in the default colormap.
+ **
+ ** These will be considered the "workspace colors."
+ */
+ cmc_record_protected(screen, &ncolors, &colors);
+
+ /* Save read-only cells for screen in workspace color file */
+ if (!cmc_write(f, scr_num, ncolors, colors))
+ fatal_error("cannot write to file %s", filename);
+
+ free((char *)colors);
+ }
+
+ XCloseDisplay(dpy);
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcshow.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,105 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#ifndef lint
+static char sccsid[] = "@(#)cmcshow.c 35.3 08/09/30";
+#endif
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include "cmc.h"
+#include "cmcutil.h"
+
+
+static void print_xcolors();
+
+
+/*
+** Print contents of workspace colors file in human readable form.
+*/
+
+void
+cmc_show ()
+
+{
+ char *filename;
+ FILE *f;
+
+ filename = comp_colors_filename(basename);
+ if ((f = fopen(filename, "r")) == NULL)
+ fatal_error("cannot open file '%s' for reading\n", filename);
+
+ /* Check magic number and version */
+ cmc_header_test(f);
+
+ for (;;) {
+ int scr_num;
+ int ncolors;
+ XColor *colors;
+
+ if (!cmc_read(f, &scr_num, &ncolors, &colors))
+ break;
+
+ printf("Screen %s.%d\n", XDisplayName(display_name), scr_num);
+ printf("%d saved colors\n", ncolors);
+
+ print_xcolors(colors, ncolors);
+ printf("\n");
+
+ free((char *)colors);
+ }
+}
+
+
+static void
+print_xcolors (colors, ncolors)
+XColor *colors;
+int ncolors;
+
+{
+ register XColor *c;
+ register int i;
+ register int max = 0;
+ char format[50];
+ int ndigits = 4;
+ int planes;
+
+ for (c = colors; c < colors + ncolors; c++) {
+ planes = c->red | c->green | c->blue;
+ for(i = 4; i > 1 && (planes&0xf)==0; i--) {
+ c->red >>= 4;
+ c->green >>= 4;
+ c->blue >>= 4;
+ planes >>= 4;
+ }
+ printf("#%0*x%0*x%0*x\n", i, c->red, i, c->green, i, c->blue);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcutil.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,301 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+#ifndef lint
+static char sccsid[] = "@(#)cmcutil.c 35.4 08/09/30";
+#endif
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include "cmcutil.h"
+#include "cmc.h"
+
+
+/*
+** Common utility routines shared by the Workspace Colors programs
+** cmcsave, cmcshow, cmcinit.
+*/
+
+/*ARGSUSED*/
+static void
+disp_err_handler (dpy)
+Display *dpy;
+
+{
+ fatal_error("cannot open display \"%s\"", display_name);
+}
+
+/*
+** Open display and handle any errors.
+*/
+
+Display *
+open_display (dpyname)
+char *dpyname;
+
+{
+ Display *dpy;
+
+ /*
+ ** Catch errors opening display so user doesn't
+ ** get confusing 'XIOError: Broken Pipe' message.
+ */
+ XSetIOErrorHandler(disp_err_handler);
+
+ display_name = XDisplayName(dpyname);
+ if (!(dpy = XOpenDisplay(dpyname)))
+ return NULL;
+
+ XSync(dpy, 0);
+ XSetIOErrorHandler(NULL);
+
+ return dpy;
+}
+
+
+/*
+** Return true if default visual of screen is dynamic.
+*/
+
+int
+dynamic_indexed_default_visual (screen)
+Screen *screen;
+
+{
+ int class = DefaultVisualOfScreen(screen)->class;
+
+ return (class == GrayScale ||
+ class == PseudoColor);
+}
+
+/*
+** If file name is not already absolute, make absolute
+** relative to home directory.
+*/
+
+static char *
+fn_absolutize (relname)
+char *relname;
+
+{
+ static char filename[256];
+ char *homedir;
+
+ if (*relname == '/')
+ return relname;
+
+ if (!(homedir = (char *) getenv("HOME")))
+ homedir = "/";
+ sprintf(filename, "%s/%s", homedir, relname);
+ return filename;
+}
+
+
+char *
+comp_colors_filename (basename)
+char *basename;
+
+{
+ if (!basename)
+ basename = COMPACTED_COLORS_FILE;
+ return fn_absolutize(basename);
+
+}
+
+int
+cmc_write (f, scr_num, ncolors, colors)
+FILE *f;
+int scr_num;
+int ncolors;
+XColor *colors;
+
+{
+ (void)fwrite(&scr_num, sizeof(int), 1, f);
+ (void)fwrite(&ncolors, sizeof(int), 1, f);
+ (void)fwrite(colors, sizeof(XColor), ncolors, f);
+
+ return 1;
+}
+
+
+/*
+** 0 is returned on EOF; 1 otherwise
+*/
+
+int
+cmc_read (f, scr_num, ncolors, colors)
+FILE *f;
+int *scr_num;
+int *ncolors;
+XColor **colors;
+
+{
+ if (!fread(scr_num, sizeof(int), 1, f))
+ return 0;
+
+ if (!fread(ncolors, sizeof(int), 1, f)) {
+ fprintf(stderr, "error: premature end-of-file\n");
+ fatal_error("cannot read number of saved colors");
+ }
+
+ if (!(*colors = (XColor *) malloc(*ncolors * sizeof(XColor))))
+ fatal_error("not enough memory");
+
+ if (!fread(*colors, sizeof(XColor), *ncolors, f)) {
+ fprintf(stderr, "error: premature end-of-file\n");
+ fatal_error("cannot read saved colors");
+ }
+
+ return 1;
+}
+
+
+void
+cmc_header_write (f)
+FILE *f;
+
+{
+ int value;
+
+ /* write magic number and version */
+ value = CMC_MAGIC;
+ (void)fwrite(&value, sizeof(int), 1, f);
+ value = CMC_VERSION;
+ (void)fwrite(&value, sizeof(int), 1, f);
+}
+
+
+void
+cmc_header_test (f)
+FILE *f;
+
+{
+ int value;
+
+ /* check magic number */
+ if (!fread(&value, sizeof(int), 1, f) ||
+ value != CMC_MAGIC)
+ fatal_error("Unrecognized colors file. Expected magic number = %x, \
+Actual = %x", CMC_MAGIC, value);
+
+ /* check version number */
+ if (!fread(&value, sizeof(int), 1, f) ||
+ value != CMC_VERSION)
+ fatal_error("Unrecognized colors file. Expected version number = %x, \
+Actual = %x", CMC_VERSION, value);
+}
+
+
+void
+prop_update (dpy, w, name, type, format, data, nelem)
+Display *dpy;
+Window w;
+char *name;
+Atom type;
+int format;
+int data;
+int nelem;
+
+{
+ /* intern the property name */
+ Atom atom = XInternAtom(dpy, name, 0);
+
+ /* create or replace the property */
+ XChangeProperty(dpy, w, atom, type, format, PropModeReplace,
+ (unsigned char *)&data, nelem);
+}
+
+
+/*
+** Sets the close-down mode of the cmc client to 'RetainPermanent'
+** so all client resources will be preserved after the client
+** exits. Puts a property on the default root window containing
+** an XID of the client so that the resources can later be killed.
+*/
+
+void
+resource_preserve (dpy)
+Display *dpy;
+
+{
+ Window w = DefaultRootWindow(dpy);
+
+ /* create dummy resource */
+ Pixmap pm = XCreatePixmap(dpy, w, 1, 1, 1);
+
+ /* create/replace the property */
+ prop_update(dpy, w, RETAIN_PROP_NAME, XA_PIXMAP, 32, (int)pm, 1);
+
+ /* retain all client resources until explicitly killed */
+ XSetCloseDownMode(dpy, RetainPermanent);
+}
+
+
+/*
+** Flushes any resources previously retained by a cmc client,
+** if any exist.
+*/
+
+void
+resource_discard (dpy)
+Display *dpy;
+
+{
+ Pixmap *pm;
+ Atom actual_type; /* NOTUSED */
+ int format;
+ int nitems;
+ int bytes_after;
+
+ /* intern the property name */
+ Atom atom = XInternAtom(dpy, RETAIN_PROP_NAME, 0);
+
+ /* look for existing resource allocation */
+ if (XGetWindowProperty(dpy, DefaultRootWindow(dpy), atom, 0, 1,
+ 1/*delete*/, AnyPropertyType, &actual_type, &format, &nitems,
+ &bytes_after, &pm) == Success && nitems == 1)
+
+ if (actual_type == XA_PIXMAP && format == 32 &&
+ nitems == 1 && bytes_after == 0) {
+ /* blast it away */
+ XKillClient(dpy, (Pixmap *) *pm);
+ XFree(pm);
+ } else if (actual_type != None) {
+ extern char *program;
+ fprintf(stderr, "%s: warning: invalid format encountered for property %s\n",
+ RETAIN_PROP_NAME, program);
+ }
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/cmcutil.h Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,96 @@
+/*
+* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+
+/* @(#)cmcutil.h 35.2 08/09/30 */
+
+/*
+** Definitions shared between several Workspace Color operations
+*/
+
+#ifndef CMCUTIL_INCLUDE
+#define CMCUTIL_INCLUDE
+
+/*
+** Symbols
+*/
+
+#define COUNT_PROP_NAME "XA_COMPACTED_COLORS_COUNT"
+#define RETAIN_PROP_NAME "XA_COMPACTED_COLORS_XID"
+
+/*
+** Note: if you change these, you must also change it in
+** server/cscript/cs_cmap.c.
+*/
+#define COMPACTED_COLORS_FILE ".owcolors"
+#define CMC_MAGIC 0xb0f0
+#define CMC_VERSION 0
+
+
+
+/*
+** Macros
+*/
+
+#define WHITE(c)\
+ ((c)->red == (c)->green && \
+ (c)->red == (c)->blue && \
+ (c)->red == 0xffff)
+
+#define BLACK(c)\
+ ((c)->red == (c)->green && \
+ (c)->red == (c)->blue && \
+ (c)->red == 0x0)
+
+/*
+** Types
+*/
+
+typedef unsigned long Pixel;
+
+
+/*
+** External Functions
+*/
+
+extern void setprogram();
+extern void fatal_error();
+extern Display *open_display();
+extern int dynamic_indexed_default_visual();
+extern char *comp_colors_filename();
+extern int cmc_write();
+extern int cmc_read();
+extern void cmc_header_write();
+extern void cmc_header_test();
+extern void resource_preserve();
+extern void resource_discard();
+extern void prop_update();
+
+#endif !CMCUTIL_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/cmap_compact/sun-src/flash.txt Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,418 @@
+.\" @(#)flash.txt 35.1 94/09/01
+.\"
+.\" To print: troff -ms flash.txt
+.\"
+
+
+.ft B
+.ce 3
+=======================================================================
+|| Colormap Compaction - A Technique for Reducing Colormap Flashing ||
+=======================================================================
+.ft P
+
+
+\fBA. Introduction\fP
+
+In some situations, it is beneficial to \fIcompact\fP the \fBxnews\fP default
+colormap. This often leads to reduced \fIcolormap flashing\fP. Colormap
+flashing occurs when colors in two different software colormaps conflict
+with each other. Since only one software colormap can be loaded into the
+hardware at a time, for a given pixel value you will see the color
+which is in one colormap or the other. Which color you see depends
+on the window into which you assign the \fIcolormap focus\fP. Typically,
+the focus is assigned to a window by moving the pointer into it.
+
+This material applies only to color devices which have a single
+hardware color LUT, such as GX. It does not apply to monochrome screens.
+The technique describe herein may be used on a device which
+provides multiple hardware color LUTs, such as GS or GT, but it
+is less valuable in this configuration, because the benefit will
+probably not be as pronounced as it can be on a single hardware
+color LUT device.
+
+
+\fBB. An Example of Colormap Flashing\fP
+
+Let us suppose we have two windows, window A and window B.
+Window A is attached to software colormap A; window B is attached to
+software colormap B. When you move the pointer into window A, colormap A
+will be loaded into the hardware colormap. Likewise, when you move
+the pointer into window B, colormap B will be loaded.
+
+Let's say the pixel value 5 is drawn somewhere on the screen. Let's also
+suppose that the color value for pixel 5 in colormap A is Red and
+the color value for pixel 5 in colormap B is Blue. When the pointer is
+in window A, all pixels of value 5 will be displayed as Red, no matter where
+they are on the screen. When the pointer is in window B, these same pixels
+will be displayed as Blue.
+
+In OpenWindows, a software colormap will only displace the other in places where they
+each have allocated colors. In places where no colors
+have been allocated, the contents of the hardware will remain set to the previous values.
+Thus, the colors of two software colormaps can exist harmoniously together in the
+hardware colormap only if their allocated colormap entries do not intersect.
+
+(Readers familiar with Sunview should note that this style of colormap management
+is very different than the named colormap segment scheme used by Sunview.)
+
+Moving the pointer rapidly back and forth between windows A and B causes
+the pixels with value 5 on the screen to blink between Red and Blue.
+This is why this effect is called colormap \fIflashing\fP.
+
+The rest of this discussion will assume a basic level of familiarity
+with X11 colormap concepts. Users should refer to O'Reilley Volume 1
+Chapter 7 "Color" for more information.
+
+
+\fBC. Why Does Colormap Flashing Happen?\fP
+
+The previous section discussed the effects and symptoms of colormap
+flashing. But the fundamental question remains: what causes the
+colors in the two colormaps to coincide and conflict?
+
+For the purposes of the following discussion, pixel 0 is called the
+\fIlow end\fP of the colormap and pixel 255 is called the \fIhigh end\fP.
+
+Because, for a typical device, a maximum of 256 distinct colors can be displayed
+on a screen at once, colors are a very scarce resource. The X11R4 standard provides
+some mechanisms for sharing colors between client programs, thus
+reducing the chance of colormap flashing. For example, two different
+applications may share the same pixel value, and therefore the same color,
+in a single colormap. Usually, a client program has to explicitly try
+to share colors with other clients. Some situations in which such
+attempts break down are:
+
+.in +0.5i
+\(bu All of the clients which are running collectively demand more
+than 256 distinct colors.
+
+\(bu One or more clients make no attempt at all to share colors
+with other applications.
+
+\(bu One or more clients use read-write (modifiable) colors, which
+cannot be shared.
+.in -0.5i
+
+There are several techniques X11 client programmers can use to share
+colors. Most of them entail the implementation of additional code
+in the program. What we seek to present in this document,
+is a generic technique that any OpenWindows user can take advantage of,
+regardless of whether a particular program contains explicit code
+which tries to reduce colormap flashing.
+
+Client programs ask the xnews server to grant them pixels to use by telling
+the server what colors they desire. The server figures out where to
+put the colors in the colormap and then tells the clients which pixels
+have been assigned to them. This process is called \fIcolor allocation\fP.
+Unless client programs do something out of the ordinary, color allocations
+tend to gravitate toward the low end of a colormap. This is because the
+server always gives a client the lowest unused pixel when allocating a
+new color.
+
+The default colormap is a colormap which all clients know about and
+can use. By default, when a window is created, the default colormap is
+attached it. If a client allocates a color in a colormap and indicates it to be
+\fIshareable\fP, other clients allocating the same color value are
+able to share these colors. More sharing of colors means less color
+conflicts and less colormap flashing. The default colormap, therefore,
+is the preferred colormap to use if you want to share colors. Sometimes
+a program cannot use the default colormap and must allocate its
+colors in an alternate colormap. This increases the chances of flashing
+between the colors in these two different colormaps. Sometimes a program wants
+to use the default colormap, but cannot because it is full. The program is then
+forced to use an alternate colormap. This, again, increases the chance of flashing.
+
+To summarize, client applications would like to use the default colormap if
+possible, but sometimes they need to or are forced to use an alternate
+colormap. The only way to prevent colormap flashing between two separate
+colormaps is to make them disjoint--to ensure their color allocations not
+intersect.
+
+
+\fBC. Types of Colormap Flashing\fP
+
+Some kinds of colormap flashing are worse than others. For example,
+an MCAD application which flashes against a spreadsheet program
+is unpleasant, but since the flashing is usually confined to specific
+window areas, it can often be tolerated as a reality of limited
+hardware. However, if the same MCAD application flashes against
+the root window background or the frame border colors, the effect
+is usually very pronounced. This is very disconcerting and
+disorienting for the user.
+
+It is specifically this latter type of colormap flashing that the
+colormap compaction attempts to solve. Other techniques for dealing
+with the former type of flashing exist, but they usually require
+programming changes and, therefore, are not something the end-user
+can typically take advantage of without having specially-modified software.
+We will therefore not deal further with this \fIwindow-to-window\fP type of
+colormap flashing. What we
+will proceed to address is the problem of the flashing of windows against
+a group of colors called the \fIworkspace colors\fP.
+
+The workspace colors are colors which are in some way important
+or pervasive in a user's workspace. They may be colors which
+cover a large area on the screen or they may be colors appear
+in frequently used applications. Some examples of applications
+which might utilize workspace colors are:
+
+.in +0.5i
+\(bu A window manager (e.g \fBolwm\fP), for the root background, window borders, and menus.
+
+\(bu A toolkit (e.g. XView), for window decorations and controls.
+
+\(bu A root image loader (e.g. \fBxsetroot\fP), for the root background image.
+
+\(bu An oft-used application (e.g. \fBfilemgr\fP).
+.in -0.5i
+
+Which colors should be designated as workspace colors is left
+up to the user. The only criteria for a workspace color is that it
+be a read-only (sharable) color and that it be allocated in the default
+colormap of a screen.
+
+To summarize, the workspace colors are the colors the user has deemed
+to be important and with which he or she would prefer not to have
+any colormap flashing.
+
+
+\fBD. Goals\fP
+
+\fIColormap compaction\fP takes advantage of the identification
+of the colors of special applications and the low-end clustering effect of
+typical applications. It takes advantage of these
+by shoving the workspace colors up to the top of the colormap.
+In this position, there is a reduced chance of the colors flashing
+flashing with other applications.
+
+It is important that it be easy to identify the workspace colors.
+Detailed knowledge of how X11 colormaps work should not be required.
+Nor should any programming ability be required. Lastly, we
+don't want to rely on the availability of specially adapted programs;
+the technique should work with any arbitrary program which conforms
+to the X11 standard protocol.
+
+All of these considerations lead us to the method which is described
+in the following section.
+
+
+\fBE. Instructions\fP
+
+The preceding material has been presented to give you a overall sense
+what the problem is and the general method of solution. This section
+will show you how to apply this method in the OpenWindows environment.
+
+In a nutshell, to reduce or prevent colormap flashing, you need to run the
+\fBxnews\fP server, perform some configuration steps, and then exit the server.
+The next time you run the server, the workspace colors you designate
+will be put up at the high end of the default colormap.
+
+For additional details on this process, refer to \fBcmap_compact\fP(1).
+
+Prerequisites:
+
+.in +0.5i
+.ti -1.5
+\(bu Your \fL~/.xinitrc\fP file should invoke a version of
+\fLopenwin-sys\fP that has the following as its first line:
+
+.in +0.5i
+.ft L
+.nf
+.na
+ cmap_compact init
+.ft P
+.fi
+.ad
+.in -0.5i
+
+The \fLopenwin-sys\fP shipped with OpenWindows 3.0 contains this
+line. If you use some other file, be sure to add this line.
+The process should never be backgrounded.
+
+.ti -1.5
+\(bu Edit your \fL~/.openwin-menu\fP file and insert the following lines into the \fIUtilities\fP menu
+after the "Save Workspace" menu entry:
+:
+
+.in +0.5i
+.ft L
+.nf
+.na
+ "Save Colors" MENU
+ "Save" DEFAULT $OPENWINHOME/bin/cmap_compact save
+ "Discard" $OPENWINHOME/bin/cmap_compact discard
+ "Save Colors" END
+.ft P
+.fi
+.ad
+.in -0.5i
+
+
+If you do not have your own customized menu file, start with a copy
+of \fL$OPENWINHOME/lib/openwin-menu\fP placed in your home directory, renamed
+to \fL.openwin-menu.\fP
+
+.in -0.5i
+
+Steps:
+
+.in 0.5i
+.ti -2.0
+1. Run the server with the \fBopenwin\fP(1) script. Be sure at this
+time to configure the server for all of the screens you want to
+compact colors for. \fBopenwin\fP will (typically) execute
+\fI~/.openwin-init\fP, which will in turn bring up your initial
+tools and programs.
+
+.ti -2.0
+2. If you use a program which loads a root background image (such as
+\fBxsetroot\fP(1)), make sure you run this program. Do this for
+every screen.
+
+.ti -2.0
+3. Use the \fIWorkspace Properties\fP sheet to select your desired
+window border and/or root window background colors. This property
+is available by selecting the \fIProperties\fP entry of the
+root menu. Do this for every screen.
+
+.ti -2.0
+4. Choose the applications whose colors you want to designate as
+workspace colors. You do this by either quitting undesired
+applications which are on the screen or by running desired
+applications which are not yet on the screen. Do this for
+every screen.
+
+.ti -2.0
+5. At this point, the only colors which are in the default colormap
+should belong to the displayed programs. Go into the
+\fIUtilities\fP submenu of the root menu of any screen and select the
+\fISave Colors\fP entry. All sharable (read-only)
+colors in the default colormaps for all screens will be recorded and stored in
+the file \fI~/.owcolors\fP. Note: private (read-write) colors used
+by any of these applications will be ignored and will not
+be saved.
+
+.ti -2.0
+6. Exit the window system.
+
+.ti -2.0
+7. Reenter the window system by rerunning \fIopenwin\fP.
+.in -0.5i
+
+When you reenter the window system, the colors that have
+been stored in \fI~/.owcolors\fP are placed at the high
+end of the default colormap. Since this is done before
+any of the other applications are started, when these
+applications are finally started, they will find the colors
+they want waiting for them at the high end and will use
+them there.
+
+Note: If you decide to change any of the workspace colors, you should
+repeat steps 3-7. Otherwise, you may end up with more colormap
+flashing.
+
+If, at any time, you wish to undo the effects of the colormap
+compaction, select the \fIDiscard\fP entry of the \fISave Colors\fP
+submenu.
+
+As a side-effect of colormap compaction, the NeWS color cube in the
+StaticColor colormap gets shifted downward. The cube is shifted down by
+the number of workspace colors you have saved (actually, the number
+of colors for the screen with the most colors). This is done to avoid
+flashing between NeWS windows and the workspace colors. Note: the base
+of the color cube is never shifted lower than pixel 0.
+
+The black and white pixels which are pre-allocated in the default colormap
+by the server are shifted up to the high end of the colormap.
+
+In addition, XGL (version 2.0 and greater) will recognize that
+colormap compaction has been turned on and will adjust its
+color cube accordingly. XGL usually allocates its color cube
+at the high end of its colormap by default. When colormap
+compaction is turned on, XGL will allocate its color cube at
+the low end of the colormap.
+
+
+\fBF. What if Colormap Flashing isn't Reduced?\fP
+
+Colormap compaction is a heuristic technique: it is not always effective
+in reducing colormap flashing and, in some situations, may actually
+increase colormap flashing. The result of using colormap compaction
+is highly dependent on the applications you use and the way that you
+have configured color on your desktop.
+
+Here are some example situations in which colormap compaction does
+not succeed:
+
+.in +0.5i
+.ti -1.5
+\(bu If you are running a program which allocates
+its colors at the high end of a non-default colormap on purpose,
+this program will end up flashing more with the workspace colors.
+
+.ti -1.5
+\(bu If you select a large amount of workspace colors, the
+NeWS color cube may be shifted down enough to start
+flashing more with X11 applications allocating their
+colors at the low end. This may increase colormap flashing
+between X11 and NeWS applications.
+.in -0.5i
+
+In general, the amount of colormap flashing reduction or
+increase afforded by colormap compaction is highly dependent
+on the set of applications you run in your environment.
+For many environments, colormap compaction will be useful.
+But there are some environments for which it is not.
+The best policy is to give it a try and see if it helps.
+If it does not help, turn it off by selecting discard on
+the "Save Colors" menu.
+
+Some other things to be aware of:
+
+.in +0.5i
+.ti -1.5
+\(bu Colormap compaction has no effect for screens which
+have the StaticColor colormap as the default (i.e. for
+screens which have a device modifier of \fIstaticvis\fP).
+
+.ti -1.5
+\(bu You should discard the saved workspace colors and
+reconfigure whenever you change the device modifiers
+(\fLstaticvis\fP, \fLgrayvis\fP or \fLdefdepth\fP) used on
+the server command line.
+
+.ti -1.5
+\(bu You should discard the saved colors and reconfigure whenever
+you remove a screen from your configuration.
+
+.ti -1.5
+\(bu Colormap compaction does not preclude other means of
+inter-application color sharing which programmers may
+want to use. For example, X11 \fIStandard Colormap
+properties\fP can be used to promote sharing among imaging
+applications that use lots of colors. Application developers can
+use these properties in conjunction with colormap
+compaction to achieve even less colormap flashing.
+.in -0.5i
+
+
+\fBG. Summary\fP
+
+Compacting the default colormap is the process of selecting certain application
+colors you would prefer not to flash and saving these
+colors into a file. When the window system is reentered, these colors
+will end up at the high end of the default colormap, a preferred position
+which often decreases colormap flashing.
+
+This process may not always make sense for your situation. Depending on the
+applications you run, it may or may not help, but it probably will. You
+must also make sure you keep the configuration up-to-date to continue
+to derive the maximum benefits. If, after trying colormap compaction, colormap
+flashing on your desktop is not reduced, colormap compaction should be turned back off.
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/mkcookie/COPYING Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,42 @@
+Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+Use subject to license terms.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+Copyright 1988 Massachusetts Institute of Technology
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of M.I.T. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. M.I.T. makes no representations about the
+suitability of this software for any purpose. It is provided "as is"
+without express or implied warranty.
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/mkcookie/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,60 @@
+###############################################################################
+#
+# mkcookie 1.x module Makefile
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+#
+
+# Package name used in tarballs
+MODULE_NAME=mkcookie
+
+# No upstream sources, only local sources
+MODULE_VERSION=src
+SOURCE_TARBALL_NAME=NONE
+SOURCE_TARBALL_NAME_SET=yes
+ADDITIONAL_SOURCE_DIR=sun-src
+
+# Man pages to apply Sun footer to & attributes to list
+SUNTOUCHED_MANPAGES= # None
+SUN_PACKAGE=SUNWxwplt
+MODULE_STABILITY=Committed
+
+# No configure script to run
+CONFIGURE_TARGETS=
+CONFIGURE_TARGETS_SET=yes
+
+# Since we don't have a configure script, pass configure flags to make
+MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+
+include ../Makefile.inc
+
+source_gen:: $(LNDIR)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/mkcookie/sun-src/Makefile Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,40 @@
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+# @(#)Makefile 1.1 08/09/30
+
+SRCS = mkcookie.c
+OBJS = $(SRCS:.c=.o)
+CFLAGS1 = -DTCPCONN -DUNIXCONN -DIPv6
+
+mkcookie: $(OBJS)
+ $(LD) -o $@ $(CFLAGS) $(CFLAGS1) $(LDFLAGS) $(OBJS) -lX11 -lXau -lnsl
+
+install: mkcookie
+ mkdir -p $(DESTDIR)$(PREFIX)/lib
+ $(INSTALL) mkcookie $(DESTDIR)$(PREFIX)/lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/mkcookie/sun-src/mkcookie.c Tue Sep 30 10:13:12 2008 -0700
@@ -0,0 +1,1004 @@
+/*
+*
+* mkcookie.c 1.x
+*
+* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+* Use subject to license terms.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, and/or sell copies of the Software, and to permit persons
+* to whom the Software is furnished to do so, provided that the above
+* copyright notice(s) and this permission notice appear in all copies of
+* the Software and that both the above copyright notice(s) and this
+* permission notice appear in supporting documentation.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*
+* Except as contained in this notice, the name of a copyright holder
+* shall not be used in advertising or otherwise to promote the sale, use
+* or other dealings in this Software without prior written authorization
+* of the copyright holder.
+*
+*/
+#pragma ident "@(#)mkcookie.c 35.13 08/09/30 SMI"
+
+/*
+ * $XConsortium: auth.c,v 1.17 89/12/14 09:42:18 rws Exp $
+ *
+ * Copyright 1988 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <X11/X.h>
+#include <X11/Xauth.h>
+#include <X11/Xos.h>
+#include <rpc/rpc.h>
+#ifdef SYSV
+#include <sys/stropts.h>
+#ifndef bcopy
+#define bcopy(a,b,c) memmove(b,a,c)
+#endif
+#ifndef bzero
+#define bzero(a,b) memset(a,0,b)
+#endif
+#ifndef bcmp
+#define bcmp(a,b,c) memcmp(a,b,c)
+#endif
+#ifndef index
+#define index(a,b) strchr(a,b)
+#endif
+#ifndef rindex
+#define rindex(a,b) strrchr(a,b)
+#endif
+#endif
+
+#define AUTH_DATA_LEN 16 /* bytes of authorization data */
+/* 1191081: SIGSEGV when starting openwin - core dumped by mkcookie.
+ * becuase d.userAuthDir is not assigned any valid directory where
+ * every one will have access to it.
+ */
+#define DEF_USER_AUTH_DIR "/tmp" /* Backup directory for User Auth file */
+
+extern int InitAuth ();
+extern Xauth *GetAuth ();
+#ifdef X_NOT_STDC_ENV
+extern char *malloc(), *realloc();
+#else
+#include <stdlib.h>
+#endif
+
+#define Local 1
+#define Foreign 0
+
+typedef struct displayType {
+ unsigned int location:1;
+ unsigned int lifetime:1;
+ unsigned int origin:1;
+} DisplayType;
+
+struct display {
+ char *name; /* DISPLAY name */
+ int authorize; /* enable authorization */
+ Xauth *authorization; /* authorization data */
+ char *authFile; /* file to store authorization in */
+ char *userAuthDir; /* backup directory for tickets */
+ char *authName; /* authorization protocol name */
+ int authNameLen; /* authorization protocol name len */
+ int resetForAuth; /* server reads auth file at reset */
+ DisplayType displayType;
+ struct sockaddr *peer;
+ int peerlen;
+};
+
+struct verify_info {
+ int uid; /* user id */
+ int gid; /* group id */
+ char **argv; /* arguments to session */
+ char **userEnviron; /* environment for session */
+ char **systemEnviron;/* environment for startup/reset */
+};
+
+struct AuthProtocol {
+ int name_length;
+ char *name;
+ int (*InitAuth)();
+ Xauth *(*GetAuth)();
+ int (*GetXdmcpAuth)();
+ int inited;
+};
+
+struct addrList {
+ unsigned short family;
+ unsigned short address_length;
+ char *address;
+ unsigned short number_length;
+ char *number;
+ struct addrList *next;
+};
+
+static char auth_name[256];
+static int auth_name_len;
+static struct addrList *addrs;
+
+static struct AuthProtocol AuthProtocols[] = {
+ { (int) 18, "MIT-MAGIC-COOKIE-1",
+ InitAuth, GetAuth, NULL,
+ },
+ { (int) 9, "SUN-DES-1",
+ InitAuth, GetAuth, NULL,
+ }
+};
+
+static char * makeEnv (name, value)
+char *name;
+char *value;
+{
+ char *result;
+
+ result = malloc ((unsigned) (strlen (name) + strlen (value) + 2));
+ if (!result) {
+ perror ("makeEnv");
+ return 0;
+ }
+ sprintf (result, "%s=%s", name, value);
+ return result;
+}
+
+
+char ** setEnv (e, name, value)
+char **e;
+char *name;
+char *value;
+{
+ char **new, **old;
+ char *newe;
+ int envsize;
+ int l;
+
+ l = strlen (name);
+ newe = makeEnv (name, value);
+ if (!newe) {
+ perror ("setEnv");
+ return e;
+ }
+ if (e) {
+ for (old = e; *old; old++)
+ if (strlen (*old) > l &&
+ !strncmp (*old, name, l) && (*old)[l] == '=')
+ break;
+ if (*old) {
+ free (*old);
+ *old = newe;
+ return e;
+ }
+ envsize = old - e;
+ new = (char **) realloc ((char *) e,
+ (unsigned) ((envsize + 2) * sizeof (char *)));
+ } else {
+ envsize = 0;
+ new = (char **) malloc (2 * sizeof (char *));
+ }
+ if (!new) {
+ perror ("setEnv");
+ free (newe);
+ return e;
+ }
+ new[envsize] = newe;
+ new[envsize+1] = 0;
+ return new;
+}
+
+
+binaryEqual (a, b, len)
+ char *a, *b;
+ int len;
+{
+ while (len-- > 0)
+ if (*a++ != *b++)
+ return 0;
+ return 1;
+}
+
+#ifdef DEBUG
+dumpBytes (len, data)
+ int len;
+ char *data;
+{
+ int i;
+
+ printf ("%d: ", len);
+ for (i = 0; i < len; i++)
+ printf ("%02x ", data[i] & 0377);
+ printf ("\n");
+}
+
+dumpAuth (auth)
+ Xauth *auth;
+{
+ printf ("family: %d\n", auth->family);
+ printf ("addr: ");
+ dumpBytes (auth->address_length, auth->address);
+ printf ("number: ");
+ dumpBytes (auth->number_length, auth->number);
+ printf ("name: ");
+ dumpBytes (auth->name_length, auth->name);
+ printf ("data: ");
+ dumpBytes (auth->data_length, auth->data);
+}
+
+
+#endif
+
+checkAddr (family, address_length, address, number_length, number)
+ int family;
+ unsigned short address_length, number_length;
+ char *address, *number;
+{
+ struct addrList *a;
+
+ for (a = addrs; a; a = a->next) {
+ if (a->family == family &&
+ a->address_length == address_length &&
+ binaryEqual (a->address, address, address_length) &&
+ a->number_length == number_length &&
+ binaryEqual (a->number, number, number_length))
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void
+saveAddr (family, address_length, address, number_length, number)
+ unsigned short family;
+ unsigned short address_length, number_length;
+ char *address, *number;
+{
+ struct addrList *new;
+
+ if (checkAddr (family, address_length, address, number_length, number))
+ return;
+ new = (struct addrList *) malloc (sizeof (struct addrList));
+ if (!new) {
+ perror ("saveAddr");
+ return;
+ }
+ if ((new->address_length = address_length) > 0) {
+ new->address = malloc (address_length);
+ if (!new->address) {
+ perror ("saveAddr");
+ free ((char *) new);
+ return;
+ }
+ bcopy (address, new->address, (int) address_length);
+ } else
+ new->address = 0;
+ if ((new->number_length = number_length) > 0) {
+ new->number = malloc (number_length);
+ if (!new->number) {
+ perror ("saveAddr");
+ free (new->address);
+ free ((char *) new);
+ return;
+ }
+ bcopy (number, new->number, (int) number_length);
+ } else
+ new->number = 0;
+ new->family = family;
+ new->next = addrs;
+ addrs = new;
+}
+
+writeLocalAuth (file, auth, name)
+ FILE *file;
+ Xauth *auth;
+ char *name;
+{
+ int fd;
+
+ setAuthNumber (auth, name);
+#ifdef TCPCONN
+#ifdef IPv6
+ fd = socket (AF_INET6, SOCK_STREAM, 0);
+#else
+ fd = socket (AF_INET, SOCK_STREAM, 0);
+#endif
+ DefineSelf (fd, file, auth);
+ close (fd);
+#endif
+#ifdef NOTDEF /* DNETCONN */
+ fd = socket (AF_DECnet, SOCK_STREAM, 0);
+ DefineSelf (fd, file, auth);
+ close (fd);
+#endif
+
+ DefineLocal (file, auth);
+}
+
+
+writeAddr (family, addr_length, addr, file, auth)
+ int family;
+ int addr_length;
+ char *addr;
+ FILE *file;
+ Xauth *auth;
+{
+
+ auth->family = (unsigned short) family;
+ auth->address_length = addr_length;
+ auth->address = addr;
+ writeAuth (file, auth);
+}
+
+
+#if defined(SYSV) && defined(TCPCONN)
+int
+ifioctl(s, cmd, arg)
+ int s;
+ int cmd;
+ char *arg;
+{
+ struct strioctl ioc;
+ int ret;
+
+ bzero((char *) &ioc, sizeof(ioc));
+ ioc.ic_cmd = cmd;
+ ioc.ic_timout = 0;
+ if (cmd == SIOCGIFCONF) {
+/* ioc.ic_len = ((struct ifconf *) arg)->ifc_len; */
+/* For jup_alpha3, it wants a smaller size in the length field, uncomment above
+ line and delete the next line once that is fixed. Should not give EINVAL */
+ ioc.ic_len = 1024;
+ ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
+ } else {
+ ioc.ic_len = sizeof(struct ifreq); ioc.ic_dp = arg;
+ }
+ ret = ioctl(s, I_STR, (char *) &ioc);
+ if (ret != -1 && cmd == SIOCGIFCONF)
+ ((struct ifconf *) arg)->ifc_len = ioc.ic_len;
+ return(ret);
+}
+#endif /* SYSV && TCPCONN */
+
+
+DefineSelf (fd, file, auth)
+ int fd;
+ FILE *file;
+ Xauth *auth;
+{
+ char buf[2048];
+ void * bufptr = buf;
+ register int n;
+ int len;
+ char *addr;
+ int family;
+#ifdef SIOCGLIFCONF
+ struct lifconf ifc;
+ register struct lifreq *ifr;
+#ifdef SIOCGLIFNUM
+ struct lifnum ifn;
+#endif
+#else
+ register struct ifreq *ifr;
+ struct ifconf ifc;
+#endif
+
+ len = sizeof(buf);
+
+#if defined(SIOCGLIFNUM) && defined(SIOCGLIFCONF)
+ ifn.lifn_family = AF_UNSPEC;
+ ifn.lifn_flags = 0;
+ if (ioctl (fd, (int) SIOCGLIFNUM, (char *) &ifn) < 0)
+ perror ("Getting interface count");
+ if (len < (ifn.lifn_count * sizeof(struct lifreq))) {
+ len = ifn.lifn_count * sizeof(struct lifreq);
+ bufptr = malloc(len);
+ }
+#endif
+
+#ifdef SIOCGLIFCONF
+ ifc.lifc_family = AF_UNSPEC;
+ ifc.lifc_flags = 0;
+ ifc.lifc_len = len;
+ ifc.lifc_buf = bufptr;
+ if (ioctl (fd, (int) SIOCGLIFCONF, (char *) &ifc) < 0)
+ return;
+ for (ifr = ifc.lifc_req, n = ifc.lifc_len / sizeof (struct lifreq);
+ --n >= 0; ifr++)
+ {
+ len = sizeof(ifr->lifr_addr);
+ {
+ family = ConvertAddr ((struct sockaddr *) &ifr->lifr_addr, &len,
+ &addr);
+#else
+ ifc.ifc_len = len;
+ ifc.ifc_buf = buf;
+#if defined(SYSV) && defined(TCPCONN)
+ ifioctl (fd, SIOCGIFCONF, (char *) &ifc);
+#else
+ ioctl (fd, SIOCGIFCONF, (char *) &ifc);
+#endif /* SYSV && TCPCONN */
+
+ for (ifr = ifc.ifc_req, n = ifc.ifc_len / sizeof (struct ifreq); --n >= 0;
+ ifr++)
+ {
+#ifdef NOTDEF /* DNETCONN */
+ /*
+ * this is ugly but SIOCGIFCONF returns decnet addresses in
+ * a different form from other decnet calls
+ */
+ if (ifr->ifr_addr.sa_family == AF_DECnet) {
+ len = sizeof (struct dn_naddr);
+ addr = (char *)ifr->ifr_addr.sa_data;
+ family = FamilyDECnet;
+ } else
+#endif
+ {
+ family = ConvertAddr (&ifr->ifr_addr, &len, &addr);
+#endif
+ if (family <= 0)
+ continue;
+
+ /*
+ * If we get back a 0.0.0.0 IP address, ignore this entry. This
+ * typically happens when a machine is in a standalone mode.
+ */
+ if(len == 4 && addr[0] == 0 && addr[1] == 0 &&
+ addr[2] == 0 && addr[3] == 0)
+ continue;
+
+#ifdef IPv6
+ if(family == AF_INET6) {
+ if (IN6_IS_ADDR_LOOPBACK(((struct in6_addr *)addr)))
+ continue;
+ else
+ family = FamilyInternet6;
+ } else
+#endif
+ family = FamilyInternet;
+ }
+
+ writeAddr (family, len, addr, file, auth);
+ }
+}
+
+
+DefineLocal (file, auth)
+ FILE *file;
+ Xauth *auth;
+{
+ char displayname[100];
+
+ /* stolen from xinit.c */
+#ifdef hpux
+ /* Why not use gethostname()? Well, at least on my system, I've had to
+ * make an ugly kernel patch to get a name longer than 8 characters, and
+ * uname() lets me access to the whole string (it smashes release, you
+ * see), whereas gethostname() kindly truncates it for me.
+ */
+ {
+ struct utsname name;
+
+ uname(&name);
+ strcpy(displayname, name.nodename);
+ }
+#else
+ gethostname(displayname, sizeof(displayname));
+#endif
+ writeAddr (FamilyLocal, strlen (displayname), displayname, file, auth);
+}
+
+/* code stolen from server/os/4.2bsd/access.c */
+
+static int
+ConvertAddr (saddr, len, addr)
+ register struct sockaddr *saddr;
+ int *len;
+ char **addr;
+{
+ if (len == 0)
+ return (0);
+ switch (saddr->sa_family)
+ {
+ case AF_UNSPEC:
+#ifndef hpux
+ case AF_UNIX:
+#endif
+ return (0);
+#ifdef TCPCONN
+ case AF_INET:
+ *len = sizeof (struct in_addr);
+ *addr = (char *) &(((struct sockaddr_in *) saddr)->sin_addr);
+ return (AF_INET);
+#ifdef IPv6
+ case AF_INET6:
+ *len = sizeof (struct in6_addr);
+ *addr = (char *) &(((struct sockaddr_in6 *) saddr)->sin6_addr);
+ return (AF_INET6);
+#endif
+#endif
+
+#ifdef NOTDEF /* DNETCONN */
+ case AF_DECnet:
+ *len = sizeof (struct dn_naddr);
+ *addr = (char *) &(((struct sockaddr_dn *) saddr)->sdn_add);
+ return (AF_DECnet);
+#endif
+ default:
+ break;
+ }
+ return (-1);
+}
+
+
+setAuthNumber (auth, name)
+ Xauth *auth;
+ char *name;
+{
+ char *colon;
+ char *dot, *number;
+
+ colon = rindex (name, ':');
+ if (colon) {
+ ++colon;
+ if (dot = index (colon, '.'))
+ auth->number_length = dot - colon;
+ else
+ auth->number_length = strlen (colon);
+ number = malloc (auth->number_length + 1);
+ if (number) {
+ strncpy (number, colon, auth->number_length);
+ number[auth->number_length] = '\0';
+ } else {
+ perror ("setAuthNumber");
+ auth->number_length = 0;
+ }
+ auth->number = number;
+ }
+}
+
+static
+ openFiles (name, new_name, oldp, newp)
+char *name, *new_name;
+FILE **oldp, **newp;
+{
+ int mask;
+
+ strcpy (new_name, name);
+ strcat (new_name, "-n");
+ mask = umask (0077);
+ (void) unlink (new_name);
+ *newp = fopen (new_name, "w");
+ (void) umask (mask);
+ if (!*newp) {
+ return 0;
+ }
+ *oldp = fopen (name, "r");
+
+ return 1;
+}
+
+writeAuth (file, auth)
+ FILE *file;
+ Xauth *auth;
+{
+ saveAddr (auth->family, auth->address_length, auth->address,
+ auth->number_length, auth->number);
+ if (!XauWriteAuth (file, auth)) {
+ fprintf(stderr,"mkcookie: Could not write authorization info. for user. exiting\n");
+ exit(-1);
+ }
+}
+doneAddrs ()
+{
+ struct addrList *a, *n;
+ for (a = addrs; a; a = n) {
+ n = a->next;
+ if (a->address)
+ free (a->address);
+ if (a->number)
+ free (a->number);
+ free ((char *) a);
+ }
+}
+
+InitAuth (name_len, name)
+ unsigned short name_len;
+ char *name;
+{
+ if (strcmp(name,"SUN-DES-1") != 0) {
+ if (name_len > 256)
+ name_len = 256;
+ }
+ auth_name_len = name_len;
+ bcopy (name, auth_name, name_len);
+}
+
+Xauth * GetAuth (namelen, name)
+ int namelen;
+ char *name;
+{
+ Xauth *new;
+ int uid = getuid();
+ char netname[MAXNETNAMELEN];
+ new = (Xauth *) malloc (sizeof (Xauth));
+
+ if (!new)
+ return (Xauth *) 0;
+ new->family = FamilyWild;
+ new->address_length = 0;
+ new->address = 0;
+ new->number_length = 0;
+ new->number = 0;
+
+ if (strncmp(name,"MIT-",4) == 0)
+ new->data = (char *) malloc (AUTH_DATA_LEN);
+ else
+ new->data = (char *) malloc (MAXNETNAMELEN);
+ if (!new->data)
+ {
+ free ((char *) new);
+ return (Xauth *) 0;
+ }
+ new->name = (char *) malloc (namelen);
+ if (!new->name)
+ {
+ free ((char *) new->data);
+ free ((char *) new);
+ return (Xauth *) 0;
+ }
+ bcopy (name, new->name, namelen);
+ new->name_length = namelen;
+ if (strncmp(name,"MIT-",4) == 0) {
+ GenerateCryptoKey (new->data, AUTH_DATA_LEN);
+ new->data_length = AUTH_DATA_LEN;
+ } else {
+ if (!user2netname(netname, uid, 0))
+ perror("user2netname");
+ new->data_length = strlen(netname);
+ bcopy(netname, new->data, new->data_length);
+ }
+ return new;
+}
+
+static long key[2];
+
+GenerateCryptoKey (auth, len)
+ char *auth;
+ int len;
+{
+ long data[2];
+ int seed;
+ int value;
+ int i, t;
+ char *ran_file = "/dev/random";
+ int fd;
+
+ if ((fd = open(ran_file, O_RDONLY)) == -1)
+ {
+ struct timeval now;
+ struct timezone zone;
+ gettimeofday (&now, &zone);
+ data[0] = now.tv_sec;
+ data[1] = now.tv_usec;
+
+ seed = (data[0]) + (data[1] << 16);
+ srand (seed);
+ for (i = 0; i < (len - 1); i++)
+ {
+ value = rand ();
+ auth[i] = value & 0xff;
+ }
+ } else {
+ for (i = 0; i < (len - 1); i++)
+ {
+ read(fd, &t, sizeof(t));
+ auth[i] = (
+ ( (t & 0xff000000) >> 24) ^
+ ( (t & 0xff0000) >> 16) ^
+ ( (t & 0xff00) >> 8) ^
+ ( (t & 0xff) )
+ ) & 0xff;
+ }
+ close(fd);
+ }
+ auth[len-1] = '\0';
+}
+
+SaveServerAuthorization (authFile, auth)
+ char *authFile;
+ Xauth *auth;
+{
+ FILE *auth_file;
+ int mask;
+ int ret;
+
+ mask = umask (0077);
+ (void) unlink (authFile);
+ auth_file = fopen (authFile, "w");
+ umask (mask);
+ if (!auth_file) {
+ ret = FALSE;
+ }
+ else
+ {
+ if (!XauWriteAuth (auth_file, auth) || fflush (auth_file) == EOF)
+ {
+ ret = FALSE;
+ }
+ else
+ ret = TRUE;
+ fclose (auth_file);
+ }
+ chmod(authFile, S_IREAD);
+ return ret;
+}
+
+#define NUM_AUTHORIZATION (sizeof (AuthProtocols) / sizeof (AuthProtocols[0]))
+
+static struct AuthProtocol *
+ findProtocol (name_length, name)
+int name_length;
+char *name;
+{
+ int i;
+
+ for (i = 0; i < NUM_AUTHORIZATION; i++)
+ if (AuthProtocols[i].name_length == name_length &&
+ bcmp (AuthProtocols[i].name, name, name_length) == 0)
+ {
+ return &AuthProtocols[i];
+ }
+ return (struct AuthProtocol *) 0;
+}
+
+Xauth *GenerateAuthorization (name, name_length)
+ char *name;
+ int name_length;
+{
+ struct AuthProtocol *a;
+ Xauth *auth = 0;
+
+ a = findProtocol (name_length, name);
+ if (a)
+ {
+ if (!a->inited)
+ {
+ (*a->InitAuth) (name_length, name);
+ a->inited = TRUE;
+ }
+ auth = (*a->GetAuth) (name_length, name);
+ }
+ return auth;
+}
+
+void
+SetLocalAuthorization (d)
+ struct display *d;
+{
+ Xauth *auth;
+ int nl = d->authNameLen;
+
+ if (d->authorization)
+ {
+ XauDisposeAuth (d->authorization);
+ d->authorization = (Xauth *) NULL;
+ }
+ if (d->authName && !d->authNameLen)
+ d->authNameLen = strlen (d->authName);
+ auth = GenerateAuthorization ( d->authName, nl);
+ if (!auth)
+ return;
+
+ /* Change to real user id, before writing any files */
+
+ setuid(getuid());
+ if (SaveServerAuthorization (d->authFile, auth))
+ d->authorization = auth;
+ else {
+ XauDisposeAuth (auth);
+ fprintf(stderr,"mkcookie: Could not write server authorization file. exiting\n");
+ exit(-1);
+ }
+}
+
+void
+SetUserAuthorization (d, verify)
+ struct display *d;
+ struct verify_info *verify;
+{
+ FILE *old, *new;
+ char home_name[1024], backup_name[1024], new_name[1024];
+ char *name;
+ char *home;
+ char *envname = 0;
+ int lockStatus;
+ Xauth *entry, *auth;
+ int setenv;
+ char **setEnv ();
+ extern char *getenv ();
+ struct stat statb;
+
+ if (auth = d->authorization) {
+ home = getenv("HOME");
+ lockStatus = LOCK_ERROR;
+ if (home) {
+ snprintf (home_name, 1024, "%s/.Xauthority", home);
+ lockStatus = XauLockAuth (home_name, 1, 2, 10);
+ if (lockStatus == LOCK_SUCCESS) {
+ if (openFiles (home_name, new_name, &old, &new)) {
+ name = home_name;
+ setenv = 0;
+ } else {
+ XauUnlockAuth (home_name);
+ lockStatus = LOCK_ERROR;
+ }
+ }
+ }
+ if (lockStatus != LOCK_SUCCESS) {
+ sprintf (backup_name, "%s/.XauthXXXXXX", d->userAuthDir);
+ mktemp (backup_name);
+ lockStatus = XauLockAuth (backup_name, 1, 2, 10);
+
+ if (lockStatus == LOCK_SUCCESS) {
+ if (openFiles (backup_name, new_name, &old, &new)) {
+ name = backup_name;
+ setenv = 1;
+ } else {
+ XauUnlockAuth (backup_name);
+ lockStatus = LOCK_ERROR;
+ }
+ }
+ }
+ if (lockStatus != LOCK_SUCCESS) {
+ return;
+ }
+ addrs = 0;
+ if (d->displayType.location == Local)
+ writeLocalAuth (new, auth, d->name);
+
+ if (old) {
+ if (fstat (fileno (old), &statb) != -1)
+ chmod (new_name, (int) (statb.st_mode & 0777));
+ while (entry = XauReadAuth (old)) {
+ if (!checkAddr (entry->family,
+ entry->address_length, entry->address,
+ entry->number_length, entry->number))
+ {
+ writeAuth (new, entry);
+ }
+ XauDisposeAuth (entry);
+ }
+ fclose (old);
+ }
+ doneAddrs ();
+ fclose (new);
+ unlink (name);
+
+ envname = name;
+ if (link (new_name, name) == -1) {
+ setenv = 1;
+ envname = new_name;
+ } else {
+ unlink (new_name);
+ }
+ if (setenv) {
+ verify->userEnviron = setEnv (verify->userEnviron,
+ "XAUTHORITY", envname);
+ verify->systemEnviron = setEnv (verify->systemEnviron,
+ "XAUTHORITY", envname);
+ }
+ XauUnlockAuth (name);
+ if (envname)
+ chown (envname, verify->uid, verify->gid);
+ }
+
+}
+
+usage(str)
+char *str;
+{
+ fprintf(stderr,"usage: %s Server_auth_file [-auth protocol]\n",str);
+ fprintf(stderr," where protocol is one of magic-cookie or sun-des\n");
+}
+
+main(argc, argv)
+int argc;
+char *argv[];
+{
+ struct display d;
+ struct verify_info verify;
+ int server_number;
+ char *au_name;
+
+
+ if (argc < 2) {
+ usage(argv[0]);
+ fprintf(stderr,"WARNING: This program will overwrite existing files.\n");
+ fprintf(stderr,"This may cause your X server to not accept any\n");
+ fprintf(stderr,"new client connections.\n");
+ exit(-1);
+ }
+
+ au_name = NULL;
+ d.authFile = argv[1];
+
+ if ((d.name = rindex(d.authFile,':')) == NULL) {
+ fprintf(stderr,"mkcookie: Invalid filename: %s\nFilename should include display\n",
+ d.authFile);
+ exit(-1);
+ }
+ d.authorize = TRUE;
+ d.authorization = NULL;
+ /* 1191081: SIGSEGV when starting openwin - core dumped by mkcookie.
+ * becuase d.userAuthDir is not assigned any valid directory where
+ * every one will have access to it.
+ */
+ d.userAuthDir = DEF_USER_AUTH_DIR; /* Backup directory for User Auth file */
+ d.authName = "MIT-MAGIC-COOKIE-1";
+
+ if (argv[2] && strcmp(argv[2],"-auth") == 0) {
+ if (argv[3])
+ au_name = argv[3];
+ else {
+ usage(argv[0]);
+ exit(-1);
+ }
+ } else if (argv[2]) {
+ usage(argv[0]);
+ exit(-1);
+ }
+
+ if (au_name) {
+ if(strcmp(au_name, "sun-des") == 0)
+ d.authName = "SUN-DES-1";
+ else if (strncmp(au_name,"magic",5) != 0) {
+ usage(argv[0]);
+ exit(-1);
+ }
+ }
+ d.authNameLen = strlen(d.authName);
+ d.peer = 0;
+ d.peerlen = 0;
+ d.displayType.location = Local;
+
+ verify.uid = getuid();
+ verify.gid = getgid();
+ verify.userEnviron = NULL;
+ verify.systemEnviron = NULL;
+
+ SetLocalAuthorization(&d);
+ SetUserAuthorization(&d, &verify);
+ exit(0);
+}
--- a/packages/SUNWxwman/copyright.add Mon Sep 22 13:27:21 2008 -0700
+++ b/packages/SUNWxwman/copyright.add Tue Sep 30 10:13:12 2008 -0700
@@ -65,6 +65,18 @@
--------------------------------------------------------------------
+Files from the app/cmap_alloc package are covered by the following notice:
+
+include app/cmap_alloc/COPYING
+
+--------------------------------------------------------------------
+
+Files from the app/cmap_compact package are covered by the following notice:
+
+include app/cmap_compact/COPYING
+
+--------------------------------------------------------------------
+
Files from the app/constype package are covered by the following notice:
include app/constype/COPYING
--- a/packages/SUNWxwman/prototype_com Mon Sep 22 13:27:21 2008 -0700
+++ b/packages/SUNWxwman/prototype_com Tue Sep 30 10:13:12 2008 -0700
@@ -26,7 +26,7 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
-# ident "@(#)prototype_com 35.110 08/09/19 SMI"
+# ident "@(#)prototype_com 35.111 08/09/30 SMI"
#
# X Window System online user man pages
@@ -57,8 +57,6 @@
f none openwin/share/man/man1/Xnest.1 0444 root bin
f none openwin/share/man/man1/Xvfb.1 0444 root bin
f none openwin/share/man/man1/bdftosnf.1 0444 root bin
-f none openwin/share/man/man1/cmap_alloc.1 0444 root bin
-f none openwin/share/man/man1/cmap_compact.1 0444 root bin
f none openwin/share/man/man1/fs.1 0444 root bin
f none openwin/share/man/man1/fsadmin.1 0444 root bin
f none openwin/share/man/man1/makepsres.1 0444 root bin
@@ -107,6 +105,12 @@
# open-src/app/bmtoa
f none X11/share/man/man1/bmtoa.1 0444 root bin
+# open-src/app/cmap_alloc
+f none X11/share/man/man1/cmap_alloc.1 0444 root bin
+
+# open-src/app/cp_compact
+f none X11/share/man/man1/cmap_compact.1 0444 root bin
+
# open-src/app/constype
f none X11/share/man/man1/constype.1 0444 root bin
--- a/packages/SUNWxwplt/copyright.add Mon Sep 22 13:27:21 2008 -0700
+++ b/packages/SUNWxwplt/copyright.add Tue Sep 30 10:13:12 2008 -0700
@@ -182,6 +182,18 @@
--------------------------------------------------------------------
+Files from the app/cmap_alloc package are covered by the following notice:
+
+include app/cmap_alloc/COPYING
+
+--------------------------------------------------------------------
+
+Files from the app/cmap_compact package are covered by the following notice:
+
+include app/cmap_compact/COPYING
+
+--------------------------------------------------------------------
+
Files from the app/constype package are covered by the following notice:
include app/constype/COPYING
@@ -212,6 +224,12 @@
--------------------------------------------------------------------
+Files from the app/mkcookie package are covered by the following notice:
+
+include app/mkcookie/COPYING
+
+--------------------------------------------------------------------
+
Files from the app/rgb package are covered by the following notice:
include app/rgb/COPYING
--- a/packages/SUNWxwplt/prototype_com Mon Sep 22 13:27:21 2008 -0700
+++ b/packages/SUNWxwplt/prototype_com Tue Sep 30 10:13:12 2008 -0700
@@ -26,7 +26,7 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
-# "@(#)prototype_com 35.205 08/09/19 Sun Microsystems"
+# "@(#)prototype_com 35.206 08/09/30 Sun Microsystems"
#
# X Window System required core package
@@ -51,8 +51,6 @@
!search $HOME/openwin/bin
d none openwin/bin 0755 root bin
-f none openwin/bin/cmap_compact 0755 root bin
-f none openwin/bin/cmap_alloc 0755 root bin
f none openwin/bin/makepsres 0755 root bin
f none openwin/bin/pclcomp 0755 root bin
f none openwin/bin/redxblue 0755 root bin
@@ -65,6 +63,14 @@
f none X11/bin/bdftopcf 0755 root bin
s none openwin/bin/bdftopcf=../../X11/bin/bdftopcf
+# open-src/app/cmap_alloc
+f none X11/bin/cmap_alloc 0755 root bin
+s none openwin/bin/cmap_alloc=../../X11/bin/cmap_alloc
+
+# open-src/app/cmap_compact
+f none X11/bin/cmap_compact 0755 root bin
+s none openwin/bin/cmap_compact=../../X11/bin/cmap_compact
+
# open-src/app/constype
f none X11/bin/constype 0755 root bin
s none openwin/bin/constype=../../X11/bin/constype
@@ -576,12 +582,12 @@
!search $HOME/X11/lib
s none X11/lib/libXRes.so=./libXRes.so.1
f none X11/lib/libXRes.so.1 0755 root bin
-
+s none openwin/lib/mkcookie=../../X11/lib/mkcookie
+f none X11/lib/mkcookie 0755 root bin
!search $HOME/openwin/lib
s none openwin/lib/libdga.so=./libdga.so.1
f none openwin/lib/libdga.so.1 0755 root bin
-f none openwin/lib/mkcookie 0755 root bin
#
# X11R6.4 upgrade changes