Index: /branches/ipp-2-5/Ohana/src/addstar/src/parse_time.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/addstar/src/parse_time.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/addstar/src/parse_time.c	(revision 17419)
@@ -58,5 +58,5 @@
   /* parse mode line */
   uppercase (DateMode);
-  for (Ny = 0, c = strchr (DateMode, 'Y'); c != (char ) NULL; c = strchr (c + 1, 'Y'), Ny++);
+  for (Ny = 0, c = strchr (DateMode, 'Y'); c != (char *) NULL; c = strchr (c + 1, 'Y'), Ny++);
   if ((Ny != 2) && (Ny != 4)) {
     fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode);
Index: /branches/ipp-2-5/Ohana/src/kapa2/include/buttons.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/kapa2/include/buttons.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/kapa2/include/buttons.h	(revision 17419)
@@ -121,5 +121,5 @@
 #define flipx_width 25
 #define flipx_height 25
-static unsigned char flipx_bits[] = {
+static char flipx_bits[] = {
    0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x80, 0x10, 0x02, 0x00,
@@ -133,5 +133,5 @@
 #define flipy_width 25
 #define flipy_height 25
-static unsigned char flipy_bits[] = {
+static char flipy_bits[] = {
    0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
    0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00,
Index: /branches/ipp-2-5/Ohana/src/libdvo/Makefile
===================================================================
--- /branches/ipp-2-5/Ohana/src/libdvo/Makefile	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/libdvo/Makefile	(revision 17419)
@@ -30,5 +30,6 @@
 $(DESTINC)/panstarrs_dev_1_defs.h \
 $(DESTINC)/ps1_dev_1_defs.h \
-$(DESTINC)/ps1_dev_2_defs.h
+$(DESTINC)/ps1_dev_2_defs.h \
+$(DESTINC)/ps1_dev_3_defs.h
 
 INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
Index: /branches/ipp-2-5/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/libdvo/include/dvo.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/libdvo/include/dvo.h	(revision 17419)
@@ -34,4 +34,5 @@
   PROJ_SIN, // zenithal
   PROJ_TAN, // zenithal
+  PROJ_TNX, // zenithal
   PROJ_DIS, // zenithal (TAN + polyterms)
   PROJ_LIN, // cartesian
@@ -404,4 +405,5 @@
 # include "ps1_dev_1_defs.h"
 # include "ps1_dev_2_defs.h"
+# include "ps1_dev_3_defs.h"
 
 /*** DVO image db I/O Functions ***/
Index: /branches/ipp-2-5/Ohana/src/libdvo/src/coordops.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/libdvo/src/coordops.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/libdvo/src/coordops.c	(revision 17419)
@@ -82,4 +82,5 @@
     switch (proj) {
       case PROJ_TAN:
+      case PROJ_TNX:
       case PROJ_DIS:
 	// R = cot (theta) = cos(theta) / sin(theta)
@@ -225,4 +226,5 @@
     switch (proj) {
       case PROJ_TAN:
+      case PROJ_TNX:
       case PROJ_DIS:
 	// R = cot (theta) = cos(theta) / sin(theta)
@@ -697,4 +699,5 @@
   if (!strcmp(&ctype[0], "MM"))   return PROJ_SIN; // note ctype[0]
   if (!strcmp(&ctype[4], "-TAN")) return PROJ_TAN;
+  if (!strcmp(&ctype[4], "-TNX")) return PROJ_TNX;
   if (!strcmp(&ctype[4], "-DIS")) return PROJ_DIS;
   if (!strcmp(&ctype[4], "-LIN")) return PROJ_LIN;
@@ -716,4 +719,5 @@
     case PROJ_SIN: strcpy(&ctype[4], "-SIN"); return TRUE;
     case PROJ_TAN: strcpy(&ctype[4], "-TAN"); return TRUE;
+    case PROJ_TNX: strcpy(&ctype[4], "-TNX"); return TRUE;
     case PROJ_DIS: strcpy(&ctype[4], "-DIS"); return TRUE;
     case PROJ_LIN: strcpy(&ctype[4], "-LIN"); return TRUE;
@@ -736,4 +740,5 @@
     case PROJ_SIN:
     case PROJ_TAN:
+    case PROJ_TNX:
     case PROJ_DIS:
       return PROJ_MODE_ZENITHAL;
Index: /branches/ipp-2-5/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 17419)
@@ -849,5 +849,4 @@
 int dvo_catalog_update_split (Catalog *catalog, char VERBOSE) {
 
-  int Nitems;
   Header header;
   FTable ftable;
Index: /branches/ipp-2-5/Ohana/src/opihi/cmd.astro/coord_systems.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/cmd.astro/coord_systems.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/cmd.astro/coord_systems.c	(revision 17419)
@@ -56,4 +56,6 @@
 	  transform->isIdentity = TRUE;
 	  break;
+	default:
+	  abort();
       }
     case COORD_GALACTIC:
@@ -72,5 +74,9 @@
 	case COORD_ECLIPTIC:
 	  return NULL;
+	default:
+	  abort();
       }
+    default:
+      abort();
   }
  
Index: /branches/ipp-2-5/Ohana/src/opihi/cmd.data/book_commands.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/cmd.data/book_commands.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/cmd.data/book_commands.c	(revision 17419)
@@ -380,8 +380,5 @@
 int book_shuffle (int argc, char **argv) {
 
-  int where, N;
-  char *varName, *keyName, *keyValue;
-  Book *book;
-  Page *page;
+  Book *book;
 
   if (argc != 2) {
Index: /branches/ipp-2-5/Ohana/src/opihi/cmd.data/vzload.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/cmd.data/vzload.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/cmd.data/vzload.c	(revision 17419)
@@ -6,6 +6,5 @@
   int kapa, type;
   char *name;
-  double dx, dy, size;
-  double min, range, MAX_OUTPUT_SIZE;
+  double size, min, range, MAX_OUTPUT_SIZE;
   KiiOverlay *overlay;
   Vector *vecx, *vecy, *vecz;
Index: /branches/ipp-2-5/Ohana/src/opihi/dvo/dbExtractMeasures.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 17419)
@@ -76,5 +76,4 @@
   double ra, dec, x, y, dT;
 
-  Image *image;
   Coords *mosaic;
   PhotCode *equiv;
@@ -132,5 +131,5 @@
 	    break;
 	  }
-	  Nsec = GetPhotcodeNsec (equiv);
+	  Nsec = GetPhotcodeNsec (equiv->code);
 	  if (Nsec == -1) break;
 	  value = secfilt[Nsec].Ncode;
@@ -141,5 +140,5 @@
 	    break;
 	  }
-	  Nsec = GetPhotcodeNsec (equiv);
+	  Nsec = GetPhotcodeNsec (equiv->code);
 	  if (Nsec == -1) break;
 	  value = secfilt[Nsec].Nused;
@@ -317,10 +316,13 @@
       value = measure[0].Xccd;
 # else
-      ra  = average[0].R - measure[0].dR / 3600.0;
-      dec = average[0].D - measure[0].dD / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].photcode);
-      if (image == NULL) break;
-      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
-      value = x;
+      { 
+	Image *image;
+	ra  = average[0].R - measure[0].dR / 3600.0;
+	dec = average[0].D - measure[0].dD / 3600.0;
+	image = MatchImage (measure[0].t, measure[0].photcode);
+	if (image == NULL) break;
+	RD_to_XY (&x, &y, ra, dec, &image[0].coords);
+	value = x;
+      }
 # endif
       break;
