Index: trunk/SophyaExt/XephemAstroLib/aa_hadec.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/aa_hadec.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/aa_hadec.c	(revision 3111)
@@ -75,3 +75,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: aa_hadec.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: aa_hadec.c,v $ $Date: 2006-11-22 13:53:27 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/aberration.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/aberration.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/aberration.c	(revision 3111)
@@ -35,5 +35,39 @@
 ab_eq (double mj, double lsn, double *ra, double *dec)
 {
+#if defined(USE_MEEUS_AB_EQ)
+
+	/* this claims to account for earth orbit excentricity and is also
+	 * smooth clear to dec=90 but it does not work well backwards with
+	 * ap_as()
+	 */
 	ab_aux(mj, ra, dec, lsn, AB_EQ_EOD);
+
+#else /* use Montenbruck */
+
+	/* this agrees with Meeus to within 0.2 arcsec until dec gets larger
+	 * than about 89.9, then grows to 1as at 89.97. but it works very
+	 * smoothly with ap_as
+	 */
+	double x, y, z;		/* equatorial rectangular coords */
+	double vx, vy, vz;	/* aberration velocity in rectangular coords */
+	double L;		/* helio long of earth */
+	double cL;
+	double r;
+
+
+	sphcart (*ra, *dec, 1.0, &x, &y, &z);
+
+	L = 2*PI*(0.27908 + 100.00214*(mj-J2000)/36525.0);
+	cL = cos(L);
+	vx = -0.994e-4*sin(L);
+	vy = 0.912e-4*cL;
+	vz = 0.395e-4*cL;
+	x += vx;
+	y += vy;
+	z += vz;
+
+	cartsph (x, y, z, ra, dec, &r);
+
+#endif
 }
 
@@ -111,6 +145,6 @@
 		
 		*ra += dra;
-		range (ra, 2*PI);
 		*dec += ddec;
+		radecrange (ra, dec);
 	    }
 	    break;
@@ -125,3 +159,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: aberration.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: aberration.c,v $ $Date: 2006-11-22 13:53:27 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/actan.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/actan.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/actan.c	(revision 3111)
@@ -1,5 +1,5 @@
 #include <math.h>
 
-/* @(#) $Id: actan.c,v 1.5 2005-08-21 10:02:36 cmv Exp $ */
+/* @(#) $Id: actan.c,v 1.6 2006-11-22 13:53:27 cmv Exp $ */
 
 /* commonly in math.h, but not in strict ANSI C */
@@ -65,3 +65,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: actan.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: actan.c,v $ $Date: 2006-11-22 13:53:27 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/airmass.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/airmass.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/airmass.c	(revision 3111)
@@ -24,3 +24,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: airmass.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: airmass.c,v $ $Date: 2006-11-22 13:53:27 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/anomaly.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/anomaly.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/anomaly.c	(revision 3111)
@@ -61,3 +61,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: anomaly.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: anomaly.c,v $ $Date: 2006-11-22 13:53:27 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/ap_as.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/ap_as.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/ap_as.c	(revision 3111)
@@ -1,3 +1,4 @@
 #include <string.h>
+#include <math.h>
 
 #include "astro.h"
