Index: /trunk/Ohana/src/relphot/include/relphot.h
===================================================================
--- /trunk/Ohana/src/relphot/include/relphot.h	(revision 4795)
+++ /trunk/Ohana/src/relphot/include/relphot.h	(revision 4796)
@@ -4,10 +4,4 @@
 /* # define GRID_V1 */
 # define GRID_V2
-
-static union { unsigned char c[4]; float f; } f_undef = { 0xff, 0xff, 0xff, 0xfe };
-# define fUNDEF (f_undef.f)
-
-static union { unsigned char c[8]; float d; } d_undef = { 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00 };
-# define dUNDEF (d_undef.d)
 
 typedef struct {
@@ -95,4 +89,12 @@
 int TimeSelect;
 unsigned int TSTART, TSTOP;
+
+# ifdef GRID_V1
+int setGridMeasure (int meas, int cat, double X, double Y);
+# endif
+
+# ifdef GRID_V2
+int setGridMeasure (int meas, int cat, double X, double Y, int ccdnum);
+# endif
 
 /***** prototypes ****/
@@ -139,15 +141,5 @@
 void reload_catalogs (GSCRegion *region, int Nregion, GSCRegion *fullregion);
 void free_catalogs (Catalog *catalog, int Ncatalog);
-
-# ifdef GRID_V1
-int setGridMeasure (int meas, int cat, double X, double Y);
-# endif
-
-# ifdef GRID_V2
-int setGridMeasure (int meas, int cat, double X, double Y, int ccdnum);
-# endif
-
 void set_ZP (double ZERO);
-
 char *GetPhotnamebyCode (PhotCodeData *photcodes, int code);
 StatType statsStarS (Catalog *catalog, int Ncatalog);
@@ -157,2 +149,64 @@
 StatType statsImageX (Catalog *catalog);
 StatType statsImageM (Catalog *catalog);
+void plot_scatter (Catalog *catalog, int Ncatalog);
+void plot_defaults (Graphdata *graphdata);
+void plot_list (Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *file);
+void plot_stars (Catalog *catalog, int Ncatalog);
+void plot_chisq (Catalog *catalog, int Ncatalog);
+void plot_star_coords (Catalog *catalog, int Ncatalog);
+void plot_grid (Catalog *catalog);
+void dump_grid (); 
+int *SelectRefMosaic (Mosaic **refmosaic, int *Nimage);
+Image *getimage (int N);
+void InterpolateGrid (float *buffer, int Nx, int Ny, Coords *ccd, Coords *gcoords);
+void plot_mosaic_fields (Catalog *catalog);
+void plot_mosaics ();
+void plot_images ();
+void wimages ();
+void clean_mosaics ();
+void freeMosaicBins (int Ncatalog);
+void freeGridBins (int Ncatalog);
+void clean_measures (Catalog *catalog, int Ncatalog, int final);
+void global_stats (Catalog *catalog, int Ncatalog);
+StatType statsImagedM (Catalog *catalog);
+StatType statsMosaicdM (Catalog *catalog);
+StatType statsMosaicM (Catalog *catalog);
+StatType statsMosaicN (Catalog *catalog);
+StatType statsMosaicX (Catalog *catalog);
+Coords *getCoords (int meas, int cat);
+int setExclusions (Catalog *catalog, int Ncatalog);
+void freeImageBins (int Ncatalog);
+void sortA (double *X, int N);
+void sortB (double *X, double *Y, int N);
+void sortC (double *X, double *Y, double *F1, double *F2, int N);
+void sortD (double *X, double *Y, double *Z, int N);
+void initstats (char *mode);
+int liststats (double *value, double *dvalue, int N, StatType *stats);
+
+int dms_to_ddd (double *Value, char *string);
+int str_to_radec (double *ra, double *dec, char *str1, char *str2);
+int chk_time (char *line);
+double sec_to_jd (unsigned long second);
+unsigned long int jd_to_sec (double jd);
+char *sec_to_date (unsigned long second);
+unsigned long date_to_sec (char *date);
+  
+int str_to_time (char *line, unsigned int *second);
+int str_to_dtime (char *line, double *second);
+int Fseek (FILE *f, long offset, int whence);
+void GetConfig (char *config, char *field, char *format, int N, void *ptr);
+void skip_measurements (Catalog *catalog, int pass);
+Image *getimages (int *N);
+
+void setMrelFinal (Catalog *catalog);
+void skip_measurements (Catalog *catalog, int pass);
+GSCRegion *get_regions (double minRa, double maxRa, double minDec, double maxDec, int *Nregions);
+int hms_to_deg (double *h0, double *h1, double *d0, double *d1, char *string);
+GSCRegion *find_regions (Image *image, int Nimage, int *Nregions, GSCRegion *fullregion);
+void getfullregion (Image *image, int Nimage, GSCRegion *fullregion);
+void setMcalFinal (Image *image, int Nimage);
+int gcatalog (Catalog *catalog, int FINAL);
+void write_coords (Header *header, Coords *coords);
+void wcatalog (Catalog *catalog);
+int setMrelOutput (Catalog *catalog, int Ncatalog, int mark);
+int setMcalOutput (Catalog *catalog, int Ncatalog);
Index: /trunk/Ohana/src/relphot/src/ConfigInit.c
===================================================================
--- /trunk/Ohana/src/relphot/src/ConfigInit.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/ConfigInit.c	(revision 4796)
@@ -1,4 +1,3 @@
 # include "relphot.h"
-void GetConfig (char *config, char *field, char *format, int N, void *ptr);
 
 void ConfigInit (int *argc, char **argv) {
@@ -60,8 +59,8 @@
 void GetConfig (char *config, char *field, char *format, int N, void *ptr) {
 
-  int status;
+  char *status;
 
   status = ScanConfig (config, field, format, N, ptr);
-  if (!status) {
+  if (status == NULL) {
     fprintf (stderr, "error in config, cannot find %s\n", field);
     exit (1);
Index: /trunk/Ohana/src/relphot/src/GridOps.v2.c
===================================================================
--- /trunk/Ohana/src/relphot/src/GridOps.v2.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/GridOps.v2.c	(revision 4796)
@@ -227,5 +227,4 @@
   return (TRUE);
 
-escape:
   fprintf (stderr, "error: star out of grid\n");
   exit (1);
@@ -352,17 +351,12 @@
 }
 
-int *SelectRefMosaic (Mosaic **refmosaic, int *Nimage);
-Image *getimage (int N);
-
 void dump_grid () { 
 
-  int i, j, Nx, Ny, Nimage;
+  int i, j, Nimage;
   int *imlist;
-  char *p, *pname, ccdname[80];
   FILE *f;
   Header header, theader;
   Matrix matrix;
   Mosaic *refmosaic;
-  Image *image;
     
   /* select reference mosaic image */
@@ -517,8 +511,8 @@
 }
 
-InterpolateGrid (float *buffer, int Nx, int Ny, Coords *ccd, Coords *gcoords) {
+void InterpolateGrid (float *buffer, int Nx, int Ny, Coords *ccd, Coords *gcoords) {
 
   int i, j;
-  double x, y, r, d, X, Y, dx, dy, dVx, dVy, dVxy;
+  double x, y, r, d, X, Y, dx, dy;
   double V00, V01, V10, V11;
   double wV00, wV01, wV10, wV11;
Index: /trunk/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 4796)
@@ -15,5 +15,5 @@
 void initImages (Image *input, int N) {
 
-  int i, j;
+  int i;
 
   image = input;
@@ -111,6 +111,6 @@
       /* add this measurement to the grid cell for this chip */
       ave = measure[0].averef;
-      ra  = catalog[cat].average[ave].R - measure[0].dR / 360000.0;
-      dec = catalog[cat].average[ave].D - measure[0].dD / 360000.0;
+      ra  = catalog[cat].average[ave].R_PS - measure[0].dR_PS / 3600.0;
+      dec = catalog[cat].average[ave].D_PS - measure[0].dD_PS / 3600.0;
        
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -152,5 +152,4 @@
 
   int i;
-  short value;
 
   i = bin[cat][meas];
@@ -285,6 +284,5 @@
 void plot_images () {
 
-  int i, j, m, c, N, Nmax, bin;
-  short Mrel, Mcal, Mmos;
+  int i, bin;
   double *xlist, *Mlist, *dlist;
   Graphdata graphdata;
@@ -334,5 +332,5 @@
 StatType statsImageN (Catalog *catalog) {
 
-  int i, j, k, m, c, n, N, Nmax;
+  int i, j, m, c, n, N;
   double *list, *dlist;
   StatType stats;
@@ -372,5 +370,5 @@
 StatType statsImageX (Catalog *catalog) {
 
-  int i, j, k, m, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
@@ -400,5 +398,5 @@
 StatType statsImageM (Catalog *catalog) {
 
-  int i, j, k, m, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
@@ -428,5 +426,5 @@
 StatType statsImagedM (Catalog *catalog) {
 
-  int i, j, k, m, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
Index: /trunk/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 4796)
@@ -99,5 +99,5 @@
   int i, j, m, NX, NY;
   int dXmax, dYmax;
-  double dR, dD, dS, dX, dY;
+  double dS, dX, dY;
   double R, D, Rmin, Rmax, Dmin, Dmax;
   double Mcal, dMcal, Xm;
@@ -211,5 +211,5 @@
 }
 
-void freeMosaicBins (Ncatalog) {
+void freeMosaicBins (int Ncatalog) {
 
   int i;
@@ -249,11 +249,10 @@
     }
   }
-  
+  return (TRUE);
 }
 
 void matchMosaics (Catalog *catalog, int meas, int cat) {
 
-  int i, ave;
-  double ra, dec, X, Y;
+  int i;
 
   for (i = 0; i < Nmosaic; i++) {
@@ -264,6 +263,6 @@
     if (USE_GRID) {
       ave = catalog[cat].measure[meas].averef;
-      ra  = catalog[cat].average[ave].R - catalog[cat].measure[meas].dR / 360000.0;
-      dec = catalog[cat].average[ave].D - catalog[cat].measure[meas].dD / 360000.0;
+      ra  = catalog[cat].average[ave].R_PS - catalog[cat].measure[meas].dR_PS / 3600.0;
+      dec = catalog[cat].average[ave].D_PS - catalog[cat].measure[meas].dD_PS / 3600.0;
 
       /* X,Y always positive-definite in range 0,0 - dX, dY */
@@ -311,5 +310,4 @@
   StatType stats;
   Image *image;
-  Graphdata graphdata;
 
   if (!MOSAICNAME[0]) return (FALSE);
@@ -391,5 +389,5 @@
 StatType statsMosaicM (Catalog *catalog) {
 
-  int i, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
@@ -417,5 +415,5 @@
 StatType statsMosaicdM (Catalog *catalog) {
 
-  int i, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
@@ -444,5 +442,5 @@
 StatType statsMosaicN (Catalog *catalog) {
 
-  int i, j, k, m, c, n, N, Nmax;
+  int i, j, m, c, n, N;
   double *list, *dlist;
   StatType stats;
@@ -483,5 +481,5 @@
 StatType statsMosaicX (Catalog *catalog) {
 
-  int i, n, N, Nmax;
+  int i, n;
   double *list, *dlist;
   StatType stats;
@@ -511,9 +509,8 @@
 void clean_mosaics () {
 
-  int i, j, N, mark, Nmark;
+  int i, N, mark, Nmark;
   double *mlist, *slist, *dlist;
   double MaxOffset, MedOffset, MaxScatter;
   StatType stats;
-  Image *image;
 
   if (!MOSAICNAME[0]) return;
@@ -562,5 +559,4 @@
 
   int i, j, m, c, N, ave, Nimage;
-  short Mrel, Mcal, Mmos;
   double *xlist, *ylist;
   double Xmin, Xmax, Ymin, Ymax;
@@ -592,6 +588,6 @@
 
       ave = catalog[c].measure[m].averef;
-      xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 360000.0;
-      ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 360000.0;
+      xlist[N] = catalog[c].average[ave].R_PS - catalog[c].measure[m].dR_PS / 3600.0;
+      ylist[N] = catalog[c].average[ave].D_PS - catalog[c].measure[m].dD_PS / 3600.0;
       N++;
     }
@@ -608,6 +604,5 @@
 void plot_mosaics () {
 
-  int i, j, m, c, N, Nmax, bin;
-  short Mrel, Mcal, Mmos;
+  int i, bin;
   double *xlist, *Mlist, *dlist;
   Graphdata graphdata;
Index: /trunk/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/StarOps.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/StarOps.c	(revision 4796)
@@ -76,4 +76,5 @@
     }
   }
+  return (TRUE);
 }
 
@@ -134,4 +135,5 @@
   free (list);
   free (dlist);
+  return (TRUE);
 }
 
@@ -366,5 +368,5 @@
 StatType statsStarX (Catalog *catalog, int Ncatalog) {
 
-  int i, j, k, m, n, N, Ntot, Xm;
+  int i, j, n, Ntot, Xm;
   double *list, *dlist;
   StatType stats;
@@ -401,5 +403,5 @@
 StatType statsStarS (Catalog *catalog, int Ncatalog) {
 
-  int i, j, k, m, n, N, Ntot, dM;
+  int i, j, n, Ntot, dM;
   double *list, *dlist;
   StatType stats;
@@ -435,5 +437,5 @@
 void plot_stars (Catalog *catalog, int Ncatalog) {
 
-  int i, j, m, c, N, bin;
+  int i, j, bin;
   short dMrel;
   double *xlist, *Mlist;
@@ -497,6 +499,5 @@
 void plot_star_coords (Catalog *catalog, int Ncatalog) {
 
-  int i, j, m, c, N, bin;
-  short Mrel, Mcal, Mmos;
+  int i, j, N;
   double *xlist, *ylist;
   double Xmin, Ymin, Xmax, Ymax;
@@ -515,6 +516,6 @@
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Naverage; j++) {
-      xlist[N] = catalog[i].average[j].R;
-      ylist[N] = catalog[i].average[j].D;
+      xlist[N] = catalog[i].average[j].R_PS;
+      ylist[N] = catalog[i].average[j].D_PS;
       N++;
     }
Index: /trunk/Ohana/src/relphot/src/args.c
===================================================================
--- /trunk/Ohana/src/relphot/src/args.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/args.c	(revision 4796)
@@ -7,5 +7,5 @@
   /* define time */
   TimeSelect = FALSE;
-  if (N = get_argument (argc, argv, "-time")) {
+  if ((N = get_argument (argc, argv, "-time"))) {
     remove_argument (N, &argc, argv);
     if (!str_to_time (argv[N], &TSTART)) { 
@@ -162,5 +162,5 @@
     exit (2);
   } 
-
+  return (TRUE);
 }
 
Index: /trunk/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /trunk/Ohana/src/relphot/src/bcatalog.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/bcatalog.c	(revision 4796)
@@ -18,8 +18,8 @@
   for (i = 0; i < catalog[0].Naverage; i++) {
     if (catalog[0].average[i].Nm < 2) continue; 
-    if (catalog[0].average[i].R < fullregion[0].RA[0]) continue;
-    if (catalog[0].average[i].R > fullregion[0].RA[1]) continue;
-    if (catalog[0].average[i].D < fullregion[0].DEC[0]) continue;
-    if (catalog[0].average[i].D > fullregion[0].DEC[1]) continue;
+    if (catalog[0].average[i].R_PS < fullregion[0].RA[0]) continue;
+    if (catalog[0].average[i].R_PS > fullregion[0].RA[1]) continue;
+    if (catalog[0].average[i].D_PS < fullregion[0].DEC[0]) continue;
+    if (catalog[0].average[i].D_PS > fullregion[0].DEC[1]) continue;
 
     /* start with all stars good */
@@ -116,4 +116,4 @@
 	     subcatalog[0].Naverage, subcatalog[0].Nmeasure);
   }
-
+  return (TRUE);
 }
Index: /trunk/Ohana/src/relphot/src/find_images.c
===================================================================
--- /trunk/Ohana/src/relphot/src/find_images.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/find_images.c	(revision 4796)
@@ -11,9 +11,8 @@
   Header header;
   Image *timage, *image;
-  int i, j, k, m, found, nimage, Nimage, NIMAGE, NTIMAGE, Nloop, Nlast;
-  int n, Nim, status, InRange, ecode;
+  int i, j, k, m, found, nimage, Nimage, NIMAGE;
+  int status, InRange, ecode;
   FILE *f;
   double Xc[5], Yc[5], Xi[5], Yi[5], r, d, dx, dy;
-  char line[256];
   int *line_number;
   Coords tcoords;
Index: /trunk/Ohana/src/relphot/src/find_regions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/find_regions.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/find_regions.c	(revision 4796)
@@ -59,5 +59,5 @@
 
 
-getfullregion (Image *image, int Nimage, GSCRegion *fullregion) {
+void getfullregion (Image *image, int Nimage, GSCRegion *fullregion) {
 
   int i;
Index: /trunk/Ohana/src/relphot/src/gcatalog.c
===================================================================
--- /trunk/Ohana/src/relphot/src/gcatalog.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/gcatalog.c	(revision 4796)
@@ -3,5 +3,5 @@
 int gcatalog (Catalog *catalog, int FINAL) {
   
-  char mode, status;
+  char mode;
 
   if (FINAL) {
Index: /trunk/Ohana/src/relphot/src/get_regions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/get_regions.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/get_regions.c	(revision 4796)
@@ -55,5 +55,5 @@
   /* use the pole regions, if near pole */
   if (maxDec > 86.25) {
-    sprintf (regions[nregions].filename, "n8230/pole.cpt\0");
+    sprintf (regions[nregions].filename, "n8230/pole.cpt");
     regions[nregions].RA[0] = 0;
     regions[nregions].RA[1] = 360;
@@ -118,5 +118,5 @@
       if ((DEC1 > 0) && (minDec < DEC1) && (maxDec > DEC0) && (minRa < RA1) && (maxRa > RA0)) {
 	temp[5] = 0;
-	sprintf (regions[nregions].filename, "%s/%s.cpt\0", Dec2Sections[NBigDec + j], &temp[1]);
+	sprintf (regions[nregions].filename, "%s/%s.cpt", Dec2Sections[NBigDec + j], &temp[1]);
 	regions[nregions].RA[0] = RA0;
 	regions[nregions].RA[1] = RA1;
@@ -131,5 +131,5 @@
       if ((DEC1 < 0) && (minDec < DEC0) && (maxDec > DEC1) && (minRa < RA1) && (maxRa > RA0)) {
 	temp[5] = 0;
-	sprintf (regions[nregions].filename, "%s/%s.cpt\0", Dec2Sections[NBigDec + j], &temp[1]);
+	sprintf (regions[nregions].filename, "%s/%s.cpt", Dec2Sections[NBigDec + j], &temp[1]);
 	regions[nregions].RA[0] = RA0;
 	regions[nregions].RA[1] = RA1;
Index: /trunk/Ohana/src/relphot/src/global_stats.c
===================================================================
--- /trunk/Ohana/src/relphot/src/global_stats.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/global_stats.c	(revision 4796)
@@ -1,12 +1,5 @@
 # include "relphot.h"
 
-StatType statsImagedM (Catalog *catalog);
-
-StatType statsMosaicdM (Catalog *catalog);
-StatType statsMosaicM (Catalog *catalog);
-StatType statsMosaicN (Catalog *catalog);
-StatType statsMosaicX (Catalog *catalog);
-
-global_stats (Catalog *catalog, int Ncatalog) {
+void global_stats (Catalog *catalog, int Ncatalog) {
 
   StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD;
Index: /trunk/Ohana/src/relphot/src/initialize.c
===================================================================
--- /trunk/Ohana/src/relphot/src/initialize.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/initialize.c	(revision 4796)
@@ -2,6 +2,4 @@
 
 void initialize (int argc, char **argv) {
-
-  int Np;
 
   /* are these set correctly? */
Index: /trunk/Ohana/src/relphot/src/liststats.c
===================================================================
--- /trunk/Ohana/src/relphot/src/liststats.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/liststats.c	(revision 4796)
@@ -6,5 +6,5 @@
 static int statmode;
 
-initstats (char *mode) {
+void initstats (char *mode) {
 
   statmode = -1;
Index: /trunk/Ohana/src/relphot/src/misc.c
===================================================================
--- /trunk/Ohana/src/relphot/src/misc.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/misc.c	(revision 4796)
@@ -1,4 +1,5 @@
+# include "relphot.h"
 
-sortA (double *X, int N) {
+void sortA (double *X, int N) {
 
   int l,j,ir,i;
@@ -36,5 +37,5 @@
 }
 
-sortB (double *X, double *Y, int N) {
+void sortB (double *X, double *Y, int N) {
 
   int l,j,ir,i;
@@ -78,5 +79,5 @@
 }
 
-sortC (double *X, double *Y, double *F1, double *F2, int N) {
+void sortC (double *X, double *Y, double *F1, double *F2, int N) {
 
   int l,j,ir,i;
@@ -133,5 +134,5 @@
 }
 
-sortD (double *X, double *Y, double *Z, int N) {
+void sortD (double *X, double *Y, double *Z, int N) {
 
   int l,j,ir,i;
Index: /trunk/Ohana/src/relphot/src/plot_scatter.c
===================================================================
--- /trunk/Ohana/src/relphot/src/plot_scatter.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/plot_scatter.c	(revision 4796)
@@ -1,11 +1,9 @@
 # include "relphot.h"
    
-plot_scatter (Catalog *catalog, int Ncatalog) {
+void plot_scatter (Catalog *catalog, int Ncatalog) {
 
-  char c;
   int i, j, k, m, N, Ntot;
   short Mrel, Mcal, Mmos, Mgrid;
   double *xlist, *ylist, *ilist;
-  StatType stats;
   Graphdata graphdata;
 
Index: /trunk/Ohana/src/relphot/src/plotstuff.c
===================================================================
--- /trunk/Ohana/src/relphot/src/plotstuff.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/plotstuff.c	(revision 4796)
@@ -4,4 +4,12 @@
 static int Xgraph[5] = {0,0,0,0,0};
 static int active;
+
+/*
+static union { unsigned char c[4]; float f; } f_undef = { {0xff, 0xff, 0xff, 0xfe} };
+# define fUNDEF (f_undef.f)
+*/
+
+static union { unsigned char c[8]; float d; } d_undef = { {0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00} };
+# define dUNDEF (d_undef.d)
 
 void XDead () {
@@ -21,9 +29,8 @@
 # endif /* ANSI */
 
-  int i, InitSocket, status, addreslen;
+  int InitSocket, status, addreslen;
   struct sockaddr_un Address;
-  char temp[100], *display_name;
+  char temp[100];
   char socket_name[100];
-  FILE *f;
   
   active = N;
@@ -35,5 +42,5 @@
   Address.sun_family = AF_UNIX; 
   InitSocket = socket (AF_UNIX, SOCK_STREAM, 0); 
-  status = bind (InitSocket, &Address, sizeof (Address));
+  status = bind (InitSocket, (struct sockaddr *) &Address, sizeof (Address));
   status = listen (InitSocket, 1);
   
@@ -47,5 +54,5 @@
   
   addreslen =  sizeof (Address);
-  Xgraph[N] = accept (InitSocket, &Address, &addreslen);
+  Xgraph[N] = accept (InitSocket, (struct sockaddr *) &Address, &addreslen);
   if (Xgraph[N] < 0) {
     fprintf (stderr, "error starting kapa\n");
@@ -65,10 +72,10 @@
   write (Xgraph[N], "DBOX", 4);
   sprintf (buffer, "%f %f %f %f", graphmode[0].xmin, graphmode[0].xmax, graphmode[0].ymin, graphmode[0].ymax);
-  sprintf (buffer2, "NBYTES: %6d", strlen (buffer));
+  sprintf (buffer2, "NBYTES: %6d", (int) strlen (buffer));
   write (Xgraph[N], buffer2, 16);
   write (Xgraph[N], buffer, strlen (buffer));
 
   sprintf (buffer, "%s %s %s", "2222", "2222", "2222");
-  sprintf (buffer2, "NBYTES: %6d", strlen (buffer));
+  sprintf (buffer2, "NBYTES: %6d", (int) strlen (buffer));
   write (Xgraph[N], buffer2, 16);
   write (Xgraph[N], buffer, strlen (buffer));
@@ -76,10 +83,11 @@
 
 void JpegPlot (Graphdata *graphmode, int N, char *filename) {
-  char buffer[65], buffer2[65];
+
+  char buffer[65];
 
   if (Xgraph[N] == 0) return;
 
   write (Xgraph[N], "PNGF", 4);
-  sprintf (buffer, "LEN: %11d", strlen (filename));
+  sprintf (buffer, "LEN: %11d", (int) strlen (filename));
   write (Xgraph[N], buffer, 16);
   write (Xgraph[N], filename, strlen (filename));
@@ -88,10 +96,11 @@
 
 void PSPlot (Graphdata *graphmode, int N, char *filename) {
-  char buffer[65], buffer2[65];
+
+  char buffer[65];
 
   if (Xgraph[N] == 0) return;
 
   write (Xgraph[N], "PSIT", 4);
-  sprintf (buffer, "LEN: %11d", strlen (filename));
+  sprintf (buffer, "LEN: %11d", (int) strlen (filename));
   write (Xgraph[N], buffer, 16);
   write (Xgraph[N], filename, strlen (filename));
@@ -126,5 +135,5 @@
 	   graphmode[0].etype, graphmode[0].color, 
 	   graphmode[0].lweight, graphmode[0].size);
-  sprintf (buffer2, "NBYTES: %6d", strlen (buffer));
+  sprintf (buffer2, "NBYTES: %6d", (int) strlen (buffer));
   write (Xgraph[N], buffer2, 16);
   write (Xgraph[N], buffer, strlen (buffer));
@@ -133,5 +142,5 @@
 	   graphmode[0].xmin, graphmode[0].xmax, 
 	   graphmode[0].ymin, graphmode[0].ymax);
-  sprintf (buffer2, "NBYTES: %6d", strlen (buffer));
+  sprintf (buffer2, "NBYTES: %6d", (int) strlen (buffer));
   write (Xgraph[N], buffer2, 16);
   write (Xgraph[N], buffer, strlen (buffer));
@@ -146,5 +155,5 @@
 
   write (Xgraph[N], "LABL", 4);
-  sprintf (buffer, " %6d %6d", strlen (string), 2);
+  sprintf (buffer, " %6d %6d", (int) strlen (string), 2);
   write (Xgraph[N], buffer, 16);
   write (Xgraph[N], string, strlen (string));
@@ -170,8 +179,7 @@
 }
 
-plot_list (Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *file) {
+void plot_list (Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *file) {
 
   int i;
-  char c;
   StatType stats;
   
@@ -207,5 +215,5 @@
 }
 
-plot_defaults (Graphdata *graphdata) {
+void plot_defaults (Graphdata *graphdata) {
 
   graphdata[0].style = 2;
Index: /trunk/Ohana/src/relphot/src/relphot.c
===================================================================
--- /trunk/Ohana/src/relphot/src/relphot.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/relphot.c	(revision 4796)
@@ -4,7 +4,6 @@
 int main (int argc, char **argv) {
 
-  char c;
   int i, Ncatalog;
-  Catalog *catalog, tcatalog;
+  Catalog *catalog;
   GSCRegion fullregion, *region;
 
@@ -81,5 +80,5 @@
   reload_catalogs (region, Ncatalog, &fullregion);
   wimages (); 
-
+  exit (0);
 }
 
Index: /trunk/Ohana/src/relphot/src/setExclusions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/setExclusions.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/setExclusions.c	(revision 4796)
@@ -1,5 +1,3 @@
 # include "relphot.h"
-
-Coords *getCoords (int meas, int cat);
 
 int setExclusions (Catalog *catalog, int Ncatalog) {
@@ -27,6 +25,6 @@
 	/* select measurements by mag limit */
 	if (AreaSelect) {
-	  r = catalog[i].average[j].R + catalog[i].measure[m].dR / 360000.0;
-	  d = catalog[i].average[j].D + catalog[i].measure[m].dD / 360000.0;
+	  r = catalog[i].average[j].R_PS + catalog[i].measure[m].dR_PS / 3600.0;
+	  d = catalog[i].average[j].D_PS + catalog[i].measure[m].dD_PS / 3600.0;
 	  if ((coords = getCoords (m, i)) == NULL) goto markbad;
 	  RD_to_XY (&x, &y, r, d, coords);
@@ -52,5 +50,4 @@
   if (VERBOSE) fprintf (stderr, "%d measurements marked by area\n", Narea);
   if (VERBOSE) fprintf (stderr, "%d measurements marked nocal\n", Nnocal);
+  return (TRUE);
 }
-
-
Index: /trunk/Ohana/src/relphot/src/setMrelFinal.c
===================================================================
--- /trunk/Ohana/src/relphot/src/setMrelFinal.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/setMrelFinal.c	(revision 4796)
@@ -1,6 +1,3 @@
 # include "relphot.h"
-
-void skip_measurements (Catalog *catalog, int pass);
-Image *getimages (int *N);
 
 void setMrelFinal (Catalog *catalog) {
@@ -73,8 +70,7 @@
 void skip_measurements (Catalog *catalog, int pass) {
 
-  int i, j, k, m, Nimage, ecode, d1, d2;
+  int i, k, m, ecode, d1, d2;
   int Ntot, Ntry, Nkeep, Nskip;
   short mag;
-  Image *image;
 
   Ntot = Ntry = Nskip = Nkeep = 0;
Index: /trunk/Ohana/src/relphot/src/time.c
===================================================================
--- /trunk/Ohana/src/relphot/src/time.c	(revision 4795)
+++ /trunk/Ohana/src/relphot/src/time.c	(revision 4796)
@@ -1,12 +1,4 @@
-# include <ohana.h>
-
-int dms_to_ddd (double *Value, char *string);
-int str_to_radec (double *ra, double *dec, char *str1, char *str2);
-int chk_time (char *line);
-double sec_to_jd (unsigned long second);
-unsigned long int jd_to_sec (double jd);
-char *sec_to_date (unsigned long second);
-unsigned long date_to_sec (char *date);
-  
+# include "relphot.h"
+
 /***** convert [-]00:00:00 to 0.0000 ****/
 int dms_to_ddd (double *Value, char *string) {
@@ -305,5 +297,5 @@
 int Fseek (FILE *f, long offset, int whence) {
 
-  int status, k;
+  int status;
 
   status = fseek (f, offset, whence);
