From owner-svn-src-head@freebsd.org Fri Oct 30 15:43:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0651D4548F1; Fri, 30 Oct 2020 15:43:53 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CN66c6QKJz472J; Fri, 30 Oct 2020 15:43:52 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0451183FA; Fri, 30 Oct 2020 15:43:52 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09UFhqO7021791; Fri, 30 Oct 2020 15:43:52 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09UFhqsC021789; Fri, 30 Oct 2020 15:43:52 GMT (envelope-from se@FreeBSD.org) Message-Id: <202010301543.09UFhqsC021789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Fri, 30 Oct 2020 15:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367173 - in head/usr.bin/calendar: . tests X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: in head/usr.bin/calendar: . tests X-SVN-Commit-Revision: 367173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Oct 2020 15:43:53 -0000 Author: se Date: Fri Oct 30 15:43:52 2020 New Revision: 367173 URL: https://svnweb.freebsd.org/changeset/base/367173 Log: Print calendar entries in the order they occur The calendar program used to output entries in reverse order, due to the way an internal linked list was built up. A regression test with 2 entries for the same day has been adapted to the now non-reversed order. MFC after: 3 days Modified: head/usr.bin/calendar/dates.c head/usr.bin/calendar/tests/regress.s5.out Modified: head/usr.bin/calendar/dates.c ============================================================================== --- head/usr.bin/calendar/dates.c Fri Oct 30 14:42:02 2020 (r367172) +++ head/usr.bin/calendar/dates.c Fri Oct 30 15:43:52 2020 (r367173) @@ -64,6 +64,7 @@ struct cal_day { struct cal_month *month; /* points back */ struct cal_year *year; /* points back */ struct event *events; + struct event *lastevent; }; int debug_remember = 0; @@ -446,8 +447,13 @@ void addtodate(struct event *e, int year, int month, int day) { struct cal_day *d; + struct event *ee; d = find_day(year, month, day); - e->next = d->events; - d->events = e; + ee = d->lastevent; + if (ee != NULL) + ee->next = e; + else + d->events = e; + d->lastevent = e; } Modified: head/usr.bin/calendar/tests/regress.s5.out ============================================================================== --- head/usr.bin/calendar/tests/regress.s5.out Fri Oct 30 14:42:02 2020 (r367172) +++ head/usr.bin/calendar/tests/regress.s5.out Fri Oct 30 15:43:52 2020 (r367173) @@ -1,3 +1,3 @@ -Jun 21* sunthird Jun 21 jun 21 +Jun 21* sunthird Jun 22 jun 22