mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
41 Commits
04.02.08
...
04.02.09-B
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
524ece5119 | ||
|
|
6334bd61b6 | ||
|
|
2e56edd557 | ||
|
|
8cae1d21cd | ||
|
|
1de6ed16eb | ||
|
|
860cb94f41 | ||
|
|
6b505704e9 | ||
|
|
167631451d | ||
|
|
fa5180b94d | ||
|
|
ae01d7be43 | ||
|
|
d5ce39ade1 | ||
|
|
a043dfe8b9 | ||
|
|
7cfb75e3b3 | ||
|
|
a18f0d982f | ||
|
|
0e2dc805c2 | ||
|
|
4c1e11df2c | ||
|
|
76776d054a | ||
|
|
45ebd05cb6 | ||
|
|
0203ce3979 | ||
|
|
72d10178bf | ||
|
|
96f4e26d53 | ||
|
|
4fd86f1b6a | ||
|
|
2f3ee0aec3 | ||
|
|
a5dde31160 | ||
|
|
b45428df05 | ||
|
|
d938763643 | ||
|
|
e4e2157622 | ||
|
|
04b349c6c7 | ||
|
|
7fe3eb7391 | ||
|
|
c1992b577a | ||
|
|
632283d47f | ||
|
|
1d9e46997c | ||
|
|
861ce34022 | ||
|
|
32e8db322d | ||
|
|
3df2b72175 | ||
|
|
e7ac4f95be | ||
|
|
e7ed69287b | ||
|
|
2e80417f53 | ||
|
|
ee435d2bb9 | ||
|
|
bb516946be | ||
|
|
81157e1cb5 |
@@ -3,7 +3,7 @@ THE REMIND COPYRIGHT
|
||||
1. REMIND refers to the entire set of files and documentation in the
|
||||
REMIND package.
|
||||
|
||||
2. REMIND is Copyright 1992-2023 Dianne Skoll, except where noted in
|
||||
2. REMIND is Copyright 1992-2024 Dianne Skoll, except where noted in
|
||||
individual files.
|
||||
|
||||
3. DISTRIBUTION AND USE
|
||||
@@ -16,7 +16,7 @@ individual files.
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
24
build.tk
Normal file → Executable file
24
build.tk
Normal file → Executable file
@@ -27,10 +27,10 @@ exec wish "$0" "$@"
|
||||
proc SetConfigDefaults {} {
|
||||
global Config
|
||||
set Config(LAT_DEG) 45
|
||||
set Config(LAT_MIN) 24
|
||||
set Config(LAT_MIN) 25
|
||||
set Config(LAT_SEC) 14
|
||||
set Config(LON_DEG) 75
|
||||
set Config(LON_MIN) 39
|
||||
set Config(LON_MIN) 41
|
||||
set Config(LON_SEC) 23
|
||||
set Config(LOCATION) "Ottawa"
|
||||
set Config(DEFAULT_PAGE) "Letter"
|
||||
@@ -190,8 +190,8 @@ proc CreateLocationDialog { w } {
|
||||
|
||||
grid $w.north $w.west
|
||||
grid $w.south $w.east
|
||||
grid $w.loclab -sticky e
|
||||
grid $w.location -sticky nsew -row 6 -column 1
|
||||
grid $w.loclab -sticky e
|
||||
grid $w.location -sticky nsew -row 8 -column 1
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -293,9 +293,9 @@ proc BuildRemind {} {
|
||||
|
||||
.msgs insert end "\n>>> Creating src/custom.h...\n\n" green
|
||||
CreateCustomH
|
||||
.msgs insert end ">>> Calling `./configure'...\n\n" green
|
||||
.msgs insert end "\n>>> Calling `./configure'...\n\n" green
|
||||
CallConfigure
|
||||
.msgs insert end ">>> Calling `make'...\n\n" green
|
||||
.msgs insert end "\n>>> Calling `make'...\n\n" green
|
||||
CallMake
|
||||
.msgs insert end "\n----------------------------------------------\n\n"
|
||||
.msgs insert end "Remind" red
|
||||
@@ -447,12 +447,12 @@ proc CreateCustomH {} {
|
||||
"#define DEFAULT_LATITUDE *" {
|
||||
set lat [expr $LAT_DEG + ($LAT_MIN/60.0) + ($LAT_SEC/3600.0)];
|
||||
puts $out "#define DEFAULT_LATITUDE $lat"
|
||||
.msgs insert end "#define DEFAULT_LATITUDE $lat"
|
||||
.msgs insert end "#define DEFAULT_LATITUDE $lat\n"
|
||||
}
|
||||
"#define DEFAULT_LONGITUDE *" {
|
||||
set lon [expr -1.0 * ($LON_DEG + ($LON_MIN/60.0) + ($LON_SEC/3600.0))]
|
||||
puts $out "#define DEFAULT_LONGITUDE $lon"
|
||||
.msgs insert end "#define DEFAULT_LONGITUDE $lon"
|
||||
.msgs insert end "#define DEFAULT_LONGITUDE $lon\n"
|
||||
}
|
||||
"#define LOCATION *" {
|
||||
puts $out "#define LOCATION \"$Config(LOCATION)\""
|
||||
@@ -506,7 +506,13 @@ proc CallMake {} {
|
||||
"Icelandic" { set lang ICELANDIC }
|
||||
default { set lang ENGLISH }
|
||||
}
|
||||
RunCommand "make \"LANGDEF=-DLANG=$lang\""
|
||||
set nproc 0
|
||||
catch { set nproc [exec nproc] }
|
||||
if { $nproc != 0 } {
|
||||
RunCommand "make -j $nproc \"LANGDEF=-DLANG=$lang\""
|
||||
} else {
|
||||
RunCommand "make \"LANGDEF=-DLANG=$lang\""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ if test "$?" != 0 ; then
|
||||
fi
|
||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
||||
|
||||
VERSION=04.02.08
|
||||
VERSION=04.02.09
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(PERL)
|
||||
AC_SUBST(PERLARTIFACTS)
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; if not, write to the Free Software
|
||||
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
;; 02111-1307, USA.
|
||||
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 4.2 Patch 9 - 2024-??-??
|
||||
|
||||
- CHANGE: remind: Do not attempt to guess terminal background color on
|
||||
startup. Only obtain it as needed. This can prevent mojibake from
|
||||
appearing on terminals that don't support the color query escape
|
||||
sequence.
|
||||
|
||||
- IMPROVEMENT: remind: Add new system variables $NumFullOmits,
|
||||
$MaxFullOmits, $NumPartialOmits and $MaxPartialOmits.
|
||||
|
||||
- IMPROVEMENT: remind: Issue a warning if someone OMITs every possible date.
|
||||
|
||||
- IMPROVEMENT: remind: In several error messages complaining about limits
|
||||
being exceeded, include the actual limit in the error message. Clarify
|
||||
the man page regarding limits on the number of OMITs.
|
||||
|
||||
- DOCUMENTATION: Add "Astronomical Algorithms" my Jean Meeus to bibliography.
|
||||
|
||||
- DOCUMENTATION FIX: Update address of the Free Software Foundation in the
|
||||
license file.
|
||||
|
||||
- DOCUMENTATION: Note that rem2ps is deprecated and will not received any
|
||||
new features. Further development will happen on rem2pdf.
|
||||
|
||||
- BUG FIX: Preserve the filename() and priority context for queued reminders.
|
||||
Previously, the filename information was lost and the priority was
|
||||
coming from uninitialized memory (yikes!). bug found by Alexander
|
||||
Möller.
|
||||
|
||||
- BUG FIX: build.tk: Various minor improvements.
|
||||
|
||||
- BUG FIX: remind: In server mode, if we de-queue a reminder without
|
||||
triggering it, issue a "NOTE queued %d" message to update the
|
||||
client's notion of the queue size.
|
||||
|
||||
- BUG FIX: tkremind: Fix typo found by Lorenzo Bazzanini.
|
||||
|
||||
* VERSION 4.2 Patch 8 - 2023-12-14
|
||||
|
||||
- NEW FEATURE: Add the $MaxLateMinutes system variable. This suppresses
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# "#PSSTUFF" for nifty PostScript examples #
|
||||
# #
|
||||
# This file is part of REMIND. #
|
||||
# Copyright (C) 1992-2023 Dianne Skoll #
|
||||
# Copyright (C) 1992-2024 Dianne Skoll #
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# #
|
||||
#############################################################################
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Not all sequences are supported by all terminals.
|
||||
|
||||
# This file is part of REMIND
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
if !defined("ansi_bold")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# US holidays
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-2023 Dianne Skoll
|
||||
# Copyright (C) 1992-2024 Dianne Skoll
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
REM [easterdate($Uy)-46] MSG Ash Wednesday
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Danish language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Mogens Lynnerup.
|
||||
|
||||
SET $Sunday "Søndag"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the German language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Wolfgang Thronicke
|
||||
|
||||
# Day names
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Support for the English language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# Nothing to do for English since it is the default.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Spanish language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Rafa Couto <rafacouto@biogate.com>
|
||||
|
||||
SET $Sunday "Domingo"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Finnish language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Mikko Silvonen
|
||||
|
||||
SET $Sunday "sunnuntai"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the French language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Laurent Duperval
|
||||
|
||||
SET $Sunday "dimanche"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Hellenic (Greek) language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by jarlaxl lamat (jarlaxl@freemail.gr)
|
||||
|
||||
SET $Sunday "Κυριακή"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Icelanding language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Björn Davíðsson (bjossi@snerpa.is)
|
||||
|
||||
SET $Sunday "sunnudagur"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Italian language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Valerio Aimale
|
||||
|
||||
SET $Sunday "Domenica"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Dutch language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Willem Kasdorp and Erik-Jan Vens
|
||||
|
||||
SET $Sunday "zondag"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Norwegian language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Trygve Randen
|
||||
|
||||
SET $Sunday "Søndag"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Polish language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Jerzy Sobczyk
|
||||
|
||||
SET $Sunday "Niedziela"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the (Brazilian) Portuguese language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Marco Paganini
|
||||
|
||||
SET $Sunday "domingo"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Support for the Romanian language.
|
||||
# This file is part of REMIND.
|
||||
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||
# REMIND is Copyright (C) 1992-2024 by Dianne Skoll
|
||||
# This file is derived from a translation by Liviu Daia
|
||||
|
||||
SET $Sunday "Duminică"
|
||||
|
||||
@@ -5,22 +5,25 @@ rem2ps \- draw a PostScript calendar from Remind output
|
||||
.SH SYNOPSIS
|
||||
.B rem2ps [\fIoptions\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBRem2ps\fR reads the standard input, which should be the results of
|
||||
\fBrem2ps\fR reads the standard input, which should be the results of
|
||||
running \fBRemind\fR with the \fB\-p\fR or \fB\-pp\fR option. It
|
||||
emits PostScript code (which draws a calendar) to the standard output.
|
||||
.PP
|
||||
See the section "Rem2PS Input Format" for details about the \fB\-p\fR
|
||||
Although \fBrem2ps\fR will be maintained, no new features will be added
|
||||
to it. Instead, all new development will continue on \fBrem2pdf\fR.
|
||||
.PP
|
||||
See the section "REM2PS INPUT FORMAT" for details about the \fB\-p\fR
|
||||
data. This may be useful if you wish to create other \fBRemind\fR
|
||||
back-ends.
|
||||
.PP
|
||||
Note that \fBRem2PS\fR does not handle UTF-8 input. If you need to
|
||||
Note that \fBrem2ps\fR does not handle UTF-8 input. If you need to
|
||||
render characters outside the ASCII character set, see
|
||||
\fBrem2pdf\fR instead.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
Be more verbose. This causes \fBRem2ps\fR to print progress messages
|
||||
Be more verbose. This causes \fBrem2ps\fR to print progress messages
|
||||
to the standard error stream. Normally, it is silent.
|
||||
.TP
|
||||
.B \-p file
|
||||
@@ -133,7 +136,7 @@ numbers.
|
||||
|
||||
.PP
|
||||
Type "rem2ps \-m help" for a list of available media. Note that the media
|
||||
type (and all \fBRem2ps\fR options) are case-sensitive. If you don't use
|
||||
type (and all \fBrem2ps\fR options) are case-sensitive. If you don't use
|
||||
the \fB\-m\fR option, the media defaults to a compiled-in default - this
|
||||
is usually Letter for North America and A4 for Europe. The "\-m help"
|
||||
option will display the compiled-in default.
|
||||
@@ -193,8 +196,8 @@ for good output:
|
||||
rem2ps \-ol 72 \-sh 12
|
||||
.fi
|
||||
.SH USAGE
|
||||
To use \fBRem2ps\fR, you should pipe the output of \fBRemind\fR with the \fB\-p\fR
|
||||
option to \fBRem2ps\fR, and then send the result to a printer. This is most easily
|
||||
To use \fBrem2ps\fR, you should pipe the output of \fBRemind\fR with the \fB\-p\fR
|
||||
option to \fBrem2ps\fR, and then send the result to a printer. This is most easily
|
||||
illustrated with examples:
|
||||
.PP
|
||||
.nf
|
||||
@@ -260,7 +263,7 @@ PostScript files. Always test your PostScript thoroughly with a PostScript
|
||||
viewer before sending it to the printer. You should not use any document
|
||||
structuring comments in your PostScript code.
|
||||
.PP
|
||||
In addition, prior to drawing a calendar page, \fBRem2ps\fR emits
|
||||
In addition, prior to drawing a calendar page, \fBrem2ps\fR emits
|
||||
the following PostScript code:
|
||||
.PP
|
||||
.nf
|
||||
@@ -320,7 +323,7 @@ For an example, create a file called "myprolog" whose contents are:
|
||||
} bind def
|
||||
.fi
|
||||
.PP
|
||||
Use that file with the \fBRem2ps\fR \fB\-p\fR option to create calendars
|
||||
Use that file with the \fBrem2ps\fR \fB\-p\fR option to create calendars
|
||||
with the year and month in large grey letters in the background of the
|
||||
calendar.
|
||||
.PP
|
||||
@@ -380,7 +383,7 @@ been set to "-". The consistent use of "/" is designed to ease parsing.
|
||||
.PP
|
||||
\fIspecial\fR is a string used
|
||||
for "out-of-band" communication with back-ends. If the reminder
|
||||
is a normal reminder, \fIspecial\fR is "*". The \fBRem2PS\fR
|
||||
is a normal reminder, \fIspecial\fR is "*". The \fBrem2ps\fR
|
||||
back-end understands the specials \fBPostScript\fR and \fBPSFile\fR.
|
||||
Other back-ends may understand other specials. A back end should
|
||||
\fIsilently ignore\fR a reminder with a special it doesn't understand.
|
||||
@@ -674,17 +677,17 @@ is desired.
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Rem2PS was written by Dianne Skoll <dianne@skoll.ca>
|
||||
rem2ps was written by Dianne Skoll <dianne@skoll.ca>
|
||||
.SH BUGS
|
||||
All \fBRem2ps\fR options are case-sensitive, unlike \fBRemind\fR.
|
||||
All \fBrem2ps\fR options are case-sensitive, unlike \fBRemind\fR.
|
||||
Any time you supply
|
||||
a font name or size, line thickness, or border width, it is treated as a
|
||||
string and sent straight to the PostScript interpreter. Thus, if you
|
||||
supply invalid fonts or sizes, \fBRem2ps\fR will not complain, but the
|
||||
supply invalid fonts or sizes, \fBrem2ps\fR will not complain, but the
|
||||
resulting PostScript output will probably not work.
|
||||
.PP
|
||||
You should ensure that the values you supply for margin widths are sensible.
|
||||
If they are too big for the media size, \fBRem2ps\fR will not complain,
|
||||
If they are too big for the media size, \fBrem2ps\fR will not complain,
|
||||
but again, the PostScript output will probably not work.
|
||||
.SH HOME PAGE
|
||||
https://dianne.skoll.ca/projects/remind/
|
||||
|
||||
@@ -1210,7 +1210,9 @@ in the bodies of timed reminders, then when the timed reminders are
|
||||
activated, the variables and functions have the definitions that were
|
||||
in effect at the end of the reminder script. These definitions may
|
||||
\fInot\fR necessarily be those that were in effect at the time the reminder
|
||||
was queued.
|
||||
was queued. In addition, the OMIT context is whatever was in effect at
|
||||
the end of the reminder script, which may not necessarily be the same
|
||||
as when the \fBREM\fR command was first processed.
|
||||
.PP
|
||||
.B THE SCHED AND WARN KEYWORDS
|
||||
.PP
|
||||
@@ -1704,6 +1706,11 @@ For example, the following sequences are equivalent:
|
||||
OMIT 3 Jan 2011 THROUGH 5 Jan 2011
|
||||
.fi
|
||||
.PP
|
||||
Note that \fBRemind\fR has a compiled-in limit to the number of full
|
||||
OMITs. If you omit a range of \fIN\fR fully-specified (ie, year
|
||||
included) days, then \fIN\fR full OMITs are used up. Trying to omit a
|
||||
very large range may result in the error "Too many full OMITs"
|
||||
.PP
|
||||
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command as
|
||||
long as both dates are fully specified
|
||||
.PP
|
||||
@@ -2603,6 +2610,18 @@ must also set \fB$CalcUTC\fR to 0 with the \fB\-i\fR option.
|
||||
.B $NextMode (read-only)
|
||||
If non-zero, then the \fB\-n\fR option was supplied on the command line.
|
||||
.TP
|
||||
.B $MaxFullOmits (read-only)
|
||||
The maximum number of full OMITs allowed (a compiled-in constant.)
|
||||
.TP
|
||||
.B $MaxPartialOmits (read-only)
|
||||
The maximum number of partial OMITs allowed (a compiled-in constant.)
|
||||
.TP
|
||||
.B $NumFullOmits (read-only)
|
||||
The number of full OMITs in the current OMIT context.
|
||||
.TP
|
||||
.B $NumPartialOmits (read-only)
|
||||
The number of partial OMITs in the current OMIT context.
|
||||
.TP
|
||||
.B $NumQueued (read-only)
|
||||
Contains the number of reminders queued so far for background
|
||||
timed triggering.
|
||||
@@ -5950,6 +5969,9 @@ Almanac Office, USNO.
|
||||
.PP
|
||||
Richard Siegel and Michael and Sharon Strassfeld, \fIThe First Jewish
|
||||
Catalog\fR, Jewish Publication Society of America.
|
||||
.PP
|
||||
Jean Meeus, \fIAstronomical Algorithms, Second Edition\fR, Willmann-Bell, Inc.
|
||||
|
||||
.SH HOME PAGE
|
||||
https://dianne.skoll.ca/projects/remind/
|
||||
.SH MAILING LIST
|
||||
|
||||
@@ -436,10 +436,16 @@ NOTE JSONQUEUE
|
||||
Indicates that queue contents in JSON format are about to follow. The
|
||||
end of the queue is indicated by a NOTE ENDJSONQUEUE line.
|
||||
|
||||
.PP
|
||||
Please note that \fBRemind\fR can write a status message \fIat any time\fR
|
||||
and not just in response to a command sent to its standard input. Therefore,
|
||||
a program that runs \fBRemind\fR in server mode must be prepared to handle
|
||||
asynchronous status messages.
|
||||
|
||||
.SH AUTHOR
|
||||
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
|
||||
|
||||
\fBTkRemind\fR is Copyright 1996-2023 by Dianne Skoll.
|
||||
\fBTkRemind\fR is Copyright 1996-2024 by Dianne Skoll.
|
||||
|
||||
.SH FILES
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# A cheesy graphical front/back end for Remind using Tcl/Tk
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-2023 Dianne Skoll
|
||||
# Copyright (C) 1992-2024 Dianne Skoll
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
@@ -289,7 +289,7 @@ set Option(PrintSmallCalendars) 1
|
||||
set OptDescr(PrintFormat) "Print format: pdf or ps"
|
||||
set Option(PrintFormat) ps
|
||||
|
||||
set WarningHeaders [list "# Lines staring with REM TAG TKTAGnnn ... were created by tkremind" "# Do not edit them by hand or results may be unpredictable."]
|
||||
set WarningHeaders [list "# Lines starting with REM TAG TKTAGnnn ... were created by tkremind" "# Do not edit them by hand or results may be unpredictable."]
|
||||
|
||||
# Highest tag seen so far. Array of tags is stored in ReminderTags()
|
||||
set HighestTagSoFar 0
|
||||
@@ -312,6 +312,10 @@ proc is_warning_header { line } {
|
||||
if {"$line" == "$h"} {
|
||||
return 1
|
||||
}
|
||||
# Ignore prior typo line too
|
||||
if {"$line" == "# Lines staring with REM TAG TKTAGnnn ... were created by tkremind"} {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -2856,12 +2860,6 @@ proc IssueBackgroundReminder { file time now tag } {
|
||||
exec "/bin/sh" "-c" $Option(RunCmd) "&"
|
||||
}
|
||||
}
|
||||
|
||||
# reread status
|
||||
if {$file != "stdin"} {
|
||||
puts $file "STATUS"
|
||||
flush $file
|
||||
}
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -3746,7 +3744,7 @@ proc DoMoonSpecial { n stuff fntag day } {
|
||||
# Displays current date and time in status window
|
||||
#***********************************************************************
|
||||
proc DisplayTime {} {
|
||||
global TwentyFourHourMode
|
||||
global TwentyFourHourMode DaemonFile
|
||||
if {$TwentyFourHourMode} {
|
||||
set msg [clock format [clock seconds] -format "%e %b %Y %H:%M"]
|
||||
} else {
|
||||
|
||||
201
src/calendar.c
201
src/calendar.c
@@ -5,7 +5,7 @@
|
||||
/* The code for generating a calendar. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -556,11 +556,11 @@ static void goff(void)
|
||||
static void
|
||||
ClampColor(int *r, int *g, int *b)
|
||||
{
|
||||
if (TerminalBackground == TERMINAL_BACKGROUND_UNKNOWN) {
|
||||
if (GetTerminalBackground() == TERMINAL_BACKGROUND_UNKNOWN) {
|
||||
/* No special clamping if terminal background is unknown */
|
||||
return;
|
||||
}
|
||||
if (TerminalBackground == TERMINAL_BACKGROUND_DARK) {
|
||||
if (GetTerminalBackground() == TERMINAL_BACKGROUND_DARK) {
|
||||
if (*r <= 64 && *g <= 64 && *b <= 64) {
|
||||
int max = *r;
|
||||
double factor;
|
||||
@@ -579,7 +579,7 @@ ClampColor(int *r, int *g, int *b)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (TerminalBackground == TERMINAL_BACKGROUND_LIGHT) {
|
||||
if (GetTerminalBackground() == TERMINAL_BACKGROUND_LIGHT) {
|
||||
if (*r > 191 && *g > 191 && *b > 191) {
|
||||
int min = *r;
|
||||
if (*g < min) min = *g;
|
||||
@@ -667,11 +667,11 @@ Colorize(int r, int g, int b, int bg, int clamp)
|
||||
if (b > 64) b = 1;
|
||||
else b = 0;
|
||||
|
||||
if (clamp && TerminalBackground == TERMINAL_BACKGROUND_DARK && !bg) {
|
||||
if (clamp && GetTerminalBackground() == TERMINAL_BACKGROUND_DARK && !bg) {
|
||||
/* Convert black-on-black to grey */
|
||||
if (!r && !g && !b) return VT100Colors[1][0][0][0];
|
||||
}
|
||||
if (clamp && TerminalBackground == TERMINAL_BACKGROUND_LIGHT && !bg) {
|
||||
if (clamp && GetTerminalBackground() == TERMINAL_BACKGROUND_LIGHT && !bg) {
|
||||
/* Convert white-on-white to grey */
|
||||
if (r && g && b) return VT100Colors[1][0][0][0];
|
||||
}
|
||||
@@ -2211,10 +2211,120 @@ static void WriteSimpleEntryProtocol1(CalEntry *e)
|
||||
printf("%s\n", e->text);
|
||||
}
|
||||
|
||||
void WriteJSONTimeTrigger(TimeTrig const *tt)
|
||||
{
|
||||
PrintJSONKeyPairTime("ttime", tt->ttime);
|
||||
PrintJSONKeyPairTime("nextttime", tt->nexttime);
|
||||
PrintJSONKeyPairInt("delta", tt->delta);
|
||||
PrintJSONKeyPairInt("rep", tt->rep);
|
||||
if (tt->duration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("duration", tt->duration);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags, int today)
|
||||
{
|
||||
/* wd is an array of days from 0=monday to 6=sunday.
|
||||
We convert to array of strings */
|
||||
if (t->wd != NO_WD) {
|
||||
printf("\"wd\":[");
|
||||
int done = 0;
|
||||
int i;
|
||||
for (i=0; i<7; i++) {
|
||||
if (t->wd & (1 << i)) {
|
||||
if (done) {
|
||||
printf(",");
|
||||
}
|
||||
done = 1;
|
||||
printf("\"%s\"", EnglishDayName[i]);
|
||||
}
|
||||
}
|
||||
printf("],");
|
||||
}
|
||||
if (t->d != NO_DAY) {
|
||||
PrintJSONKeyPairInt("d", t->d);
|
||||
}
|
||||
if (t->m != NO_MON) {
|
||||
PrintJSONKeyPairInt("m", t->m+1);
|
||||
}
|
||||
if (t->y != NO_YR) {
|
||||
PrintJSONKeyPairInt("y", t->y);
|
||||
}
|
||||
if (t->back) {
|
||||
PrintJSONKeyPairInt("back", t->back);
|
||||
}
|
||||
if (t->delta) {
|
||||
PrintJSONKeyPairInt("delta", t->delta);
|
||||
}
|
||||
if (t->rep) {
|
||||
PrintJSONKeyPairInt("rep", t->rep);
|
||||
}
|
||||
/* Local omit is an array of days from 0=monday to 6=sunday.
|
||||
We convert to array of strings */
|
||||
if (t->localomit != NO_WD) {
|
||||
printf("\"localomit\":[");
|
||||
int done = 0;
|
||||
int i;
|
||||
for (i=0; i<7; i++) {
|
||||
if (t->localomit & (1 << i)) {
|
||||
if (done) {
|
||||
printf(",");
|
||||
}
|
||||
done = 1;
|
||||
printf("\"%s\"", EnglishDayName[i]);
|
||||
}
|
||||
}
|
||||
printf("],");
|
||||
}
|
||||
switch(t->skip) {
|
||||
case SKIP_SKIP:
|
||||
PrintJSONKeyPairString("skip", "SKIP");
|
||||
break;
|
||||
case BEFORE_SKIP:
|
||||
PrintJSONKeyPairString("skip", "BEFORE");
|
||||
break;
|
||||
case AFTER_SKIP:
|
||||
PrintJSONKeyPairString("skip", "AFTER");
|
||||
break;
|
||||
}
|
||||
PrintJSONKeyPairDate("until", t->until);
|
||||
if (t->once != NO_ONCE) {
|
||||
PrintJSONKeyPairInt("once", t->once);
|
||||
}
|
||||
if (t->scanfrom != today) {
|
||||
PrintJSONKeyPairDate("scanfrom", t->scanfrom);
|
||||
}
|
||||
PrintJSONKeyPairDate("from", t->from);
|
||||
PrintJSONKeyPairInt("priority", t->priority);
|
||||
PrintJSONKeyPairDateTime("eventstart", t->eventstart);
|
||||
if (t->eventduration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("eventduration", t->eventduration);
|
||||
}
|
||||
if (t->maybe_uncomputable) {
|
||||
PrintJSONKeyPairInt("maybe_uncomputable", 1);
|
||||
}
|
||||
if (t->noqueue) {
|
||||
PrintJSONKeyPairInt("noqueue", 1);
|
||||
}
|
||||
if (*t->sched) {
|
||||
PrintJSONKeyPairString("sched", t->sched);
|
||||
}
|
||||
if (*t->warn) {
|
||||
PrintJSONKeyPairString("warn", t->warn);
|
||||
}
|
||||
if (*t->omitfunc) {
|
||||
PrintJSONKeyPairString("omitfunc", t->omitfunc);
|
||||
}
|
||||
if (t->addomit) {
|
||||
PrintJSONKeyPairInt("addomit", 1);
|
||||
}
|
||||
if (include_tags) {
|
||||
PrintJSONKeyPairString("tags", DBufValue(&(t->tags)));
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||
{
|
||||
int done = 0;
|
||||
char const *s;
|
||||
if (DoPrefixLineNo) {
|
||||
PrintJSONKeyPairString("filename", e->filename);
|
||||
@@ -2234,88 +2344,13 @@ static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||
PrintJSONKeyPairInt("trep", e->tt.rep);
|
||||
}
|
||||
}
|
||||
if (e->trig.eventduration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("eventduration", e->trig.eventduration);
|
||||
}
|
||||
/* wd is an array of days from 0=monday to 6=sunday.
|
||||
We convert to array of strings */
|
||||
if (e->trig.wd != NO_WD) {
|
||||
printf("\"wd\":[");
|
||||
done = 0;
|
||||
int i;
|
||||
for (i=0; i<7; i++) {
|
||||
if (e->trig.wd & (1 << i)) {
|
||||
if (done) {
|
||||
printf(",");
|
||||
}
|
||||
done = 1;
|
||||
printf("\"%s\"", EnglishDayName[i]);
|
||||
}
|
||||
}
|
||||
printf("],");
|
||||
}
|
||||
if (e->trig.d != NO_DAY) {
|
||||
PrintJSONKeyPairInt("d", e->trig.d);
|
||||
}
|
||||
if (e->trig.m != NO_MON) {
|
||||
PrintJSONKeyPairInt("m", e->trig.m+1);
|
||||
}
|
||||
if (e->trig.y != NO_YR) {
|
||||
PrintJSONKeyPairInt("y", e->trig.y);
|
||||
}
|
||||
PrintJSONKeyPairDateTime("eventstart", e->trig.eventstart);
|
||||
if (e->trig.back) {
|
||||
PrintJSONKeyPairInt("back", e->trig.back);
|
||||
}
|
||||
if (e->trig.delta) {
|
||||
PrintJSONKeyPairInt("delta", e->trig.delta);
|
||||
}
|
||||
if (e->trig.rep) {
|
||||
PrintJSONKeyPairInt("rep", e->trig.rep);
|
||||
}
|
||||
WriteJSONTrigger(&e->trig, 0, today);
|
||||
if (e->nonconst_expr) {
|
||||
PrintJSONKeyPairInt("nonconst_expr", e->nonconst_expr);
|
||||
}
|
||||
if (e->if_depth) {
|
||||
PrintJSONKeyPairInt("if_depth", e->if_depth);
|
||||
}
|
||||
switch(e->trig.skip) {
|
||||
case SKIP_SKIP:
|
||||
PrintJSONKeyPairString("skip", "SKIP");
|
||||
break;
|
||||
case BEFORE_SKIP:
|
||||
PrintJSONKeyPairString("skip", "BEFORE");
|
||||
break;
|
||||
case AFTER_SKIP:
|
||||
PrintJSONKeyPairString("skip", "AFTER");
|
||||
break;
|
||||
}
|
||||
/* Local omit is an array of days from 0=monday to 6=sunday.
|
||||
We convert to array of strings */
|
||||
if (e->trig.localomit != NO_WD) {
|
||||
printf("\"localomit\":[");
|
||||
done = 0;
|
||||
int i;
|
||||
for (i=0; i<7; i++) {
|
||||
if (e->trig.localomit & (1 << i)) {
|
||||
if (done) {
|
||||
printf(",");
|
||||
}
|
||||
done = 1;
|
||||
printf("\"%s\"", EnglishDayName[i]);
|
||||
}
|
||||
}
|
||||
printf("],");
|
||||
}
|
||||
PrintJSONKeyPairDate("until", e->trig.until);
|
||||
if (e->trig.once != NO_ONCE) {
|
||||
PrintJSONKeyPairInt("once", e->trig.once);
|
||||
}
|
||||
if (e->trig.scanfrom != today) {
|
||||
PrintJSONKeyPairDate("scanfrom", e->trig.scanfrom);
|
||||
}
|
||||
PrintJSONKeyPairDate("from", e->trig.from);
|
||||
PrintJSONKeyPairInt("priority", e->trig.priority);
|
||||
|
||||
if (e->is_color) {
|
||||
PrintJSONKeyPairInt("r", e->r);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* which you can customize. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* which you can customize. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* commands. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -1147,7 +1147,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
|
||||
DoMsgCommand(msg_command, DBufValue(&buf));
|
||||
} else {
|
||||
/* Add a space before "NOTE endreminder" */
|
||||
if (Daemon < 0 && !strncmp(DBufValue(&buf), "NOTE endreminder", 16)) {
|
||||
if (IsServerMode() && !strncmp(DBufValue(&buf), "NOTE endreminder", 16)) {
|
||||
printf(" %s", DBufValue(&buf));
|
||||
} else {
|
||||
printf("%s", DBufValue(&buf));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* reminders are triggered. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* buffers. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Declaration of functions for manipulating dynamic buffers */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
12
src/err.h
12
src/err.h
@@ -5,7 +5,7 @@
|
||||
/* Error definitions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -129,6 +129,10 @@
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#define STR(X) STR2(X)
|
||||
#define STR2(X) #X
|
||||
|
||||
|
||||
#ifndef L_ERR_OVERRIDE
|
||||
EXTERN char *ErrMsg[]
|
||||
|
||||
@@ -165,7 +169,7 @@ EXTERN char *ErrMsg[]
|
||||
"Number too high",
|
||||
"Number too low",
|
||||
"Can't open file",
|
||||
"INCLUDE nested too deeply",
|
||||
"INCLUDE nested too deeply (max. " STR(INCLUDE_NEST) ")",
|
||||
"Parse error",
|
||||
"Can't compute trigger",
|
||||
"Too many nested IFs",
|
||||
@@ -189,8 +193,8 @@ EXTERN char *ErrMsg[]
|
||||
"Day specified twice",
|
||||
"Unknown token",
|
||||
"Must specify month in OMIT command",
|
||||
"Too many partial OMITs",
|
||||
"Too many full OMITs",
|
||||
"Too many partial OMITs (max. " STR(MAX_PARTIAL_OMITS) ")",
|
||||
"Too many full OMITs (max. " STR(MAX_FULL_OMITS) ")",
|
||||
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
||||
"Error reading",
|
||||
"Expecting end-of-line",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* This file contains routines to parse and evaluate */
|
||||
/* expressions. */
|
||||
/* */
|
||||
/* Copyright 1992-2023 by Dianne Skoll */
|
||||
/* Copyright 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
17
src/expr.h
17
src/expr.h
@@ -5,19 +5,20 @@
|
||||
/* Contains a few definitions used by expression evaluator. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* Define the types of values */
|
||||
#define ERR_TYPE 0
|
||||
#define INT_TYPE 1
|
||||
#define TIME_TYPE 2
|
||||
#define DATE_TYPE 3
|
||||
#define STR_TYPE 4
|
||||
#define DATETIME_TYPE 5
|
||||
#define SPECIAL_TYPE 6 /* Only for system variables */
|
||||
#define ERR_TYPE 0
|
||||
#define INT_TYPE 1
|
||||
#define TIME_TYPE 2
|
||||
#define DATE_TYPE 3
|
||||
#define STR_TYPE 4
|
||||
#define DATETIME_TYPE 5
|
||||
#define SPECIAL_TYPE 6 /* Only for system variables */
|
||||
#define CONST_INT_TYPE 7 /* Only for system variables */
|
||||
|
||||
/* Define stuff for parsing expressions */
|
||||
#define BEG_OF_EXPR '['
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* files. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* expressions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* globals.h and err.h */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -79,7 +79,7 @@ EXTERN INIT( int SortByDate, 0);
|
||||
EXTERN INIT( int SortByPrio, 0);
|
||||
EXTERN INIT( int UntimedBeforeTimed, 0);
|
||||
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
|
||||
EXTERN INIT( long SysTime, -1L);
|
||||
EXTERN INIT( int SysTime, -1);
|
||||
EXTERN INIT( int ParseUntriggered, 1);
|
||||
|
||||
EXTERN char const *InitialFile;
|
||||
@@ -102,7 +102,7 @@ EXTERN INIT( int SynthesizeTags, 0);
|
||||
EXTERN INIT( int ScFormat, SC_AMPM);
|
||||
EXTERN INIT( int MaxSatIter, 1000);
|
||||
EXTERN INIT( int MaxStringLen, MAX_STR_LEN);
|
||||
EXTERN INIT( char *FileName, NULL);
|
||||
EXTERN INIT( char *FileName, NULL);
|
||||
EXTERN INIT( int UseStdin, 0);
|
||||
EXTERN INIT( int PurgeMode, 0);
|
||||
EXTERN INIT( int PurgeIncludeDepth, 0);
|
||||
@@ -157,6 +157,9 @@ EXTERN INIT( char *EndSentIg, "\"')]}>");
|
||||
EXTERN DynamicBuffer Banner;
|
||||
EXTERN DynamicBuffer LineBuffer;
|
||||
EXTERN DynamicBuffer ExprBuf;
|
||||
|
||||
extern int NumFullOmits, NumPartialOmits;
|
||||
|
||||
/* List of months */
|
||||
EXTERN char *EnglishMonthName[]
|
||||
#ifdef MK_GLOBALS
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Support for the Hebrew calendar */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/* Derived from code written by Amos Shapir in 1978; revised */
|
||||
|
||||
41
src/init.c
41
src/init.c
@@ -7,7 +7,7 @@
|
||||
/* in normal mode. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -176,7 +176,6 @@ void InitRemind(int argc, char const *argv[])
|
||||
int x;
|
||||
int dse;
|
||||
int ttyfd;
|
||||
int r, g, b;
|
||||
|
||||
dse = NO_DATE;
|
||||
|
||||
@@ -649,17 +648,6 @@ void InitRemind(int argc, char const *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (should_guess_terminal_background) {
|
||||
guess_terminal_background(&r, &g, &b);
|
||||
if (r >= 0 && g >= 0 && b >= 0) {
|
||||
if (r+g+b <= 85*3 && r <= 128 && g <= 128 && b <= 128) {
|
||||
TerminalBackground = TERMINAL_BACKGROUND_DARK;
|
||||
} else {
|
||||
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the filename. */
|
||||
if (!InvokedAsRem) {
|
||||
if (i >= argc) {
|
||||
@@ -779,7 +767,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
#ifndef L_USAGE_OVERRIDE
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2023 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2024 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
@@ -1042,7 +1030,12 @@ guess_terminal_background(int *r, int *g, int *b)
|
||||
return;
|
||||
}
|
||||
tty_raw(ttyfd);
|
||||
write(ttyfd, "\033]11;?\033\\", 8);
|
||||
n = write(ttyfd, "\033]11;?\033\\", 8);
|
||||
|
||||
if (n != 8) {
|
||||
/* write failed... WTF? Not much we can do */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Wait up to 0.1s for terminal to respond */
|
||||
p.fd = ttyfd;
|
||||
@@ -1110,3 +1103,21 @@ tty_reset(int fd)
|
||||
{
|
||||
tcsetattr(fd, TCSAFLUSH, &orig_termios);
|
||||
}
|
||||
|
||||
int
|
||||
GetTerminalBackground(void)
|
||||
{
|
||||
int r, g, b;
|
||||
if (should_guess_terminal_background) {
|
||||
guess_terminal_background(&r, &g, &b);
|
||||
if (r >= 0 && g >= 0 && b >= 0) {
|
||||
if (r+g+b <= 85*3 && r <= 128 && g <= 128 && b <= 128) {
|
||||
TerminalBackground = TERMINAL_BACKGROUND_DARK;
|
||||
} else {
|
||||
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
|
||||
}
|
||||
}
|
||||
should_guess_terminal_background = 0;
|
||||
}
|
||||
return TerminalBackground;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Header file for language support for various languages. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* REMIND is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/* Further corrections by Erik-Jan Vens */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Support for the English language. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
||||
/* REMIND is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* REMIND is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -254,7 +254,7 @@ EXTERN char *ErrMsg[] =
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2023 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2024 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* REMIND is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
||||
/* Dianne Skoll. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
@@ -228,7 +228,7 @@ EXTERN char *ErrMsg[] =
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2023 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2024 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/* I don't speak German. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Support for the Icelandic language. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* This file is part of REMIND. */
|
||||
/* It is Copyright (C) 1996 by Valerio Aimale */
|
||||
/* */
|
||||
/* Remind is copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Remind is copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
||||
/* Remind is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Remind is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/* Polish. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -244,7 +244,7 @@ EXTERN char *ErrMsg[] =
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2023 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2024 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* REMIND is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
||||
/* Dianne Skoll. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
@@ -253,7 +253,7 @@ EXTERN char *ErrMsg[] =
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2023 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2024 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* REMIND is Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* Author: Rafa Couto <rafacouto@biogate.com> */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
12
src/main.c
12
src/main.c
@@ -6,7 +6,7 @@
|
||||
/* routines, etc. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -747,17 +747,17 @@ int PushToken(char const *tok, ParsePtr p)
|
||||
/* Return the system time in seconds past midnight */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
long SystemTime(int realtime)
|
||||
int SystemTime(int realtime)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *t;
|
||||
|
||||
if (!realtime && (SysTime != -1L)) return SysTime;
|
||||
if (!realtime && (SysTime != -1)) return SysTime;
|
||||
|
||||
now = time(NULL);
|
||||
t = localtime(&now);
|
||||
return (long) t->tm_hour * 3600L + (long) t->tm_min * 60L +
|
||||
(long) t->tm_sec;
|
||||
return t->tm_hour * 3600L + t->tm_min * 60L +
|
||||
t->tm_sec;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -769,7 +769,7 @@ long SystemTime(int realtime)
|
||||
/***************************************************************/
|
||||
int MinutesPastMidnight(int realtime)
|
||||
{
|
||||
return (int) (SystemTime(realtime) / 60);
|
||||
return (SystemTime(realtime) / 60);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Calculations for figuring out moon phases. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* the data structures for OMITted dates. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -32,7 +32,7 @@ static int PartialOmitArray[MAX_PARTIAL_OMITS];
|
||||
/* WeekdayOmits is declared in global.h */
|
||||
|
||||
/* How many of each omit types do we have? */
|
||||
static int NumFullOmits, NumPartialOmits;
|
||||
int NumFullOmits, NumPartialOmits;
|
||||
|
||||
/* The structure for saving and restoring OMIT contexts */
|
||||
typedef struct omitcontext {
|
||||
@@ -445,6 +445,9 @@ int DoOmit(ParsePtr p)
|
||||
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
|
||||
InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome);
|
||||
NumPartialOmits++;
|
||||
if (NumPartialOmits == 366) {
|
||||
Wprint("You have OMITted everything! The space-time continuum is at risk.");
|
||||
}
|
||||
}
|
||||
if (mc == m[1] && dc == d[1]) {
|
||||
break;
|
||||
|
||||
11
src/protos.h
11
src/protos.h
@@ -5,7 +5,7 @@
|
||||
/* Function Prototypes. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -22,6 +22,9 @@
|
||||
/* Characters to ignore */
|
||||
#define isempty(c) (isspace(c) || ((c) == '\\'))
|
||||
|
||||
#define IsServerMode() (Daemon < 0)
|
||||
#define ShouldFork (!DontFork)
|
||||
|
||||
#include "dynbuf.h"
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -71,7 +74,7 @@ void OutputLine (FILE *fp);
|
||||
void CreateParser (char const *s, ParsePtr p);
|
||||
void DestroyParser (ParsePtr p);
|
||||
int PushToken (char const *tok, ParsePtr p);
|
||||
long SystemTime (int realtime);
|
||||
int SystemTime (int realtime);
|
||||
int MinutesPastMidnight (int realtime);
|
||||
int SystemDate (int *y, int *m, int *d);
|
||||
int DoIf (ParsePtr p);
|
||||
@@ -171,6 +174,8 @@ int AddGlobalOmit(int dse);
|
||||
void set_lat_and_long_from_components(void);
|
||||
void set_components_from_lat_and_long(void);
|
||||
|
||||
int GetTerminalBackground(void);
|
||||
|
||||
char const *get_day_name(int wkday);
|
||||
char const *get_month_name(int mon);
|
||||
|
||||
@@ -179,6 +184,8 @@ void clear_callstack(void);
|
||||
int print_callstack(FILE *fp);
|
||||
void pop_call(void);
|
||||
void FixSpecialType(Trigger *trig);
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags, int today);
|
||||
void WriteJSONTimeTrigger(TimeTrig const *tt);
|
||||
#ifdef REM_USE_WCHAR
|
||||
#define _XOPEN_SOURCE 600
|
||||
#include <wctype.h>
|
||||
|
||||
168
src/queue.c
168
src/queue.c
@@ -5,7 +5,7 @@
|
||||
/* Queue up reminders for subsequent execution. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -35,6 +35,13 @@
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
|
||||
/* A list of filenames associated with queued reminders */
|
||||
typedef struct queuedfname {
|
||||
struct queuedfname *next;
|
||||
char const *fname;
|
||||
} QueuedFilename;
|
||||
|
||||
|
||||
/* List structure for holding queued reminders */
|
||||
typedef struct queuedrem {
|
||||
struct queuedrem *next;
|
||||
@@ -42,16 +49,17 @@ typedef struct queuedrem {
|
||||
int RunDisabled;
|
||||
int ntrig;
|
||||
char const *text;
|
||||
char const *fname;
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
char sched[VAR_NAME_LEN+1];
|
||||
DynamicBuffer tags;
|
||||
Trigger t;
|
||||
TimeTrig tt;
|
||||
} QueuedRem;
|
||||
|
||||
/* Global variables */
|
||||
|
||||
static QueuedRem *QueueHead;
|
||||
static QueuedRem *QueueHead = NULL;
|
||||
static QueuedFilename *Files = NULL;
|
||||
static time_t FileModTime;
|
||||
static struct stat StatBuf;
|
||||
|
||||
@@ -62,6 +70,50 @@ static int CalculateNextTimeUsingSched (QueuedRem *q);
|
||||
static void DaemonWait (struct timeval *sleep_tv);
|
||||
static void reread (void);
|
||||
static void PrintQueue(void);
|
||||
static char const *QueueFilename(char const *fname);
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* QueueFilename */
|
||||
/* */
|
||||
/* Add fname to the list of queued filenames if it's not */
|
||||
/* already present. Either way, return a pointer to the */
|
||||
/* filename. Returns NULL if out of memory */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static QueuedFilename *last_file_found = NULL;
|
||||
static char const *QueueFilename(char const *fname)
|
||||
{
|
||||
QueuedFilename *elem = Files;
|
||||
|
||||
/* Optimization: We are very likely in the same file as
|
||||
before... */
|
||||
if (last_file_found && !strcmp(fname, last_file_found->fname)) {
|
||||
return last_file_found->fname;
|
||||
}
|
||||
|
||||
/* No such luck; search the list */
|
||||
while(elem) {
|
||||
if (!strcmp(elem->fname, fname)) {
|
||||
last_file_found = elem;
|
||||
return elem->fname;
|
||||
}
|
||||
elem = elem->next;
|
||||
}
|
||||
/* Not found... queue it */
|
||||
elem = NEW(QueuedFilename);
|
||||
if (!elem) return NULL;
|
||||
elem->fname = StrDup(fname);
|
||||
if (!elem->fname) {
|
||||
free(elem);
|
||||
return NULL;
|
||||
}
|
||||
elem->next = Files;
|
||||
Files = elem;
|
||||
last_file_found = elem;
|
||||
return elem->fname;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -72,7 +124,7 @@ static void PrintQueue(void);
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
TimeTrig *tim, char const *sched)
|
||||
TimeTrig *tim, char const *sched)
|
||||
{
|
||||
QueuedRem *qelem;
|
||||
|
||||
@@ -92,21 +144,27 @@ int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
free(qelem);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
qelem->fname = QueueFilename(FileName);
|
||||
if (!qelem->fname) {
|
||||
free((void *) qelem->text);
|
||||
free(qelem);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
NumQueued++;
|
||||
qelem->typ = trig->typ;
|
||||
strcpy(qelem->passthru, trig->passthru);
|
||||
qelem->tt = *tim;
|
||||
qelem->t = *trig;
|
||||
DBufInit(&(qelem->t.tags));
|
||||
DBufPuts(&(qelem->t.tags), DBufValue(&(trig->tags)));
|
||||
if (SynthesizeTags) {
|
||||
AppendTag(&(qelem->t.tags), SynthesizeTag());
|
||||
}
|
||||
qelem->next = QueueHead;
|
||||
qelem->RunDisabled = RunDisabled;
|
||||
qelem->ntrig = 0;
|
||||
strcpy(qelem->sched, sched);
|
||||
DBufInit(&(qelem->tags));
|
||||
DBufPuts(&(qelem->tags), DBufValue(&(trig->tags)));
|
||||
if (SynthesizeTags) {
|
||||
AppendTag(&(qelem->tags), SynthesizeTag());
|
||||
}
|
||||
QueueHead = qelem;
|
||||
return OK;
|
||||
}
|
||||
@@ -141,6 +199,21 @@ SigContHandler(int d)
|
||||
UNUSED(d);
|
||||
}
|
||||
|
||||
static void
|
||||
print_num_queued(void)
|
||||
{
|
||||
int nqueued = 0;
|
||||
QueuedRem *q = QueueHead;
|
||||
while(q) {
|
||||
if (q->tt.nexttime != NO_TIME) {
|
||||
nqueued++;
|
||||
}
|
||||
q = q->next;
|
||||
}
|
||||
printf("NOTE queued %d\n", nqueued);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* HandleQueuedReminders */
|
||||
@@ -154,7 +227,6 @@ void HandleQueuedReminders(void)
|
||||
int TimeToSleep;
|
||||
unsigned SleepTime;
|
||||
Parser p;
|
||||
Trigger trig;
|
||||
struct timeval tv;
|
||||
struct timeval sleep_tv;
|
||||
struct sigaction sa;
|
||||
@@ -165,6 +237,12 @@ void HandleQueuedReminders(void)
|
||||
/* Turn off sorting -- otherwise, TriggerReminder has no effect! */
|
||||
SortByDate = 0;
|
||||
|
||||
/* Free FileName if necessary */
|
||||
if (FileName) {
|
||||
free(FileName);
|
||||
FileName = NULL;
|
||||
}
|
||||
|
||||
/* If we are not connected to a tty, then we must close the
|
||||
* standard file descriptors. This is to prevent someone
|
||||
* doing:
|
||||
@@ -174,7 +252,7 @@ void HandleQueuedReminders(void)
|
||||
* processed correctly are RUN commands, provided they mail
|
||||
* the result back or use their own resource (as a window).
|
||||
*/
|
||||
if (!DontFork) {
|
||||
if (ShouldFork) {
|
||||
maybe_close(STDIN_FILENO);
|
||||
maybe_close(STDOUT_FILENO);
|
||||
maybe_close(STDERR_FILENO);
|
||||
@@ -197,7 +275,7 @@ void HandleQueuedReminders(void)
|
||||
q = q->next;
|
||||
}
|
||||
|
||||
if (!DontFork || Daemon) {
|
||||
if (ShouldFork || Daemon) {
|
||||
sa.sa_handler = SigIntHandler;
|
||||
sa.sa_flags = 0;
|
||||
(void) sigaction(SIGINT, &sa, NULL);
|
||||
@@ -213,7 +291,7 @@ void HandleQueuedReminders(void)
|
||||
if (!q && !Daemon) break;
|
||||
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
if (IsServerMode()) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(1);
|
||||
} else {
|
||||
@@ -232,7 +310,7 @@ void HandleQueuedReminders(void)
|
||||
|
||||
/* Wake up once a minute to recalibrate sleep time in
|
||||
case of laptop hibernation */
|
||||
if (Daemon < 0) {
|
||||
if (IsServerMode()) {
|
||||
/* Wake up on the next exact minute */
|
||||
gettimeofday(&tv, NULL);
|
||||
sleep_tv.tv_sec = 60 - (tv.tv_sec % 60);
|
||||
@@ -263,7 +341,7 @@ void HandleQueuedReminders(void)
|
||||
if (Daemon > 0 && SleepTime) CheckInitialFile();
|
||||
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
if (IsServerMode()) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(1);
|
||||
} else {
|
||||
@@ -286,25 +364,25 @@ void HandleQueuedReminders(void)
|
||||
(MaxLateMinutes == 0 || SystemTime(1) - (q->tt.nexttime * 60) <= 60 * MaxLateMinutes))) {
|
||||
/* Trigger the reminder */
|
||||
CreateParser(q->text, &p);
|
||||
trig.typ = q->typ;
|
||||
strcpy(trig.passthru, q->passthru);
|
||||
RunDisabled = q->RunDisabled;
|
||||
if (Daemon < 0) {
|
||||
if (IsServerMode()) {
|
||||
printf("NOTE reminder %s",
|
||||
SimpleTime(q->tt.ttime));
|
||||
printf("%s", SimpleTime(MinutesPastMidnight(1)));
|
||||
if (!*DBufValue(&q->tags)) {
|
||||
if (!*DBufValue(&q->t.tags)) {
|
||||
printf("*\n");
|
||||
} else {
|
||||
printf("%s\n", DBufValue(&(q->tags)));
|
||||
printf("%s\n", DBufValue(&(q->t.tags)));
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up global variables so some functions like trigdate()
|
||||
and trigtime() work correctly */
|
||||
SaveAllTriggerInfo(&(q->t), &(q->tt), DSEToday, q->tt.ttime, 1);
|
||||
(void) TriggerReminder(&p, &trig, &q->tt, DSEToday, 1);
|
||||
if (Daemon < 0) {
|
||||
FileName = (char *) q->fname;
|
||||
(void) TriggerReminder(&p, &q->t, &q->tt, DSEToday, 1);
|
||||
FileName = NULL;
|
||||
if (IsServerMode()) {
|
||||
printf("NOTE endreminder\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
@@ -314,14 +392,20 @@ void HandleQueuedReminders(void)
|
||||
/* Calculate the next trigger time */
|
||||
q->tt.nexttime = CalculateNextTime(q);
|
||||
|
||||
/* If trigger time is way in the past because computer has been
|
||||
suspended or hibernated, remove from queue */
|
||||
/* If it's dequeued, update num_queued */
|
||||
if (q->tt.nexttime != NO_TIME) {
|
||||
/* If trigger time is way in the past because computer has been
|
||||
suspended or hibernated, remove from queue */
|
||||
if (q->tt.ttime < MinutesPastMidnight(1) - MaxLateMinutes &&
|
||||
q->tt.nexttime < MinutesPastMidnight(1) - MaxLateMinutes) {
|
||||
q->tt.nexttime = NO_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have dequeued a reminder, update controlling process */
|
||||
if (q->tt.nexttime == NO_TIME && IsServerMode()) {
|
||||
print_num_queued();
|
||||
}
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
@@ -530,6 +614,11 @@ json_queue(QueuedRem const *q)
|
||||
}
|
||||
done = 1;
|
||||
printf("{");
|
||||
WriteJSONTrigger(&(q->t), 1, DSEToday);
|
||||
WriteJSONTimeTrigger(&(q->tt));
|
||||
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
|
||||
PrintJSONKeyPairInt("ntrig", q->ntrig);
|
||||
PrintJSONKeyPairString("filename", q->fname);
|
||||
switch(q->typ) {
|
||||
case NO_TYPE: PrintJSONKeyPairString("type", "NO_TYPE"); break;
|
||||
case MSG_TYPE: PrintJSONKeyPairString("type", "MSG_TYPE"); break;
|
||||
@@ -542,26 +631,6 @@ json_queue(QueuedRem const *q)
|
||||
case PASSTHRU_TYPE: PrintJSONKeyPairString("type", "PASSTHRU_TYPE"); break;
|
||||
default: PrintJSONKeyPairString("type", "?"); break;
|
||||
}
|
||||
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
|
||||
PrintJSONKeyPairInt("ntrig", q->ntrig);
|
||||
PrintJSONKeyPairTime("ttime", q->tt.ttime);
|
||||
PrintJSONKeyPairTime("nextttime", q->tt.nexttime);
|
||||
PrintJSONKeyPairInt("delta", q->tt.delta);
|
||||
if (q->tt.rep != NO_TIME) {
|
||||
PrintJSONKeyPairInt("rep", q->tt.rep);
|
||||
}
|
||||
if (q->tt.duration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("duration", q->tt.duration);
|
||||
}
|
||||
if (q->passthru[0]) {
|
||||
PrintJSONKeyPairString("passthru", q->passthru);
|
||||
}
|
||||
if (q->sched[0]) {
|
||||
PrintJSONKeyPairString("sched", q->sched);
|
||||
}
|
||||
if (DBufLen(&(q->tags))) {
|
||||
PrintJSONKeyPairString("tags", DBufValue(&(q->tags)));
|
||||
}
|
||||
|
||||
/* Last one is a special case - no trailing comma */
|
||||
printf("\"");
|
||||
@@ -622,16 +691,7 @@ static void DaemonWait(struct timeval *sleep_tv)
|
||||
if (!strcmp(cmdLine, "EXIT\n")) {
|
||||
exit(EXIT_SUCCESS);
|
||||
} else if (!strcmp(cmdLine, "STATUS\n")) {
|
||||
int nqueued = 0;
|
||||
QueuedRem *q = QueueHead;
|
||||
while(q) {
|
||||
if (q->tt.nexttime != NO_TIME) {
|
||||
nqueued++;
|
||||
}
|
||||
q = q->next;
|
||||
}
|
||||
printf("NOTE queued %d\n", nqueued);
|
||||
fflush(stdout);
|
||||
print_num_queued();
|
||||
} else if (!strcmp(cmdLine, "QUEUE\n")) {
|
||||
printf("NOTE queue\n");
|
||||
QueuedRem *q = QueueHead;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Print a PostScript calendar. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -350,7 +350,7 @@ int main(int argc, char *argv[])
|
||||
!strcmp(DBufValue(&buf), PSBEGIN2)) {
|
||||
if (!validfile) {
|
||||
if (Verbose) {
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2023 by Dianne Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2024 by Dianne Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Generating PostScript calendar\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Define the PostScript prologue */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -14,7 +14,7 @@ char *PSProlog1[] =
|
||||
{
|
||||
"% This file was produced by Remind and Rem2PS, written by",
|
||||
"% Dianne Skoll.",
|
||||
"% Remind and Rem2PS are Copyright 1992-2023 Dianne Skoll.",
|
||||
"% Remind and Rem2PS are Copyright 1992-2024 Dianne Skoll.",
|
||||
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
|
||||
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
|
||||
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Routines for sorting reminders by trigger date */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* classifying the tokens parsed. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Routines for figuring out the trigger date of a reminder */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -324,8 +324,11 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
|
||||
break;
|
||||
}
|
||||
start--;
|
||||
if (start < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iter > MaxSatIter) {
|
||||
if (start < 0 || iter > MaxSatIter) {
|
||||
/* omitfunc must have returned "true" too often */
|
||||
*err = E_CANT_TRIG;
|
||||
return -2;
|
||||
@@ -388,6 +391,10 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
|
||||
break;
|
||||
}
|
||||
simple--;
|
||||
if (simple < 0) {
|
||||
*err = E_CANT_TRIG;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
if (iter > MaxSatIter) {
|
||||
*err = E_CANT_TRIG;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Type definitions all dumped here. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* functions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -349,7 +349,9 @@ int CallUserFunc(char const *name, int nargs, ParsePtr p)
|
||||
|
||||
/* Skip the opening bracket, if there's one */
|
||||
while (isempty(*s)) s++;
|
||||
if (*s == BEG_OF_EXPR) s++;
|
||||
if (*s == BEG_OF_EXPR) {
|
||||
s++;
|
||||
}
|
||||
push_call(f->filename, f->name, f->lineno);
|
||||
h = Evaluate(&s, f->locals, p);
|
||||
if (h == OK) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Useful utility functions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -36,6 +36,11 @@ char *StrnCpy(char *dest, char const *source, int n)
|
||||
{
|
||||
char *odest = dest;
|
||||
|
||||
if (n <= 0) {
|
||||
*dest = 0;
|
||||
return dest;
|
||||
}
|
||||
|
||||
while (n-- && (*dest++ = *source++)) ;
|
||||
if (*(dest-1)) *dest = 0;
|
||||
return odest;
|
||||
@@ -108,7 +113,7 @@ int DateOK(int y, int m, int d)
|
||||
m > 11 ||
|
||||
y > BASE + YR_RANGE ||
|
||||
d > DaysInMonth(m, y) ) return 0;
|
||||
else return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Functions designed to defeat gcc optimizer */
|
||||
|
||||
43
src/var.c
43
src/var.c
@@ -6,7 +6,7 @@
|
||||
/* user- and system-defined variables. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-2023 by Dianne Skoll */
|
||||
/* Copyright (C) 1992-2024 by Dianne Skoll */
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
@@ -167,6 +167,13 @@ static int latitude_func(int do_set, Value *val)
|
||||
return latitude_longitude_func(do_set, val, &Latitude, -90.0, 90.0);
|
||||
}
|
||||
|
||||
static int terminal_bg_func(int do_set, Value *val)
|
||||
{
|
||||
UNUSED(do_set);
|
||||
val->type = INT_TYPE;
|
||||
val->v.val = GetTerminalBackground();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int trig_date_func(int do_set, Value *val)
|
||||
{
|
||||
@@ -525,7 +532,9 @@ int DoSet (Parser *p)
|
||||
int r;
|
||||
|
||||
DynamicBuffer buf;
|
||||
DynamicBuffer buf2;
|
||||
DBufInit(&buf);
|
||||
DBufInit(&buf2);
|
||||
|
||||
r = ParseIdentifier(p, &buf);
|
||||
if (r) return r;
|
||||
@@ -541,6 +550,13 @@ int DoSet (Parser *p)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = ParseToken(p, &buf2);
|
||||
if (r) return r;
|
||||
if (DBufLen(&buf2)) {
|
||||
DBufFree(&buf2);
|
||||
return E_EXPECTING_EOL;
|
||||
}
|
||||
DBufFree(&buf2);
|
||||
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
|
||||
else r = SetVar(DBufValue(&buf), &v);
|
||||
if (buf.len > VAR_NAME_LEN) {
|
||||
@@ -762,10 +778,14 @@ typedef struct {
|
||||
char modifiable;
|
||||
int type;
|
||||
void *value;
|
||||
int min;
|
||||
int min; /* Or const-value */
|
||||
int max;
|
||||
} SysVar;
|
||||
|
||||
/* Macro to access "min" but as a constval. Just to make source more
|
||||
readable */
|
||||
#define constval min
|
||||
|
||||
/* If the type of a sys variable is STR_TYPE, then min is redefined
|
||||
to be a flag indicating whether or not the value has been malloc'd. */
|
||||
#define been_malloced min
|
||||
@@ -825,7 +845,9 @@ static SysVar SysVarArr[] = {
|
||||
{"LongMin", 1, SPECIAL_TYPE, longmin_func, 0, 0 },
|
||||
{"LongSec", 1, SPECIAL_TYPE, longsec_func, 0, 0 },
|
||||
{"March", 1, STR_TYPE, &DynamicMonthName[2], 0, 0 },
|
||||
{"MaxFullOmits", 0, CONST_INT_TYPE, NULL, MAX_FULL_OMITS, 0},
|
||||
{"MaxLateMinutes", 1, INT_TYPE, &MaxLateMinutes, 0, 1440 },
|
||||
{"MaxPartialOmits",0, CONST_INT_TYPE, NULL, MAX_PARTIAL_OMITS, 0},
|
||||
{"MaxSatIter", 1, INT_TYPE, &MaxSatIter, 10, ANY },
|
||||
{"MaxStringLen", 1, INT_TYPE, &MaxStringLen, -1, ANY },
|
||||
{"May", 1, STR_TYPE, &DynamicMonthName[4], 0, 0 },
|
||||
@@ -836,6 +858,8 @@ static SysVar SysVarArr[] = {
|
||||
{"NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
|
||||
{"November", 1, STR_TYPE, &DynamicMonthName[10],0, 0 },
|
||||
{"Now", 1, STR_TYPE, &DynamicNow, 0, 0 },
|
||||
{"NumFullOmits", 0, INT_TYPE, &NumFullOmits, 0, 0 },
|
||||
{"NumPartialOmits",0, INT_TYPE, &NumPartialOmits, 0, 0 },
|
||||
{"NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
|
||||
{"NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
|
||||
{"October", 1, STR_TYPE, &DynamicMonthName[9], 0, 0 },
|
||||
@@ -857,7 +881,7 @@ static SysVar SysVarArr[] = {
|
||||
{"SysInclude", 0, STR_TYPE, &SysDir, 0, 0 },
|
||||
{"T", 0, SPECIAL_TYPE, trig_date_func, 0, 0 },
|
||||
{"Td", 0, SPECIAL_TYPE, trig_day_func, 0, 0 },
|
||||
{"TerminalBackground", 0, INT_TYPE, &TerminalBackground, 0, 0 },
|
||||
{"TerminalBackground", 0, SPECIAL_TYPE, terminal_bg_func, 0, 0 },
|
||||
{"Thursday", 1, STR_TYPE, &DynamicDayName[3], 0, 0 },
|
||||
{"TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 },
|
||||
{"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0 },
|
||||
@@ -895,13 +919,13 @@ int SetSysVar(char const *name, Value *value)
|
||||
int r;
|
||||
SysVar *v = FindSysVar(name);
|
||||
if (!v) return E_NOSUCH_VAR;
|
||||
if (v->type != SPECIAL_TYPE &&
|
||||
v->type != value->type) return E_BAD_TYPE;
|
||||
if (!v->modifiable) {
|
||||
Eprint("%s: `$%s'", ErrMsg[E_CANT_MODIFY], name);
|
||||
return E_CANT_MODIFY;
|
||||
}
|
||||
|
||||
if (v->type != SPECIAL_TYPE &&
|
||||
v->type != value->type) return E_BAD_TYPE;
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
r = f(1, value);
|
||||
@@ -942,6 +966,11 @@ int GetSysVar(char const *name, Value *val)
|
||||
|
||||
val->type = ERR_TYPE;
|
||||
if (!v) return E_NOSUCH_VAR;
|
||||
if (v->type == CONST_INT_TYPE) {
|
||||
val->v.val = v->constval;
|
||||
val->type = INT_TYPE;
|
||||
return OK;
|
||||
}
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
return f(0, val);
|
||||
@@ -1035,7 +1064,9 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
if (name) strcat(buffer, name); else strcat(buffer, v->name);
|
||||
fprintf(ErrFp, "%16s ", buffer);
|
||||
if (v) {
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
if (v->type == CONST_INT_TYPE) {
|
||||
fprintf(ErrFp, "%d\n", v->constval);
|
||||
} else if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
f(0, &vtmp);
|
||||
PrintValue(&vtmp, ErrFp);
|
||||
|
||||
@@ -4,7 +4,7 @@ MSG UseVTColors is: [$UseVTColors]%
|
||||
MSG Use256Colors is: [$Use256Colors]%
|
||||
MSG UseTrueColors is: [$UseTrueColors]%
|
||||
MSG UseBGVTColors is: [$UseBGVTColors]%
|
||||
set n ansicolor("")]
|
||||
set n ansicolor("")
|
||||
MSG This is [ansicolor(0,255,0)]green[n], [ansicolor("255 0 0")]red[n] and [ansicolor("0 0 255")]blue[n] text.%
|
||||
MSG This is [ansicolor(0,0,0)][ansicolor(0,255,0,1)]black text on a green background[n]%
|
||||
MSG This is [ansicolor(0,0,0,0,1)]clamped black text[n]%
|
||||
|
||||
6
tests/queue1.rem
Normal file
6
tests/queue1.rem
Normal file
@@ -0,0 +1,6 @@
|
||||
FSET msgprefix(x) "Priority: " + x + "; Filename: " + filename() + ": "
|
||||
|
||||
REM at 23:56 MSG foo
|
||||
REM PRIORITY 42 at 23:57 MSG bar
|
||||
REM PRIORITY 999 at 23:58 MSQ quux
|
||||
DO queue2.rem
|
||||
1
tests/queue2.rem
Normal file
1
tests/queue2.rem
Normal file
@@ -0,0 +1 @@
|
||||
REM at 23:59 PRIORITY 2 MSG XXXX
|
||||
@@ -7,7 +7,7 @@
|
||||
# in the build directory.
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-2023 Dianne Skoll
|
||||
# Copyright (C) 1992-2024 Dianne Skoll
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -31,6 +31,15 @@ fi
|
||||
TZ=UTC
|
||||
export TZ
|
||||
|
||||
RESULT=`(echo 'BANNER %'; echo 'IF now() > 23:55'; echo 'MSG late%'; echo 'ENDIF') | ../src/remind -h -`
|
||||
|
||||
if test "$RESULT" = "late" ; then
|
||||
echo ""
|
||||
echo "*** Please do not run the test suite between 23:55 and 00:00 UTC; it will fail."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If we're already in a utf-8 locale, do
|
||||
# nothing; otherwise, set LC_ALL
|
||||
OK=0
|
||||
@@ -440,6 +449,11 @@ rm -rf include_dir/ww
|
||||
# Test --version long option
|
||||
../src/remind --version >> ../tests/test.out 2>&1
|
||||
|
||||
# Test queueing. Because eventstart depends on the actual system
|
||||
# date, we have to convert it to some constant (in this case,
|
||||
# VOLATILE) so that tests are not dependent on the system date.
|
||||
echo JSONQUEUE | ../src/remind -z0 ../tests/queue1.rem 2>&1 | sed -e 's/"eventstart":"................"/"eventstart":"VOLATILE"/g' >> ../tests/test.out 2>&1
|
||||
|
||||
# Remove references to SysInclude, which is build-specific
|
||||
grep -F -v '$SysInclude' < ../tests/test.out > ../tests/test.out.1 && mv -f ../tests/test.out.1 ../tests/test.out
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
|
||||
@@ -82,7 +82,7 @@ INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo MSG Yippee
|
||||
INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo MSG Yippee
|
||||
INCLUDECMD echo INCLUDECMD echo MSG Yippee
|
||||
INCLUDECMD echo MSG Yippee
|
||||
echo INCLUDECMD echo MSG Yippee|(1): INCLUDE nested too deeply
|
||||
echo INCLUDECMD echo MSG Yippee|(1): INCLUDE nested too deeply (max. 9)
|
||||
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
|
||||
../tests/test.rem(31): Trig = Saturday, 16 February, 1991
|
||||
today() => 1991-02-16
|
||||
@@ -1060,7 +1060,7 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "04.02.08"
|
||||
version() => "04.02.09"
|
||||
set a059 wkday(today())
|
||||
today() => 1991-02-16
|
||||
wkday(1991-02-16) => "Saturday"
|
||||
@@ -2644,7 +2644,7 @@ a086 4
|
||||
a109 2012-01-01
|
||||
a128 2018-02-03@16:45
|
||||
a039 "February"
|
||||
a058 "04.02.08"
|
||||
a058 "04.02.09"
|
||||
a077 "1992 92\n"
|
||||
a096 -4
|
||||
a119 -1
|
||||
@@ -2789,7 +2789,9 @@ Variable Value
|
||||
$LongMin 15
|
||||
$LongSec 0
|
||||
$March "March"
|
||||
$MaxFullOmits 1000
|
||||
$MaxLateMinutes 0 [0, 1440]
|
||||
$MaxPartialOmits 366
|
||||
$MaxSatIter 150 [10, Inf)
|
||||
$MaxStringLen 65535 [-1, Inf)
|
||||
$May "May"
|
||||
@@ -2800,6 +2802,8 @@ Variable Value
|
||||
$NextMode 0
|
||||
$November "November"
|
||||
$Now "now"
|
||||
$NumFullOmits 1
|
||||
$NumPartialOmits 0
|
||||
$NumQueued 0
|
||||
$NumTrig 41
|
||||
$October "October"
|
||||
@@ -4125,7 +4129,7 @@ Global Weekday OMITs:
|
||||
None.
|
||||
CLEAR-OMIT-CONTEXT
|
||||
OMIT 2000-01-01 THROUGH 2020-12-31
|
||||
../tests/test.rem(841): Too many full OMITs
|
||||
../tests/test.rem(841): Too many full OMITs (max. 1000)
|
||||
|
||||
OMIT Dec 5 2029 through Dec 4 2029
|
||||
../tests/test.rem(843): Error: THROUGH date earlier than start date
|
||||
@@ -4833,6 +4837,11 @@ REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
../tests/test.rem(887): Expired
|
||||
SET $ParseUntriggered 1
|
||||
|
||||
# Should result in errors
|
||||
set pqxya 1+2)
|
||||
1 + 2 => 3
|
||||
../tests/test.rem(891): Expecting end-of-line
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
@@ -8678,7 +8687,7 @@ No reminders.
|
||||
<< /PageSize [612 792] >> setpagedevice
|
||||
% This file was produced by Remind and Rem2PS, written by
|
||||
% Dianne Skoll.
|
||||
% Remind and Rem2PS are Copyright 1992-2023 Dianne Skoll.
|
||||
% Remind and Rem2PS are Copyright 1992-2024 Dianne Skoll.
|
||||
/ISOLatin1Encoding where { pop save true }{ false } ifelse
|
||||
/ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus
|
||||
StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute
|
||||
@@ -9782,7 +9791,7 @@ showpage
|
||||
<< /PageSize [612 792] >> setpagedevice
|
||||
% This file was produced by Remind and Rem2PS, written by
|
||||
% Dianne Skoll.
|
||||
% Remind and Rem2PS are Copyright 1992-2023 Dianne Skoll.
|
||||
% Remind and Rem2PS are Copyright 1992-2024 Dianne Skoll.
|
||||
/ISOLatin1Encoding where { pop save true }{ false } ifelse
|
||||
/ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus
|
||||
StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute
|
||||
@@ -10894,11 +10903,11 @@ January 2012 31 0 0
|
||||
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
|
||||
December 31
|
||||
February 29
|
||||
{"date":"2012-01-02","filename":"-","lineno":1,"wd":["Monday"],"nonconst_expr":1,"priority":5000,"body":"bar"}
|
||||
{"date":"2012-01-09","filename":"-","lineno":1,"wd":["Monday"],"nonconst_expr":1,"priority":5000,"body":"bar"}
|
||||
{"date":"2012-01-16","filename":"-","lineno":1,"wd":["Monday"],"nonconst_expr":1,"priority":5000,"body":"bar"}
|
||||
{"date":"2012-01-23","filename":"-","lineno":1,"wd":["Monday"],"nonconst_expr":1,"priority":5000,"body":"bar"}
|
||||
{"date":"2012-01-30","filename":"-","lineno":1,"wd":["Monday"],"nonconst_expr":1,"priority":5000,"body":"bar"}
|
||||
{"date":"2012-01-02","filename":"-","lineno":1,"wd":["Monday"],"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"}
|
||||
{"date":"2012-01-09","filename":"-","lineno":1,"wd":["Monday"],"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"}
|
||||
{"date":"2012-01-16","filename":"-","lineno":1,"wd":["Monday"],"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"}
|
||||
{"date":"2012-01-23","filename":"-","lineno":1,"wd":["Monday"],"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"}
|
||||
{"date":"2012-01-30","filename":"-","lineno":1,"wd":["Monday"],"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"}
|
||||
# rem2ps2 end
|
||||
-stdin-(7): Number too high
|
||||
-stdin-(7): Number too high
|
||||
@@ -11696,4 +11705,7 @@ Can't open file: include_dir/ww
|
||||
Error reading include_dir/ww: Can't open file
|
||||
SECURITY: Won't read world-writable file or directory!
|
||||
Error reading include_dir/ww: No files matching *.rem
|
||||
04.02.08
|
||||
04.02.09
|
||||
NOTE JSONQUEUE
|
||||
[{"priority":2,"eventstart":"VOLATILE","ttime":"23:59","nextttime":"23:59","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue2.rem","type":"MSG_TYPE","body":"XXXX"},{"priority":999,"eventstart":"VOLATILE","ttime":"23:58","nextttime":"23:58","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"quux"},{"priority":42,"eventstart":"VOLATILE","ttime":"23:57","nextttime":"23:57","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"bar"},{"priority":5000,"eventstart":"VOLATILE","ttime":"23:56","nextttime":"23:56","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"foo"}]
|
||||
NOTE ENDJSONQUEUE
|
||||
|
||||
@@ -887,6 +887,9 @@ SET $ParseUntriggered 0
|
||||
REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
SET $ParseUntriggered 1
|
||||
|
||||
# Should result in errors
|
||||
set pqxya 1+2)
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# Use the output to verify your translations.
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-2023 Dianne Skoll
|
||||
# Copyright (C) 1992-2024 Dianne Skoll
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user