@@ -11,7 +12,9 @@
 ap_as (Now *np, double Mjd, double *rap, double *decp)
 {
+	double r0 = *rap, d0 = *decp;
 	Obj o;
 	Now n;
 
+	/* as -> ap */
 	zero_mem ((void *)&o, sizeof(o));
 	o.o_type = FIXED;
@@ -24,4 +27,16 @@
 	*rap -= o.s_ra - *rap;
 	*decp -= o.s_dec - *decp;
+
+	/* then back to start for second order correction */
+	o.o_type = FIXED;
+	o.f_RA = (float)*rap;
+	o.f_dec = (float)*decp;
+	o.f_epoch = (float)mjd;
+	memcpy ((void *)&n, (void *)np, sizeof(Now));
+	n.n_epoch = EOD;
+	obj_cir (&n, &o);
+	*rap -= o.s_ra - r0;
+	*decp -= o.s_dec - d0;
+
 	radecrange (rap, decp);
 	precess (mjd, Mjd, rap, decp);
@@ -51,3 +66,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: ap_as.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: ap_as.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/astro.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/astro.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/astro.h	(revision 3111)
@@ -657,5 +657,5 @@
 /* formats.c */
 extern int fs_sexa (char *out, double a, int w, int fracbase);
-extern int fs_date (char out[], double jd);
+extern int fs_date (char out[], int format, double jd);
 extern int f_scansexa (const char *str, double *dp);
 extern void f_sscandate (char *bp, int pref, int *m, double *d, int *y);
@@ -810,4 +810,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: astro.h,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: astro.h,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/atlas.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/atlas.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/atlas.c	(revision 3111)
@@ -194,3 +194,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: atlas.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: atlas.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/auxil.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/auxil.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/auxil.c	(revision 3111)
@@ -40,3 +40,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: auxil.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: auxil.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/bdl.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/bdl.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/bdl.c	(revision 3111)
@@ -232,3 +232,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: bdl.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: bdl.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/bdl.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/bdl.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/bdl.h	(revision 3111)
@@ -3,4 +3,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: bdl.h,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: bdl.h,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/chap95.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/chap95.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/chap95.c	(revision 3111)
@@ -172,3 +172,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: chap95.c,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: chap95.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/chap95.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/chap95.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/chap95.h	(revision 3111)
@@ -65,4 +65,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: chap95.h,v $ $Date: 2005-08-21 10:02:36 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: chap95.h,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/chap95_data.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/chap95_data.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/chap95_data.c	(revision 3111)
@@ -781,3 +781,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: chap95_data.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: chap95_data.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/circum.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/circum.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/circum.c	(revision 3111)
@@ -861,3 +861,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: circum.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: circum.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/comet.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/comet.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/comet.c	(revision 3111)
@@ -81,3 +81,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: comet.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: comet.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/constel.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/constel.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/constel.c	(revision 3111)
@@ -1801,3 +1801,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: constel.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: constel.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/dbfmt.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/dbfmt.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/dbfmt.c	(revision 3111)
@@ -142,11 +142,4 @@
 db_write_line (Obj *op, char lp[])
 {
-	int priorpref;
-
-	/* .edb format always uses MDY.
-	 * N.B. must restore old value before returning from here!
-	 */
-	priorpref = pref_set (PREF_DATE_FORMAT, PREF_MDY);
-
 	switch (op->o_type) {
 	case FIXED:
@@ -182,7 +175,4 @@
 	    abort();
 	}
-
-	/* restore date format preference */
-	(void) pref_set (PREF_DATE_FORMAT, priorpref);
 }
 
@@ -836,8 +826,8 @@
 	    *lp++ = '|';
 	    if (*sp)
-		lp += fs_date (lp, *sp);
+		lp += fs_date (lp, PREF_MDY, *sp);
 	    if (*ep) {
 		*lp++ = '|';
-		lp += fs_date (lp, *ep);
+		lp += fs_date (lp, PREF_MDY, *ep);
 	    }
 	}
@@ -885,8 +875,8 @@
 	lp += sprintf (lp, ",%.7g", op->e_M);
 	*lp++ = ',';
-	lp += fs_date (lp, op->e_cepoch);
+	lp += fs_date (lp, PREF_MDY, op->e_cepoch);
 	lp += get_okdates (lp, &op->e_startok, &op->e_endok);
 	*lp++ = ',';
-	lp += fs_date (lp, op->e_epoch);
+	lp += fs_date (lp, PREF_MDY, op->e_epoch);
 	if (op->e_mag.whichm == MAG_gk)
 	    lp += sprintf (lp, ",g%.7g", op->e_mag.m1);
@@ -904,5 +894,5 @@
 	lp += sprintf (lp, "%s,h", op->o_name);
 	*lp++ = ',';
-	lp += fs_date (lp, op->h_ep);
+	lp += fs_date (lp, PREF_MDY, op->h_ep);
 	lp += get_okdates (lp, &op->h_startok, &op->h_endok);
 	lp += sprintf (lp, ",%.7g", op->h_inc);
@@ -912,5 +902,5 @@
 	lp += sprintf (lp, ",%.7g", op->h_qp);
 	*lp++ = ',';
-	lp += fs_date (lp, op->h_epoch);
+	lp += fs_date (lp, PREF_MDY, op->h_epoch);
 	lp += sprintf (lp, ",%.7g", op->h_g);
 	lp += sprintf (lp, ",%.7g", op->h_k);
@@ -923,5 +913,5 @@
 	lp += sprintf (lp, "%s,p", op->o_name);
 	*lp++ = ',';
