From dada@freepass.tu-graz.ac.at  Mon Apr 14 03:33:48 1997
Received: from freepass.tu-graz.ac.at (freepass.tu-graz.ac.at [129.27.193.133])
          by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id DAA02090
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Apr 1997 03:32:38 -0700 (PDT)
Received: (from dada@localhost) by freepass.tu-graz.ac.at (8.6.11/8.6.9) id MAA13863; Mon, 14 Apr 1997 12:32:26 +0200
Message-Id: <199704141032.MAA13863@freepass.tu-graz.ac.at>
Date: Mon, 14 Apr 1997 12:32:26 +0200
From: Martin Kammerhofer <dada@freepass.tu-graz.ac.at>
Reply-To: dada@sbox.tu-graz.ac.at
To: FreeBSD-gnats-submit@freebsd.org
Subject: date option for pom(6) (phase of the moon)
X-Send-Pr-Version: 3.2

>Number:         3285
>Category:       bin
>Synopsis:       date option for pom(6) (phase of the moon)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 14 03:40:12 PDT 1997
>Closed-Date:    Thu Jun 4 09:58:25 PDT 1998
>Last-Modified:  Thu Jun  4 09:59:33 PDT 1998
>Originator:     Martin Kammerhofer
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Graz University of Technology
>Environment:

	

>Description:
	Maybe others are too curious what phase the moon was on
	that very special day...
	The enhancement is only some 15 lines.

>How-To-Repeat:

	

>Fix:
--- /usr/src/games/pom/pom.c	Wed Jul 17 22:13:33 1996
+++ /usr/home/dada/src/pom.c	Sat Apr  5 20:04:03 1997
@@ -41,6 +41,7 @@
 
 #ifndef lint
 static const char sccsid[] = "@(#)pom.c       8.1 (Berkeley) 5/31/93";
+static const char rcsid[]  = "@(#)$Id$";
 #endif /* not lint */
 
 /*
@@ -72,7 +73,9 @@
 static double	potm __P((double));
 
 int
-main()
+main(argc, argv)
+int argc;
+char *argv[];
 {
 	time_t tt;
 	struct tm *GMT;
@@ -81,6 +84,20 @@
 
 	(void) time(&tt);
 	GMT = gmtime(&tt);
+
+	if (argc == 4) {	/* expect a date in YYYY MM DD format */
+	    GMT = localtime(&tt);
+	    sscanf(argv[1], "%d", &GMT->tm_year);
+	    GMT->tm_year -= 1900;
+	    sscanf(argv[2], "%d", &GMT->tm_mon);
+	    GMT->tm_mon--;	/* 0..11 */
+	    sscanf(argv[3], "%d", &GMT->tm_mday);	/* 1..31 */
+	    GMT->tm_isdst = -2;	/* i.e. 'guess' */
+	    tt = mktime(GMT);
+	    GMT = gmtime(&tt);
+	    printf("%s", asctime(GMT));
+	}
+	
 	days = (GMT->tm_yday + 1) + ((GMT->tm_hour +
 	    (GMT->tm_min / 60.0) + (GMT->tm_sec / 3600.0)) / 24.0);
 	for (cnt = EPOCH; cnt < GMT->tm_year; ++cnt)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Thu Jun 4 09:58:25 PDT 1998 
State-Changed-Why:  
The orignator asked that this be closed.  He is now using 
Emacs' "C-u M-x calendar" and "M". 
>Unformatted:
