Commit Graph

39 Commits

Author SHA1 Message Date
Conrad Meyer
fd1efedc79 Add extremely useful calendar(1) application to FreeBSD
It does extremely useful things like execute sendmail and spew dubiously
accurate factoids.

From the feedback, it seems like it is an essential utility in a modern unix
and not at all a useless bikeshed.  How do those Linux people live without it?
Reverts r358561.
2020-03-03 00:20:08 +00:00
Conrad Meyer
3c565de33f Fix typo in r278616
FreeBSD isn't an encyclopedia.
2020-03-02 23:37:47 +00:00
Gleb Smirnoff
1e01d2dcac Remove pointless playing with LC_TIME, which should have been done in r205821. 2019-09-10 04:01:41 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Ed Schouten
bf70becee6 More -Wmissing-variable-declarations fixes.
In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
2012-10-19 14:49:42 +00:00
Edwin Groothuis
bb06482c77 On request of joel@:
- Remove the 3rd clause of the UC Berkeley copyrighted files.
- For the files added copyrighted by me, move the "All rights
  reserved" to the next line.
2010-03-30 06:42:01 +00:00
Edwin Groothuis
2b84020d5c Long awaited update to the calendar system:
- Repeating events which 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) and solar events
  (equinox and solstice, 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.

MFC after:	1 month
2010-03-29 06:49:20 +00:00
Xin LI
d993d09a6c - Remove times.h from C programs that does not manipulate with time at
all.
 - Remove pathnames.h from all but io.c since it's the only module that
   used these definations.
2009-12-13 04:50:11 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Edwin Groothuis
35304a1641 style(9)ify usr.bin/calendar
PR:		bin/118644
Approved by:	bde@ (mentor)
MFC after:	1 week
2008-08-05 08:11:54 +00:00
Greg Lehey
f4025ee00f Sort events by date.
Correct long-standing off-by-one error in -W option.

Submitted by: edwin@

Shorten some long lines.  These files are still not completely
style(9) compliant.
2007-06-09 05:54:13 +00:00
Greg Lehey
70ee1a4509 Fix various bugs in the -A and -B options.
Submitted by:	edwin@
PR:		bin/113250
MFC after:	2 weeks
2007-06-03 03:07:10 +00:00
David Malone
e4cedda807 ANSIfy function definitions.
Move some extern declarations to a header file.
Remove an unneeded extern declaration for optarg.
2007-05-07 11:18:30 +00:00
Stefan Farfeleder
080397239a Remove break after return. 2006-07-18 07:10:30 +00:00
Greg Lehey
a176b8d333 Correct previous commit. We don't want to suppress an entry because
it runs into the following month.  Instead adjust month and day,
wrapping round into next year where necessary.

MFC after: 14 days
2006-05-31 01:30:50 +00:00
Greg Lehey
29ef275b38 Don't go past the end of the month with a repetitive entry of the
style "every Monday":

   mon *	Do Foo.

Previously, at the end of the month, this could cause a printout of
the following nature when invoked with -A 7:

   36 May* Do Foo

MFC after:	2 weeks
2006-05-30 04:00:23 +00:00
Alexander Nedotsukov
59dd44d303 Fix -t option processing.
Partially initialized tm structure was passed into mktime(3).

Approved by:	ru
2004-12-06 15:38:24 +00:00
Greg Lehey
b20a21a6c1 Add two new options:
-W is like -A (number of days in the future to consider, but also
   specifies that we don't want special treatment at weekends.
-F changes our notion of "Friday" (the day before the weekend).

Arguably, calendar(1) is broken to have special treatment of weekends
by default, but this method maintains POLA.
2002-06-13 21:20:56 +00:00
Andrey A. Chernov
dfe8796660 Setlocale returns static buffer, don't assume it will be unchanged
Pointed by:	phantom
2002-03-10 14:54:59 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
9e1e9c4421 WARNS=2 fixup (mostly. Some are Hard To Fix(tm), so NO_WERROR is set)
Use __FBSDID().
Sort some headers.
2001-12-02 22:44:14 +00:00
Dima Dorfman
766b57c9d1 Fix compilation with -DDEBUG.
PR:		31536
Submitted by:	Alan Batie <alan@agora.rdrop.com>
2001-11-04 23:15:21 +00:00
Andrey A. Chernov
1f30a4236c Restore old locale properly 2001-03-21 15:39:17 +00:00
David Malone
db3626fb72 Use a slightly better documented way of calculating easter and
include a reference to the Calendar FAQ. Also make argument parsing
a little more robust.

PR:		23881
2001-01-02 11:35:57 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nick Hibma
15c2a9ef79 Correct a typo (22th -> 22nd)
Remove some whitespace
Fix a problem where any event on the Last whatever of the month
was duplicated after the last day of the month (e.g. 32oct.)

PR:		4907
Submitted by:	Mikhail Teterin mi@aldan.algebra.com
1999-07-24 16:23:52 +00:00
Wolfram Schneider
93a590c71d typo. 1997-10-26 12:51:30 +00:00
Poul-Henning Kamp
d030d2d2ae Many places in the code NULL is used in integer context, where
plain 0 should be used.  This happens to work because we #define
NULL to 0, but is stylistically wrong and can cause problems
for people trying to port bits of code to other environments.

PR:		2752
Submitted by:	Arne Henrik Juul <arnej@imf.unit.no>
1997-09-18 14:08:40 +00:00
Philippe Charnier
4d2854f4b5 Use err(3). Abort if strdup() returns NULL. 1997-06-23 06:52:13 +00:00
Mike Pritchard
3fef3b185e Fix calendar so that it doesn't report strange results on
Jan 1st (and probably other dates as well) for some variable
events.  E.g.

01/SunThird	whatever...

Was being printed as:

Jan  0	Whatever

when calendar was run on January 1st.

Closes PR#2461.
1997-02-02 07:37:46 +00:00
Mike Pritchard
b82b4e07ee Fix calendar so that you can run it like:
calendar -t 0101 -f file

Previously calendar's time processing routine directly
modified the "0101" argument" which confused getopt.
The time routines now make a copy of the argument
to mess with.
1997-01-12 18:35:14 +00:00
Andrey A. Chernov
9d0a521e31 Localize even more.
FIx Orthodox Easter calculation
Better debug output
1996-05-10 19:31:02 +00:00
Andrey A. Chernov
7f7d4bbe18 Allow to configure national Easter names.
Speedup my national months/days handling code.
1996-05-10 17:32:06 +00:00
Andrey A. Chernov
ab5dc10734 Localize it
Handle Orthodox Eastern
-Wall cleanup
1996-05-10 16:30:22 +00:00
Wolfram Schneider
a9251605ba Easter was one day to fast.
Unix use days *since* January 1 [0-365], not the 1th day of year etc.
1996-04-09 19:48:31 +00:00
Mike Pritchard
544b5cb2f1 Change calendar to report the actual date for variable day events.
E.g. for Easter, and entries like "04/SunFirst" calendar will
now report:

04/05*	Good Friday (2 days before easter)
04/07*	First Sunday...

instead of:

Easter-2	Good Friday...
04/SunFirst	First Sunday...

I also modified the calendar files to use the variable day format
for a lot of events so that they will be reported correctly.
E.g. U.S. daylight savings time is now listed as:

04/SunFirst	Daylight savings time...

There are still a lot of wrong dates in there for some events
that move from year to year, but I don't have a good calendar handy
right now that I can use for reference.
1996-04-06 01:15:21 +00:00
Wolfram Schneider
c9c822e632 - handle events that move around from year to year, i.e.,
``the last Monday in April'
- handle easter

new options
	-f calendarfile
	-A days
	-B days

Calendar HOME directory ~/.calendar
don't sent mail if ~/.calendar/nomail exist
1996-02-02 06:02:41 +00:00