Commit patch sent to tech-userlevel with universal approval to add a

version option for calendar(1):

	% calendar -v
	calendar-20160601
	%

For reference, see:

	http://mail-index.netbsd.org/tech-userlevel/2016/06/02/msg010081.html
This commit is contained in:
agc 2016-06-03 02:06:40 +00:00
parent cb28c6994f
commit 1f657fa580
2 changed files with 16 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: calendar.1,v 1.25 2010/06/08 03:08:47 riz Exp $
.\" $NetBSD: calendar.1,v 1.26 2016/06/03 02:06:40 agc Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)calendar.1 8.1 (Berkeley) 6/29/93
.\"
.Dd August 27, 2009
.Dd June 1, 2016
.Dt CALENDAR 1
.Os
.Sh NAME
@ -37,7 +37,7 @@
.Nd reminder service
.Sh SYNOPSIS
.Nm
.Op Fl ax
.Op Fl avx
.Op Fl d Ar MMDD[[YY]YY]
.Op Fl f Ar file
.Op Fl l Ar days
@ -95,6 +95,11 @@ number if and only if the day specified is a Friday.
The default value is two, which causes
.Nm
to print entries through the weekend on Fridays.
.It Fl v
Causes
.Nm
to print version information for itself,
and then exit.
.It Fl x
Causes
.Nm

View File

@ -1,4 +1,4 @@
/* $NetBSD: calendar.c,v 1.52 2015/07/01 06:48:25 dholland Exp $ */
/* $NetBSD: calendar.c,v 1.53 2016/06/03 02:06:40 agc Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)calendar.c 8.4 (Berkeley) 1/7/95";
#endif
__RCSID("$NetBSD: calendar.c,v 1.52 2015/07/01 06:48:25 dholland Exp $");
__RCSID("$NetBSD: calendar.c,v 1.53 2016/06/03 02:06:40 agc Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -65,6 +65,8 @@ __RCSID("$NetBSD: calendar.c,v 1.52 2015/07/01 06:48:25 dholland Exp $");
#include "pathnames.h"
#define CALENDAR_VERSION "calendar-20160601"
/* flags used by calendar file parser */
#define F_ISMONTH 0x01
#define F_ISDAY 0x02
@ -133,7 +135,7 @@ main(int argc, char **argv)
(void)setprogname(argv[0]); /* for portability */
while ((ch = getopt(argc, argv, "-ad:f:l:w:x")) != -1) {
while ((ch = getopt(argc, argv, "-ad:f:l:vw:x")) != -1) {
switch (ch) {
case '-': /* backward contemptible */
case 'a':
@ -152,6 +154,9 @@ main(int argc, char **argv)
case 'l':
atodays(ch, optarg, &lookahead);
break;
case 'v':
printf("%s\n", CALENDAR_VERSION);
return 0;
case 'w':
atodays(ch, optarg, &weekend);
break;