Index: /trunk/Ohana/Makefile
===================================================================
--- /trunk/Ohana/Makefile	(revision 3399)
+++ /trunk/Ohana/Makefile	(revision 3400)
@@ -28,6 +28,4 @@
 # directory may be compiled by going to those directories. 
 PROGRAM =   \
-addrefs     \
-addspphot   \
 addstar     \
 delstar     \
@@ -42,5 +40,5 @@
 kii         \
 misc        \
-mosastro.v2 \
+mosastro.v3 \
 nightd      \
 opihi.v2    \
@@ -56,4 +54,6 @@
 opihi.v1    \
 addusno     \
+addrefs     \
+addspphot   \
 fixcat      \
 getstar     \
@@ -63,4 +63,5 @@
 markstar    \
 mosastro.v1 \
+mosastro.v2 \
 skycalc     
 
Index: /trunk/Ohana/src/addstar/include/addstar.h
===================================================================
--- /trunk/Ohana/src/addstar/include/addstar.h	(revision 3399)
+++ /trunk/Ohana/src/addstar/include/addstar.h	(revision 3400)
@@ -161,4 +161,6 @@
 int FindRegionDecBandStart (GSCRegion *region, int Nregion, double dec);
 int FindRegionDecBandStop (GSCRegion *region, int Nregion, double dec);
+int FindDecBand (double dec, double *DEC0, double *DEC1);
+
 int hms_to_deg (double *h0, double *h1, double *d0, double *d1, char *string);
 void find_matches_refstars (GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog);
