From owner-freebsd-ports Wed Jan 9 19:31:43 2002 Delivered-To: freebsd-ports@freebsd.org Received: from mail5.nc.rr.com (fe5.southeast.rr.com [24.93.67.52]) by hub.freebsd.org (Postfix) with ESMTP id AD53437B405; Wed, 9 Jan 2002 19:31:32 -0800 (PST) Received: from there ([66.57.85.154]) by mail5.nc.rr.com with Microsoft SMTPSVC(5.5.1877.687.68); Wed, 9 Jan 2002 22:31:30 -0500 From: Brian T.Schellenberger To: freebsd-ports@freebsd.org, deischen@freebsd.org Subject: Posting Possible Plan Patches Date: Wed, 9 Jan 2002 22:31:23 -0500 X-Mailer: KMail [version 1.3] MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_BSDPRPYUSDCI1WYHEXAT" Message-ID: <06f793031030a12FE5@mail5.nc.rr.com> Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --------------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