Index: trunk/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 27367)
+++ trunk/Ohana/src/addstar/src/ReadImageHeader.c	(revision 27369)
@@ -85,5 +85,5 @@
   }
 
-  { 
+  {
     double R, D;
     /* sanity check on the image coordinates */
@@ -94,9 +94,9 @@
     }
   }
-    
+
   /* CERROR in data file is in arcsec */
   if (!gfits_scan (header, "CERROR",   "%lf", 1, &tmp)) tmp = 1.0;
   image[0].cerror = tmp * 50.0;
- 
+
   /* get photcode from header */
   if (photcode == 0) {
@@ -112,5 +112,5 @@
     photcode = photcodeData[0].code;
   }
-  if (photcode == 0) { 
+  if (photcode == 0) {
     fprintf (stderr, "no valid photcode is supplied\n");
     return (FALSE);
@@ -122,5 +122,5 @@
   gfits_scan (header, ExptimeKeyword,  "%lf", 1, &tmp);
   image[0].exptime = tmp;
-  
+
   /*** why are we no longer using APMIFIT?? ***/
   tmp = 0;
@@ -172,5 +172,5 @@
   if (gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp)) {
     image[0].secz = tmp;
-  } 
+  }
 
   if (!gfits_scan (header, CCDNumKeyword, "%s", 1, ccdnum)) {
@@ -184,9 +184,9 @@
     // get rid of any leading non-digit characters
     while (*p && !isdigit(*p)) p++;
-    if (*p == 0) {
-      fprintf (stderr, "invalid ccdnum %s\n", ccdnum);
-      return FALSE;
-    }
-    image[0].ccdnum = atoi(p);
+    if (*p) {
+        image[0].ccdnum = atoi(p);
+    } else {
+        image[0].ccdnum = 0;
+    }
   }
 
@@ -198,5 +198,5 @@
   } else {
     if (sourceID > 0xffff) {
-      fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID); 
+      fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID);
       return (FALSE);
     }
@@ -207,8 +207,8 @@
   // 0 - 32 so it would fit in an unsigned int.  This is also needed because some programs like
   // sextractor will put in an arbitrary zero point that we need to understand to get back to
-  // instrumental mags.  
+  // instrumental mags.
   gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt);
   if (ZeroPt != GetZeroPoint()) {
-      fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 
+      fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint());
   }
 
@@ -217,9 +217,9 @@
       float ZPT_OBS;
       if (!photcodeData || !gfits_scan (header, "ZPT_OBS", "%f", 1, &ZPT_OBS)) {
-	  fprintf (stderr, "zero point not supplied in header\n");
-	  ZERO_POINT_OFFSET = 0.0;
+          fprintf (stderr, "zero point not supplied in header\n");
+          ZERO_POINT_OFFSET = 0.0;
       } else {
-	  ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
-      }	  
+          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
+      }
   }
 
@@ -227,9 +227,9 @@
   if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
       if (!photcodeData) {
-	  fprintf (stderr, "photcode data not supplied for this chip\n");
-	  ZERO_POINT_OFFSET = 0.0;
+          fprintf (stderr, "photcode data not supplied for this chip\n");
+          ZERO_POINT_OFFSET = 0.0;
       } else {
-	  ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
-      }	  
+          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
+      }
   }
 
