games/pom WARNS6 patch

Peter Avalos pavalos at theshell.com
Sat Aug 5 10:45:52 PDT 2006


-remove #define for PI, and use <math.h>'s version
-ANSI function declarations
-WARNS6 cleanup (1 warning)

Can also be downloaded at:
http://www.theshell.com/~pavalos/wip/pom.diff

--Peter

Index: games/pom/Makefile
===================================================================
RCS file: /home/dcvs/src/games/pom/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- games/pom/Makefile	16 Mar 2005 21:26:01 -0000	1.3
+++ games/pom/Makefile	5 Aug 2006 17:32:03 -0000
@@ -7,6 +7,5 @@
 MAN=	pom.6
 DPADD=	${LIBM}
 LDADD=	-lm
-CFLAGS+=-Wall
 
 .include <bsd.prog.mk>
Index: games/pom/pom.c
===================================================================
RCS file: /home/dcvs/src/games/pom/pom.c,v
retrieving revision 1.3
diff -u -r1.3 pom.c
--- games/pom/pom.c	12 Nov 2003 14:53:54 -0000	1.3
+++ games/pom/pom.c	5 Aug 2006 17:40:42 -0000
@@ -52,9 +52,6 @@
 #include <stdio.h>
 #include <math.h>
 
-#ifndef	PI
-#define	PI	  3.14159265358979323846
-#endif
 #define	EPOCH	  85
 #define	EPSILONg  279.611371	/* solar ecliptic long at EPOCH */
 #define	RHOg	  282.680403	/* solar ecliptic long of perigee at EPOCH */
@@ -69,7 +66,7 @@
 static double	potm (double);
 
 int
-main()
+main(void)
 {
 	time_t tt;
 	struct tm *GMT;
@@ -113,8 +110,7 @@
  *	return phase of the moon
  */
 static double
-potm(days)
-	double days;
+potm(double days)
 {
 	double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime;
 	double A4, lprime, V, ldprime, D, Nm;
@@ -123,7 +119,7 @@
 	adj360(&N);
 	Msol = N + EPSILONg - RHOg;				/* sec 42 #4 */
 	adj360(&Msol);
-	Ec = 360 / PI * ECCEN * sin(dtor(Msol));		/* sec 42 #5 */
+	Ec = 360 / M_PI * ECCEN * sin(dtor(Msol));		/* sec 42 #5 */
 	LambdaSol = N + Ec + EPSILONg;				/* sec 42 #6 */
 	adj360(&LambdaSol);
 	l = 13.1763966 * days + lzero;				/* sec 61 #4 */
@@ -150,10 +146,9 @@
  *	convert degrees to radians
  */
 static double
-dtor(deg)
-	double deg;
+dtor(double deg)
 {
-	return(deg * PI / 180);
+	return(deg * M_PI / 180);
 }
 
 /*
@@ -161,8 +156,7 @@
  *	adjust value so 0 <= deg <= 360
  */
 static void
-adj360(deg)
-	double *deg;
+adj360(double *deg)
 {
 	for (;;)
 		if (*deg < 0)
Attachment:
pgp00010.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00010.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20060805/f554cba7/attachment-0018.obj>


More information about the Submit mailing list