/[base]/head/usr.bin/calendar/calendar.c
ViewVC logotype

Log of /head/usr.bin/calendar/calendar.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:

Revision 367126 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 29 08:26:38 2020 UTC (3 years, 8 months ago) by se
File length: 6462 byte(s)
Diff to previous 358562
Fix calendar -a processing of files included in the user's home directory

The existing code performed a chdir() into the home directory, but the
parser fell back to using the invoking user's home directory as the base
directory for the search for an include file.

Since use of the -a option is limited to UID==0, the directory searched
was typically ~root/.calendar, not the .calendar directory of the user
whose file is being processed.

PR:		205580
Reported by:	greg.bal4@gmail.com (Greg Balfour)
MFC after:	3 days


Revision 358562 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 3 00:20:08 2020 UTC (4 years, 4 months ago) by cem
File length: 6427 byte(s)
Copied from: head/usr.bin/calendar/calendar.c revision 358560
Diff to previous 352116
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.


Revision 352116 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 10 04:21:48 2019 UTC (4 years, 9 months ago) by glebius
File length: 6427 byte(s)
Diff to previous 344340
Fix 'calendar -a' in several ways.

o Do not run any iconv() processing in -a. The locale of root user is not
  what is desired by most of the users who receive their calendar mail.
  Just assume that users store their calendars in a format that is readable
  to them. This fixes regression from r344340.
o fork() and setusercontext(LOGIN_SETALL) for every user. This makes LANG
  set inside a calendar file mostly excessive, as we will pick up user's
  login class LANG.
o This also executes complex function cal() that parses user owned files
  with appropriate user privileges.
  Previously it was run with privileges dropped only temporary for execution
  of cal(), and fully dropped only before invoking sendmail (see r22473).

Reviewed by:	bapt (older version of patch)


Revision 344340 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 20 06:40:52 2019 UTC (5 years, 4 months ago) by bapt
File length: 6211 byte(s)
Diff to previous 326025
calendar: use iconv to respect the output encoding

calendar(1) can have input in various encoding, specifying
LANG=<locale_name> to enable calendar(1) to determine which one to use.

The problem is the content of the calendar itself is exposed as is making it
unreadable in many cases. For example french calendar which is encoded
ISO8859-1 is rendered badly in a fr_FR.UTF-8 environment.

Using iconv allows to solve this issue.
This will also allow to keep only 1 encoding in base for those files without
breaking user existing setup

Reported by:	many
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19221


Revision 326025 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 20 19:49:47 2017 UTC (6 years, 7 months ago) by pfg
File length: 5929 byte(s)
Diff to previous 314436
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.


Revision 314436 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 28 23:42:47 2017 UTC (7 years, 4 months ago) by imp
File length: 5885 byte(s)
Diff to previous 262011
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


Revision 262011 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 17 03:24:00 2014 UTC (10 years, 4 months ago) by eadler
File length: 5885 byte(s)
Diff to previous 251678
calendar(1): don't segfault in invalid input

When the user supplies an invalid number of days provide a useful error message
instead of segfaulting.

PR:		bin/186697
Reported by:	kaltheat <kaltheat@gmail.com>
Submitted by:	oliver <oliver@beefrankly.org> (older version)


Revision 251678 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 13 04:11:21 2013 UTC (11 years ago) by grog
File length: 5742 byte(s)
Diff to previous 251648
Revert revision 251648.  style(9) requires an empty line here.

Reported by:	mdf@


Revision 251648 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 12 07:53:59 2013 UTC (11 years ago) by grog
File length: 5741 byte(s)
Diff to previous 241737
style(9)

MFC after:	2 weeks


Revision 241737 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 19 14:49:42 2012 UTC (11 years, 8 months ago) by ed
File length: 5742 byte(s)
Diff to previous 227370
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'.


Revision 227370 - (view) (download) (annotate) - [select for diffs]
Modified Wed Nov 9 01:40:46 2011 UTC (12 years, 7 months ago) by grog
File length: 5730 byte(s)
Diff to previous 205872
Tidy up command line processing:
  - Add ? option to optstring.
  - Sort options alphabetically.
  - Vertical space.

Tidy up usage() function.

Bring man page in sync with source.

Ensure that debug code is only executed with the -d option.

Submitted by: Christiane Yeardley


Revision 205872 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 30 06:42:01 2010 UTC (14 years, 3 months ago) by edwin
File length: 5677 byte(s)
Diff to previous 205821
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.


Revision 205821 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 29 06:49:20 2010 UTC (14 years, 3 months ago) by edwin
File length: 5914 byte(s)
Diff to previous 200470
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


Revision 200470 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 13 04:50:11 2009 UTC (14 years, 6 months ago) by delphij
File length: 3968 byte(s)
Diff to previous 200462
 - 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.


Revision 200462 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 13 03:14:06 2009 UTC (14 years, 6 months ago) by delphij
File length: 3991 byte(s)
Diff to previous 200420
Revert most part of 200420 as requested, as more review and polish is
needed.


Revision 200420 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 11 23:35:38 2009 UTC (14 years, 6 months ago) by delphij
File length: 3968 byte(s)
Diff to previous 181323
Remove unneeded header includes from usr.bin/ except contributed code.