@@ -330,10 +332,13 @@
       value = measure[0].Yccd;
 # else
-      ra  = average[0].R - measure[0].dR / 3600.0;
-      dec = average[0].D - measure[0].dD / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].photcode);
-      if (image == NULL) break;
-      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
-      value = y;
+      {
+	Image *image;
+	ra  = average[0].R - measure[0].dR / 3600.0;
+	dec = average[0].D - measure[0].dD / 3600.0;
+	image = MatchImage (measure[0].t, measure[0].photcode);
+	if (image == NULL) break;
+	RD_to_XY (&x, &y, ra, dec, &image[0].coords);
+	value = y;
+      }
 # endif
       break;
Index: /branches/ipp-2-5/Ohana/src/opihi/include/astro.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/astro.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/astro.h	(revision 17419)
@@ -10,4 +10,5 @@
 
 void InitAstro ();
+void FreeAstro ();
 
 typedef struct {
Index: /branches/ipp-2-5/Ohana/src/opihi/include/basic.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/basic.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/basic.h	(revision 17419)
@@ -5,3 +5,4 @@
 void cleanup ();
 void InitBasic ();
+void FreeBasic ();
 void InitBasic_PantasksClient ();
Index: /branches/ipp-2-5/Ohana/src/opihi/include/data.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/data.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/data.h	(revision 17419)
@@ -34,4 +34,5 @@
 
 void InitData ();
+void FreeData ();
 
 /* in book.c */
@@ -153,4 +154,7 @@
 int ibracket (int *list, int Nlist, int mode, double value);
 
+void FreeKapa ();
+void FreeQueues ();
+void FreeBooks ();
+
 # endif
-
Index: /branches/ipp-2-5/Ohana/src/opihi/include/dvoshell.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/dvoshell.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/dvoshell.h	(revision 17419)
@@ -188,4 +188,5 @@
 int           GetTimeSelection      PROTO((time_t *tz, time_t *te));
 void          InitDVO               PROTO(());
+void          FreeDVO               PROTO(());
 int           InitPhotcodes         PROTO(());
 Image        *LoadImages            PROTO((int *Nimage));
@@ -262,3 +263,6 @@
 int dbExtractMeasuresInitMeas ();
 
+int dbExtractAveragesInitTransform (CoordTransformSystem target);
+int dbExtractAveragesInit ();
+
 # endif
Index: /branches/ipp-2-5/Ohana/src/opihi/include/mana.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/mana.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/mana.h	(revision 17419)
@@ -6,4 +6,5 @@
 
 void InitMana ();
+void FreeMana ();
 int *findrowpeaks (float *row, int Nrow, float threshold, int *npeaks);
 
Index: /branches/ipp-2-5/Ohana/src/opihi/include/pantasks.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/pantasks.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/pantasks.h	(revision 17419)
@@ -162,7 +162,15 @@
 
 void InitPantasks ();
+void FreePantasks ();
+
 void InitPantasksServer ();
+void FreePantasksServer ();
+
 void InitPantasksClient ();
+void FreePantasksClient ();
+
 void InitTasks ();
+void FreeTasks ();
+
 Task *NextTask ();
 Task *FindTask (char *name);
@@ -187,8 +195,11 @@
 
 int NextJobID ();
-int InitJobIDs ();
+void InitJobIDs ();
+void FreeJobIDs ();
 int FreeJobID (int ID);
 
 void InitJobs ();
+void FreeJobs ();
+
 Job *NextJob ();
 Job *FindJob (int JobID);
@@ -256,4 +267,5 @@
 // functions related to the queue of input files
 void InitInputs ();
+void FreeInputs ();
 void AddNewInput (char *input);
 int DeleteInput (char *input);
Index: /branches/ipp-2-5/Ohana/src/opihi/include/pclient.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/pclient.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/pclient.h	(revision 17419)
@@ -45,8 +45,10 @@
 
 int InitChild ();
+int FreeChild ();
 int CheckChild ();
 void CheckChildStatus ();
 
 void InitPclient ();
+void FreePclient ();
 void gotsignal (int signum);
 
Index: /branches/ipp-2-5/Ohana/src/opihi/include/pcontrol.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/pcontrol.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/pcontrol.h	(revision 17419)
@@ -125,7 +125,9 @@
 
 void InitPcontrol ();
+void FreePcontrol ();
 
 /*** StackOps.c ***/
 Stack *InitStack ();
+void   FreeStack (Stack *stack);
 int    PushStack (Stack *stack, int where, void *object, int id, char *name);
 void  *PullStackByLocation (Stack *stack, int where);
@@ -184,4 +186,5 @@
 /*** HostOps.c ***/
 void   InitHostStacks ();
+void   FreeHostStacks ();
 Stack *GetHostStack (int StackID);
 char  *GetHostStackName (int StackID);
@@ -204,4 +207,5 @@
 /*** JobOps.c ***/
 void   InitJobStacks ();
+void   FreeJobStacks ();
 Stack *GetJobStack (int StackID);
 char  *GetJobStackName (int StackID);
Index: /branches/ipp-2-5/Ohana/src/opihi/include/shell.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/include/shell.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/include/shell.h	(revision 17419)
@@ -65,5 +65,8 @@
 int           opihi                     PROTO((int argc, char **argv));
 int           multicommand          	PROTO((char *line));
+int getServer ();
 void          multicommand_InitServer   PROTO((void));
+void multicommand_StopServer ();
+
 int           command               	PROTO((char *line, char **outline, int VERBOSE));
 char         *expand_vars           	PROTO((char *line));
@@ -111,4 +114,5 @@
 
 int           ConfigInit            	PROTO((int *argc, char **argv));
+void          ConfigFree            	PROTO((void));
 char         *VarConfig             	PROTO((char *keyword, char *mode, void *ptr));
 char         *VarConfigEntry           	PROTO((char *keyword, char *mode, int entry, void *ptr));
@@ -170,4 +174,10 @@
 int DefineValidIP ();
 
+void FreeCommands ();
+void FreeMacros ();
+void FreeBuffers ();
+void FreeVectors ();
+void FreeVariables ();
+void FreeLists ();
+
 # endif
-
Index: /branches/ipp-2-5/Ohana/src/opihi/lib.data/page.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/lib.data/page.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/lib.data/page.c	(revision 17419)
@@ -137,5 +137,4 @@
 
   int i, N, *seq;
-  Page *page;
 
   N = book[0].Npages;
Index: /branches/ipp-2-5/Ohana/src/opihi/lib.shell/VariableOps.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/lib.shell/VariableOps.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/lib.shell/VariableOps.c	(revision 17419)
@@ -142,5 +142,5 @@
   
   int i;
-  char *local, *MacroName, *value;
+  char *local, *value;
 
   if (name == NULL) return (NULL);
Index: /branches/ipp-2-5/Ohana/src/opihi/lib.shell/gprint.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/lib.shell/gprint.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/lib.shell/gprint.c	(revision 17419)
@@ -223,5 +223,4 @@
 void gprintSetFile (gpStream *stream, gpDest dest, char *filename) {
 
-  int i, Nmatch;
   FILE *file;
 
Index: /branches/ipp-2-5/Ohana/src/opihi/pantasks/JobIDOps.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 17419)
@@ -5,13 +5,12 @@
 static int   JobIDPtr;
 
-int InitJobIDs () {
+void InitJobIDs () {
 
   JobIDPtr = 0;
   ALLOCATE (JobIDList, char, MAX_N_JOBS);
   bzero (JobIDList, MAX_N_JOBS*sizeof(char));
-  return (TRUE);
 }  
 
-int FreeJobIDs () {
+void FreeJobIDs () {
   free (JobIDList);
 }
Index: /branches/ipp-2-5/Ohana/src/opihi/pclient/init.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/opihi/pclient/init.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/opihi/pclient/init.c	(revision 17419)
@@ -1,3 +1,3 @@
-# include "opihi.h"
+# include "pclient.h"
 
 int job	            PROTO((int, char **));
Index: /branches/ipp-2-5/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/relastro/src/UpdateObjects.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/relastro/src/UpdateObjects.c	(revision 17419)
@@ -47,5 +47,4 @@
   int mode, Nave, Npm, Npar, Nskip;
   double Tmin, Tmax;
-  float errorScale;
   float mag;
   int mask;
Index: /branches/ipp-2-5/Ohana/src/relastro/src/fitpoly.c
===================================================================
--- /branches/ipp-2-5/Ohana/src/relastro/src/fitpoly.c	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/relastro/src/fitpoly.c	(revision 17419)
@@ -273,6 +273,4 @@
 CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords) {
 
-  double c11, c12;
-  double c21, c22;
   double Xo, Yo, R1, R2;
   CoordFit *modfit;
@@ -330,4 +328,7 @@
   fit_free (modfit);
   /* keep the order and type from initial values */
-}
-
+  
+  // XXX if desired in the future, return modfit (and free above)
+  return (NULL);
+}
+
Index: /branches/ipp-2-5/Ohana/src/relphot/include/relphot.h
===================================================================
--- /branches/ipp-2-5/Ohana/src/relphot/include/relphot.h	(revision 17418)
+++ /branches/ipp-2-5/Ohana/src/relphot/include/relphot.h	(revision 17419)
@@ -214,2 +214,3 @@
 void          wimages             PROTO(());
 void          write_coords        PROTO((Header *header, Coords *coords));
+int relphot_objects ();
Index: /trunk/Ohana/src/addstar/src/parse_time.c
===================================================================
--- /trunk/Ohana/src/addstar/src/parse_time.c	(revision 17418)
+++ /trunk/Ohana/src/addstar/src/parse_time.c	(revision 17419)
@@ -58,5 +58,5 @@
   /* parse mode line */
   uppercase (DateMode);
-  for (Ny = 0, c = strchr (DateMode, 'Y'); c != (char ) NULL; c = strchr (c + 1, 'Y'), Ny++);
+  for (Ny = 0, c = strchr (DateMode, 'Y'); c != (char *) NULL; c = strchr (c + 1, 'Y'), Ny++);
   if ((Ny != 2) && (Ny != 4)) {
     fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode);
Index: /trunk/Ohana/src/kapa2/include/buttons.h
===================================================================
--- /trunk/Ohana/src/kapa2/include/buttons.h	(revision 17418)
+++ /trunk/Ohana/src/kapa2/include/buttons.h	(revision 17419)
@@ -121,5 +121,5 @@
 #define flipx_width 25
 #define flipx_height 25
-static unsigned char flipx_bits[] = {
+static char flipx_bits[] = {
    0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x80, 0x10, 0x02, 0x00,
@@ -133,5 +133,5 @@
 #define flipy_width 25
 #define flipy_height 25
-static unsigned char flipy_bits[] = {
+static char flipy_bits[] = {
    0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
    0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00,
Index: /trunk/Ohana/src/libdvo/Makefile
===================================================================
--- /trunk/Ohana/src/libdvo/Makefile	(revision 17418)
+++ /trunk/Ohana/src/libdvo/Makefile	(revision 17419)
@@ -30,5 +30,6 @@
 $(DESTINC)/panstarrs_dev_1_defs.h \
 $(DESTINC)/ps1_dev_1_defs.h \
-$(DESTINC)/ps1_dev_2_defs.h
+$(DESTINC)/ps1_dev_2_defs.h \
+$(DESTINC)/ps1_dev_3_defs.h
 
 INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
Index: /trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /trunk/Ohana/src/libdvo/include/dvo.h	(revision 17418)
+++ /trunk/Ohana/src/libdvo/include/dvo.h	(revision 17419)
@@ -34,4 +34,5 @@
   PROJ_SIN, // zenithal
   PROJ_TAN, // zenithal
+  PROJ_TNX, // zenithal
   PROJ_DIS, // zenithal (TAN + polyterms)
   PROJ_LIN, // cartesian
@@ -404,4 +405,5 @@
 # include "ps1_dev_1_defs.h"
 # include "ps1_dev_2_defs.h"
+# include "ps1_dev_3_defs.h"
 
 /*** DVO image db I/O Functions ***/
Index: /trunk/Ohana/src/libdvo/src/coordops.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/coordops.c	(revision 17418)
+++ /trunk/Ohana/src/libdvo/src/coordops.c	(revision 17419)
@@ -82,4 +82,5 @@
     switch (proj) {
       case PROJ_TAN:
+      case PROJ_TNX:
       case PROJ_DIS:
 	// R = cot (theta) = cos(theta) / sin(theta)
@@ -225,4 +226,5 @@
     switch (proj) {
       case PROJ_TAN:
+      case PROJ_TNX:
       case PROJ_DIS:
 	// R = cot (theta) = cos(theta) / sin(theta)
@@ -697,4 +699,5 @@
   if (!strcmp(&ctype[0], "MM"))   return PROJ_SIN; // note ctype[0]
   if (!strcmp(&ctype[4], "-TAN")) return PROJ_TAN;
+  if (!strcmp(&ctype[4], "-TNX")) return PROJ_TNX;
   if (!strcmp(&ctype[4], "-DIS")) return PROJ_DIS;
   if (!strcmp(&ctype[4], "-LIN")) return PROJ_LIN;
@@ -716,4 +719,5 @@
     case PROJ_SIN: strcpy(&ctype[4], "-SIN"); return TRUE;
     case PROJ_TAN: strcpy(&ctype[4], "-TAN"); return TRUE;
+    case PROJ_TNX: strcpy(&ctype[4], "-TNX"); return TRUE;
     case PROJ_DIS: strcpy(&ctype[4], "-DIS"); return TRUE;
     case PROJ_LIN: strcpy(&ctype[4], "-LIN"); return TRUE;
@@ -736,4 +740,5 @@
     case PROJ_SIN:
     case PROJ_TAN:
+    case PROJ_TNX:
     case PROJ_DIS:
       return PROJ_MODE_ZENITHAL;
Index: /trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 17418)
+++ /trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 17419)
@@ -849,5 +849,4 @@
 int dvo_catalog_update_split (Catalog *catalog, char VERBOSE) {
 
-  int Nitems;
   Header header;
   FTable ftable;
Index: /trunk/Ohana/src/opihi/cmd.astro/coord_systems.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/coord_systems.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/cmd.astro/coord_systems.c	(revision 17419)
@@ -56,4 +56,6 @@
 	  transform->isIdentity = TRUE;
 	  break;
+	default:
+	  abort();
       }
     case COORD_GALACTIC:
@@ -72,5 +74,9 @@
 	case COORD_ECLIPTIC:
 	  return NULL;
+	default:
+	  abort();
       }
+    default:
+      abort();
   }
  
Index: /trunk/Ohana/src/opihi/cmd.data/book_commands.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/book_commands.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/cmd.data/book_commands.c	(revision 17419)
@@ -380,8 +380,5 @@
 int book_shuffle (int argc, char **argv) {
 
-  int where, N;
-  char *varName, *keyName, *keyValue;
-  Book *book;
-  Page *page;
+  Book *book;
 
   if (argc != 2) {
Index: /trunk/Ohana/src/opihi/cmd.data/vzload.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/vzload.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/cmd.data/vzload.c	(revision 17419)
@@ -6,6 +6,5 @@
   int kapa, type;
   char *name;
-  double dx, dy, size;
-  double min, range, MAX_OUTPUT_SIZE;
+  double size, min, range, MAX_OUTPUT_SIZE;
   KiiOverlay *overlay;
   Vector *vecx, *vecy, *vecz;
Index: /trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 17419)
@@ -76,5 +76,4 @@
   double ra, dec, x, y, dT;
 
-  Image *image;
   Coords *mosaic;
   PhotCode *equiv;
@@ -132,5 +131,5 @@
 	    break;
 	  }
-	  Nsec = GetPhotcodeNsec (equiv);
+	  Nsec = GetPhotcodeNsec (equiv->code);
 	  if (Nsec == -1) break;
 	  value = secfilt[Nsec].Ncode;
@@ -141,5 +140,5 @@
 	    break;
 	  }
-	  Nsec = GetPhotcodeNsec (equiv);
+	  Nsec = GetPhotcodeNsec (equiv->code);
 	  if (Nsec == -1) break;
 	  value = secfilt[Nsec].Nused;
@@ -317,10 +316,13 @@
       value = measure[0].Xccd;
 # else
-      ra  = average[0].R - measure[0].dR / 3600.0;
-      dec = average[0].D - measure[0].dD / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].photcode);
-      if (image == NULL) break;
-      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
-      value = x;
+      { 
+	Image *image;
+	ra  = average[0].R - measure[0].dR / 3600.0;
+	dec = average[0].D - measure[0].dD / 3600.0;
+	image = MatchImage (measure[0].t, measure[0].photcode);
+	if (image == NULL) break;
+	RD_to_XY (&x, &y, ra, dec, &image[0].coords);
+	value = x;
+      }
 # endif
       break;
