From owner-svn-src-all@FreeBSD.ORG Thu Jul 22 01:23:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC6B106566C; Thu, 22 Jul 2010 01:23:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B29158FC16; Thu, 22 Jul 2010 01:23:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6M1Ndwi095558; Thu, 22 Jul 2010 01:23:39 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6M1NdVu095555; Thu, 22 Jul 2010 01:23:39 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201007220123.o6M1NdVu095555@svn.freebsd.org> From: Ed Maste Date: Thu, 22 Jul 2010 01:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210364 - stable/8/games/pom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2010 01:23:40 -0000 Author: emaste Date: Thu Jul 22 01:23:39 2010 New Revision: 210364 URL: http://svn.freebsd.org/changeset/base/210364 Log: MFC r210089: Add -p option to have pom(6) print just the percentage, without extra text. PR: bin/51070 Submitted by: Matt Koivisto mkoivisto sandvine com Modified: stable/8/games/pom/pom.6 stable/8/games/pom/pom.c Directory Properties: stable/8/games/pom/ (props changed) Modified: stable/8/games/pom/pom.6 ============================================================================== --- stable/8/games/pom/pom.6 Thu Jul 22 01:14:33 2010 (r210363) +++ stable/8/games/pom/pom.6 Thu Jul 22 01:23:39 2010 (r210364) @@ -32,7 +32,7 @@ .\" @(#)pom.6 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd May 31, 1993 +.Dd July 14, 2010 .Dt POM 6 .UC 7 .Sh NAME @@ -40,6 +40,7 @@ .Nd display the phase of the moon .Sh SYNOPSIS .Nm +.Op Fl p .Op Fl d Ar yyyy.mm.dd .Op Fl t Ar hh:mm:ss .Sh DESCRIPTION @@ -49,6 +50,10 @@ utility displays the current phase of th Useful for selecting software completion target dates and predicting managerial behavior. .Pp +Use the +.Fl p +option to print just the phase as a percentage. +.Pp Use the arguments .Fl d and Modified: stable/8/games/pom/pom.c ============================================================================== --- stable/8/games/pom/pom.c Thu Jul 22 01:14:33 2010 (r210363) +++ stable/8/games/pom/pom.c Thu Jul 22 01:23:39 2010 (r210364) @@ -88,14 +88,17 @@ main(int argc, char **argv) time_t tt; struct tm GMT, tmd; double days, today, tomorrow; - int ch, cnt; + int ch, cnt, pflag = 0; char *odate = NULL, *otime = NULL; - while ((ch = getopt(argc, argv, "d:t:")) != -1) + while ((ch = getopt(argc, argv, "d:pt:")) != -1) switch (ch) { case 'd': odate = optarg; break; + case 'p': + pflag = 1; + break; case 't': otime = optarg; break; @@ -138,6 +141,10 @@ main(int argc, char **argv) for (cnt = EPOCH; cnt < GMT.tm_year; ++cnt) days += isleap(1900 + cnt) ? 366 : 365; today = potm(days) + .5; + if (pflag) { + (void)printf("%1.0f\n", today); + return (0); + } (void)printf("The Moon is "); if ((int)today == 100) (void)printf("Full\n"); @@ -231,6 +238,7 @@ static void usage(char *progname) { - fprintf(stderr, "Usage: %s [-d yyyy.mm.dd] [-t hh:mm:ss]\n", progname); + fprintf(stderr, "Usage: %s [-p] [-d yyyy.mm.dd] [-t hh:mm:ss]\n", + progname); exit(EX_USAGE); }