Index: /trunk/Ohana/src/opihi/cmd.data/box.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/box.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/cmd.data/box.c	(revision 5919)
@@ -6,6 +6,4 @@
   Graphdata graphmode;
   
-  if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);
-
   strcpy (graphmode.ticks, "2222");
   if ((N = get_argument (argc, argv, "-ticks"))) {
@@ -47,4 +45,5 @@
     remove_argument (N, &argc, argv);
   }
+  if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);
 
   if (argc != 1) goto usage;
Index: /trunk/Ohana/src/opihi/dimm/dimm.c
===================================================================
--- /trunk/Ohana/src/opihi/dimm/dimm.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/dimm/dimm.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void initialize (int argc, char **argv) {
+void program_init (int *argc, char **argv) {
   
   auto_break = TRUE;
@@ -24,20 +24,9 @@
   set_str_variable ("PROMPT", opihi_prompt);
   set_str_variable ("RCFILE", opihi_rcfile);
+
 # ifdef HELPDIR_DEFAULT
   set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
 # endif
 
-  { /* check history file permission */
-    FILE *f;
-    f = fopen (opihi_history, "a");
-    if (f == NULL) /* no current history file here */
-      fprintf (stderr, "can't save history.\n");
-    else
-      fclose (f);
-    stifle_history (200);
-    read_history (opihi_history);
-  }
-
-  signal (SIGINT, SIG_IGN);
   return;
 }
Index: /trunk/Ohana/src/opihi/dvo/dvo.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dvo.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/dvo/dvo.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void program_init (int argc, char **argv) {
+void program_init (int *argc, char **argv) {
   
   auto_break = TRUE;
@@ -18,5 +18,5 @@
   InitDVO ();
 
-  if (!SetCATDIR (NULL, TRUE)) {
+  if (!SetCATDIR (NULL, FALSE)) {
     fprintf (stderr, "CATDIR is not defined\n");
   }
Index: /trunk/Ohana/src/opihi/include/shell.h
===================================================================
--- /trunk/Ohana/src/opihi/include/shell.h	(revision 5918)
+++ /trunk/Ohana/src/opihi/include/shell.h	(revision 5919)
@@ -44,7 +44,7 @@
 
 /*** basic opihi shell functions ***/
-void          general_init            	PROTO((int argc, char **argv));
-void          program_init            	PROTO((int argc, char **argv));
-void          startup               	PROTO((int argc, char **argv));
+void          general_init            	PROTO((int *argc, char **argv));
+void          program_init            	PROTO((int *argc, char **argv));
+void          startup               	PROTO((int *argc, char **argv));
 int           multicommand          	PROTO((char *line));
 int           command               	PROTO((char *, char **));
Index: /trunk/Ohana/src/opihi/lib.data/open_graph.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.data/open_graph.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/lib.data/open_graph.c	(revision 5919)
@@ -5,16 +5,9 @@
 # define NXGRAPH 5
 
-static int       IsImage = FALSE;
 static int       Active;
 static int       Xgraph[NXGRAPH];  
 static Graphdata graphdata[NXGRAPH];
 
-int GetCurrentDevice () {
-  return (IsImage);
-}
 
-void SetImageDevice (int state) {
-  IsImage = state;
-}
 
 void QuitGraph () {
@@ -69,5 +62,5 @@
 
   int fd;
-  char *kapa_exec;
+  char *kapa_exec, name[16];
   
   kapa_exec = get_variable ("KAPA");
@@ -77,5 +70,7 @@
   }
 
-  fd = KiiOpen (kapa_exec, NULL);
+  snprintf (name, 16, "[%d]", N);
+  fd = KiiOpen (kapa_exec, name);
+  free (kapa_exec);
 
   if (fd < 0) {
@@ -158,2 +153,15 @@
   graphdata[Active] = data;
 }
+
+/** internal tracking of current active device type **/
+
+static int       IsImage = FALSE;
+
+int GetCurrentDevice () {
+  return (IsImage);
+}
+
+void SetImageDevice (int state) {
+  IsImage = state;
+}
+
Index: /trunk/Ohana/src/opihi/lib.data/open_image.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.data/open_image.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/lib.data/open_image.c	(revision 5919)
@@ -1,4 +1,3 @@
 # include "display.h"
-
 # define DEBUG 0
 
@@ -11,6 +10,4 @@
 static double    Xzero[NXIMAGE];
 static double    Xrange[NXIMAGE];
-
-/* define a structure to carry the relevant image data, eqiv to GraphData? */
 
 void QuitImage () {
@@ -36,4 +33,22 @@
 }
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 /* set SIGPIPE to this function to close cleanly */ 
 void XImageDead (int input) {
@@ -47,5 +62,5 @@
 
   int fd;
-  char *kii_exec;
+  char *kii_exec, name[16];
 
   kii_exec = get_variable ("KII");
@@ -55,5 +70,6 @@
   }
 
-  fd = KiiOpen (kii_exec, NULL);
+  snprintf (name, 16, "[%d]", N);
+  fd = KiiOpen (kii_exec, name);
   free (kii_exec);
 
Index: /trunk/Ohana/src/opihi/lib.shell/opihi.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/opihi.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/lib.shell/opihi.c	(revision 5919)
@@ -8,7 +8,7 @@
   pid_t ppid;
 
-  general_init (argc, argv);
-  program_init (argc, argv);
-  startup (argc, argv);
+  general_init (&argc, argv);
+  program_init (&argc, argv);
+  startup (&argc, argv);
   prompt = get_variable("PROMPT");
   history = get_variable("HISTORY");
Index: /trunk/Ohana/src/opihi/lib.shell/startup.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/startup.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/lib.shell/startup.c	(revision 5919)
@@ -6,5 +6,5 @@
  */
 
-void general_init (int argc, char **argv) {
+void general_init (int *argc, char **argv) {
 
   /* init srand for rnd numbers elsewhere */
@@ -18,5 +18,5 @@
 
   /* load config data (.ptolemyrc) */
-  if (!ConfigInit (&argc, argv)) {
+  if (!ConfigInit (argc, argv)) {
     fprintf (stderr, "can't find config file. some functions will be unavailable\n");
   }
@@ -25,5 +25,5 @@
 }
 
-void startup (int argc, char **argv) {
+void startup (int *argc, char **argv) {
     
     int i, N, status, ONLY_INPUT, LOAD_RC;
@@ -31,5 +31,4 @@
     char *rcfile, **list;
     int Nlist, NLIST;
-    static char dot[] = ".";
    
     /* load in interesting environment variables */
@@ -37,6 +36,8 @@
     
     home = getenv ("HOME");
-    if (home == NULL) home = dot;
-    set_str_variable ("HOME", home);
+    if (home == NULL) 
+      set_str_variable ("HOME", ".");
+    else 
+      set_str_variable ("HOME", home);
     set_str_variable ("KII", "kii");
     set_str_variable ("KAPA", "kapa");
@@ -54,5 +55,5 @@
     char *opihi_history;
 
-    opihi_history = get_variable ("RCFILE");
+    opihi_history = get_variable ("HISTORY");
     f = fopen (opihi_history, "a");
     if (f == NULL) /* no current history file here */
@@ -84,14 +85,15 @@
       }
     }
+  }
 
     LOAD_RC = TRUE;
-    if ((N = get_argument (argc, argv, "--norc"))) {
-      remove_argument (N, &argc, argv);
+    if ((N = get_argument (*argc, argv, "--norc"))) {
+      remove_argument (N, argc, argv);
       LOAD_RC = FALSE;
     }
     
     ONLY_INPUT = FALSE;
-    if ((N = get_argument (argc, argv, "--only"))) {
-      remove_argument (N, &argc, argv);
+    if ((N = get_argument (*argc, argv, "--only"))) {
+      remove_argument (N, argc, argv);
       ONLY_INPUT = TRUE;
     }
@@ -101,8 +103,8 @@
     NLIST = 10;
     ALLOCATE (list, char *, NLIST);
-    while ((N = get_argument (argc, argv, "--load"))) {
-      remove_argument (N, &argc, argv);
+    while ((N = get_argument (*argc, argv, "--load"))) {
+      remove_argument (N, argc, argv);
       list[Nlist] = strcreate (argv[N]);
-      remove_argument (N, &argc, argv);
+      remove_argument (N, argc, argv);
       Nlist++;
       if (Nlist == NLIST) {
@@ -113,5 +115,5 @@
 
     is_script = TRUE;
-    if (argc == 1) is_script = FALSE;
+    if (*argc == 1) is_script = FALSE;
     set_int_variable ("SCRIPT", is_script);
 
@@ -130,5 +132,5 @@
       /* generate list argv:0 - argv:n from arguments */
       ALLOCATE (varname, char, 256);
-      for (i = 2; i < argc; i++) {
+      for (i = 2; i < *argc; i++) {
 	sprintf (varname, "argv:%d", i - 2);
 	set_str_variable (varname, argv[i]);
@@ -150,4 +152,4 @@
     if (ONLY_INPUT) exit (2);
     if (is_script) exit (2);
-  }
+    return;
 }
Index: /trunk/Ohana/src/opihi/mana/mana.c
===================================================================
--- /trunk/Ohana/src/opihi/mana/mana.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/mana/mana.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void initialize (int argc, char **argv) {
+void program_init (int argc, char **argv) {
   
   auto_break = TRUE;
@@ -24,20 +24,9 @@
   set_str_variable ("PROMPT", opihi_prompt);
   set_str_variable ("RCFILE", opihi_rcfile);
+
 # ifdef HELPDIR_DEFAULT
   set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
 # endif
 
-  { /* check history file permission */
-    FILE *f;
-    f = fopen (opihi_history, "a");
-    if (f == NULL) /* no current history file here */
-      fprintf (stderr, "can't save history.\n");
-    else
-      fclose (f);
-    stifle_history (200);
-    read_history (opihi_history);
-  }
-
-  signal (SIGINT, SIG_IGN);
   return;
 }
Index: /trunk/Ohana/src/opihi/pantasks/psched.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/psched.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/pantasks/psched.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void initialize (int argc, char **argv) {
+void program_init (int *argc, char **argv) {
   
   auto_break = TRUE;
@@ -25,20 +25,9 @@
   set_str_variable ("PROMPT", opihi_prompt);
   set_str_variable ("RCFILE", opihi_rcfile);
+
 # ifdef HELPDIR_DEFAULT
   set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
 # endif
 
-  { /* check history file permission */
-    FILE *f;
-    f = fopen (opihi_history, "a");
-    if (f == NULL) /* no current history file here */
-      fprintf (stderr, "can't save history.\n");
-    else
-      fclose (f);
-    stifle_history (200);
-    read_history (opihi_history);
-  }
-
-  signal (SIGINT, SIG_IGN);
   signal (SIGPIPE, gotsignal);
   signal (SIGTSTP, gotsignal);
Index: /trunk/Ohana/src/opihi/pclient/pclient.c
===================================================================
--- /trunk/Ohana/src/opihi/pclient/pclient.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/pclient/pclient.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void initialize (int argc, char **argv) {
+void program_init (int *argc, char **argv) {
   
   auto_break = TRUE;
@@ -31,5 +31,4 @@
 
   /* ignore the history file.  to change this, see, eg, mana.c */
-  signal (SIGINT, SIG_IGN);
   signal (SIGPIPE, gotsignal);
   signal (SIGTSTP, gotsignal);
Index: /trunk/Ohana/src/opihi/pcontrol/pcontrol.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/pcontrol.c	(revision 5918)
+++ /trunk/Ohana/src/opihi/pcontrol/pcontrol.c	(revision 5919)
@@ -8,5 +8,5 @@
 
 /* program-dependent initialization */
-void initialize (int argc, char **argv) {
+void program_init (int *argc, char **argv) {
   
   auto_break = TRUE;
@@ -24,4 +24,5 @@
   set_str_variable ("PROMPT", opihi_prompt);
   set_str_variable ("RCFILE", opihi_rcfile);
+
 # ifdef HELPDIR_DEFAULT
   set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
@@ -29,5 +30,4 @@
 
   /* ignore the history file.  to change this, see, eg, mana.c */
-  signal (SIGINT, SIG_IGN);
   signal (SIGPIPE, gotsignal);
   signal (SIGTSTP, gotsignal);
