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/jupmoon.c

    r2818 r3111  
    44#include <stdlib.h>
    55#include <string.h>
     6#include <errno.h>
    67#include <math.h>
    78
     
    3132static double cmlIImjd; /*    "                      II      " */
    3233
    33 /* file containing BDL coefficients */
    34 static char jbdlfn[] = "jupiter.9910";
    35 
    3634/* These values are from the Explanatory Supplement.
    3735 * Precession degrades them gradually over time.
     
    134132        char buf[1024];
    135133        FILE *fp;
    136         int i;
    137 
    138         /* only valid 1999 through 2010 */
    139         if (JD < 2451179.50000 || JD >= 2455562.5)
     134        char *fn;
     135        int i;
     136
     137        /* check ranges and appropriate data file */
     138        if (JD < 2451179.50000)         /* Jan 1 1999 UTC */
     139            return (-1);
     140        if (JD < 2455562.5)             /* Jan 1 2011 UTC */
     141            fn = "jupiter.9910";
     142        else if (JD < 2459215.5)        /* Jan 1 2021 UTC */
     143            fn = "jupiter.1020";
     144        else
    140145            return (-1);
    141146
    142147        /* open */
    143         (void) sprintf (buf, "%s/%s", dir, jbdlfn);
     148        (void) sprintf (buf, "%s/%s", dir, fn);
    144149        fp = fopen (buf, "r");
    145         if (!fp)
    146             return (-1);
     150        if (!fp) {
     151            fprintf (stderr, "%s: %s\n", fn, strerror(errno));
     152            return (-1);
     153        }
    147154
    148155        /* use it */
    149156        if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
    150             fprintf (stderr, "%s: %s\n", jbdlfn, buf);
     157            fprintf (stderr, "%s: %s\n", fn, buf);
    151158            fclose (fp);
    152159            return (-1);
    153160        }
    154161        if (i != J_NMOONS-1) {
    155             fprintf (stderr, "%s: BDL says %d moons, code expects %d", jbdlfn,
     162            fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn,
    156163                                                                i, J_NMOONS-1);
    157164            fclose (fp);
     
    382389
    383390/* For RCS Only -- Do Not Edit */
    384 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 $"};
     391static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: jupmoon.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Note: See TracChangeset for help on using the changeset viewer.