Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2002 22:31:23 -0500
From:      Brian T.Schellenberger <bts@babbleon.org>
To:        freebsd-ports@freebsd.org, deischen@freebsd.org
Subject:   Posting Possible Plan Patches 
Message-ID:  <06f793031030a12FE5@mail5.nc.rr.com>

next in thread | raw e-mail | index | archive | help

--------------Boundary-00=_BSDPRPYUSDCI1WYHEXAT
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit


I realize that this probably isn't the best moment, but I've been meaning to 
do this for a while, so I'm going to do it before I forget.

I have some suggested patches for "plan."  I sent them to the author of plan 
some time ago, or at least to his listed address, but I've gotten no reply 
and wonder if perhaps I have the wrong address for him.  Anyway, whether he 
incorporates them or not I thought that they were worth considering as 
FreeBSD port patches anyway.

There are three patches (in a single files) that do three things:

1. Patch to convert.c - allows for ISO dates (2002/01/09).
2. Patch to main.c - adds -O (only) option to simplify adding repeated 
monthly items.  For example, every 3rd Wednesday instead of every Wednesday 
is -D 3 -O 3 (day three, only the 3rd one)
3. Patch to man page - documents the -O option and fixes the doc for the -D 
option, which is just plain wrong in the current man page.  (Says that day 0 
is Monday when in fact it's Sunday.)

-- 
Brian T. Schellenberger . . . . . . .   bts@wnt.sas.com (work)
Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)
                                        http://www.babbleon.org

-------> Free Dmitry Sklyarov!  (let him go home)  <-----------

http://www.eff.org                 http://www.programming-freedom.org 

--------------Boundary-00=_BSDPRPYUSDCI1WYHEXAT
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="plan-patches"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="plan-patches"

# ====================> CONVERT.C - Allow yyyy/mm/dd <=========================
*** oldsrc/convert.c	Sat Sep 29 16:56:28 2001
--- src/convert.c	Sat Sep 29 18:25:41 2001
***************
*** 106,115 ****
--- 106,116 ----
  	long		num[3];		/* m,d,y or d,m,y */
  	int		nnum;		/* how many numbers in text */
  	long		i;		/* tmp counter */
  	char		*p;		/* text scan pointer */
  	char		buf[10];	/* lowercase weekday name */
+     int     noswap;
  
  	today  = get_time();				/* today's date */
  	today -= today % 86400;
  	tm = time_to_tm(today);
  	for (p=text; *p; p++)				/* ignore "wkday," */
***************
*** 173,183 ****
--- 174,193 ----
  		while (*p && !(*p >= '0' && *p <= '9') && *p!=' ' && *p!='\t')
  			p++;
  	}
  	if (nnum == 0)					/* ... no numbers */
  		return(today);
+     noswap = FALSE;
  	if (nnum == 3) {				/* ... have year? */
+         if (num[0] > 999) {   /* bts: 4-digit first => year is first */
+                               /* 4-digit year => yyyy/mm/dd          */
+             i = num[0];
+             num[0] = num[2];
+             num[2] = i;
+             noswap = TRUE;
+         }
+ 
  		if (num[2] < 70)
  			num[2] += 100;
  		else if (num[2] > 100)
  			num[2] -= 1900;
  		if (num[2] < 70 || num[2] > 137)
***************
*** 190,200 ****
  				tm->tm_mon = 0;
  				tm->tm_year++;
  			}
  		tm->tm_mday = num[0];
  	} else {					/* ... d/m or m/d */
! 		if (config.mmddyy) {
  			i      = num[0];
  			num[0] = num[1];
  			num[1] = i;
  		}
  		if (nnum < 3 && num[1]*100+num[0] <
--- 200,210 ----
  				tm->tm_mon = 0;
  				tm->tm_year++;
  			}
  		tm->tm_mday = num[0];
  	} else {					/* ... d/m or m/d */
! 		if (config.mmddyy && !noswap) {
  			i      = num[0];
  			num[0] = num[1];
  			num[1] = i;
  		}
  		if (nnum < 3 && num[1]*100+num[0] <


# ====================> MAIN.C - Add -O option <=========================

*** oldsrc/main.c	Sat Sep 29 16:56:28 2001
--- src/main.c	Sat Sep 29 17:59:25 2001
***************
*** 369,378 ****
--- 369,381 ----
  			edit.entry.rep_days |= 1 << atoi(argv[i+1]);
  			break;
  		  case 'D':
  			edit.entry.rep_weekdays |= 1 << atoi(argv[i+1]);
  			break;
+           case 'O':
+ 			edit.entry.rep_weekdays |= 1 << (atoi(argv[i+1]) + 7);
+ 			break;
  		  case 'e':
          		edit.entry.rep_last = parse_datestring(argv[i+1],
  								trigger);
  			break;
  		  case 'w':

# ==================> MAN PAGE - fix -D doc; add -O option <=================
*** oldmisc/plan.1	Sat Sep 29 18:03:46 2001
--- misc/plan.1	Sat Sep 29 18:15:26 2001
***************
*** 86,98 ****
  The new appointment repeats every N days. N is an integer greater than zero.
  .IP \-d\ N
  The new appointment repeats on day N of the month. N is an integer between
  1 and 31. There can be multiple -d options.
  .IP \-D\ N
! The new appointment repeats on weekday N. N=0 indicates Monday, 1 is Tuesday,
! 2 is Wednesday, 3 is Thursday, 4 is Friday, 5 is Saturday, and 6 is Sunday.
  There can be multiple -D options.
  .IP \-e\ D
  The new appointment stops repeating on date D. D is a string such as
  '31.12.' or '12/31'.
  .IP \-w\ N
  Set the early warning time of the new appointment to N minutes.
--- 86,102 ----
  The new appointment repeats every N days. N is an integer greater than zero.
  .IP \-d\ N
  The new appointment repeats on day N of the month. N is an integer between
  1 and 31. There can be multiple -d options.
  .IP \-D\ N
! The new appointment repeats on weekday N. N=0 indicates Sunday, 1 is Monday,
! 2 is Tuesday, 3 is Wednesday, 4 is Thursday, 5 is Friday, and 6 is Saturday.
  There can be multiple -D options.
+ .IP \-O\ N
+ The -D days only repeat the Nth time of the month.  May be repeated.  For
+ example, "-D 2 -O 2 -O 4" means the 2nd and 4th Tuesdays of each month.
+ -O 6 means the last one.
  .IP \-e\ D
  The new appointment stops repeating on date D. D is a string such as
  '31.12.' or '12/31'.
  .IP \-w\ N
  Set the early warning time of the new appointment to N minutes.

--------------Boundary-00=_BSDPRPYUSDCI1WYHEXAT--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06f793031030a12FE5>