-	lp += fs_date (lp, op->p_ep);
+	lp += fs_date (lp, PREF_MDY, op->p_ep);
 	lp += get_okdates (lp, &op->p_startok, &op->p_endok);
 	lp += sprintf (lp, ",%.7g", op->p_inc);
@@ -930,5 +920,5 @@
 	lp += sprintf (lp, ",%.7g", op->p_Om);
 	*lp++ = ',';
-	lp += fs_date (lp, op->p_epoch);
+	lp += fs_date (lp, PREF_MDY, op->p_epoch);
 	lp += sprintf (lp, ",%.7g", op->p_g);
 	lp += sprintf (lp, ",%.7g", op->p_k);
@@ -941,5 +931,5 @@
 	lp += sprintf (lp, "%s,E", op->o_name);
 	*lp++ = ',';
-	lp += fs_date (lp, op->es_epoch);
+	lp += fs_date (lp, PREF_MDY, op->es_epoch);
 	lp += get_okdates (lp, &op->es_startok, &op->es_endok);
 	lp += sprintf (lp, ",%.7g", op->es_inc);
@@ -1006,3 +996,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: dbfmt.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: dbfmt.c,v $ $Date: 2006-11-22 13:53:28 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/deep.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/deep.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/deep.c	(revision 3111)
@@ -788,3 +788,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deep.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deep.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/deepconst.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/deepconst.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/deepconst.h	(revision 3111)
@@ -2,5 +2,5 @@
 #define _CONST_H
 
-/* $Id: deepconst.h,v 1.5 2005-08-21 10:02:37 cmv Exp $ */
+/* $Id: deepconst.h,v 1.6 2006-11-22 13:53:29 cmv Exp $ */
 
 
@@ -31,4 +31,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: deepconst.h,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: deepconst.h,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/deltat.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/deltat.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/deltat.c	(revision 3111)
@@ -144,8 +144,7 @@
     /* 1999 USNO data 1998.0 thru 2000.0 (McBurnett) */
      6297, 6347, 6383, 
-    /* 1999 extrapolation (McBurnett), 2001.0 thru 2006.0
-       Ramp up to 1.6 s/yr to transition smoothly to Stevenson formula
-       in 2130.0 */
-     6440, 6510, 6600, 6750, 6900, 7060
+    /* 1999 extrapolation (McBurnett), 2001.0 thru 2006.0 */
+     /* 6440, 6510, 6600, 6750, 6900, 7060 */
+     6409, 6430, 6447, 6507, 6578, 6610	/* ECD */
 
     /* original 1997 USNO extrapolation (stern), 1998.0 thru 2004.0
@@ -178,14 +177,14 @@
 	Y = 2000.0 + (mj - J2000)/365.25;
 
-	if( Y > TABEND  &&  Y < 2130.0 ) {
+	if( Y > TABEND) {
 	    /* linear interpolation from table end; stern */
 	    B = Y - TABEND;
-	    ans = dt[TABSIZ-1] + B * (dt[TABSIZ-1]  - dt[TABSIZ-2]);
+	    ans = dt[TABSIZ-1] + B * (dt[TABSIZ-1]  - dt[TABSIZ-11])/10;
 	    ans *= 0.01;
 	    return(ans);
 	}
 
