home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
astronmy
/
strchart.lzh
/
PATCH
/
MOONPHSE.DIF
< prev
next >
Wrap
Text File
|
1989-03-23
|
2KB
|
81 lines
*** ../starchart/moonphase.c Mon Sep 19 09:11:06 1988
--- moonphse.c Mon Sep 26 08:00:23 1988
***************
*** 12,17 ****
--- 12,21 ----
! modified by awpaeth@watcgl, December 1987 for sysV compatability
****************************************************************************/
+ #ifdef ST_MWC /* Mark Williams C for the Atari ST */
+ #define SYSV /* MWC is almost SYSV compatible */
+ #endif /* ST_MWC */
+
#include <stdio.h>
#ifndef SYSV
#include <sys/time.h>
***************
*** 19,25 ****
--- 23,35 ----
#include <time.h>
#endif
#include <math.h>
+ #ifdef ST_MWC
+ #include <osbind.h> /* Needed for Cconws() and Crawcin() */
+ #define cfree() free() /* MWC doesn't have cfree() */
+ #endif /* ST_MWC */
+ #ifndef PI
#define PI 3.141592654
+ #endif
#define EPOCH 1983
#define EPSILONg 279.103035 /* solar ecliptic long at EPOCH */
#define RHOg 282.648015 /* solar ecliptic long of perigee at EPOCH */
***************
*** 34,40 ****
--- 44,55 ----
double adj360();
double potm();
+ #ifdef ST_MWC
+ extern char *getenv(); /* Used to see if we're running from the desktop */
+ time_t lo;
+ #else /* !ST_MWC */
long *lo = (long *) calloc (1, sizeof(long)); /* used by time calls */
+ #endif /* ST_MWC */
struct tm *pt; /* ptr to time structure */
double days; /* days since EPOCH */
***************
*** 42,50 ****
--- 57,70 ----
double phase2; /* percent of lunar surface illuminated one day later */
int i = EPOCH;
+ #ifdef ST_MWC
+ time (&lo); /* get system time */
+ pt = gmtime(&lo); /* get ptr to gmt time struct */
+ #else /* !ST_MWC */
time (lo); /* get system time */
pt = gmtime(lo); /* get ptr to gmt time struct */
cfree(lo);
+ #endif /* ST_MWC */
/* calculate days since EPOCH */
days = (pt->tm_yday +1) + ((pt->tm_hour + (pt->tm_min / 60.0)
***************
*** 82,87 ****
--- 102,115 ----
printf("Waning ");
printf("Crescent (%1.0f%% of Full)\n", phase);
}
+ #ifdef ST_MWC /* We want to hold the screen if invoked from the GEM desktop; */
+ /* the desktop doesn't usually set any environment variables, */
+ /* and if getenv() does find anything, it's probably empty */
+ if (((getenv("PATH")) == 0) || (strlen(getenv("PATH")) == 0)) {
+ Cconws("press any key to continue: "); /* Hold screen if desktop */
+ i = Crawcin(); /* Read raw character input */
+ }
+ #endif /* ST_MWC */
}
double potm(days)