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

    r2818 r3111  
    44#include <stdlib.h>
    55#include <string.h>
     6#include <errno.h>
    67#include <math.h>
    78
     
    3435static double stiltmjd;
    3536
    36 /* file containing BDL coefficients */
    37 static char sbdlfn[] = "saturne.9910";
    38 
    3937/* These values are from the Explanatory Supplement.
    4038 * Precession degrades them gradually over time.
     
    136134        char buf[1024];
    137135        FILE *fp;
     136        char *fn;
    138137        int i;
    139138
    140         /* only valid 1999 through 2010 */
    141         if (JD < 2451179.50000 || JD >= 2455562.5)
     139        /* check ranges and appropriate data file */
     140        if (JD < 2451179.50000)         /* Jan 1 1999 UTC */
    142141            return (-1);
     142        if (JD < 2455562.5)             /* Jan 1 2011 UTC */
     143            fn = "saturne.9910";
     144        else if (JD < 2459215.5)        /* Jan 1 2021 UTC */
     145            fn = "saturne.1020";
     146        else
     147            return (-1);
    143148
    144149        /* open */
    145         (void) sprintf (buf, "%s/%s", dir, sbdlfn);
     150        (void) sprintf (buf, "%s/%s", dir, fn);
    146151        fp = fopen (buf, "r");
    147         if (!fp)
     152        if (!fp) {
     153            fprintf (stderr, "%s: %s\n", fn, strerror(errno));
    148154            return (-1);
     155        }
    149156
    150157        /* use it */
    151158        if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) {
    152             fprintf (stderr, "%s: %s\n", sbdlfn, buf);
     159            fprintf (stderr, "%s: %s\n", fn, buf);
    153160            fclose (fp);
    154161            return (-1);
    155162        }
    156163        if (i != S_NMOONS-1) {
    157             fprintf (stderr, "%s: BDL says %d moons, code expects %d", sbdlfn,
     164            fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn,
    158165                                                                i, S_NMOONS-1);
    159166            fclose (fp);
     
    501508
    502509/* For RCS Only -- Do Not Edit */
    503 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 $"};
     510static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: satmoon.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.