calendar(1): Sync with FreeBSD

Operating Systems / DragonFlyBSD - Aaron LI [aaronly.me] - 10 November 2019 04:56 EST

New features:
- Support events that span multiple years, because of '-A', '-B' or just the three days before the end of the year.
- Support for lunar events (full moon, new moon), solar events (equinox, solstice), and Chinese new year. Because of this, the options '-U' (UTC offset) and '-l' (longitude) are available to compensate if reality doesn't match the calculated values.
- Implement an internal 'cpp'-like parser to parse the calendars, so no longer require the external cpp(1).

Changed behavior: DragonFly's calendar(1) switched to use the 'calendar.all' file by default in 9abdd9620822cc1232dc702a76d95ebf133733b5. This calendar file always exists. However, it makes calendar(1) print too much entries, which I think most users would not need. So switch to the original default calendar file, i.e., 'calendar', the same as other BSDs.

The following minor changes were made: 1. In 'calendar.c' and 'io.c', delete the unused 'copyright' variable to suppress the compilation warnings. 2. In 'sunpos.c', rename the macro 'MIN(h)' to 'MINUTE(h)' to avoid the conflict; meanwhile rename the macro 'SMIN(h)' to 'SMINUTE(h)' for better consistency.

More cleanups and improvements to follow.

148ae05012 calendar(1): Sync with FreeBSD
usr.bin/calendar/Makefile | 6 +-
usr.bin/calendar/calendar.1 | 117 ++++-
usr.bin/calendar/calendar.c | 183 +++++--
usr.bin/calendar/calendar.h | 194 ++++++--
usr.bin/calendar/dates.c | 453 +++++++++++++++++
usr.bin/calendar/day.c | 473 ++----------------
usr.bin/calendar/events.c | 125 +++++
usr.bin/calendar/io.c | 659 +++++++++++++------------
usr.bin/calendar/locale.c | 168 +++++++
usr.bin/calendar/ostern.c | 95 +---
usr.bin/calendar/parsedata.c | 1118 ++++++++++++++++++++++++++++++++++++++++++
usr.bin/calendar/paskha.c | 73 +--
usr.bin/calendar/pathnames.h | 8 +-
usr.bin/calendar/pom.c | 278 +++++++++++
usr.bin/calendar/sunpos.c | 450 +++++++++++++++++
15 files changed, 3441 insertions(+), 959 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share