Index: /trunk/Ohana/src/addstar/doc/Changes.txt
===================================================================
--- /trunk/Ohana/src/addstar/doc/Changes.txt	(revision 5385)
+++ /trunk/Ohana/src/addstar/doc/Changes.txt	(revision 5386)
@@ -1,2 +1,15 @@
+
+2005.10.19
+
+	I have added the client / server mode, and tested it out to a
+	fair degree.  It handles all of the available addstar modes,
+	including -ref and -cat.  A handful of things still need to be
+	done, including pushing some of the logic to enforce sorting
+	into the dvo load_catalog functions.  Also, I need to correct
+	the idiosyncratic problem with sky vs Myyyy for the skyprobe
+	data.  There are a handful of other improvements that are
+	needed before addstar / DVO is ready for IPP release.
+	However, at this point, it is ready for internal use by the
+	grad students, but not yet ready for CFHT use with Elixir.
 
 2005.10.07
Index: /trunk/Ohana/src/addstar/src/get2mass.c
===================================================================
--- /trunk/Ohana/src/addstar/src/get2mass.c	(revision 5385)
+++ /trunk/Ohana/src/addstar/src/get2mass.c	(revision 5386)
@@ -28,4 +28,5 @@
 
   for (i = 0; i < Nregions; i++) {
+    refcat = NULL;
     switch (mode) {
       case 0:
Index: /trunk/Ohana/src/addstar/src/get2mass_as.c
===================================================================
--- /trunk/Ohana/src/addstar/src/get2mass_as.c	(revision 5385)
+++ /trunk/Ohana/src/addstar/src/get2mass_as.c	(revision 5386)
@@ -16,5 +16,5 @@
   
   int FilterSkip, TimeSkip;
-  int Nstars, NSTARS, Nbyte, Nextra, code, Qentry;
+  int Nstars, NSTARS, Nbyte, Nextra, Qentry;
   Stars *stars;
   gzFile gf;
@@ -33,5 +33,5 @@
   DEC1 = MIN (patch[0].DEC[1], UserPatch.DEC[1]);
 
-  FilterSkip = TimeSkip = 0;
+  FilterSkip = TimeSkip = Qentry = 0;
   if (photcode == TM_J) {
       FilterSkip = 6;
@@ -102,5 +102,5 @@
       stars[Nstars].M     = M;
       stars[Nstars].dM    = dM;
-      stars[Nstars].code  = code;
+      stars[Nstars].code  = photcode;
       stars[Nstars].t     = time;
       stars[Nstars].found = -1;
Index: /trunk/Ohana/src/gastro/src/gastro.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gastro.c	(revision 5385)
+++ /trunk/Ohana/src/gastro/src/gastro.c	(revision 5386)
@@ -46,4 +46,5 @@
   fprintf (stderr, "good solution: %f %f (%d stars)\n", dR, (dR / sqrt(1.0*Nmatch)), Nmatch);
 
+  Nminterms = MIN_MATCHES;
   switch (NPOLYTERMS) {
   case 0:
Index: /trunk/Ohana/src/gastro/src/gaussj.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gaussj.c	(revision 5385)
+++ /trunk/Ohana/src/gastro/src/gaussj.c	(revision 5386)
@@ -7,4 +7,6 @@
   double big,dum,pivinv;
   
+  irow = icol = 0;
+
   ALLOCATE (indxc, int, n);
   ALLOCATE (indxr, int, n);
Index: /trunk/Ohana/src/gastro/src/gcenter.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gcenter.c	(revision 5385)
+++ /trunk/Ohana/src/gastro/src/gcenter.c	(revision 5386)
@@ -25,7 +25,8 @@
   
   SearchRadius = NX * SEARCH_RADIUS;
+  xvect = yvect = NULL;
+  Nvect = 0;
 
   if (PLOTSTUFF) {
-    Nvect = 0;
     NVECT = N1*N2;
     ALLOCATE (xvect, float, NVECT);
@@ -82,5 +83,5 @@
   }
 
-
+  Xmin = Ymin = 0;
   Fmin = Smin = 1000000.0;
   rot = Rot = ROT_ZERO-dROT*NROT;
@@ -131,4 +132,5 @@
 
     Fmin0 = 1000.0;
+    Smin0 = Nmin0 = Xmin0 = Ymin0 = 0;
     for (k = 0; k < NPIX*NPIX; k++) {
       n = N[k]; /* 1*/ 
Index: /trunk/Ohana/src/gastro/src/gfit.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gfit.c	(revision 5385)
+++ /trunk/Ohana/src/gastro/src/gfit.c	(revision 5386)
@@ -26,8 +26,9 @@
   int Nvect2, NVECT2;
   
+  Nvect = NVECT = Nvect2 = NVECT2 = 0;
+  xvect = yvect = xvect2 = yvect2 = NULL;
+
   if (PLOTSTUFF) {
-    Nvect2 = 0;
     NVECT2 = MAX(N1, N2);
-    Nvect = 0;
     NVECT = MAX(N1, N2);
     ALLOCATE (xvect, float, NVECT);
@@ -48,4 +49,6 @@
   ALLOCATE (Nextra, int, N2);
   bzero (Nextra, sizeof(int) * N2);
+
+  dX = dY = N = 0;
 
   /* assign and sort list */
Index: /trunk/Ohana/src/gastro/src/gfitpoly.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gfitpoly.c	(revision 5385)
+++ /trunk/Ohana/src/gastro/src/gfitpoly.c	(revision 5386)
@@ -100,4 +100,6 @@
      on first pass, find the coeffs.
      on next pass, find just the residuals */
+
+  dX = dY = d2X = d2Y = N = 0;
   for (last = 0; last < 2; last++) {
     if (last) {
Index: /trunk/Ohana/src/gastro2/src/gaussj.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/gaussj.c	(revision 5385)
+++ /trunk/Ohana/src/gastro2/src/gaussj.c	(revision 5386)
@@ -7,4 +7,6 @@
   double big,dum,pivinv;
   
+  irow = icol = 0;
+
   ALLOCATE (indxc, int, n);
   ALLOCATE (indxr, int, n);
Index: /trunk/Ohana/src/gastro2/src/grid.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/grid.c	(revision 5385)
+++ /trunk/Ohana/src/gastro2/src/grid.c	(revision 5386)
@@ -27,4 +27,5 @@
   YMAX = +0.5*NFIELD*Target[0].header.Naxis[1];
 
+  dX = dY = 0;
   /* make two passes, with grids offset by 0.5 box for the second */
   for (n = 0; n < 2; n++) {
Index: /trunk/Ohana/src/imclean/src/LoadStarsChad.c
===================================================================
--- /trunk/Ohana/src/imclean/src/LoadStarsChad.c	(revision 5385)
+++ /trunk/Ohana/src/imclean/src/LoadStarsChad.c	(revision 5386)
@@ -27,5 +27,6 @@
   /* zero things that will sum */
   for (i = 0; i < HIST_BINS; i++) { Mhist[i] = Shist[i] = 0; }
-
+  
+  N = 0;
   Nstars = 0;
   NSTARS = 500;
@@ -103,4 +104,5 @@
   }
   satfound = done = FALSE;
+  saturate = complete = 0.0;
   for (i = 0; (i < HIST_BINS) && !done; i++) {
     if ((!satfound) && (Mhist[i] > 0)) {
Index: /trunk/Ohana/src/imclean/src/LoadStarsDophot.c
===================================================================
--- /trunk/Ohana/src/imclean/src/LoadStarsDophot.c	(revision 5385)
+++ /trunk/Ohana/src/imclean/src/LoadStarsDophot.c	(revision 5386)
@@ -21,5 +21,5 @@
   double SMedHist, dMed;
 
-  NMedHist = 0;
+  N = NMedHist = 0;
   bzero (MedHist, 2002*sizeof(int));
 
@@ -126,4 +126,5 @@
   }
   satfound = done = FALSE;
+  saturate = complete = 0.0;
   for (i = 0; (i < HIST_BINS) && !done; i++) {
     if ((!satfound) && (Mhist[i] > 0)) {
Index: /trunk/Ohana/src/imclean/src/LoadStarsSex.c
===================================================================
--- /trunk/Ohana/src/imclean/src/LoadStarsSex.c	(revision 5385)
+++ /trunk/Ohana/src/imclean/src/LoadStarsSex.c	(revision 5386)
@@ -30,5 +30,5 @@
 
   /* zero things that will sum */
-  A = A2 = S2 = 0;
+  N = A = A2 = S2 = 0;
   gotFWHM = FALSE;
   for (i = 0; i < HIST_BINS; i++) { Mhist[i] = Shist[i] = 0; }
@@ -117,4 +117,5 @@
   }
   satfound = done = FALSE;
+  saturate = complete = 0.0;
   for (i = 0; (i < HIST_BINS) && !done; i++) {
     if ((!satfound) && (Mhist[i] > 0)) {
Index: /trunk/Ohana/src/imregister/imphot/subset.c
===================================================================
--- /trunk/Ohana/src/imregister/imphot/subset.c	(revision 5385)
+++ /trunk/Ohana/src/imregister/imphot/subset.c	(revision 5386)
@@ -7,4 +7,6 @@
   int Nsubset, NameSelectLength;
   int *index;
+
+  NameSelectLength = 0;
 
   /* allocate space for reference lists */
Index: /trunk/Ohana/src/imregister/photreg/output.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/output.c	(revision 5385)
+++ /trunk/Ohana/src/imregister/photreg/output.c	(revision 5386)
@@ -81,5 +81,5 @@
   char *c1, *c2, *code, *photsys, *extname;
   int i;
-  unsigned int tsecond;
+  unsigned long tsecond;
 
   /* create primary header */
@@ -99,6 +99,6 @@
     
   /* add current date/time to header */
-  str_to_time ("now", (unsigned long *)&tsecond);
-  datestr = sec_to_date (tsecond);
+  str_to_time ("now", &tsecond);
+  datestr = sec_to_date ((unsigned int) tsecond);
   fits_modify (&header,  "DATE", "%s", 1, datestr);
   fits_modify (&theader, "DATE", "%s", 1, datestr);
Index: /trunk/Ohana/src/imregister/src/photcode.c
===================================================================
--- /trunk/Ohana/src/imregister/src/photcode.c	(revision 5385)
+++ /trunk/Ohana/src/imregister/src/photcode.c	(revision 5386)
@@ -1,4 +1,4 @@
 # include "imregister.h"
-static char *version = "photcode $Revision: 3.2 $";
+static char *version = "photcode $Revision: 3.3 $";
 
 int main (int argc, char **argv) {
@@ -61,5 +61,5 @@
   }
   if (ccd == -1) {
-    fprintf (stderr, "warning: ccd %s not found in camera config file\n", ccd);
+    fprintf (stderr, "warning: ccd %d not found in camera config file\n", ccd);
     ccd = 0;
   }
Index: /trunk/Ohana/src/kapa/graph/DrawFrame.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/DrawFrame.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/DrawFrame.c	(revision 5386)
@@ -81,4 +81,5 @@
   if (mode == 1) {
     fontname = GetRotFont (&fontsize);
+    pos = 0;
     
     /* temporarily assume rectilinear axes */
Index: /trunk/Ohana/src/kapa/graph/DrawLabels.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/DrawLabels.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/DrawLabels.c	(revision 5386)
@@ -7,4 +7,5 @@
   char *fontname;
 
+  pos = 0;
   fontname = GetRotFont (&size);
   XSetForeground (graphic.display, graphic.gc, graphic.fore);
Index: /trunk/Ohana/src/kapa/graph/DrawRotString.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/DrawRotString.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/DrawRotString.c	(revision 5386)
@@ -25,4 +25,5 @@
 
   /* apply appropriate offset */
+  Xoff = Yoff = 0;
   switch (pos) {
   case 0: Xoff =     -dX; Yoff = dY; break;
@@ -338,4 +339,5 @@
   /* compute string length */
   /* PS fonts are somewhat different scales from bitmap font equivalents */
+  fscale = 1.0;
   if (!strcmp (currentname, "times")) fscale = 1.07;
   if (!strcmp (currentname, "courier")) fscale = 1.5;
@@ -346,4 +348,5 @@
   
   /* apply appropriate offset */
+  Xoff = Yoff = 0;
   switch (pos) {
   case 0: Xoff =     -dX; Yoff = -dY; break;
Index: /trunk/Ohana/src/kapa/graph/LoadObject.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/LoadObject.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/LoadObject.c	(revision 5386)
@@ -112,4 +112,5 @@
   char *buff;
 
+  buff = NULL;
   Npts = layout[0].objects[N].Npts;
   status = 1;
Index: /trunk/Ohana/src/kapa/graph/PSFrame.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/PSFrame.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/PSFrame.c	(revision 5386)
@@ -55,4 +55,6 @@
   char string[64], *fontname;
 
+  pos = size = 0;
+
   if (mode == 1) { size = MAX (0.02, 7.0 / P); }
   if (mode == 0) { size = MAX (0.01, 4.0 / P); }
Index: /trunk/Ohana/src/kapa/graph/PSLabels.c
===================================================================
--- /trunk/Ohana/src/kapa/graph/PSLabels.c	(revision 5385)
+++ /trunk/Ohana/src/kapa/graph/PSLabels.c	(revision 5386)
@@ -7,4 +7,5 @@
   char *fontname;
 
+  pos = 0;
   fontname = GetRotFont (&size);
   for (i = 0; i < 8; i++) {
Index: /trunk/Ohana/src/kii/colorbar/DragColorbar.c
===================================================================
--- /trunk/Ohana/src/kii/colorbar/DragColorbar.c	(revision 5385)
+++ /trunk/Ohana/src/kii/colorbar/DragColorbar.c	(revision 5386)
@@ -17,5 +17,5 @@
   slope = layout[0].slope;
   start = layout[0].start;
-  oldfrac_x = 10;
+  oldfrac_x = oldfrac_y = 10;
   
   while (1) {
Index: /trunk/Ohana/src/kii/overlay/DrawOverlay.c
===================================================================
--- /trunk/Ohana/src/kii/overlay/DrawOverlay.c	(revision 5385)
+++ /trunk/Ohana/src/kii/overlay/DrawOverlay.c	(revision 5386)
@@ -9,4 +9,5 @@
   double expand, X0, Y0;
  
+  expand = 1.0;
   if (layout[0].expand > 0) {
     expand = 1 / (1.0*layout[0].expand);
Index: /trunk/Ohana/src/kii/overlay/PaintOverlay.c
===================================================================
--- /trunk/Ohana/src/kii/overlay/PaintOverlay.c	(revision 5385)
+++ /trunk/Ohana/src/kii/overlay/PaintOverlay.c	(revision 5386)
@@ -11,4 +11,5 @@
   XSetForeground (graphic[0].display, graphic[0].gc, layout[0].overlay[N].color);
   
+  expand = 1.0;
   if (layout[0].expand > 0) {
     expand = 1 / (1.0*layout[0].expand);
Index: /trunk/Ohana/src/kii/picture/CursorOps.c
===================================================================
--- /trunk/Ohana/src/kii/picture/CursorOps.c	(revision 5385)
+++ /trunk/Ohana/src/kii/picture/CursorOps.c	(revision 5386)
@@ -5,4 +5,5 @@
   double expand;
 
+  expand = 1.0;
   if (layout[0].expand > 0) {
     expand = 1 / (1.0*layout[0].expand);
@@ -22,4 +23,5 @@
 
   /* notice that here, expand is the reciprocal of the expand above */
+  expand = 1.0;
   if (layout[0].expand > 0) {
     expand = abs(layout[0].expand);
Index: /trunk/Ohana/src/kii/picture/Remap16.c
===================================================================
--- /trunk/Ohana/src/kii/picture/Remap16.c	(revision 5385)
+++ /trunk/Ohana/src/kii/picture/Remap16.c	(revision 5386)
@@ -26,4 +26,5 @@
   white2 = 0x00ff & (white >> 8);
 
+  expand = expand_in = expand_out = 1.0;
   if (layout[0].expand == 0) /* set up expansions */
     layout[0].expand = 1;
Index: /trunk/Ohana/src/kii/picture/Remap24.c
===================================================================
--- /trunk/Ohana/src/kii/picture/Remap24.c	(revision 5385)
+++ /trunk/Ohana/src/kii/picture/Remap24.c	(revision 5386)
@@ -27,4 +27,5 @@
   white3 = 0x0000ff & (white >> 16);
 
+  expand = expand_in = expand_out = 1.0;
   if (layout[0].expand == 0) /* set up expansions */
     layout[0].expand = 1;
Index: /trunk/Ohana/src/kii/picture/Remap32.c
===================================================================
--- /trunk/Ohana/src/kii/picture/Remap32.c	(revision 5385)
+++ /trunk/Ohana/src/kii/picture/Remap32.c	(revision 5386)
@@ -20,4 +20,5 @@
   white = layout[0].white;
 
+  expand = expand_in = expand_out = 1.0;
   if (layout[0].expand == 0) /* set up expansions */
     layout[0].expand = 1;
Index: /trunk/Ohana/src/kii/picture/Remap8.c
===================================================================
--- /trunk/Ohana/src/kii/picture/Remap8.c	(revision 5385)
+++ /trunk/Ohana/src/kii/picture/Remap8.c	(revision 5386)
@@ -20,4 +20,5 @@
   white = layout[0].white;
 
+  expand = expand_in = expand_out = 1.0;
   if (layout[0].expand == 0) /* set up expansions */
     layout[0].expand = 1;
Index: /trunk/Ohana/src/kii/setup/DrawBitmap.c
===================================================================
--- /trunk/Ohana/src/kii/setup/DrawBitmap.c	(revision 5385)
+++ /trunk/Ohana/src/kii/setup/DrawBitmap.c	(revision 5386)
@@ -11,4 +11,7 @@
   int i, j, byte_line, byte, bit, flag;
   unsigned long int black, white;
+
+  black = graphic[0].black;
+  white = graphic[0].white;
 
   if (mode == 0) {
Index: /trunk/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 5385)
+++ /trunk/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 5386)
@@ -49,4 +49,5 @@
 
   /* get datatype size */
+  ImageSize = 0;
   if (db[0].format == DVO_FORMAT_INTERNAL)  ImageSize = sizeof(Image);
   if (db[0].format == DVO_FORMAT_LONEOS)    ImageSize = sizeof(ImageLoneos);
Index: /trunk/Ohana/src/nightd/src/misc.c
===================================================================
--- /trunk/Ohana/src/nightd/src/misc.c	(revision 5385)
+++ /trunk/Ohana/src/nightd/src/misc.c	(revision 5386)
@@ -191,5 +191,5 @@
 
   done = FALSE;
-  exit_good = FALSE;
+  exit_good = exit_stat = FALSE;
   for (i = 0; !done && (i < 10*timeout); i++) {
     Nread = read (rfd[0], buffer, 0x4000);
Index: /trunk/Ohana/src/opihi/cmd.astro/help/region
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/help/region	(revision 5385)
+++ /trunk/Ohana/src/opihi/cmd.astro/help/region	(revision 5386)
@@ -10,2 +10,9 @@
   AIT - aitoff projection (good for the full sky)
   GLS - ?? (also good for the full sky)
+
+  optional orientation flags:
+
+  -ew : display with East Left (default)
+  +ew : display with East Right 
+  -ns : display with North Down
+  +ns : display with North Up (default)
Index: /trunk/Ohana/src/opihi/cmd.astro/region.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/region.c	(revision 5385)
+++ /trunk/Ohana/src/opihi/cmd.astro/region.c	(revision 5386)
@@ -89,4 +89,7 @@
   set_variable ("DMAX", Dec + graphmode.ymax);
 
+  set_int_variable ("EAST_RIGHT", !graphmode.flipeast);
+  set_int_variable ("NORTH_UP", !graphmode.flipnorth);
+
   graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1;
   graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1;
Index: /trunk/Ohana/src/opihi/dvo/cmpread.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/cmpread.c	(revision 5385)
+++ /trunk/Ohana/src/opihi/dvo/cmpread.c	(revision 5386)
@@ -93,4 +93,5 @@
   bzero (vec[0].elements, Nstars*sizeof(float));
 
+  value = 0;
   for (i = 0; i < Nstars; i++) {
     switch (field) {
Index: /trunk/Ohana/src/relphot/src/gcatalog.c
===================================================================
--- /trunk/Ohana/src/relphot/src/gcatalog.c	(revision 5385)
+++ /trunk/Ohana/src/relphot/src/gcatalog.c	(revision 5386)
@@ -3,6 +3,4 @@
 int gcatalog (Catalog *catalog, int FINAL) {
   
-  char mode;
-
   if (FINAL) {
     catalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
Index: /trunk/Ohana/src/relphot/src/liststats.c
===================================================================
--- /trunk/Ohana/src/relphot/src/liststats.c	(revision 5385)
+++ /trunk/Ohana/src/relphot/src/liststats.c	(revision 5386)
@@ -27,4 +27,6 @@
   int i, ks, ke, Nm;
   double Mo, dMo, M, dM, X2, dS, *chi;
+
+  ke = ks = dMo = 0;
 
   stats[0].Nmeas = N;
Index: /trunk/Ohana/src/uniphot/include/uniphot.h
===================================================================
--- /trunk/Ohana/src/uniphot/include/uniphot.h	(revision 5385)
+++ /trunk/Ohana/src/uniphot/include/uniphot.h	(revision 5386)
@@ -76,6 +76,6 @@
 int           args               PROTO((int argc, char **argv));
 void          dumpresult         PROTO(());
-Group        *find_image_sgroups PROTO((FITS_DB *db, ImageLink *imlink, int *Nsgroup));
-Group        *find_image_tgroups PROTO((FITS_DB *db, ImageLink *imlink, int *Ntgroup));
+Group        *find_image_sgroups PROTO((FITS_DB *db, ImageLink **imlink, int *Nsgroup));
+Group        *find_image_tgroups PROTO((FITS_DB *db, ImageLink **imlink, int *Ntgroup));
 void          fit_sgroup         PROTO((Group *sgroup, int Nsgroup));
 void          fit_tgroup         PROTO((Group *tgroup, int Ntgroup));
Index: /trunk/Ohana/src/uniphot/src/find_image_sgroups.c
===================================================================
--- /trunk/Ohana/src/uniphot/src/find_image_sgroups.c	(revision 5385)
+++ /trunk/Ohana/src/uniphot/src/find_image_sgroups.c	(revision 5386)
@@ -1,5 +1,5 @@
 # include "uniphot.h"
 
-Group *find_image_sgroups (FITS_DB *db, ImageLink *imlink, int *Nsgroup) {
+Group *find_image_sgroups (FITS_DB *db, ImageLink **Imlink, int *Nsgroup) {
 
   int i, j, Nimage, Ngroup, Nentry, NENTRY;
@@ -8,5 +8,7 @@
   Coords coords;
   Image *image;
+  ImageLink *imlink;
 
+  imlink = *Imlink;
   image = fits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
 
Index: /trunk/Ohana/src/uniphot/src/find_image_tgroups.c
===================================================================
--- /trunk/Ohana/src/uniphot/src/find_image_tgroups.c	(revision 5385)
+++ /trunk/Ohana/src/uniphot/src/find_image_tgroups.c	(revision 5386)
@@ -1,5 +1,5 @@
 # include "uniphot.h"
 
-Group *find_image_tgroups (FITS_DB *db, ImageLink *imlink, int *Ntgroup) {
+Group *find_image_tgroups (FITS_DB *db, ImageLink **Imlink, int *Ntgroup) {
 
   char *start, *stop;
@@ -8,6 +8,8 @@
   Group *group;
   Image *image;
+  ImageLink *imlink;
 
   image = fits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
+  ALLOCATE (imlink, ImageLink, Nimage);
 
   /* sort time list (use only valid images?) */
@@ -75,4 +77,5 @@
     group[i].Nimage = Nentry;
   }
+  *Imlink = imlink;
   *Ntgroup = Ngroup;
   return (group);
Index: /trunk/Ohana/src/uniphot/src/liststats.c
===================================================================
--- /trunk/Ohana/src/uniphot/src/liststats.c	(revision 5385)
+++ /trunk/Ohana/src/uniphot/src/liststats.c	(revision 5386)
@@ -27,4 +27,6 @@
   int i, ks, ke, Nm;
   double Mo, dMo, M, dM, X2, dS, *chi;
+
+  ke = ks = dMo = 0;
 
   stats[0].Nmeas = N;
Index: /trunk/Ohana/src/uniphot/src/uniphot.c
===================================================================
--- /trunk/Ohana/src/uniphot/src/uniphot.c	(revision 5385)
+++ /trunk/Ohana/src/uniphot/src/uniphot.c	(revision 5386)
@@ -3,5 +3,5 @@
 int main (int argc, char **argv) {
 
-  int i, Nimage, Ntgroup, Nsgroup;
+  int i, Ntgroup, Nsgroup;
   Group *tgroup, *sgroup;
   ImageLink *imlinks;
@@ -20,7 +20,6 @@
   subset_images (&db);
 
-  ALLOCATE (imlinks, ImageLink, Nimage);
-  tgroup = find_image_tgroups (&db, imlinks, &Ntgroup);
-  sgroup = find_image_sgroups (&db, imlinks, &Nsgroup);
+  tgroup = find_image_tgroups (&db, &imlinks, &Ntgroup);
+  sgroup = find_image_sgroups (&db, &imlinks, &Nsgroup);
 
   /* determine fit values */
