Index: /trunk/Ohana/src/opihi/Makefile.Common
===================================================================
--- /trunk/Ohana/src/opihi/Makefile.Common	(revision 12279)
+++ /trunk/Ohana/src/opihi/Makefile.Common	(revision 12280)
@@ -4,6 +4,9 @@
 
 BASE_CFLAGS   =	$(CFLAGS)
-BASE_CPPFLAGS =	$(CPPFLAGS) -I$(INC) -I$(DESTINC) $(INCDIRS) -D$(ARCH) -DDATADIR_DEFAULT=$(DATA)
+BASE_CPPFLAGS =	$(CPPFLAGS) -I$(INC) -I$(DESTINC) $(INCDIRS) -D$(ARCH) 
 BASE_LDFLAGS  = $(LDFLAGS) -L$(LIB) -L$(DESTLIB) $(LIBDIRS) $(LIBFLAGS)
+
+%.c : %.c.in
+	sed "s|@DATADIR@|$(DATA)|" $< > $@
 
 %.$(ARCH).o : %.c
Index: unk/Ohana/src/opihi/dimm/dimm.c
===================================================================
--- /trunk/Ohana/src/opihi/dimm/dimm.c	(revision 12279)
+++ 	(revision )
@@ -1,60 +1,0 @@
-# include "opihi.h"
-
-# define opihi_name "DIMM"
-# define opihi_prompt "dimm: "
-# define opihi_description "DIMM telescope controller\n"
-# define opihi_history ".dimm"
-# define opihi_rcfile ".dimmrc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitData ();
-  InitAstro ();
-  InitDIMM ();
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-
-  set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  { 
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_ERR, "\n");
-  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  QuitImage ();
-  QuitGraph ();
-  return;
-}
Index: /trunk/Ohana/src/opihi/dimm/dimm.c.in
===================================================================
--- /trunk/Ohana/src/opihi/dimm/dimm.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/dimm/dimm.c.in	(revision 12280)
@@ -0,0 +1,55 @@
+# include "opihi.h"
+
+# define opihi_name "DIMM"
+# define opihi_prompt "dimm: "
+# define opihi_description "DIMM telescope controller\n"
+# define opihi_history ".dimm"
+# define opihi_rcfile ".dimmrc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitAstro ();
+  InitDIMM ();
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  { 
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_ERR, "\n");
+  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  return;
+}
Index: unk/Ohana/src/opihi/dvo/dvo.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dvo.c	(revision 12279)
+++ 	(revision )
@@ -1,71 +1,0 @@
-# include "dvoshell.h"
-
-# define opihi_name "DVO"
-# define opihi_prompt "dvo: "
-# define opihi_description "desktop virtual observatory\n"
-# define opihi_history ".dvo"
-# define opihi_rcfile ".dvorc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitData ();
-  InitAstro ();
-  InitDVO ();
-
-  if (!SetCATDIR (NULL, FALSE)) {
-    gprint (GP_ERR, "CATDIR is not defined\n");
-  }
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-
-  set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  {
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_ERR, "\n");
-  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  QuitImage ();
-  QuitGraph ();
-  return;
-}
-
-/* call to opihi shell */
-int main (int argc, char **argv) {
-  int status;
-  status = opihi (argc, argv);
-  exit (status);
-}
Index: /trunk/Ohana/src/opihi/dvo/dvo.c.in
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dvo.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/dvo/dvo.c.in	(revision 12280)
@@ -0,0 +1,67 @@
+# include "dvoshell.h"
+
+# define opihi_name "DVO"
+# define opihi_prompt "dvo: "
+# define opihi_description "desktop virtual observatory\n"
+# define opihi_history ".dvo"
+# define opihi_rcfile ".dvorc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitAstro ();
+  InitDVO ();
+
+  if (!SetCATDIR (NULL, FALSE)) {
+    gprint (GP_ERR, "CATDIR is not defined\n");
+  }
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  {
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_ERR, "\n");
+  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  return;
+}
+
+/* call to opihi shell */
+int main (int argc, char **argv) {
+  int status;
+  status = opihi (argc, argv);
+  exit (status);
+}
Index: unk/Ohana/src/opihi/mana/mana.c
===================================================================
--- /trunk/Ohana/src/opihi/mana/mana.c	(revision 12279)
+++ 	(revision )
@@ -1,67 +1,0 @@
-# include "mana.h"
-
-# define opihi_name "MANA"
-# define opihi_prompt "mana: "
-# define opihi_description "an image manipulation tool\n"
-# define opihi_history ".mana"
-# define opihi_rcfile ".manarc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitData ();
-  InitAstro ();
-  InitMana ();
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-
-  set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  {
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_ERR, "\n");
-  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  QuitImage ();
-  QuitGraph ();
-  return;
-}
-
-/* call to opihi shell */
-int main (int argc, char **argv) {
-  int status;
-  status = opihi (argc, argv);
-  exit (status);
-}
Index: /trunk/Ohana/src/opihi/mana/mana.c.in
===================================================================
--- /trunk/Ohana/src/opihi/mana/mana.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/mana/mana.c.in	(revision 12280)
@@ -0,0 +1,63 @@
+# include "mana.h"
+
+# define opihi_name "MANA"
+# define opihi_prompt "mana: "
+# define opihi_description "an image manipulation tool\n"
+# define opihi_history ".mana"
+# define opihi_rcfile ".manarc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitAstro ();
+  InitMana ();
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  {
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_ERR, "\n");
+  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  return;
+}
+
+/* call to opihi shell */
+int main (int argc, char **argv) {
+  int status;
+  status = opihi (argc, argv);
+  exit (status);
+}
Index: unk/Ohana/src/opihi/pantasks/pantasks.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/pantasks.c	(revision 12279)
+++ 	(revision )
@@ -1,93 +1,0 @@
-# include "pantasks.h"
-
-# define opihi_name "pantasks"
-# define opihi_prompt "pantasks: "
-# define opihi_description "parallel task scheduler\n"
-# define opihi_history ".pantasks"
-# define opihi_rcfile ".pantasksrc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  pthread_t jobsThread;
-  pthread_t tasksThread;
-  pthread_t controllerThread;
-
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitData ();
-  InitPantasks ();
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-  rl_event_hook = NULL;
-  rl_set_keyboard_input_timeout (1000); 
-
-  set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  { 
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  signal (SIGPIPE, gotsignal);
-  signal (SIGTSTP, gotsignal);
-  signal (SIGTTIN, gotsignal);
-
-  /* start up the background threads here */
-  pthread_create (&tasksThread,      NULL, &CheckTasksThread, 	   NULL);
-  pthread_create (&jobsThread,       NULL, &CheckJobsThread, 	   NULL);
-  pthread_create (&controllerThread, NULL, &CheckControllerThread, NULL);
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_LOG, "\n");
-  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  QuitImage ();
-  QuitGraph ();
-  QuitController ();
-  return;
-}
-
-void gotsignal (int signum) {
-  gprint (GP_ERR, "got signal : %d\n", signum);
-  return;
-}
-
-/* call to opihi shell */
-int main (int argc, char **argv) {
-  int status;
-  status = opihi (argc, argv);
-  exit (status);
-}
-
-/* pantasks runs three (or four) threads:
-   - one thread parses commands from the connected clients
-   - one thread runs the scheduler loop
-   - one thread may run the controller loop independently
-   - the main thread runs readline and accepts user input
-*/
Index: /trunk/Ohana/src/opihi/pantasks/pantasks.c.in
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/pantasks.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/pantasks/pantasks.c.in	(revision 12280)
@@ -0,0 +1,89 @@
+# include "pantasks.h"
+
+# define opihi_name "pantasks"
+# define opihi_prompt "pantasks: "
+# define opihi_description "parallel task scheduler\n"
+# define opihi_history ".pantasks"
+# define opihi_rcfile ".pantasksrc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  pthread_t jobsThread;
+  pthread_t tasksThread;
+  pthread_t controllerThread;
+
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitPantasks ();
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+  rl_event_hook = NULL;
+  rl_set_keyboard_input_timeout (1000); 
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  { 
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+
+  signal (SIGPIPE, gotsignal);
+  signal (SIGTSTP, gotsignal);
+  signal (SIGTTIN, gotsignal);
+
+  /* start up the background threads here */
+  pthread_create (&tasksThread,      NULL, &CheckTasksThread, 	   NULL);
+  pthread_create (&jobsThread,       NULL, &CheckJobsThread, 	   NULL);
+  pthread_create (&controllerThread, NULL, &CheckControllerThread, NULL);
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_LOG, "\n");
+  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  QuitController ();
+  return;
+}
+
+void gotsignal (int signum) {
+  gprint (GP_ERR, "got signal : %d\n", signum);
+  return;
+}
+
+/* call to opihi shell */
+int main (int argc, char **argv) {
+  int status;
+  status = opihi (argc, argv);
+  exit (status);
+}
+
+/* pantasks runs three (or four) threads:
+   - one thread parses commands from the connected clients
+   - one thread runs the scheduler loop
+   - one thread may run the controller loop independently
+   - the main thread runs readline and accepts user input
+*/
Index: unk/Ohana/src/opihi/pantasks/pantasks_client.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/pantasks_client.c	(revision 12279)
+++ 	(revision )
@@ -1,77 +1,0 @@
-# include "pantasks.h"
-
-# define opihi_name "pantasks client shell"
-# define opihi_prompt "pantasks: "
-# define opihi_description "parallel task scheduler\n"
-# define opihi_history ".pantasks"
-# define opihi_rcfile ".pantasksrc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitData ();
-  InitAstro ();
-  InitPantasksClient ();
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-
-  set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  {
-      char *datadir;
-      char *helpdir;
-      char *modules;
-      datadir = MACRO_NAME(DATADIR_DEFAULT);
-      /* set_str_variable ("DATADIR", datadir); */
-      ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-      sprintf (helpdir, "%s/help", datadir);
-      set_str_variable ("HELPDIR", helpdir);
-      free (helpdir);
-      ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-      sprintf (modules, "%s/modules", datadir);
-      set_str_variable ("MODULES:0", modules);
-      set_int_variable ("MODULES:n", 1);
-      free (modules);
-  }
-# endif
-
-  signal (SIGPIPE, gotsignal);
-  signal (SIGTSTP, gotsignal);
-  signal (SIGTTIN, gotsignal);
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_LOG, "\n");
-  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  QuitImage ();
-  QuitGraph ();
-  return;
-}
-
-/* default signal handling */
-void gotsignal (int signum) {
-  gprint (GP_ERR, "got signal : %d\n", signum);
-  return;
-}
-
-/* call to client_shell: this opihi tool uses a slightly different
-   shell function from the standard tools */
-int main (int argc, char **argv) {
-  int status;
-  status = client_shell (argc, argv);
-  exit (status);
-}
Index: /trunk/Ohana/src/opihi/pantasks/pantasks_client.c.in
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/pantasks_client.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/pantasks/pantasks_client.c.in	(revision 12280)
@@ -0,0 +1,73 @@
+# include "pantasks.h"
+
+# define opihi_name "pantasks client shell"
+# define opihi_prompt "pantasks: "
+# define opihi_description "parallel task scheduler\n"
+# define opihi_history ".pantasks"
+# define opihi_rcfile ".pantasksrc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitData ();
+  InitAstro ();
+  InitPantasksClient ();
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+
+  set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  {
+      char *helpdir;
+      char *modules;
+      static char *datadir = "@DATADIR@";
+      ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+      sprintf (helpdir, "%s/help", datadir);
+      set_str_variable ("HELPDIR", helpdir);
+      free (helpdir);
+      ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+      sprintf (modules, "%s/modules", datadir);
+      set_str_variable ("MODULES:0", modules);
+      set_int_variable ("MODULES:n", 1);
+      free (modules);
+  }
+
+  signal (SIGPIPE, gotsignal);
+  signal (SIGTSTP, gotsignal);
+  signal (SIGTTIN, gotsignal);
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_LOG, "\n");
+  gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  QuitImage ();
+  QuitGraph ();
+  return;
+}
+
+/* default signal handling */
+void gotsignal (int signum) {
+  gprint (GP_ERR, "got signal : %d\n", signum);
+  return;
+}
+
+/* call to client_shell: this opihi tool uses a slightly different
+   shell function from the standard tools */
+int main (int argc, char **argv) {
+  int status;
+  status = client_shell (argc, argv);
+  exit (status);
+}
Index: unk/Ohana/src/opihi/pclient/pclient.c
===================================================================
--- /trunk/Ohana/src/opihi/pclient/pclient.c	(revision 12279)
+++ 	(revision )
@@ -1,81 +1,0 @@
-# include "pclient.h"
-
-# define opihi_name "PCLIENT"
-# define opihi_prompt "pclient: "
-# define opihi_description "pcontrol client shell\n"
-# define opihi_history ""
-# define opihi_rcfile ".pcontrolrc"
-
-void dummy_prep_term (int flag) {
-}
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitPclient ();
-  InitChild ();
-
-  rl_prep_term_function = dummy_prep_term;
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-  rl_event_hook = CheckChild;
-  rl_set_keyboard_input_timeout (1000); 
-  /* 1 ms seems to be the minimum valid number */
-
-  // set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  {
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  /* ignore the history file.  to change this, see, eg, mana.c */
-  signal (SIGPIPE, gotsignal);
-  signal (SIGTSTP, gotsignal);
-  signal (SIGTTIN, gotsignal);
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_ERR, "\n");
-  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  return;
-}
-
-void gotsignal (int signum) {
-  gprint (GP_ERR, "got signal : %d\n", signum);
-  return;
-}
-
-/* call to opihi shell */
-int main (int argc, char **argv) {
-  int status;
-  status = opihi (argc, argv);
-  exit (status);
-}
-
Index: /trunk/Ohana/src/opihi/pclient/pclient.c.in
===================================================================
--- /trunk/Ohana/src/opihi/pclient/pclient.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/pclient/pclient.c.in	(revision 12280)
@@ -0,0 +1,77 @@
+# include "pclient.h"
+
+# define opihi_name "PCLIENT"
+# define opihi_prompt "pclient: "
+# define opihi_description "pcontrol client shell\n"
+# define opihi_history ""
+# define opihi_rcfile ".pcontrolrc"
+
+void dummy_prep_term (int flag) {
+}
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitPclient ();
+  InitChild ();
+
+  rl_prep_term_function = dummy_prep_term;
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+  rl_event_hook = CheckChild;
+  rl_set_keyboard_input_timeout (1000); 
+  /* 1 ms seems to be the minimum valid number */
+
+  // set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  {
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+
+  /* ignore the history file.  to change this, see, eg, mana.c */
+  signal (SIGPIPE, gotsignal);
+  signal (SIGTSTP, gotsignal);
+  signal (SIGTTIN, gotsignal);
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_ERR, "\n");
+  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  return;
+}
+
+void gotsignal (int signum) {
+  gprint (GP_ERR, "got signal : %d\n", signum);
+  return;
+}
+
+/* call to opihi shell */
+int main (int argc, char **argv) {
+  int status;
+  status = opihi (argc, argv);
+  exit (status);
+}
+
Index: unk/Ohana/src/opihi/pcontrol/pcontrol.c
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/pcontrol.c	(revision 12279)
+++ 	(revision )
@@ -1,92 +1,0 @@
-# include "pcontrol.h"
-
-# define opihi_name "PCONTROL"
-# define opihi_prompt "pcontrol: "
-# define opihi_description "pcontrol client shell\n"
-# define opihi_history ".pcontrol"
-# define opihi_rcfile ".pcontrolrc"
-
-/* program-dependent initialization */
-void program_init (int *argc, char **argv) {
-  
-# ifdef THREADED  
-  pthread_t clientsThread;
-# endif
-
-  auto_break = TRUE;
-
-  /* load the commands used by this implementation */
-  InitBasic ();
-  InitPcontrol ();
-
-  InitJobStacks ();
-  InitHostStacks ();
-
-  /* set global signal masks (these apply to all threads launched below) */
-  // signal (SIGPIPE, gotsignal);
-  signal (SIGTSTP, gotsignal);
-  signal (SIGTTIN, gotsignal);
-
-  rl_readline_name = opihi_name;
-  rl_attempted_completion_function = command_completer;
-# ifdef THREADED
-  SetRunLevel (PCONTROL_RUN_ALL);
-  pthread_create (&clientsThread, NULL, &CheckSystem_Threaded, NULL);
-  rl_event_hook = NULL;
-  rl_set_keyboard_input_timeout (1000); 
-# else
-  rl_event_hook = CheckSystem;
-  rl_set_keyboard_input_timeout (1000); 
-# endif  
-
-  // set_str_variable ("HISTORY", opihi_history);
-  set_str_variable ("PROMPT", opihi_prompt);
-  set_str_variable ("RCFILE", opihi_rcfile);
-
-# ifdef DATADIR_DEFAULT
-  {
-    char *datadir;
-    char *helpdir;
-    char *modules;
-    datadir = MACRO_NAME(DATADIR_DEFAULT);
-    /* set_str_variable ("DATADIR", datadir); */
-    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
-    sprintf (helpdir, "%s/help", datadir);
-    set_str_variable ("HELPDIR", helpdir);
-    free (helpdir);
-    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
-    sprintf (modules, "%s/modules", datadir);
-    set_str_variable ("MODULES:0", modules);
-    set_int_variable ("MODULES:n", 1);
-    free (modules);
-  }
-# endif
-
-  /* ignore the history file.  to change this, see, eg, mana.c */
-  return;
-}
-
-/* standard welcome message */
-void welcome () {
-  gprint (GP_ERR, "\n");
-  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
-}
-
-/* add program-dependent exit functions here */
-void cleanup () {
-  DownHosts ();
-  return;
-}
-
-void gotsignal (int signum) {
-  // this message is lost if we are connected to a pantasks
-  fprintf (stderr, "got signal : %d\n", signum);
-  return;
-}
-
-/* call to opihi shell */
-int main (int argc, char **argv) {
-  int status;
-  status = opihi (argc, argv);
-  exit (status);
-}
Index: /trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in
===================================================================
--- /trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in	(revision 12280)
+++ /trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in	(revision 12280)
@@ -0,0 +1,88 @@
+# include "pcontrol.h"
+
+# define opihi_name "PCONTROL"
+# define opihi_prompt "pcontrol: "
+# define opihi_description "pcontrol client shell\n"
+# define opihi_history ".pcontrol"
+# define opihi_rcfile ".pcontrolrc"
+
+/* program-dependent initialization */
+void program_init (int *argc, char **argv) {
+  
+# ifdef THREADED  
+  pthread_t clientsThread;
+# endif
+
+  auto_break = TRUE;
+
+  /* load the commands used by this implementation */
+  InitBasic ();
+  InitPcontrol ();
+
+  InitJobStacks ();
+  InitHostStacks ();
+
+  /* set global signal masks (these apply to all threads launched below) */
+  // signal (SIGPIPE, gotsignal);
+  signal (SIGTSTP, gotsignal);
+  signal (SIGTTIN, gotsignal);
+
+  rl_readline_name = opihi_name;
+  rl_attempted_completion_function = command_completer;
+# ifdef THREADED
+  SetRunLevel (PCONTROL_RUN_ALL);
+  pthread_create (&clientsThread, NULL, &CheckSystem_Threaded, NULL);
+  rl_event_hook = NULL;
+  rl_set_keyboard_input_timeout (1000); 
+# else
+  rl_event_hook = CheckSystem;
+  rl_set_keyboard_input_timeout (1000); 
+# endif  
+
+  // set_str_variable ("HISTORY", opihi_history);
+  set_str_variable ("PROMPT", opihi_prompt);
+  set_str_variable ("RCFILE", opihi_rcfile);
+
+  {
+    char *helpdir;
+    char *modules;
+    static char *datadir = "@DATADIR@";
+    ALLOCATE (helpdir, char, strlen(datadir) + strlen("/help") + 2);
+    sprintf (helpdir, "%s/help", datadir);
+    set_str_variable ("HELPDIR", helpdir);
+    free (helpdir);
+    ALLOCATE (modules, char, strlen(datadir) + strlen("/modules") + 2);
+    sprintf (modules, "%s/modules", datadir);
+    set_str_variable ("MODULES:0", modules);
+    set_int_variable ("MODULES:n", 1);
+    free (modules);
+  }
+
+  /* ignore the history file.  to change this, see, eg, mana.c */
+  return;
+}
+
+/* standard welcome message */
+void welcome () {
+  gprint (GP_ERR, "\n");
+  gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description);
+}
+
+/* add program-dependent exit functions here */
+void cleanup () {
+  DownHosts ();
+  return;
+}
+
+void gotsignal (int signum) {
+  // this message is lost if we are connected to a pantasks
+  fprintf (stderr, "got signal : %d\n", signum);
+  return;
+}
+
+/* call to opihi shell */
+int main (int argc, char **argv) {
+  int status;
+  status = opihi (argc, argv);
+  exit (status);
+}
