Ignore:
Timestamp:
Nov 22, 2006, 2:53:31 PM (19 years ago)
Author:
cmv
Message:

mise en conformite xephem 3.7.2 cmv 22/11/2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/XephemAstroLib/umoon.c

    r2818 r3111  
    44#include <stdlib.h>
    55#include <string.h>
     6#include <errno.h>
    67#include <math.h>
    78
     
    2829static double sizemjd;  /* size at last mjd */
    2930
    30 /* file containing BDL coefficients */
    31 static char ubdlfn[] = "uranus.9910";
    32 
    3331/* These values are from the Explanatory Supplement.
    3432 * Precession degrades them gradually over time.
     
    9290
    9391        /* get moon x,y,z from BDL if possible */
    94         if (dir && use_bdl (JD, dir, md) < 0) {
     92        if (!dir || use_bdl (JD, dir, md) < 0) {
    9593            int i;
    9694            for (i = 1; i < U_NMOONS; i++)
     
    127125        char buf[1024];
    128126        FILE *fp;
    129         int i;
    130 
    131         /* only valid 1999 through 2010 */
    132         if (JD < 2451179.50000 || JD >= 2455562.5)
     127        char *fn;
     128        int i;
     129
     130        /* check ranges and appropriate data file */
     131        if (JD < 2451179.50000)         /* Jan 1 1999 UTC */
     132            return (-1);
     133        if (JD < 2455562.5)             /* Jan 1 2011 UTC */
     134            fn = "uranus.9910";
     135        else if (JD < 2459215.5)        /* Jan 1 2021 UTC */
     136            fn = "uranus.1020";
     137        else
    133138            return (-1);
    134139
    135140        /* open */
    136         (void) sprintf (buf, "%s/%s", dir, ubdlfn);
     141        (void) sprintf (buf, "%s/%s", dir, fn);
    137142        fp = fopen (buf, "r");
    138         if (!fp)
    139             return (-1);
     143        if (!fp) {
     144            fprintf (stderr, "%s: %s\n", fn, strerror(errno));
     145            return (-1);
     146        }
    140147
    141148        /* use it */
    142149        if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
    143             fprintf (stderr, "%s: %s\n", ubdlfn, buf);
     150            fprintf (stderr, "%s: %s\n", fn, buf);
    144151            fclose (fp);
    145152            return (-1);
    146153        }
    147154        if (i != U_NMOONS-1) {
    148             fprintf (stderr, "%s: BDL says %d moons, code expects %d", ubdlfn,
     155            fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn,
    149156                                                                i, U_NMOONS-1);
    150157            fclose (fp);
     
    261268
    262269/* For RCS Only -- Do Not Edit */
    263 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 $"};
     270static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: umoon.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Note: See TracChangeset for help on using the changeset viewer.