Index: trunk/Ohana/src/kii/setup/DefineLayout.c
===================================================================
--- trunk/Ohana/src/kii/setup/DefineLayout.c	(revision 5700)
+++ trunk/Ohana/src/kii/setup/DefineLayout.c	(revision 5852)
@@ -5,25 +5,14 @@
 void DefineLayout (Layout *layout, Graphic *graphic, int argc, char **argv) {
 
-  int i, status, N;
-  struct sockaddr_un Address;
-  char temp[100], *temp_name;
+  int i, N;
+  char *colormap;
 
   /** initiate connection with mana **/
-  if (!DEBUG) {	
+  if (!FOREGROUND) {
     if (argc < 2) {
       fprintf (stderr, "socket path not specified\n");
       exit (0);
     }
-    strcpy (Address.sun_path, argv[1]);
-    Address.sun_family = AF_UNIX;
-    layout[0].Ximage = socket (AF_UNIX, SOCK_STREAM, 0);
-    status = connect (layout[0].Ximage, (struct sockaddr *) &Address, (socklen_t) sizeof (Address));
-    if (status < 0) {
-      fprintf (stderr, "kii - unsuccessful connection: %d\n", status);
-      exit (0);
-    }
-    fcntl (layout[0].Ximage, F_SETFL, O_NONBLOCK);  
-    sprintf (temp, "rm -f %s", argv[1]);
-    system (temp);
+    layout[0].Ximage = KiiWait (argv[1]);
   }
 
@@ -34,11 +23,11 @@
     MakeColormap (graphic, layout, argc, argv);
   } else {
-    temp_name = default_colormap;
+    colormap = default_colormap;
     if ((N = get_argument (argc, argv, "-cm"))) {
       remove_argument (N, &argc, argv);
-      temp_name = argv[N];
+      colormap = argv[N];
     }
     layout[0].Npixels = 256;
-    SetColormap (graphic, layout, temp_name);
+    SetColormap (graphic, layout, colormap);
   }
 
@@ -70,8 +59,6 @@
 }
 
-
 /* this routine is independent of the number of overlays */
 
   /* cmap = the mapping of value to color in kii
      colormap = the set of pixel -> color representation in X */
-