@@ -330,10 +332,13 @@
       value = measure[0].Yccd;
 # else
-      ra  = average[0].R - measure[0].dR / 3600.0;
-      dec = average[0].D - measure[0].dD / 3600.0;
-      image = MatchImage (measure[0].t, measure[0].photcode);
-      if (image == NULL) break;
-      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
-      value = y;
+      {
+	Image *image;
+	ra  = average[0].R - measure[0].dR / 3600.0;
+	dec = average[0].D - measure[0].dD / 3600.0;
+	image = MatchImage (measure[0].t, measure[0].photcode);
+	if (image == NULL) break;
+	RD_to_XY (&x, &y, ra, dec, &image[0].coords);
+	value = y;
+      }
 # endif
       break;
Index: /trunk/Ohana/src/opihi/include/astro.h
===================================================================
--- /trunk/Ohana/src/opihi/include/astro.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/astro.h	(revision 17419)
@@ -10,4 +10,5 @@
 
 void InitAstro ();
+void FreeAstro ();
 
 typedef struct {
Index: /trunk/Ohana/src/opihi/include/basic.h
===================================================================
--- /trunk/Ohana/src/opihi/include/basic.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/basic.h	(revision 17419)
@@ -5,3 +5,4 @@
 void cleanup ();
 void InitBasic ();
+void FreeBasic ();
 void InitBasic_PantasksClient ();
Index: /trunk/Ohana/src/opihi/include/data.h
===================================================================
--- /trunk/Ohana/src/opihi/include/data.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/data.h	(revision 17419)
@@ -34,4 +34,5 @@
 
 void InitData ();
+void FreeData ();
 
 /* in book.c */
@@ -153,4 +154,7 @@
 int ibracket (int *list, int Nlist, int mode, double value);
 
+void FreeKapa ();
+void FreeQueues ();
+void FreeBooks ();
+
 # endif
-
Index: /trunk/Ohana/src/opihi/include/dvoshell.h
===================================================================
--- /trunk/Ohana/src/opihi/include/dvoshell.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/dvoshell.h	(revision 17419)
@@ -188,4 +188,5 @@
 int           GetTimeSelection      PROTO((time_t *tz, time_t *te));
 void          InitDVO               PROTO(());
+void          FreeDVO               PROTO(());
 int           InitPhotcodes         PROTO(());
 Image        *LoadImages            PROTO((int *Nimage));
@@ -262,3 +263,6 @@
 int dbExtractMeasuresInitMeas ();
 
+int dbExtractAveragesInitTransform (CoordTransformSystem target);
+int dbExtractAveragesInit ();
+
 # endif
Index: /trunk/Ohana/src/opihi/include/mana.h
===================================================================
--- /trunk/Ohana/src/opihi/include/mana.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/mana.h	(revision 17419)
@@ -6,4 +6,5 @@
 
 void InitMana ();
+void FreeMana ();
 int *findrowpeaks (float *row, int Nrow, float threshold, int *npeaks);
 
Index: /trunk/Ohana/src/opihi/include/pantasks.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pantasks.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/pantasks.h	(revision 17419)
@@ -162,7 +162,15 @@
 
 void InitPantasks ();
+void FreePantasks ();
+
 void InitPantasksServer ();
+void FreePantasksServer ();
+
 void InitPantasksClient ();
+void FreePantasksClient ();
+
 void InitTasks ();
+void FreeTasks ();
+
 Task *NextTask ();
 Task *FindTask (char *name);
@@ -187,8 +195,11 @@
 
 int NextJobID ();
-int InitJobIDs ();
+void InitJobIDs ();
+void FreeJobIDs ();
 int FreeJobID (int ID);
 
 void InitJobs ();
+void FreeJobs ();
+
 Job *NextJob ();
 Job *FindJob (int JobID);
@@ -256,4 +267,5 @@
 // functions related to the queue of input files
 void InitInputs ();
+void FreeInputs ();
 void AddNewInput (char *input);
 int DeleteInput (char *input);
Index: /trunk/Ohana/src/opihi/include/pclient.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pclient.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/pclient.h	(revision 17419)
@@ -45,8 +45,10 @@
 
 int InitChild ();
+int FreeChild ();
 int CheckChild ();
 void CheckChildStatus ();
 
 void InitPclient ();
+void FreePclient ();
 void gotsignal (int signum);
 
Index: /trunk/Ohana/src/opihi/include/pcontrol.h
===================================================================
--- /trunk/Ohana/src/opihi/include/pcontrol.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/pcontrol.h	(revision 17419)
@@ -125,7 +125,9 @@
 
 void InitPcontrol ();
+void FreePcontrol ();
 
 /*** StackOps.c ***/
 Stack *InitStack ();
+void   FreeStack (Stack *stack);
 int    PushStack (Stack *stack, int where, void *object, int id, char *name);
 void  *PullStackByLocation (Stack *stack, int where);
@@ -184,4 +186,5 @@
 /*** HostOps.c ***/
 void   InitHostStacks ();
+void   FreeHostStacks ();
 Stack *GetHostStack (int StackID);
 char  *GetHostStackName (int StackID);
@@ -204,4 +207,5 @@
 /*** JobOps.c ***/
 void   InitJobStacks ();
+void   FreeJobStacks ();
 Stack *GetJobStack (int StackID);
 char  *GetJobStackName (int StackID);
Index: /trunk/Ohana/src/opihi/include/shell.h
===================================================================
--- /trunk/Ohana/src/opihi/include/shell.h	(revision 17418)
+++ /trunk/Ohana/src/opihi/include/shell.h	(revision 17419)
@@ -65,5 +65,8 @@
 int           opihi                     PROTO((int argc, char **argv));
 int           multicommand          	PROTO((char *line));
+int getServer ();
 void          multicommand_InitServer   PROTO((void));
+void multicommand_StopServer ();
+
 int           command               	PROTO((char *line, char **outline, int VERBOSE));
 char         *expand_vars           	PROTO((char *line));
@@ -111,4 +114,5 @@
 
 int           ConfigInit            	PROTO((int *argc, char **argv));
+void          ConfigFree            	PROTO((void));
 char         *VarConfig             	PROTO((char *keyword, char *mode, void *ptr));
 char         *VarConfigEntry           	PROTO((char *keyword, char *mode, int entry, void *ptr));
@@ -170,4 +174,10 @@
 int DefineValidIP ();
 
+void FreeCommands ();
+void FreeMacros ();
+void FreeBuffers ();
+void FreeVectors ();
+void FreeVariables ();
+void FreeLists ();
+
 # endif
-
Index: /trunk/Ohana/src/opihi/lib.data/page.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.data/page.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/lib.data/page.c	(revision 17419)
@@ -137,5 +137,4 @@
 
   int i, N, *seq;
-  Page *page;
 
   N = book[0].Npages;
Index: /trunk/Ohana/src/opihi/lib.shell/VariableOps.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/VariableOps.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/lib.shell/VariableOps.c	(revision 17419)
@@ -142,5 +142,5 @@
   
   int i;
-  char *local, *MacroName, *value;
+  char *local, *value;
 
   if (name == NULL) return (NULL);
Index: /trunk/Ohana/src/opihi/lib.shell/gprint.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/gprint.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/lib.shell/gprint.c	(revision 17419)
@@ -223,5 +223,4 @@
 void gprintSetFile (gpStream *stream, gpDest dest, char *filename) {
 
-  int i, Nmatch;
   FILE *file;
 
Index: /trunk/Ohana/src/opihi/pantasks/JobIDOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/pantasks/JobIDOps.c	(revision 17419)
@@ -5,13 +5,12 @@
 static int   JobIDPtr;
 
-int InitJobIDs () {
+void InitJobIDs () {
 
   JobIDPtr = 0;
   ALLOCATE (JobIDList, char, MAX_N_JOBS);
   bzero (JobIDList, MAX_N_JOBS*sizeof(char));
-  return (TRUE);
 }  
 
-int FreeJobIDs () {
+void FreeJobIDs () {
   free (JobIDList);
 }
Index: /trunk/Ohana/src/opihi/pclient/init.c
===================================================================
--- /trunk/Ohana/src/opihi/pclient/init.c	(revision 17418)
+++ /trunk/Ohana/src/opihi/pclient/init.c	(revision 17419)
@@ -1,3 +1,3 @@
-# include "opihi.h"
+# include "pclient.h"
 
 int job	            PROTO((int, char **));
Index: /trunk/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /trunk/Ohana/src/relastro/src/UpdateObjects.c	(revision 17418)
+++ /trunk/Ohana/src/relastro/src/UpdateObjects.c	(revision 17419)
@@ -47,5 +47,4 @@
   int mode, Nave, Npm, Npar, Nskip;
   double Tmin, Tmax;
-  float errorScale;
   float mag;
   int mask;
Index: /trunk/Ohana/src/relastro/src/fitpoly.c
===================================================================
--- /trunk/Ohana/src/relastro/src/fitpoly.c	(revision 17418)
+++ /trunk/Ohana/src/relastro/src/fitpoly.c	(revision 17419)
@@ -273,6 +273,4 @@
 CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords) {
 
-  double c11, c12;
-  double c21, c22;
   double Xo, Yo, R1, R2;
   CoordFit *modfit;
@@ -330,4 +328,7 @@
   fit_free (modfit);
   /* keep the order and type from initial values */
-}
-
+  
+  // XXX if desired in the future, return modfit (and free above)
+  return (NULL);
+}
+
Index: /trunk/Ohana/src/relphot/include/relphot.h
===================================================================
--- /trunk/Ohana/src/relphot/include/relphot.h	(revision 17418)
+++ /trunk/Ohana/src/relphot/include/relphot.h	(revision 17419)
@@ -214,2 +214,3 @@
 void          wimages             PROTO(());
 void          write_coords        PROTO((Header *header, Coords *coords));
+int relphot_objects ();