-	if( Y < TABSTART  ||  Y >= 2130.0 ) {
-	    if( (Y >= 948.0 - 15.0  &&  Y < TABSTART) ||  Y >= 2130.0 ) {
+	if( Y < TABSTART) {
+	    if( Y >= 948.0 - 15.0 ) {
 		/* Stephenson and Morrison, stated domain is 948 to 1600:
 		 * 25.5(centuries from 1800)^2 - 1.9159(centuries from 1955)^2
@@ -304,3 +303,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deltat.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: deltat.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/earthsat.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/earthsat.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/earthsat.c	(revision 3111)
@@ -784,3 +784,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: earthsat.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: earthsat.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/eq_ecl.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/eq_ecl.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/eq_ecl.c	(revision 3111)
@@ -70,3 +70,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: eq_ecl.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: eq_ecl.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/eq_gal.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/eq_gal.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/eq_gal.c	(revision 3111)
@@ -97,3 +97,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: eq_gal.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: eq_gal.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/formats.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/formats.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/formats.c	(revision 3111)
@@ -77,12 +77,11 @@
 }
 
-/* put the given modified Julian date, jd, in out[] according to preference
- * format.
+/* put the given modified Julian date, jd, in out[] according to the given
+ * preference format.
  * return number of characters written to out, not counting final '\0'.
  */
 int
-fs_date (char out[], double jd)
-{
-	int p = pref_get (PREF_DATE_FORMAT);
+fs_date (char out[], int format, double jd)
+{
 	char *out0 = out;
 	int m, y;
@@ -96,5 +95,5 @@
 	    mjd_cal (mjd_day(jd+0.5), &m, &d, &y);
 
-	switch (p) {
+	switch (format) {
 	case PREF_YMD:
 	    out += sprintf (out, "%4d/%02d/%02.6g", y, m, d);
@@ -107,5 +106,5 @@
 	    break;
 	default:
-	    printf ("fs_date: bad date pref: %d\n", p);
+	    printf ("fs_date: bad date pref: %d\n", format);
 	    abort();
 	}
@@ -125,8 +124,8 @@
 double *dp)		/* cracked value, if return 0 */
 {
-	double a = 0, b = 0, c = 0;
-	char str[128];
+	double a, b, c;
+	char str[256];
 	char *neg;
-	int r;
+	int isneg, r;
 
 	/* copy str0 so we can play with it */
@@ -134,12 +133,21 @@
 	str[sizeof(str)-1] = '\0';
 
+	/* note first negative (but not fooled by neg exponent) */
+	isneg = 0;
 	neg = strchr(str, '-');
-	if (neg)
+	if (neg && (neg == str || (neg[-1] != 'E' && neg[-1] != 'e'))) {
 	    *neg = ' ';
+	    isneg = 1;
+	}
+
+	/* crack up to three components */
+	a = b = c = 0.0;
 	r = sscanf (str, "%lf%*[^0-9]%lf%*[^0-9]%lf", &a, &b, &c);
 	if (r < 1)
 	    return (-1);
-	*dp = a + b/60 + c/3600;
-	if (neg)
+
+	/* back to one value, restoring neg */
+	*dp = (c/60.0 + b)/60.0 + a;
+	if (isneg)
 	    *dp *= -1;
 	return (0);
@@ -202,3 +210,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: formats.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: formats.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/helio.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/helio.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/helio.c	(revision 3111)
@@ -49,3 +49,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: helio.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: helio.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/jupmoon.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/jupmoon.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/jupmoon.c	(revision 3111)
@@ -4,4 +4,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
@@ -31,7 +32,4 @@
 static double cmlIImjd;	/*    "                      II      " */
 
-/* file containing BDL coefficients */
-static char jbdlfn[] = "jupiter.9910";
-
 /* These values are from the Explanatory Supplement.
  * Precession degrades them gradually over time.
@@ -134,24 +132,33 @@
 	char buf[1024];
 	FILE *fp;
-	int i;
-
-	/* only valid 1999 through 2010 */
-	if (JD < 2451179.50000 || JD >= 2455562.5)
+	char *fn;
+	int i;
+
+	/* check ranges and appropriate data file */
+	if (JD < 2451179.50000)		/* Jan 1 1999 UTC */
+	    return (-1);
+	if (JD < 2455562.5)		/* Jan 1 2011 UTC */
+	    fn = "jupiter.9910";
+	else if (JD < 2459215.5)	/* Jan 1 2021 UTC */
+	    fn = "jupiter.1020";
+	else
 	    return (-1);
 
 	/* open */
-	(void) sprintf (buf, "%s/%s", dir, jbdlfn);
+	(void) sprintf (buf, "%s/%s", dir, fn);
 	fp = fopen (buf, "r");
-	if (!fp)
-	    return (-1);
+	if (!fp) {
+	    fprintf (stderr, "%s: %s\n", fn, strerror(errno));
+	    return (-1);
+	}
 
 	/* use it */
 	if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
-	    fprintf (stderr, "%s: %s\n", jbdlfn, buf);
+	    fprintf (stderr, "%s: %s\n", fn, buf);
 	    fclose (fp);
 	    return (-1);
 	}
 	if (i != J_NMOONS-1) {
-	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", jbdlfn, 
+	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn, 
 								i, J_NMOONS-1);
 	    fclose (fp);
@@ -382,3 +389,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: jupmoon.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: jupmoon.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/libration.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/libration.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/libration.c	(revision 3111)
@@ -2216,3 +2216,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: libration.c,v $ $Date: 2005-08-21 10:02:37 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: libration.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/magdecl.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/magdecl.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/magdecl.c	(revision 3111)
@@ -379,3 +379,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: magdecl.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: magdecl.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/marsmoon.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/marsmoon.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/marsmoon.c	(revision 3111)
@@ -4,4 +4,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
@@ -24,7 +25,4 @@
 };
 static double sizemjd;
-
-/* file containing BDL coefficients */
-static char mbdlfn[] = "mars.9910";
 
 /* These values are from the Explanatory Supplement.
@@ -87,5 +85,5 @@
 
 	/* get moon x,y,z from BDL if possible */
-	if (dir && use_bdl (JD, dir, md) < 0) {
+	if (!dir || use_bdl (JD, dir, md) < 0) {
 	    int i;
 	    for (i = 1; i < M_NMOONS; i++)
@@ -122,24 +120,33 @@
 	char buf[1024];
 	FILE *fp;
-	int i;
-
-	/* only valid 1999 through 2010 */
-	if (JD < 2451179.50000 || JD >= 2455562.5)
+	char *fn;
+	int i;
+
+	/* check ranges and appropriate data file */
+	if (JD < 2451179.50000)		/* Jan 1 1999 UTC */
+	    return (-1);
+	if (JD < 2455562.5)		/* Jan 1 2011 UTC */
+	    fn = "mars.9910";
+	else if (JD < 2459215.5)	/* Jan 1 2021 UTC */
+	    fn = "mars.1020";
+	else
 	    return (-1);
 
 	/* open */
-	(void) sprintf (buf, "%s/%s", dir, mbdlfn);
+	(void) sprintf (buf, "%s/%s", dir, fn);
 	fp = fopen (buf, "r");
-	if (!fp)
-	    return (-1);
+	if (!fp) {
+	    fprintf (stderr, "%s: %s\n", fn, strerror(errno));
+	    return (-1);
+	}
 
 	/* use it */
 	if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
-	    fprintf (stderr, "%s: %s\n", mbdlfn, buf);
+	    fprintf (stderr, "%s: %s\n", fn, buf);
 	    fclose (fp);
 	    return (-1);
 	}
 	if (i != M_NMOONS-1) {
-	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", mbdlfn,
+	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn,
 								i, M_NMOONS-1);
 	    fclose (fp);
@@ -256,3 +263,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: marsmoon.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: marsmoon.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/misc.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/misc.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/misc.c	(revision 3111)
@@ -501,3 +501,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: misc.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: misc.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/mjd.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/mjd.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/mjd.c	(revision 3111)
@@ -254,3 +254,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: mjd.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: mjd.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/moon.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/moon.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/moon.c	(revision 3111)
@@ -3465,3 +3465,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: moon.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: moon.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/mooncolong.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/mooncolong.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/mooncolong.c	(revision 3111)
@@ -234,3 +234,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: mooncolong.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: mooncolong.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/moonnf.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/moonnf.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/moonnf.c	(revision 3111)
@@ -67,3 +67,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: moonnf.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: moonnf.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/nutation.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/nutation.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/nutation.c	(revision 3111)
@@ -439,3 +439,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: nutation.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: nutation.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/obliq.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/obliq.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/obliq.c	(revision 3111)
@@ -25,3 +25,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: obliq.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: obliq.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/parallactic.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/parallactic.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/parallactic.c	(revision 3111)
@@ -52,3 +52,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallactic.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallactic.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/parallax.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/parallax.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/parallax.c	(revision 3111)
@@ -40,3 +40,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallax.c,v $ $Date: 2005-08-21 10:02:38 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallax.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/plans.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/plans.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/plans.c	(revision 3111)
@@ -225,3 +225,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: plans.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: plans.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/plshadow.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/plshadow.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/plshadow.c	(revision 3111)
@@ -48,3 +48,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: plshadow.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: plshadow.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/precess.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/precess.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/precess.c	(revision 3111)
@@ -144,3 +144,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: precess.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: precess.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/preferences.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/preferences.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/preferences.h	(revision 3111)
@@ -29,4 +29,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: preferences.h,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: preferences.h,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/reduce.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/reduce.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/reduce.c	(revision 3111)
@@ -76,3 +76,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: reduce.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: reduce.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/refract.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/refract.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/refract.c	(revision 3111)
@@ -89,3 +89,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: refract.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: refract.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/rings.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/rings.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/rings.c	(revision 3111)
@@ -43,3 +43,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: rings.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: rings.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/riset.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/riset.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/riset.c	(revision 3111)
@@ -98,3 +98,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/riset_cir.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/riset_cir.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/riset_cir.c	(revision 3111)
@@ -370,3 +370,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset_cir.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset_cir.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/satlib.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/satlib.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/satlib.h	(revision 3111)
@@ -2,5 +2,5 @@
 #define __SATLIB_H
 
-/* $Id: satlib.h,v 1.5 2005-08-21 10:02:39 cmv Exp $ */
+/* $Id: satlib.h,v 1.6 2006-11-22 13:53:31 cmv Exp $ */
 
 typedef struct _SatElem {
@@ -203,4 +203,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: satlib.h,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: satlib.h,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/satmoon.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/satmoon.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/satmoon.c	(revision 3111)
@@ -4,4 +4,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
@@ -34,7 +35,4 @@
 static double stiltmjd;
 
-/* file containing BDL coefficients */
-static char sbdlfn[] = "saturne.9910";
-
 /* These values are from the Explanatory Supplement.
  * Precession degrades them gradually over time.
@@ -136,24 +134,33 @@
 	char buf[1024];
 	FILE *fp;
+	char *fn;
 	int i;
 
-	/* only valid 1999 through 2010 */
-	if (JD < 2451179.50000 || JD >= 2455562.5)
+	/* check ranges and appropriate data file */
+	if (JD < 2451179.50000)		/* Jan 1 1999 UTC */
 	    return (-1);
+	if (JD < 2455562.5)		/* Jan 1 2011 UTC */
+	    fn = "saturne.9910";
+	else if (JD < 2459215.5)	/* Jan 1 2021 UTC */
+	    fn = "saturne.1020";
+	else
+	    return (-1);
 
 	/* open */
-	(void) sprintf (buf, "%s/%s", dir, sbdlfn);
+	(void) sprintf (buf, "%s/%s", dir, fn);
 	fp = fopen (buf, "r");
-	if (!fp)
+	if (!fp) {
+	    fprintf (stderr, "%s: %s\n", fn, strerror(errno));
 	    return (-1);
+	}
 
 	/* use it */
 	if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
-	    fprintf (stderr, "%s: %s\n", sbdlfn, buf);
+	    fprintf (stderr, "%s: %s\n", fn, buf);
 	    fclose (fp);
 	    return (-1);
 	}
 	if (i != S_NMOONS-1) {
-	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", sbdlfn,
+	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn,
 								i, S_NMOONS-1);
 	    fclose (fp);
@@ -501,3 +508,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: satmoon.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: satmoon.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/satspec.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/satspec.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/satspec.h	(revision 3111)
@@ -2,5 +2,5 @@
 #define __SATSPEC_H
 
-/* $Id: satspec.h,v 1.5 2005-08-21 10:02:39 cmv Exp $ */
+/* $Id: satspec.h,v 1.6 2006-11-22 13:53:31 cmv Exp $ */
 
 #include "sattypes.h"
@@ -40,4 +40,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: satspec.h,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: satspec.h,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/sattypes.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/sattypes.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/sattypes.h	(revision 3111)
@@ -2,5 +2,5 @@
 #define __SATTYPES_H
 
-/* $Id: sattypes.h,v 1.5 2005-08-21 10:02:39 cmv Exp $ */
+/* $Id: sattypes.h,v 1.6 2006-11-22 13:53:31 cmv Exp $ */
 
 typedef struct _Vec3 {
@@ -25,4 +25,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: sattypes.h,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: sattypes.h,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/sdp4.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/sdp4.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/sdp4.c	(revision 3111)
@@ -428,3 +428,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sdp4.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sdp4.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/sgp4.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/sgp4.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/sgp4.c	(revision 3111)
@@ -399,3 +399,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sgp4.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sgp4.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/sphcart.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/sphcart.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/sphcart.c	(revision 3111)
@@ -25,5 +25,5 @@
 	double rho = x*x + y*y;
 
-	if (rho > 1e-35) {	/* standard case: off axis */
+	if (rho > 0) {	/* standard case: off axis */
 	    *l = atan2(y, x);
 	    range (l, 2*PI);
@@ -41,3 +41,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sphcart.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sphcart.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/sun.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/sun.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/sun.c	(revision 3111)
@@ -42,3 +42,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sun.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sun.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/thetag.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/thetag.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/thetag.c	(revision 3111)
@@ -3,5 +3,5 @@
 #include "deepconst.h"
 
-/* @(#) $Id: thetag.c,v 1.5 2005-08-21 10:02:40 cmv Exp $ */
+/* @(#) $Id: thetag.c,v 1.6 2006-11-22 13:53:31 cmv Exp $ */
 
 
@@ -88,3 +88,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: thetag.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: thetag.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/twobody.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/twobody.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/twobody.c	(revision 3111)
@@ -241,3 +241,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: twobody.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: twobody.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/umoon.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/umoon.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/umoon.c	(revision 3111)
@@ -4,4 +4,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
@@ -28,7 +29,4 @@
 static double sizemjd;	/* size at last mjd */
 
-/* file containing BDL coefficients */
-static char ubdlfn[] = "uranus.9910";
-
 /* These values are from the Explanatory Supplement.
  * Precession degrades them gradually over time.
@@ -92,5 +90,5 @@
 
 	/* get moon x,y,z from BDL if possible */
-	if (dir && use_bdl (JD, dir, md) < 0) {
+	if (!dir || use_bdl (JD, dir, md) < 0) {
 	    int i;
 	    for (i = 1; i < U_NMOONS; i++)
@@ -127,24 +125,33 @@
 	char buf[1024];
 	FILE *fp;
-	int i;
-
-	/* only valid 1999 through 2010 */
-	if (JD < 2451179.50000 || JD >= 2455562.5)
+	char *fn;
+	int i;
+
+	/* check ranges and appropriate data file */
+	if (JD < 2451179.50000)		/* Jan 1 1999 UTC */
+	    return (-1);
+	if (JD < 2455562.5)		/* Jan 1 2011 UTC */
+	    fn = "uranus.9910";
+	else if (JD < 2459215.5)	/* Jan 1 2021 UTC */
+	    fn = "uranus.1020";
+	else
 	    return (-1);
 
 	/* open */
-	(void) sprintf (buf, "%s/%s", dir, ubdlfn);
+	(void) sprintf (buf, "%s/%s", dir, fn);
 	fp = fopen (buf, "r");
-	if (!fp)
-	    return (-1);
+	if (!fp) {
+	    fprintf (stderr, "%s: %s\n", fn, strerror(errno));
+	    return (-1);
+	}
 
 	/* use it */
 	if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
-	    fprintf (stderr, "%s: %s\n", ubdlfn, buf);
+	    fprintf (stderr, "%s: %s\n", fn, buf);
 	    fclose (fp);
 	    return (-1);
 	}
 	if (i != U_NMOONS-1) {
-	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", ubdlfn, 
+	    fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn, 
 								i, U_NMOONS-1);
 	    fclose (fp);
@@ -261,3 +268,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: umoon.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: umoon.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/utc_gst.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/utc_gst.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/utc_gst.c	(revision 3111)
@@ -93,3 +93,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: utc_gst.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: utc_gst.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/vector.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/vector.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/vector.h	(revision 3111)
@@ -2,5 +2,5 @@
 #define __SATVECTOR_H
 
-/* $Id: vector.h,v 1.5 2005-08-21 10:02:40 cmv Exp $ */
+/* $Id: vector.h,v 1.6 2006-11-22 13:53:31 cmv Exp $ */
 
 #define dotp(A,B) ((A).x*(B).x+(A).y*(B).y+(A).z*(B).z)
@@ -16,4 +16,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: vector.h,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: vector.h,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/vsop87.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/vsop87.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/vsop87.c	(revision 3111)
@@ -207,3 +207,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: vsop87.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: vsop87.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"};
Index: trunk/SophyaExt/XephemAstroLib/vsop87.h
===================================================================
--- trunk/SophyaExt/XephemAstroLib/vsop87.h	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/vsop87.h	(revision 3111)
@@ -90,4 +90,4 @@
 
 /* For RCS Only -- Do Not Edit
- * @(#) $RCSfile: vsop87.h,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ * @(#) $RCSfile: vsop87.h,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $
  */
Index: trunk/SophyaExt/XephemAstroLib/vsop87_data.c
===================================================================
--- trunk/SophyaExt/XephemAstroLib/vsop87_data.c	(revision 3088)
+++ trunk/SophyaExt/XephemAstroLib/vsop87_data.c	(revision 3111)
@@ -6986,3 +6986,3 @@
 
 /* For RCS Only -- Do Not Edit */
-static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: vsop87_data.c,v $ $Date: 2005-08-21 10:02:40 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
+static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: vsop87_data.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.6 $ $Name: not supported by cvs2svn $"};
