From owner-freebsd-current@FreeBSD.ORG Sat Dec 31 12:00:40 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22A7C10657B1 for ; Sat, 31 Dec 2011 12:00:40 +0000 (UTC) (envelope-from coco@executive-computing.de) Received: from mail.moehre.org (mail.moehre.org [195.96.35.7]) by mx1.freebsd.org (Postfix) with ESMTP id C6EE88FC0A for ; Sat, 31 Dec 2011 12:00:39 +0000 (UTC) Received: from mail.moehre.org (unknown [195.96.35.7]) by mail.moehre.org (Postfix) with ESMTP id AB1708B1423 for ; Sat, 31 Dec 2011 12:44:27 +0100 (CET) X-Spam-Flag: NO X-Spam-Score: -100.964 X-Spam-Level: X-Spam-Status: No, score=-100.964 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, AWL=0.036, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mail.moehre.org ([195.96.35.7]) by mail.moehre.org (mail.moehre.org [195.96.35.7]) (amavisd-new, port 10024) with ESMTP id WU2LcSenYGbz for ; Sat, 31 Dec 2011 12:44:26 +0100 (CET) Received: from [192.168.100.30] (p54B0C0C1.dip.t-dialin.net [84.176.192.193]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: coco@executive-computing.de) by mail.moehre.org (Postfix) with ESMTPSA id ED9068B141C for ; Sat, 31 Dec 2011 12:44:25 +0100 (CET) Message-ID: <4EFEF589.2030304@executive-computing.de> Date: Sat, 31 Dec 2011 12:44:09 +0100 From: Marco Steinbach User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: freebsd-current@freebsd.org Content-Type: multipart/mixed; boundary="------------010203070200050604080102" Subject: [cft] Small patch for calendar(1) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2011 12:00:40 -0000 This is a multi-part message in MIME format. --------------010203070200050604080102 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Hi, for a while now, calendar(1) seems to have forgotten how to handle what the man page describes as: 'A month without a day matches the first of that month.' A notable result of this is, that the output of 'calendar -f /usr/share/calendar/calendar.all' is always headed by 'Unprocessed' error messages. The attached patch tries to help calendar(1) remember how to do this as is described in the man page. Since I'm not an avid calendar(1) user, I'd very much like others to review and try out the patch, before I go pester commiters by opening a PR. MfG CoCo --------------010203070200050604080102 Content-Type: text/plain; name="calendar.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="calendar.patch" --- src/usr.bin/calendar/parsedata.c.orig 2011-12-31 11:36:40.000000000 +0100 +++ src/usr.bin/calendar/parsedata.c 2011-12-31 11:57:55.000000000 +0100 @@ -174,11 +174,22 @@ } if (isonlydigits(date, 1)) { /* Assume month number only */ - *flags |= F_MONTH; + *flags |= (F_MONTH | F_DAYOFMONTH); + *idayofmonth = 1; *imonth = (int)strtol(date, (char **)NULL, 10); strcpy(month, getmonthname(*imonth)); return(1); } + if ((checkmonth(date, &len, &offset, &pmonth) != 0)) { + /* Assume month name only */ + *flags |= (F_MONTH | F_DAYOFMONTH); + *idayofmonth = 1; + *imonth = offset; + strcpy(month, getmonthname(*imonth)); + return(1); + } + + return (0); } } --------------010203070200050604080102--