Index: /trunk/Ohana/src/addstar/src/RegionOps.c
===================================================================
--- /trunk/Ohana/src/addstar/src/RegionOps.c	(revision 3399)
+++ /trunk/Ohana/src/addstar/src/RegionOps.c	(revision 3400)
@@ -21,6 +21,6 @@
 GSCRegion *LoadRegions (int *nregions) {
   
-  int Nregions, i, N, NDec, Nx, Ny;
-  char buffer[28800], temp[50], file[256];
+  int Nregions, i, NDec, Nx, Ny;
+  char temp[50], file[256];
   double RA0, RA1, DEC0, DEC1, D0, D1;
   FILE *f;
Index: /trunk/Ohana/src/addstar/src/get2mass.c
===================================================================
--- /trunk/Ohana/src/addstar/src/get2mass.c	(revision 3399)
+++ /trunk/Ohana/src/addstar/src/get2mass.c	(revision 3400)
@@ -5,5 +5,5 @@
 Stars *get2mass (GSCRegion *patch, int *NSTARS) {
   
-  int i, j, k, Ns, Nstars, Nrefcat, Nregions; 
+  int i, Nstars, Nrefcat, Nregions; 
   Stars     *stars;
   Stars     *refcat;
@@ -84,10 +84,9 @@
 Stars *get2mass_data (TM_Region *region, GSCRegion *patch, int *nstars) {
   
-  int i, Nstars, NSTARS, Nbyte, Nline, Nval;
+  int i, Nstars, NSTARS, Nbyte, Nline;
   Stars *stars;
   gzFile gf;
-  char *filename, buffer[NLINE*NBYTE], datestr[64];
+  char *filename, buffer[NLINE*NBYTE];
   double RA, DEC, J, H, K, dJ, dH, dK;
-  e_time time;
   double RA0, RA1, DEC0, DEC1;
 
@@ -170,12 +169,4 @@
 }
 
-/*
-      Nval  = sscanf (&buffer[NBYTE*i + 	 0], "%lf %lf", &RA, &DEC);
-      Nval += sscanf (&buffer[NBYTE*i + 	53], "%lf %lf", &J, &dJ);
-      Nval += sscanf (&buffer[NBYTE*i + 	72], "%lf %lf", &H, &dH);
-      Nval += sscanf (&buffer[NBYTE*i + 	91], "%lf %lf", &K, &dK);
-      Nval += sscanf (&buffer[NBYTE*i + 164], "%s", datestr);
-*/
-
     /* this just scans along in the file.  file is sorted by dec, so we 
        should be skipping large chunks - but we would need to have
Index: /trunk/Ohana/src/addstar/src/getgsc.c
===================================================================
--- /trunk/Ohana/src/addstar/src/getgsc.c	(revision 3399)
+++ /trunk/Ohana/src/addstar/src/getgsc.c	(revision 3400)
@@ -8,5 +8,5 @@
 Stars *getgsc (GSCRegion *patch, int *NSTARS) {
   
-  int i, j, k, Ns, Ngsc, Nregions, Nstars; 
+  int i, Ngsc, Nregions, Nstars; 
   Stars *gsc;
   Stars *stars;
Index: /trunk/Ohana/src/addstar/src/greference.c
===================================================================
--- /trunk/Ohana/src/addstar/src/greference.c	(revision 3399)
+++ /trunk/Ohana/src/addstar/src/greference.c	(revision 3400)
@@ -10,4 +10,5 @@
 
   Nstars = 0;
+  stars = NULL;
 
   /* get stars from USNO for the given region */
Index: /trunk/Ohana/src/elixir/src/MachineOps.c
===================================================================
--- /trunk/Ohana/src/elixir/src/MachineOps.c	(revision 3399)
+++ /trunk/Ohana/src/elixir/src/MachineOps.c	(revision 3400)
@@ -447,4 +447,5 @@
   double dt;
 
+  fd = 0;
   if (filename == (char *) NULL) {
     system ("tput clear");
Index: /trunk/Ohana/src/libfits/header/F_modify.c
===================================================================
--- /trunk/Ohana/src/libfits/header/F_modify.c	(revision 3399)
+++ /trunk/Ohana/src/libfits/header/F_modify.c	(revision 3400)
@@ -102,5 +102,4 @@
 char *fits_keyword_start (char *line) {
 
-  int done;
   char *c;
 
Index: /trunk/Ohana/src/libfits/include/fits.h
===================================================================
--- /trunk/Ohana/src/libfits/include/fits.h	(revision 3399)
+++ /trunk/Ohana/src/libfits/include/fits.h	(revision 3400)
@@ -32,10 +32,10 @@
   X = (T *) malloc ((unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
   if (X == NULL) { \
-    fprintf(stderr,"failed malloc at %s in %s\n", __LINE__, __FILE__);\
+    fprintf(stderr,"failed malloc at %d in %s\n", __LINE__, __FILE__);\
     exit (10); } 
 # define REALLOCATE(X,T,S) \
   X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
   if (X == NULL) { \
-    fprintf(stderr,"failed realloc at %s in %s\n", __LINE__, __FILE__);\
+    fprintf(stderr,"failed realloc at %d in %s\n", __LINE__, __FILE__);\
     exit (10); }
 # define CHECK_REALLOCATE(X,T,S,N,D) \
@@ -44,5 +44,5 @@
     X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
     if (X == NULL) { \
-      fprintf(stderr,"failed realloc increment at %s in %s\n", __LINE__, __FILE__);\
+      fprintf(stderr,"failed realloc increment at %d in %s\n", __LINE__, __FILE__);\
       exit (10); } }
 # endif /* ALLOCATE */
Index: /trunk/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- /trunk/Ohana/src/libfits/table/F_get_column.c	(revision 3399)
+++ /trunk/Ohana/src/libfits/table/F_get_column.c	(revision 3400)
@@ -197,4 +197,5 @@
   if (label == (char *) NULL) return (FALSE);
   if (label[0] == 0) return (FALSE);
+  array = NULL;
 
   /* find label in header */
Index: /trunk/Ohana/src/libfits/table/F_table_format.c
===================================================================
--- /trunk/Ohana/src/libfits/table/F_table_format.c	(revision 3399)
+++ /trunk/Ohana/src/libfits/table/F_table_format.c	(revision 3400)
@@ -54,5 +54,5 @@
 int fits_table_format (char *format, char *type, int *Nval, int *Nbytes) {
 
-  char Fchar, foo[80], bar;
+  char Fchar, Size[80], Type;
   int Nv;
 
@@ -64,15 +64,16 @@
   if (Nv == 0) { 
     Nv = 1;
-    strcpy (foo, "1");
+    strcpy (Size, "1");
   } else {
-    strcpy (foo, &format[1]);
+    strcpy (Size, &format[1]);
   }
-
-  if (Fchar == 'F') { *Nbytes = 1;  strcpy (type, "float");  bar = 'f'; *Nval = Nv; }
-  if (Fchar == 'I') { *Nbytes = 1;  strcpy (type, "int");    bar = 'd'; *Nval = Nv; }
-  if (Fchar == 'A') { *Nbytes = 1;  strcpy (type, "char");   bar = 's'; *Nval = Nv; }
+  
+  Type = 'x';
+  if (Fchar == 'F') { *Nbytes = 1;  strcpy (type, "float");  Type = 'f'; *Nval = Nv; }
+  if (Fchar == 'I') { *Nbytes = 1;  strcpy (type, "int");    Type = 'd'; *Nval = Nv; }
+  if (Fchar == 'A') { *Nbytes = 1;  strcpy (type, "char");   Type = 's'; *Nval = Nv; }
   if (!*Nbytes) { return (FALSE); }
   
-  sprintf (format, "%%-%s%c", foo, bar);
+  sprintf (format, "%%-%s%c", Size, Type);
 
   return (TRUE);
Index: /trunk/Ohana/src/libohana/include/loneos.h
===================================================================
--- /trunk/Ohana/src/libohana/include/loneos.h	(revision 3399)
+++ /trunk/Ohana/src/libohana/include/loneos.h	(revision 3400)
@@ -414,4 +414,9 @@
 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
 
+int FindMosaicForImage (Image *images, int Nimages, int entry);
+int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
+int FindMosaicForImage_MatchSearch (Image *images, int Nimages, int entry);
+int BuildChipMatch (Image *images, int Nimages);
+
 short int putMi (double value);
 double getMi (short int value);
Index: /trunk/Ohana/src/libohana/include/ohana.h
===================================================================
--- /trunk/Ohana/src/libohana/include/ohana.h	(revision 3399)
+++ /trunk/Ohana/src/libohana/include/ohana.h	(revision 3400)
@@ -78,10 +78,10 @@
   X = (T *) malloc ((unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
   if (X == NULL) { \
-    fprintf(stderr,"failed malloc at %s in %s\n", __LINE__, __FILE__);\
+    fprintf(stderr,"failed malloc at %d in %s\n", __LINE__, __FILE__);\
     exit (10); } 
 # define REALLOCATE(X,T,S) \
   X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
   if (X == NULL) { \
-    fprintf(stderr,"failed realloc at %s in %s\n", __LINE__, __FILE__);\
+    fprintf(stderr,"failed realloc at %d in %s\n", __LINE__, __FILE__);\
     exit (10); }
 # define CHECK_REALLOCATE(X,T,S,N,D) \
@@ -90,5 +90,5 @@
     X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \
     if (X == NULL) { \
-      fprintf(stderr,"failed realloc increment at %s in %s\n", __LINE__, __FILE__);\
+      fprintf(stderr,"failed realloc increment at %d in %s\n", __LINE__, __FILE__);\
       exit (10); } }
 # endif /* ALLOCATE */
