Commit Graph

27 Commits

Author SHA1 Message Date
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