Tested with:	make universe


Revision 181323 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 5 08:16:37 2008 UTC (15 years, 11 months ago) by edwin
File length: 3991 byte(s)
Diff to previous 181322
Move functions which are only locally used into their C files and
make them static.

usage() in calendar.c
event_*() in io.c

PR:		bin/118644
Approved by:	bde@ (mentor)


Revision 181322 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 5 08:11:54 2008 UTC (15 years, 11 months ago) by edwin
File length: 3942 byte(s)
Diff to previous 169343
style(9)ify usr.bin/calendar

PR:		bin/118644
Approved by:	bde@ (mentor)
MFC after:	1 week


Revision 169343 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 7 11:18:30 2007 UTC (17 years, 2 months ago) by dwmalone
File length: 3971 byte(s)
Diff to previous 101862
ANSIfy function definitions.
Move some extern declarations to a header file.
Remove an unneeded extern declaration for optarg.


Revision 101862 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 14 11:28:07 2002 UTC (21 years, 10 months ago) by ru
File length: 3981 byte(s)
Diff to previous 98181
Fix the usage() to match style(9).


Revision 98181 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 13 21:20:56 2002 UTC (22 years ago) by grog
File length: 3957 byte(s)
Diff to previous 87628
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.


Revision 87628 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 10 21:13:08 2001 UTC (22 years, 6 months ago) by dwmalone
File length: 3728 byte(s)
Diff to previous 87235
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.


Revision 87235 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 2 22:44:14 2001 UTC (22 years, 7 months ago) by markm
File length: 3722 byte(s)
Diff to previous 73256
WARNS=2 fixup (mostly. Some are Hard To Fix(tm), so NO_WERROR is set)
Use __FBSDID().
Sort some headers.


Revision 73256 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 1 05:46:03 2001 UTC (23 years, 4 months ago) by imp
File length: 3720 byte(s)
Diff to previous 66742
Remove redundant declaration of optind.  It has been declared in unistd.h
for ages.


Revision 66742 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 6 12:10:51 2000 UTC (23 years, 9 months ago) by alex
File length: 3740 byte(s)
Diff to previous 59945
List the -t option in usage().

PR:		21734
Submitted by:	Giorgos Keramidas <keramida@ceid.upatras.gr>


Revision 59945 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 4 11:28:55 2000 UTC (24 years, 2 months ago) by phantom
File length: 3720 byte(s)
Diff to previous 48172
Add missing $FreeBSD$ tags


Revision 48172 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 24 06:45:32 1999 UTC (25 years ago) by imp
File length: 3704 byte(s)
Diff to previous 24360
Don't add '?' to getopt's options.


Revision 24360 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 29 04:34:07 1997 UTC (27 years, 3 months ago) by imp
File length: 3705 byte(s)
Diff to previous 22323
compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


Revision 22323 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 6 05:42:49 1997 UTC (27 years, 5 months ago) by mpp
File length: 3706 byte(s)
Diff to previous 15714
Initialize the group list when we switch uids when run as
root with "calendar -a".  Drop all privs when execing other
programs.

Obtained from: OpenBSD


Revision 15714 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 10 16:30:22 1996 UTC (28 years, 1 month ago) by ache
File length: 3660 byte(s)
Diff to previous 13840
Localize it
Handle Orthodox Eastern
-Wall cleanup


Revision 13840 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 2 06:02:41 1996 UTC (28 years, 5 months ago) by wosch
File length: 3595 byte(s)
Diff to previous 11335
- 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


Revision 11335 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 8 14:18:15 1995 UTC (28 years, 9 months ago) by ache
File length: 9862 byte(s)
Diff to previous 11334
Change error diagnostic to be less confusing:
no calendar file -> no calendar file in current directory


Revision 11334 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 8 14:15:20 1995 UTC (28 years, 9 months ago) by ache
File length: 9841 byte(s)
Diff to previous 9987
Remove hack inserted by me long time ago (cd $HOME for user-called case),
no other system do it and it can cause problem with multi-calendars
for single user.


Revision 9987 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 7 19:17:46 1995 UTC (28 years, 11 months ago) by wollman
File length: 9905 byte(s)
Diff to previous 8874
Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


Revision 8874 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 30 06:41:30 1995 UTC (29 years, 1 month ago) by rgrimes
File length: 9868 byte(s)
Diff to previous 5311
Remove trailing whitespace.


Revision 5311 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 31 12:15:27 1994 UTC (29 years, 6 months ago) by ache
File length: 9872 byte(s)
Diff to previous 1591
Fix for two problems:
Calendar not cd $HOME when running by user
Calendar calls cpp with # lines allowed


Revision 1591 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 27 12:33:43 1994 UTC (30 years, 1 month ago) by rgrimes
File length: 9802 byte(s)
Copied from: vendor/CSRG/dist/usr.bin/calendar/calendar.c revision 1590
Diff to previous 1590
This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.


Revision 1590 - (view) (download) (annotate) - [select for diffs]
Added Fri May 27 12:33:43 1994 UTC (30 years, 1 month ago) by rgrimes
Original Path: vendor/CSRG/dist/usr.bin/calendar/calendar.c
File length: 9802 byte(s)
BSD 4.4 Lite Usr.bin Sources


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27