History log of /freebsd-current/usr.bin/calendar/calendar.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 3fa2a149 29-Oct-2020 Stefan Eßer <se@FreeBSD.org>

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


# fd1efedc 02-Mar-2020 Conrad Meyer <cem@FreeBSD.org>

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.


# 3c565de3 02-Mar-2020 Conrad Meyer <cem@FreeBSD.org>

Fix typo in r278616

FreeBSD isn't an encyclopedia.


# e67975d3 09-Sep-2019 Gleb Smirnoff <glebius@FreeBSD.org>

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)


# adedf5ee 19-Feb-2019 Baptiste Daroussin <bapt@FreeBSD.org>

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


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

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


# 81479c5c 16-Feb-2014 Eitan Adler <eadler@FreeBSD.org>

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)


# 13b01d1d 12-Jun-2013 Greg Lehey <grog@FreeBSD.org>

Revert revision 251648. style(9) requires an empty line here.

Reported by: mdf@


# 33d6ebec 12-Jun-2013 Greg Lehey <grog@FreeBSD.org>

style(9)

MFC after: 2 weeks


# bf70bece 19-Oct-2012 Ed Schouten <ed@FreeBSD.org>

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'.


# 415f0311 08-Nov-2011 Greg Lehey <grog@FreeBSD.org>

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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# bb06482c 30-Mar-2010 Edwin Groothuis <edwin@FreeBSD.org>

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.


# 2b84020d 29-Mar-2010 Edwin Groothuis <edwin@FreeBSD.org>

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


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d993d09a 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

- 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.


# 821df508 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

Revert most part of 200420 as requested, as more review and polish is
needed.


# 6f2d3221 11-Dec-2009 Xin LI <delphij@FreeBSD.org>

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 0d724b87 05-Aug-2008 Edwin Groothuis <edwin@FreeBSD.org>

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)


# 35304a16 05-Aug-2008 Edwin Groothuis <edwin@FreeBSD.org>

style(9)ify usr.bin/calendar

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


# e4cedda8 07-May-2007 David Malone <dwmalone@FreeBSD.org>

ANSIfy function definitions.
Move some extern declarations to a header file.
Remove an unneeded extern declaration for optarg.


# 67cb90ec 14-Aug-2002 Ruslan Ermilov <ru@FreeBSD.org>

Fix the usage() to match style(9).


# b20a21a6 13-Jun-2002 Greg Lehey <grog@FreeBSD.org>

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.


# 9f5b04e9 10-Dec-2001 David Malone <dwmalone@FreeBSD.org>

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.


# 9e1e9c44 02-Dec-2001 Mark Murray <markm@FreeBSD.org>

WARNS=2 fixup (mostly. Some are Hard To Fix(tm), so NO_WERROR is set)
Use __FBSDID().
Sort some headers.


# 78de6667 28-Feb-2001 Warner Losh <imp@FreeBSD.org>

Remove redundant declaration of optind. It has been declared in unistd.h
for ages.


# 15dde4b2 05-Oct-2000 Alexander Langer <alex@FreeBSD.org>

List the -t option in usage().

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


# 2c215927 04-May-2000 Alexey Zelkin <phantom@FreeBSD.org>

Add missing $FreeBSD$ tags


# b1bd32ef 24-Jun-1999 Warner Losh <imp@FreeBSD.org>

Don't add '?' to getopt's options.


# c44252b6 06-Jul-1997 Bruce Evans <bde@FreeBSD.org>

Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,
pascal and vmstat.sparc. All changed files on the vendor branch should
already have been imported.


# 1c8af878 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 3b4984d0 05-Feb-1997 Mike Pritchard <mpp@FreeBSD.org>

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


# ab5dc107 10-May-1996 Andrey A. Chernov <ache@FreeBSD.org>

Localize it
Handle Orthodox Eastern
-Wall cleanup


# c9c822e6 01-Feb-1996 Wolfram Schneider <wosch@FreeBSD.org>

- 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


# ec3e1161 08-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

Change error diagnostic to be less confusing:
no calendar file -> no calendar file in current directory


# 2b91a983 08-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

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.


# 656dcd43 07-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


# 7799f52a 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 31e98e3f 30-Dec-1994 Andrey A. Chernov <ache@FreeBSD.org>

Fix for two problems:
Calendar not cd $HOME when running by user
Calendar calls cpp with # lines allowed


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources