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
This commit is contained in:
Stefan Eßer 2020-10-30 15:43:52 +00:00
parent cb895863ac
commit ddad3a3875
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367173
2 changed files with 9 additions and 3 deletions

View File

@ -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;
}

View File

@ -1,3 +1,3 @@
Jun 21* sunthird
Jun 21 jun 21
Jun 21* sunthird
Jun 22 jun 22