mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3916887aff | ||
|
|
f84f59fa91 | ||
|
|
1032f8908e | ||
|
|
6c2e8fc608 | ||
|
|
012e527fb5 | ||
|
|
62198c9807 | ||
|
|
de95224d62 | ||
|
|
be374a0464 | ||
|
|
fe9b3186d7 | ||
|
|
8405ea6c53 | ||
|
|
4274d05e10 | ||
|
|
4e80ce1159 | ||
|
|
52f473f2af | ||
|
|
1d6ca51bf9 | ||
|
|
e662d0b3dd | ||
|
|
b910d557d1 | ||
|
|
a4ad0a9e97 | ||
|
|
07f67e7dd7 | ||
|
|
d6575773fb | ||
|
|
ac1303886e | ||
|
|
1569992184 | ||
|
|
55a1f1d746 | ||
|
|
ef7742a3cc | ||
|
|
ef48c2020b | ||
|
|
6dcb25073b | ||
|
|
4824b07ec8 | ||
|
|
a8f1228fb7 | ||
|
|
80e51d1d0f |
7
.github/README.md
vendored
Normal file
7
.github/README.md
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Remind has moved
|
||||||
|
|
||||||
|
For various reasons, I have decided to move Remind off GitHub. This repo
|
||||||
|
will be archived. To create merge requests or issues, please visit
|
||||||
|
Remind's new home at https://salsa.debian.org/dskoll/remind
|
||||||
|
|
||||||
|
-- Dianne Skoll
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,3 +26,4 @@ src/test-*.out
|
|||||||
src/version.h
|
src/version.h
|
||||||
tests/test.out
|
tests/test.out
|
||||||
www/Makefile
|
www/Makefile
|
||||||
|
set-irc-topic
|
||||||
|
|||||||
2
configure
vendored
2
configure
vendored
@@ -4006,7 +4006,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
VERSION=04.00.01
|
VERSION=04.00.03
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
||||||
VERSION=04.00.01
|
VERSION=04.00.03
|
||||||
AC_SUBST(VERSION)
|
AC_SUBST(VERSION)
|
||||||
AC_SUBST(PERL)
|
AC_SUBST(PERL)
|
||||||
AC_SUBST(PERLARTIFACTS)
|
AC_SUBST(PERLARTIFACTS)
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
CHANGES TO REMIND
|
CHANGES TO REMIND
|
||||||
|
|
||||||
|
* VERSION 4.0 Patch 3 - 2022-08-16
|
||||||
|
|
||||||
|
- IMPROVEMENT: remind: add plain_body and calendar_body JSON keys in -pp...
|
||||||
|
output.
|
||||||
|
|
||||||
|
- BUG FIX: tkremind: Don't create empty files called '&1' when creating
|
||||||
|
a new reminder.
|
||||||
|
|
||||||
|
- BUG FIX: remind: Don't call signal-unsafe functions from signal handler
|
||||||
|
|
||||||
|
* VERSION 4.0 Patch 2 - 2022-08-02
|
||||||
|
|
||||||
|
- IMPROVEMENT: remind: Allow more forms of OMIT as per Ian D. Allen!'s request:
|
||||||
|
|
||||||
|
OMIT Month [THROUGH Month]
|
||||||
|
OMIT Day Month [THROUGH Day Month]
|
||||||
|
OMIT Day Month Year [THROUGH Day Month Year]
|
||||||
|
|
||||||
|
- BUG FIX: Make $T behave as documented, exactly like trigdate(). $T would
|
||||||
|
return '1989-12-31' rather than 0 if the trigger date was not valid.
|
||||||
|
|
||||||
|
- BUG FIX: TkRemind: Fix resizing bug for a calendar with 6 rows.
|
||||||
|
|
||||||
|
- DOCUMENTATION IMPROVEMENT: Improve TkRemind documentation; document use
|
||||||
|
of inotifywait if available.
|
||||||
|
|
||||||
* VERSION 4.0 Patch 1 - 2022-06-03
|
* VERSION 4.0 Patch 1 - 2022-06-03
|
||||||
|
|
||||||
- IMPROVEMENT: Add $SuppressLRM system variable to suppress the UTF-8
|
- IMPROVEMENT: Add $SuppressLRM system variable to suppress the UTF-8
|
||||||
|
|||||||
12
man/rem2ps.1
12
man/rem2ps.1
@@ -586,6 +586,18 @@ For a SHADE or COLOR special, the blue color component.
|
|||||||
.B body \fIbody\fR
|
.B body \fIbody\fR
|
||||||
The body of the reminder to issue. Always present.
|
The body of the reminder to issue. Always present.
|
||||||
.TP
|
.TP
|
||||||
|
.B calendar_body \fIbody\fR
|
||||||
|
The text appropriate to include in a calendar. Only present if the
|
||||||
|
original body contains %"...%" sequences and the "q" modifier was used
|
||||||
|
with Remind's "-pp..." flag.
|
||||||
|
.TP
|
||||||
|
.B plain_body \fIbody\fR
|
||||||
|
The "plain" body of the reminder with any %"...%" sequences removed.
|
||||||
|
If your back-end is designed to draw a calendar, then it should
|
||||||
|
use the \fBcalendar_body\fR if present. If not, then it
|
||||||
|
should use the \fBplain_body\fR if present, and if not, then it
|
||||||
|
should fall back on the \fBbody\fR.
|
||||||
|
.TP
|
||||||
.B rawbody \fIraw\fR
|
.B rawbody \fIraw\fR
|
||||||
The "raw" body of the reminder, before any expression-pasting or
|
The "raw" body of the reminder, before any expression-pasting or
|
||||||
substitution-sequence processing. If the raw body would be the same
|
substitution-sequence processing. If the raw body would be the same
|
||||||
|
|||||||
45
man/remind.1
45
man/remind.1
@@ -1532,11 +1532,11 @@ In addition to being a keyword in the \fBREM\fR command,
|
|||||||
\fBOMIT\fR is a command in its own right. Its syntax is:
|
\fBOMIT\fR is a command in its own right. Its syntax is:
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
\fBOMIT\fR \fIday\fR \fImonth\fR [\fIyear\fR]
|
\fBOMIT\fR [\fIday\fR] \fImonth\fR [\fIyear\fR]
|
||||||
.PP
|
.PP
|
||||||
or:
|
or:
|
||||||
.PP
|
.PP
|
||||||
\fBOMIT\fR \fIday1\fR \fImonth1\fR \fIyear1\fR \fBTHROUGH\fR \fIday2\fR \fImonth2\fR \fIyear2\fR
|
\fBOMIT\fR [\fIday1\fR] \fImonth1\fR [\fIyear1\fR] \fBTHROUGH\fR [\fIday2\fR] \fImonth2\fR [\fIyear2\fR]
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
The \fBOMIT\fR command is used to "globally" omit certain days
|
The \fBOMIT\fR command is used to "globally" omit certain days
|
||||||
@@ -1545,8 +1545,13 @@ The \fBOMIT\fR command is used to "globally" omit certain days
|
|||||||
"\-\-" and "\+\+" forms. Some examples:
|
"\-\-" and "\+\+" forms. Some examples:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
OMIT 1 Jan
|
OMIT 1 Jan
|
||||||
OMIT 7 Sep 1992
|
OMIT 7 Sep 1992
|
||||||
|
OMIT 15 Jan THROUGH 14 Feb
|
||||||
|
OMIT May # Equivalent to OMIT May 1 THROUGH May 31
|
||||||
|
OMIT 25 Dec THROUGH 4 Jan
|
||||||
|
OMIT 2023-05-03 THROUGH 2023-05-12
|
||||||
|
OMIT Jun THROUGH July # Equivalent to OMIT Jun 1 THROUGH July 31
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
The first example specifies a holiday that occurs on the same date each
|
The first example specifies a holiday that occurs on the same date each
|
||||||
@@ -1578,9 +1583,7 @@ equivalent:
|
|||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
The \fBTHROUGH\fR keyword lets you conveniently OMIT a range of days.
|
The \fBTHROUGH\fR keyword lets you conveniently OMIT a range of days.
|
||||||
The starting and ending points must be fully-specified (ie, they must
|
For example, the following sequences are equivalent:
|
||||||
include day, month and year.). For example, the following sequences
|
|
||||||
are equivalent:
|
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
OMIT 3 Jan 2011
|
OMIT 3 Jan 2011
|
||||||
@@ -1592,12 +1595,28 @@ are equivalent:
|
|||||||
OMIT 3 Jan 2011 THROUGH 5 Jan 2011
|
OMIT 3 Jan 2011 THROUGH 5 Jan 2011
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command:
|
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command as
|
||||||
|
long as both dates are fully specified
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
OMIT 6 Sep 2010 THROUGH 10 Sep 2010 MSG Vacation
|
OMIT 6 Sep 2010 THROUGH 10 Sep 2010 MSG Vacation
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
|
If you use a THROUGH clause, then either the year must be supplied before
|
||||||
|
and after the THROUGH, or it must be missing before and after the THROUGH.
|
||||||
|
The following are legal:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
OMIT 25 Dec THROUGH 6 Jan
|
||||||
|
OMIT 25 Dec 2024 THROUGH 6 Jan 2025
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
But the following are not:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
OMIT 25 Dec THROUGH 6 Jan 2025
|
||||||
|
OMIT 25 Dec 2024 THROUGH 6 Jan
|
||||||
|
.nf
|
||||||
.PP
|
.PP
|
||||||
You can debug your global OMITs with the following command:
|
You can debug your global OMITs with the following command:
|
||||||
.PP
|
.PP
|
||||||
@@ -2342,8 +2361,8 @@ For example, the coordinates of the Statue of Liberty in New York City
|
|||||||
are approximately set by:
|
are approximately set by:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
SET $Latitude "40.68933"
|
SET $Latitude "40.68933"
|
||||||
SET $Longitude "-74.04454"
|
SET $Longitude "-74.04454"
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
@@ -3238,7 +3257,7 @@ takes \fIa\fR back to 2009-05-13.
|
|||||||
.TP
|
.TP
|
||||||
.B strlen(s_str)
|
.B strlen(s_str)
|
||||||
Returns the length of \fIstr\fR. If the length of \fIstr\fR is too large
|
Returns the length of \fIstr\fR. If the length of \fIstr\fR is too large
|
||||||
to represent as an integers, emits a "Number too high" error.
|
to represent as an integer, emits a "Number too high" error.
|
||||||
.TP
|
.TP
|
||||||
.B substr(s_str, i_start [,i_end])
|
.B substr(s_str, i_start [,i_end])
|
||||||
Returns a \fBSTRING\fR consisting of all characters in \fIstr\fR from
|
Returns a \fBSTRING\fR consisting of all characters in \fIstr\fR from
|
||||||
@@ -4825,7 +4844,7 @@ Suppose you want to change the "%b" sequence to substitute "the day
|
|||||||
after tomorrow" for an event two days from now. You could do this:
|
after tomorrow" for an event two days from now. You could do this:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
FSET subst_bx(a,d,t) iif(d==today()+2, "the day after tomorrow", \
|
FSET subst_bx(a,d,t) iif(d==today()+2, "the day after tomorrow", \\
|
||||||
"in " + (d-today()) + " days' time")
|
"in " + (d-today()) + " days' time")
|
||||||
REM [today()+3] ++3 MSG Event 1 is %b%
|
REM [today()+3] ++3 MSG Event 1 is %b%
|
||||||
REM [today()+2] ++3 MSG Event 2 is %b%
|
REM [today()+2] ++3 MSG Event 2 is %b%
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ as well as the tcllib extension. It also requires a \fBwish\fR
|
|||||||
binary. If you are using Tcl/Tk 8.5, you may also need either the Img
|
binary. If you are using Tcl/Tk 8.5, you may also need either the Img
|
||||||
or the tkpng extension to handle PNG images.
|
or the tkpng extension to handle PNG images.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH COMMAND-LINE OPTIONS
|
||||||
\fBTkRemind\fR itself has no options. However, it passes certain options
|
\fBTkRemind\fR itself has no command-line options. However, it passes
|
||||||
on to \fBRemind\fR. The options it passes are
|
certain options on to \fBRemind\fR. The options it passes are
|
||||||
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR.
|
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR. See the
|
||||||
See the \fBRemind\fR man page for details about the options.
|
\fBRemind\fR man page for details about the options. Note that
|
||||||
Note that \fBTkRemind\fR will respect the \fB\-m\fR and
|
\fBTkRemind\fR will respect the \fB\-m\fR and \fB\-b1\fR options and
|
||||||
\fB\-b1\fR options and adjust its appearance accordingly.
|
adjust its appearance accordingly.
|
||||||
|
|
||||||
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
|
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
|
||||||
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
|
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
|
||||||
@@ -44,8 +44,14 @@ include the line:
|
|||||||
.PP
|
.PP
|
||||||
|
|
||||||
\fIConfig_file\fR is the file in which \fBTkRemind\fR stores
|
\fIConfig_file\fR is the file in which \fBTkRemind\fR stores
|
||||||
its options. If it is omitted, it defaults to \fI$HOME/.tkremindrt\fR.
|
its options. If it is omitted, it defaults to \fI$HOME/.config/tkremindrc\fR.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
If \fB$HOME/.reminders\fR is a \fIdirectory\fR, then \fBTkRemind\fR defaults to
|
||||||
|
reading \fB$HOME/.reminders\fR and writing new reminders to
|
||||||
|
\fB$HOME/.reminders/100-tkremind.rem\fR. If you want to keep your
|
||||||
|
reminders in a directory \fB$HOME/.reminders\fR, you should create that
|
||||||
|
directory before starting \fBTkRemind\fR.
|
||||||
.SH THE CALENDAR WINDOW
|
.SH THE CALENDAR WINDOW
|
||||||
When you start \fBTkRemind\fR, it displays a calendar for the current
|
When you start \fBTkRemind\fR, it displays a calendar for the current
|
||||||
month, with today's date highlighted. Reminders are filled into each
|
month, with today's date highlighted. Reminders are filled into each
|
||||||
@@ -274,7 +280,7 @@ Similar to Change entry font, but applies to calendar heading
|
|||||||
.PP
|
.PP
|
||||||
Once you've configured the options the way you like them,
|
Once you've configured the options the way you like them,
|
||||||
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
||||||
to put them into effect and save them in $HOME/.tkremindrc, or
|
to put them into effect and save them in $HOME/.config/tkremindrc, or
|
||||||
\fBCancel\fR to cancel any changes you made.
|
\fBCancel\fR to cancel any changes you made.
|
||||||
|
|
||||||
.SH KEYBOARD SHORTCUTS
|
.SH KEYBOARD SHORTCUTS
|
||||||
@@ -293,6 +299,19 @@ Next Month
|
|||||||
.B Home
|
.B Home
|
||||||
Today
|
Today
|
||||||
|
|
||||||
|
.SH IMMEDIATE UPDATES
|
||||||
|
|
||||||
|
If you are running \fBTkRemind\fR on Linux and have the
|
||||||
|
\fBinotifywait\fR program installed (part of the \fBinotify-tools\fR
|
||||||
|
or similar package), then \fBTkRemind\fR redraws the calendar window
|
||||||
|
\fIimmediately\fR if \fB$HOME/.reminders\fR changes (or, if it is a
|
||||||
|
directory, any files in that directory change.)
|
||||||
|
.PP
|
||||||
|
This lets \fBTkRemind\fR react immediately to hand-edited reminders or
|
||||||
|
to reminder files that are imported from another calendar system (for example,
|
||||||
|
you may have a cron job that periodically imports your Google Calendar
|
||||||
|
entries into Remind format.)
|
||||||
|
|
||||||
.SH ODDS AND ENDS
|
.SH ODDS AND ENDS
|
||||||
\fBTkRemind\fR performs some basic consistency checks when you add or
|
\fBTkRemind\fR performs some basic consistency checks when you add or
|
||||||
preview a reminder. However, if you edit a reminder in the previewer,
|
preview a reminder. However, if you edit a reminder in the previewer,
|
||||||
@@ -323,8 +342,7 @@ You can use this to activate certain reminders in different ways
|
|||||||
for \fBTkRemind\fR (for example).
|
for \fBTkRemind\fR (for example).
|
||||||
.PP
|
.PP
|
||||||
\fBTkRemind\fR uses tags to keep track of reminders in the
|
\fBTkRemind\fR uses tags to keep track of reminders in the
|
||||||
script file. It also places special comments in the reminder
|
script file. You can certainly mix
|
||||||
file to store additional state. You can certainly mix
|
|
||||||
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
|
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
|
||||||
if you are aware of the following rules and limitations:
|
if you are aware of the following rules and limitations:
|
||||||
.TP
|
.TP
|
||||||
@@ -334,15 +352,16 @@ where \fInnn\fR is a number. You should not use such \fBTAG\fRs
|
|||||||
in hand-crafted reminders.
|
in hand-crafted reminders.
|
||||||
.TP
|
.TP
|
||||||
o
|
o
|
||||||
Do not edit lines starting with "# TKTAGnnn", "# TKEND", or any
|
|
||||||
lines in between. You can move such lines, but be careful to move
|
|
||||||
them as a single block.
|
|
||||||
.TP
|
|
||||||
o
|
|
||||||
Hand-crafted reminders cannot be edited with \fBTkRemind\fR, and
|
Hand-crafted reminders cannot be edited with \fBTkRemind\fR, and
|
||||||
for hand-crafted timed reminders, you will not be presented with
|
for hand-crafted timed reminders, you will not be presented with
|
||||||
the "Don't remind me again" option when they pop up.
|
the "Don't remind me again" option when they pop up.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
However, rather than mixing hand-edited files with \fBTkRemind\fR-generated
|
||||||
|
ones, it is better to make \fB$HOME/.reminders\fR a directory and keep
|
||||||
|
your hand-edited files in a separate \fB*.rem\fR file than \fBTkRemind\fR's
|
||||||
|
\fB100-tkremind.rem\fR file.
|
||||||
|
|
||||||
.SH SERVER MODE
|
.SH SERVER MODE
|
||||||
|
|
||||||
\fBRemind\fR has a special mode for interacting with programs like
|
\fBRemind\fR has a special mode for interacting with programs like
|
||||||
@@ -400,13 +419,13 @@ This line is emitted in response to a \fBSTATUS\fR command. The number
|
|||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
|
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
|
||||||
|
|
||||||
\fBTkRemind\fR is Copyright 1996-2020 by Dianne Skoll.
|
\fBTkRemind\fR is Copyright 1996-2022 by Dianne Skoll.
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
|
|
||||||
$HOME/.reminders -- default reminder file.
|
$HOME/.reminders -- default reminder file or directory.
|
||||||
|
|
||||||
$HOME/.tkremindrc -- \fBTkRemind\fR saved options.
|
$HOME/.config/tkremindrc -- \fBTkRemind\fR saved options.
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
\fBremind\fR, \fBrem2ps\fR, \fBrem2pdf\fR, \fBrem2html\fR
|
\fBremind\fR, \fBrem2ps\fR, \fBrem2pdf\fR, \fBrem2html\fR
|
||||||
|
|||||||
@@ -227,14 +227,16 @@ sub parse_oldstyle_line
|
|||||||
|
|
||||||
if ($hash->{passthru}) {
|
if ($hash->{passthru}) {
|
||||||
if ($hash->{passthru} =~ /^(shade|color|colour)$/i) {
|
if ($hash->{passthru} =~ /^(shade|color|colour)$/i) {
|
||||||
if ($hash->{body} =~ /^\s*(\d+)\s+(\d+)\s+(\d+)/) {
|
if ($hash->{body} =~ /^\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)/) {
|
||||||
$hash->{r} = $1;
|
$hash->{r} = $1;
|
||||||
$hash->{g} = $2;
|
$hash->{g} = $2;
|
||||||
$hash->{b} = $3;
|
$hash->{b} = $3;
|
||||||
} elsif ($hash->{body} =~ /^\s*(\d+)/) {
|
$hash->{body} = $4;
|
||||||
|
} elsif ($hash->{body} =~ /^\s*(\d+)\s*(.*)/) {
|
||||||
$hash->{r} = $1;
|
$hash->{r} = $1;
|
||||||
$hash->{g} = $1;
|
$hash->{g} = $1;
|
||||||
$hash->{b} = $1;
|
$hash->{b} = $1;
|
||||||
|
$hash->{body} = $2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,15 @@ sub render
|
|||||||
|
|
||||||
$layout->set_width(1024 * ($x2 - $x1 - 2 * $settings->{border_size}));
|
$layout->set_width(1024 * ($x2 - $x1 - 2 * $settings->{border_size}));
|
||||||
$layout->set_wrap('word-char');
|
$layout->set_wrap('word-char');
|
||||||
$layout->set_text(Encode::decode('UTF-8', $self->{body}));
|
my $body;
|
||||||
|
if (exists($self->{calendar_body})) {
|
||||||
|
$body = $self->{calendar_body};
|
||||||
|
} elsif (exists($self->{plain_body})) {
|
||||||
|
$body = $self->{plain_body};
|
||||||
|
} else {
|
||||||
|
$body = $self->{body};
|
||||||
|
}
|
||||||
|
$layout->set_text(Encode::decode('UTF-8', $body));
|
||||||
my $desc = Pango::FontDescription->from_string($settings->{entry_font} . ' ' . $settings->{entry_size} . 'px');
|
my $desc = Pango::FontDescription->from_string($settings->{entry_font} . ' ' . $settings->{entry_size} . 'px');
|
||||||
$layout->set_font_description($desc);
|
$layout->set_font_description($desc);
|
||||||
my ($wid, $h) = $layout->get_pixel_size();
|
my ($wid, $h) = $layout->get_pixel_size();
|
||||||
@@ -233,11 +241,9 @@ sub _adjust
|
|||||||
package Remind::PDF::Entry::color;
|
package Remind::PDF::Entry::color;
|
||||||
use base 'Remind::PDF::Entry';
|
use base 'Remind::PDF::Entry';
|
||||||
|
|
||||||
# Strip the RGB prefix from body
|
# Nothing to do for COLOR-type reminder
|
||||||
sub _adjust
|
sub _adjust
|
||||||
{
|
{
|
||||||
my ($self) = @_;
|
|
||||||
$self->{body} =~ s/^\d+\s+\d+\s+\d+\s+//;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package Remind::PDF::Entry::postscript;
|
package Remind::PDF::Entry::postscript;
|
||||||
|
|||||||
@@ -547,7 +547,9 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
|||||||
$w.t$i configure -state disabled -takefocus 0
|
$w.t$i configure -state disabled -takefocus 0
|
||||||
}
|
}
|
||||||
for {set i $first} {$i <= $last} {incr i} {
|
for {set i $first} {$i <= $last} {incr i} {
|
||||||
|
set row [expr ($i/7)+1]
|
||||||
grid $w.f$i
|
grid $w.f$i
|
||||||
|
grid rowconfigure $w $row -weight 1
|
||||||
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
|
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
|
||||||
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
||||||
raise $w.l$i
|
raise $w.l$i
|
||||||
@@ -581,7 +583,7 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
|||||||
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
||||||
raise $w.l$i
|
raise $w.l$i
|
||||||
raise $w.t$i
|
raise $w.t$i
|
||||||
grid rowconfigure $w [expr $row+1] -weight 1
|
grid rowconfigure $w $row -weight 1
|
||||||
}
|
}
|
||||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||||
$w.l$i configure -state disabled
|
$w.l$i configure -state disabled
|
||||||
@@ -1089,8 +1091,13 @@ proc FillCalWindow {} {
|
|||||||
} else {
|
} else {
|
||||||
set tag "*"
|
set tag "*"
|
||||||
}
|
}
|
||||||
set stuff [dict get $obj body]
|
if {[dict exists $obj calendar_body]} {
|
||||||
|
set stuff [dict get $obj calendar_body]
|
||||||
|
} elseif {[dict exists $obj plain_body]} {
|
||||||
|
set stuff [dict get $obj plain_body]
|
||||||
|
} else {
|
||||||
|
set stuff [dict get $obj body]
|
||||||
|
}
|
||||||
set day [string trimleft $day 0]
|
set day [string trimleft $day 0]
|
||||||
set n [expr $day+$offset]
|
set n [expr $day+$offset]
|
||||||
set month [string trimleft $month 0]
|
set month [string trimleft $month 0]
|
||||||
@@ -1114,30 +1121,31 @@ proc FillCalWindow {} {
|
|||||||
}
|
}
|
||||||
"COLOUR" -
|
"COLOUR" -
|
||||||
"COLOR" {
|
"COLOR" {
|
||||||
if {[regexp {^ *([0-9]+) +([0-9]+) +([0-9]+) +(.*)$} $stuff all r g b rest]} {
|
set r [dict get $obj r]
|
||||||
if {$r > 255} {
|
set g [dict get $obj g]
|
||||||
set r 255
|
set b [dict get $obj b]
|
||||||
} elseif {$r < 0} {
|
if {$r > 255} {
|
||||||
set r 0
|
set r 255
|
||||||
}
|
} elseif {$r < 0} {
|
||||||
if {$g > 255} {
|
set r 0
|
||||||
set g 255
|
}
|
||||||
} elseif {$g < 0} {
|
if {$g > 255} {
|
||||||
set g 0
|
set g 255
|
||||||
}
|
} elseif {$g < 0} {
|
||||||
if {$b > 255} {
|
set g 0
|
||||||
set b 255
|
}
|
||||||
} elseif {$b < 0} {
|
if {$b > 255} {
|
||||||
set b 0
|
set b 255
|
||||||
}
|
} elseif {$b < 0} {
|
||||||
set color [format "%02X%02X%02X" $r $g $b]
|
set b 0
|
||||||
set extratags "clr$color"
|
}
|
||||||
.cal.t$n configure -state normal
|
set color [format "%02X%02X%02X" $r $g $b]
|
||||||
.cal.t$n tag configure $extratags -foreground "#$color"
|
set extratags "clr$color"
|
||||||
.cal.t$n configure -state disabled -takefocus 0
|
.cal.t$n configure -state normal
|
||||||
set stuff $rest
|
.cal.t$n tag configure $extratags -foreground "#$color"
|
||||||
set type "COLOR"
|
.cal.t$n configure -state disabled -takefocus 0
|
||||||
}
|
set stuff $stuff
|
||||||
|
set type "COLOR"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if { $type != "*" && $type != "COLOR" && $type != "COLOUR"} {
|
if { $type != "*" && $type != "COLOR" && $type != "COLOUR"} {
|
||||||
@@ -2104,7 +2112,7 @@ proc CreateReminder {w} {
|
|||||||
|
|
||||||
# Check it out!
|
# Check it out!
|
||||||
global Remind
|
global Remind
|
||||||
set f [open "|$Remind -arq -e - 2>&1" r+]
|
set f [open "|$Remind -arq -e - 2>@1" r+]
|
||||||
puts $f "BANNER %"
|
puts $f "BANNER %"
|
||||||
puts $f "$rem MSG %"
|
puts $f "$rem MSG %"
|
||||||
puts $f "MSG %_%_%_%_"
|
puts $f "MSG %_%_%_%_"
|
||||||
|
|||||||
@@ -293,6 +293,19 @@ despace(char const *s)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintJSONChar(char c) {
|
||||||
|
switch(c) {
|
||||||
|
case '\b': printf("\\b"); break;
|
||||||
|
case '\f': printf("\\f"); break;
|
||||||
|
case '\n': printf("\\n"); break;
|
||||||
|
case '\r': printf("\\r"); break;
|
||||||
|
case '\t': printf("\\t"); break;
|
||||||
|
case '"': printf("\\\""); break;
|
||||||
|
case '\\': printf("\\\\"); break;
|
||||||
|
default: printf("%c", c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PrintJSONString(char const *s)
|
void PrintJSONString(char const *s)
|
||||||
{
|
{
|
||||||
while (*s) {
|
while (*s) {
|
||||||
@@ -1912,6 +1925,7 @@ static void WriteSimpleEntryProtocol1(CalEntry *e)
|
|||||||
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||||
{
|
{
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
char const *s;
|
||||||
if (DoPrefixLineNo) {
|
if (DoPrefixLineNo) {
|
||||||
PrintJSONKeyPairString("filename", e->filename);
|
PrintJSONKeyPairString("filename", e->filename);
|
||||||
PrintJSONKeyPairInt("lineno", e->lineno);
|
PrintJSONKeyPairInt("lineno", e->lineno);
|
||||||
@@ -2038,6 +2052,45 @@ static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
|||||||
if (strcmp(e->raw_text, e->text)) {
|
if (strcmp(e->raw_text, e->text)) {
|
||||||
PrintJSONKeyPairString("rawbody", e->raw_text);
|
PrintJSONKeyPairString("rawbody", e->raw_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Figure out calendar_body and plain_body */
|
||||||
|
if (DontSuppressQuoteMarkers) {
|
||||||
|
s = strstr(e->text, "%\"");
|
||||||
|
if (s) {
|
||||||
|
s += 2;
|
||||||
|
printf("\"calendar_body\":\"");
|
||||||
|
while (*s) {
|
||||||
|
if (*s == '%' && *(s+1) == '"') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PrintJSONChar(*s);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
printf("\",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s = strstr(e->text, "%\"");
|
||||||
|
if (s || e->is_color) {
|
||||||
|
printf("\"plain_body\":\"");
|
||||||
|
s = e->text;
|
||||||
|
if (e->is_color) {
|
||||||
|
while(*s && !isspace(*s)) s++;
|
||||||
|
while(*s && isspace(*s)) s++;
|
||||||
|
while(*s && !isspace(*s)) s++;
|
||||||
|
while(*s && isspace(*s)) s++;
|
||||||
|
while(*s && !isspace(*s)) s++;
|
||||||
|
while(*s && isspace(*s)) s++;
|
||||||
|
}
|
||||||
|
while(*s) {
|
||||||
|
if (*s == '%' && *(s+1) == '"') {
|
||||||
|
s += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PrintJSONChar(*s);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
printf("\",");
|
||||||
|
}
|
||||||
printf("\"body\":\"");
|
printf("\"body\":\"");
|
||||||
PrintJSONString(e->text);
|
PrintJSONString(e->text);
|
||||||
printf("\"");
|
printf("\"");
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
#define E_MON_TWICE 51
|
#define E_MON_TWICE 51
|
||||||
#define E_DAY_TWICE 52
|
#define E_DAY_TWICE 52
|
||||||
#define E_UNKNOWN_TOKEN 53
|
#define E_UNKNOWN_TOKEN 53
|
||||||
#define E_SPEC_MON_DAY 54
|
#define E_SPEC_MON 54
|
||||||
#define E_2MANY_PART 55
|
#define E_2MANY_PART 55
|
||||||
#define E_2MANY_FULL 56
|
#define E_2MANY_FULL 56
|
||||||
#define E_PUSH_NOPOP 57
|
#define E_PUSH_NOPOP 57
|
||||||
@@ -187,7 +187,7 @@ EXTERN char *ErrMsg[]
|
|||||||
"Month specified twice",
|
"Month specified twice",
|
||||||
"Day specified twice",
|
"Day specified twice",
|
||||||
"Unknown token",
|
"Unknown token",
|
||||||
"Must specify month and day in OMIT command",
|
"Must specify month in OMIT command",
|
||||||
"Too many partial OMITs",
|
"Too many partial OMITs",
|
||||||
"Too many full OMITs",
|
"Too many full OMITs",
|
||||||
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Kuukausi annettu kahdesti",
|
"Kuukausi annettu kahdesti",
|
||||||
"Päivä annettu kahdesti",
|
"Päivä annettu kahdesti",
|
||||||
"Tuntematon sana tai merkki",
|
"Tuntematon sana tai merkki",
|
||||||
"OMIT-komennossa on annettava kuukausi ja päivä",
|
"OMIT-komennossa on annettava kuukausi",
|
||||||
"Liian monta osittaista OMIT-komentoa",
|
"Liian monta osittaista OMIT-komentoa",
|
||||||
"Liian monta täydellistä OMIT-komentoa",
|
"Liian monta täydellistä OMIT-komentoa",
|
||||||
"Varoitus: PUSH-OMIT-CONTEXT ilman POP-OMIT-CONTEXTia",
|
"Varoitus: PUSH-OMIT-CONTEXT ilman POP-OMIT-CONTEXTia",
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Miesiąc podany dwókrotnie",
|
"Miesiąc podany dwókrotnie",
|
||||||
"Dzień podany dwókrotnie",
|
"Dzień podany dwókrotnie",
|
||||||
"Nieznane słowo",
|
"Nieznane słowo",
|
||||||
"W komendzie OMIT trzeba podać miesiąc i dzień",
|
"W komendzie OMIT trzeba podać miesiąc",
|
||||||
"Za dużo częściowych komend OMIT",
|
"Za dużo częściowych komend OMIT",
|
||||||
"Za dużo pełnych komend OMIT",
|
"Za dużo pełnych komend OMIT",
|
||||||
"Ostrzeżenie: PUSH-OMIT-CONTEXT bez POP-OMIT-CONTEXT",
|
"Ostrzeżenie: PUSH-OMIT-CONTEXT bez POP-OMIT-CONTEXT",
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Mes especificado duas vezes",
|
"Mes especificado duas vezes",
|
||||||
"Dia especificado duas vezes",
|
"Dia especificado duas vezes",
|
||||||
"Token desconhecido",
|
"Token desconhecido",
|
||||||
"Mes e dia devem ser especificados no comando OMIT",
|
"O mes deve ser especificados no comando OMIT",
|
||||||
"Muitos OMITs parciais",
|
"Muitos OMITs parciais",
|
||||||
"Muitos OMITs full",
|
"Muitos OMITs full",
|
||||||
"Aviso: PUSH-OMIT-CONTEXT sem POP-OMIT-CONTEXT correspondente",
|
"Aviso: PUSH-OMIT-CONTEXT sem POP-OMIT-CONTEXT correspondente",
|
||||||
|
|||||||
18
src/main.c
18
src/main.c
@@ -1357,13 +1357,23 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
|
|||||||
/* command-line flag is supplied. */
|
/* command-line flag is supplied. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
static sig_atomic_t got_sigint = 0;
|
||||||
|
|
||||||
void SigIntHandler(int d)
|
void
|
||||||
|
SigIntHandler(int d)
|
||||||
{
|
{
|
||||||
UNUSED(d);
|
UNUSED(d);
|
||||||
signal(SIGINT, SigIntHandler);
|
got_sigint = 1;
|
||||||
GotSigInt();
|
}
|
||||||
exit(0);
|
|
||||||
|
int
|
||||||
|
GotSigInt(void)
|
||||||
|
{
|
||||||
|
if (got_sigint) {
|
||||||
|
got_sigint = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
214
src/omit.c
214
src/omit.c
@@ -271,7 +271,6 @@ static void InsertIntoSortedArray(int *array, int num, int key)
|
|||||||
*cur = key;
|
*cur = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DoThroughOmit(ParsePtr p, int y, int m, int d);
|
|
||||||
static void DumpOmits(void);
|
static void DumpOmits(void);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@@ -283,11 +282,15 @@ static void DumpOmits(void);
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
int DoOmit(ParsePtr p)
|
int DoOmit(ParsePtr p)
|
||||||
{
|
{
|
||||||
int y = NO_YR, m = NO_MON, d = NO_DAY, r;
|
int y[2] = {NO_YR, NO_YR}, m[2] = {NO_MON, NO_MON}, d[2] = {NO_DAY, NO_DAY}, r;
|
||||||
Token tok;
|
Token tok;
|
||||||
int parsing=1;
|
int parsing = 1;
|
||||||
|
int seen_through = 0;
|
||||||
int syndrome;
|
int syndrome;
|
||||||
int not_first_token = -1;
|
int not_first_token = -1;
|
||||||
|
int start, end, tmp;
|
||||||
|
|
||||||
|
int mc, dc;
|
||||||
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
@@ -308,28 +311,28 @@ int DoOmit(ParsePtr p)
|
|||||||
|
|
||||||
case T_Date:
|
case T_Date:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (y != NO_YR) return E_YR_TWICE;
|
if (y[seen_through] != NO_YR) return E_YR_TWICE;
|
||||||
if (m != NO_MON) return E_MON_TWICE;
|
if (m[seen_through] != NO_MON) return E_MON_TWICE;
|
||||||
if (d != NO_DAY) return E_DAY_TWICE;
|
if (d[seen_through] != NO_DAY) return E_DAY_TWICE;
|
||||||
FromJulian(tok.val, &y, &m, &d);
|
FromJulian(tok.val, &y[seen_through], &m[seen_through], &d[seen_through]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Year:
|
case T_Year:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (y != NO_YR) return E_YR_TWICE;
|
if (y[seen_through] != NO_YR) return E_YR_TWICE;
|
||||||
y = tok.val;
|
y[seen_through] = tok.val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Month:
|
case T_Month:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (m != NO_MON) return E_MON_TWICE;
|
if (m[seen_through] != NO_MON) return E_MON_TWICE;
|
||||||
m = tok.val;
|
m[seen_through] = tok.val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Day:
|
case T_Day:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (d != NO_DAY) return E_DAY_TWICE;
|
if (d[seen_through] != NO_DAY) return E_DAY_TWICE;
|
||||||
d = tok.val;
|
d[seen_through] = tok.val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Delta:
|
case T_Delta:
|
||||||
@@ -338,8 +341,9 @@ int DoOmit(ParsePtr p)
|
|||||||
|
|
||||||
case T_Through:
|
case T_Through:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) return E_INCOMPLETE;
|
if (seen_through) return E_UNTIL_TWICE;
|
||||||
return DoThroughOmit(p, y, m, d);
|
seen_through = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case T_Empty:
|
case T_Empty:
|
||||||
case T_Comment:
|
case T_Comment:
|
||||||
@@ -358,26 +362,85 @@ int DoOmit(ParsePtr p)
|
|||||||
return E_UNKNOWN_TOKEN;
|
return E_UNKNOWN_TOKEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m == NO_MON || d == NO_DAY) return E_SPEC_MON_DAY;
|
|
||||||
|
|
||||||
if (y == NO_YR) {
|
if (!seen_through) {
|
||||||
if (NumPartialOmits == MAX_PARTIAL_OMITS) return E_2MANY_PART;
|
/* We must have at least a month */
|
||||||
|
if (m[0] == NO_MON) return E_SPEC_MON;
|
||||||
if (d > MonthDays[m]) return E_BAD_DATE;
|
m[1] = m[0];
|
||||||
syndrome = (m<<5) + d;
|
y[1] = y[0];
|
||||||
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
|
if (d[0] == NO_DAY) {
|
||||||
InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome);
|
d[0] = 1;
|
||||||
NumPartialOmits++;
|
if (y[0] == NO_YR) {
|
||||||
}
|
d[1] = MonthDays[m[0]];
|
||||||
|
} else {
|
||||||
|
d[1] = DaysInMonth(m[0], y[0]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
d[1] = d[0];
|
||||||
|
m[1] = m[0];
|
||||||
|
y[1] = y[0];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (m[0] == NO_MON) return E_SPEC_MON;
|
||||||
if (d > DaysInMonth(m, y)) return E_BAD_DATE;
|
if (m[1] == NO_MON) return E_SPEC_MON;
|
||||||
syndrome = Julian(y, m, d);
|
if ((y[0] != NO_YR && y[1] == NO_YR) ||
|
||||||
r = AddGlobalOmit(syndrome);
|
(y[0] == NO_YR && y[1] != NO_YR)) {
|
||||||
if (r) {
|
return E_BAD_DATE;
|
||||||
return r;
|
}
|
||||||
|
if (d[0] == NO_DAY) d[0] = 1;
|
||||||
|
if (d[1] == NO_DAY) {
|
||||||
|
if (y[1] == NO_YR) {
|
||||||
|
d[1] = MonthDays[m[1]];
|
||||||
|
} else {
|
||||||
|
d[1] = DaysInMonth(m[1], y[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (y[0] == NO_YR) {
|
||||||
|
/* Partial OMITs */
|
||||||
|
if (d[0] > MonthDays[m[0]]) return E_BAD_DATE;
|
||||||
|
if (d[1] > MonthDays[m[1]]) return E_BAD_DATE;
|
||||||
|
dc = d[0];
|
||||||
|
mc = m[0];
|
||||||
|
while(1) {
|
||||||
|
syndrome = (mc<<5) + dc;
|
||||||
|
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
|
||||||
|
InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome);
|
||||||
|
NumPartialOmits++;
|
||||||
|
}
|
||||||
|
if (mc == m[1] && dc == d[1]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dc++;
|
||||||
|
if (dc > MonthDays[mc]) {
|
||||||
|
dc = 1;
|
||||||
|
mc++;
|
||||||
|
if (mc > 11) {
|
||||||
|
mc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Full OMITs */
|
||||||
|
if (d[0] > DaysInMonth(m[0], y[0])) return E_BAD_DATE;
|
||||||
|
if (d[1] > DaysInMonth(m[1], y[1])) return E_BAD_DATE;
|
||||||
|
start = Julian(y[0], m[0], d[0]);
|
||||||
|
end = Julian(y[1], m[1], d[1]);
|
||||||
|
if (end < start) {
|
||||||
|
Eprint("Error: THROUGH date earlier than start date");
|
||||||
|
return E_BAD_DATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (tmp = start; tmp <= end; tmp++) {
|
||||||
|
if (!BexistsIntArray(FullOmitArray, NumFullOmits, tmp)) {
|
||||||
|
if (NumFullOmits >= MAX_FULL_OMITS) return E_2MANY_FULL;
|
||||||
|
InsertIntoSortedArray(FullOmitArray, NumFullOmits, tmp);
|
||||||
|
NumFullOmits++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
|
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
@@ -394,95 +457,6 @@ AddGlobalOmit(int jul)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
|
|
||||||
{
|
|
||||||
int yend = NO_YR, mend = NO_MON, dend = NO_DAY, r;
|
|
||||||
int start, end, tmp;
|
|
||||||
int parsing = 1;
|
|
||||||
|
|
||||||
Token tok;
|
|
||||||
|
|
||||||
DynamicBuffer buf;
|
|
||||||
DBufInit(&buf);
|
|
||||||
|
|
||||||
while(parsing) {
|
|
||||||
if ( (r=ParseToken(p, &buf)) ) return r;
|
|
||||||
FindToken(DBufValue(&buf), &tok);
|
|
||||||
|
|
||||||
switch(tok.type) {
|
|
||||||
case T_Date:
|
|
||||||
DBufFree(&buf);
|
|
||||||
if (yend != NO_YR) return E_YR_TWICE;
|
|
||||||
if (mend != NO_MON) return E_MON_TWICE;
|
|
||||||
if (dend != NO_DAY) return E_DAY_TWICE;
|
|
||||||
FromJulian(tok.val, ¥d, &mend, &dend);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_Year:
|
|
||||||
DBufFree(&buf);
|
|
||||||
if (yend != NO_YR) return E_YR_TWICE;
|
|
||||||
yend = tok.val;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_Month:
|
|
||||||
DBufFree(&buf);
|
|
||||||
if (mend != NO_MON) return E_MON_TWICE;
|
|
||||||
mend = tok.val;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_Day:
|
|
||||||
DBufFree(&buf);
|
|
||||||
if (dend != NO_DAY) return E_DAY_TWICE;
|
|
||||||
dend = tok.val;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_Empty:
|
|
||||||
case T_Comment:
|
|
||||||
case T_RemType:
|
|
||||||
case T_Priority:
|
|
||||||
case T_Tag:
|
|
||||||
case T_Duration:
|
|
||||||
DBufFree(&buf);
|
|
||||||
parsing = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Eprint("%s: `%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN],
|
|
||||||
DBufValue(&buf));
|
|
||||||
DBufFree(&buf);
|
|
||||||
return E_UNKNOWN_TOKEN;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (yend == NO_YR || mend == NO_MON || dend == NO_DAY) return E_INCOMPLETE;
|
|
||||||
if (dend > DaysInMonth(mend, yend)) return E_BAD_DATE;
|
|
||||||
if (dstart > DaysInMonth(mstart, ystart)) return E_BAD_DATE;
|
|
||||||
|
|
||||||
start = Julian(ystart, mstart, dstart);
|
|
||||||
end = Julian(yend, mend, dend);
|
|
||||||
|
|
||||||
if (end < start) {
|
|
||||||
Wprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
|
|
||||||
tmp = start;
|
|
||||||
start = end;
|
|
||||||
end = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = end - start + 1;
|
|
||||||
|
|
||||||
/* Don't create any OMITs if there would be too many. */
|
|
||||||
if (NumFullOmits + tmp >= MAX_FULL_OMITS) return E_2MANY_FULL;
|
|
||||||
for (tmp = start; tmp <= end; tmp++) {
|
|
||||||
if (!BexistsIntArray(FullOmitArray, NumFullOmits, tmp)) {
|
|
||||||
InsertIntoSortedArray(FullOmitArray, NumFullOmits, tmp);
|
|
||||||
NumFullOmits++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DumpOmits(void)
|
DumpOmits(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define isempty(c) (isspace(c) || ((c) == '\\'))
|
#define isempty(c) (isspace(c) || ((c) == '\\'))
|
||||||
|
|
||||||
#include "dynbuf.h"
|
#include "dynbuf.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
int CallUserFunc (char const *name, int nargs, ParsePtr p);
|
int CallUserFunc (char const *name, int nargs, ParsePtr p);
|
||||||
int DoFset (ParsePtr p);
|
int DoFset (ParsePtr p);
|
||||||
@@ -143,7 +144,7 @@ int MoonPhase (int date, int time);
|
|||||||
void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
|
void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
|
||||||
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio, int untimed_first);
|
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio, int untimed_first);
|
||||||
void SigIntHandler (int d);
|
void SigIntHandler (int d);
|
||||||
void GotSigInt (void);
|
int GotSigInt (void);
|
||||||
void PurgeEchoLine(char const *fmt, ...);
|
void PurgeEchoLine(char const *fmt, ...);
|
||||||
void FreeTrig(Trigger *t);
|
void FreeTrig(Trigger *t);
|
||||||
void AppendTag(DynamicBuffer *buf, char const *s);
|
void AppendTag(DynamicBuffer *buf, char const *s);
|
||||||
|
|||||||
21
src/queue.c
21
src/queue.c
@@ -59,6 +59,7 @@ static QueuedRem *FindNextReminder (void);
|
|||||||
static int CalculateNextTimeUsingSched (QueuedRem *q);
|
static int CalculateNextTimeUsingSched (QueuedRem *q);
|
||||||
static void DaemonWait (struct timeval *sleep_tv);
|
static void DaemonWait (struct timeval *sleep_tv);
|
||||||
static void reread (void);
|
static void reread (void);
|
||||||
|
static void PrintQueue(void);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -123,6 +124,7 @@ void HandleQueuedReminders(void)
|
|||||||
Trigger trig;
|
Trigger trig;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timeval sleep_tv;
|
struct timeval sleep_tv;
|
||||||
|
struct sigaction sa;
|
||||||
|
|
||||||
/* Suppress the BANNER from being issued */
|
/* Suppress the BANNER from being issued */
|
||||||
NumTriggered = 1;
|
NumTriggered = 1;
|
||||||
@@ -161,7 +163,11 @@ void HandleQueuedReminders(void)
|
|||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DontFork || Daemon) signal(SIGINT, SigIntHandler);
|
if (!DontFork || Daemon) {
|
||||||
|
sa.sa_handler = SigIntHandler;
|
||||||
|
sa.sa_flags = 0;
|
||||||
|
(void) sigaction(SIGINT, &sa, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Sit in a loop, issuing reminders when necessary */
|
/* Sit in a loop, issuing reminders when necessary */
|
||||||
while(1) {
|
while(1) {
|
||||||
@@ -205,6 +211,10 @@ void HandleQueuedReminders(void)
|
|||||||
sleep(SleepTime);
|
sleep(SleepTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GotSigInt()) {
|
||||||
|
PrintQueue();
|
||||||
|
}
|
||||||
|
|
||||||
/* If not in daemon mode and day has rolled around,
|
/* If not in daemon mode and day has rolled around,
|
||||||
exit -- not much we can do. */
|
exit -- not much we can do. */
|
||||||
if (!Daemon) {
|
if (!Daemon) {
|
||||||
@@ -337,13 +347,13 @@ static QueuedRem *FindNextReminder(void)
|
|||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* GotSigInt */
|
/* PrintQueue */
|
||||||
/* */
|
/* */
|
||||||
/* Split out what's done on a SIGINT from the SIGINT Handler. */
|
/* For debugging: Print queue contents to STDOUT */
|
||||||
/* This will be necessary for OS/2 multithreaded. */
|
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void GotSigInt(void)
|
static
|
||||||
|
void PrintQueue(void)
|
||||||
{
|
{
|
||||||
QueuedRem *q = QueueHead;
|
QueuedRem *q = QueueHead;
|
||||||
|
|
||||||
@@ -368,6 +378,7 @@ void GotSigInt(void)
|
|||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
printf(NL);
|
printf(NL);
|
||||||
|
printf("To terminate program, send SIGQUIT (probably Ctrl-\\ on the keyboard.)%s", NL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|||||||
@@ -170,10 +170,11 @@ static int latitude_func(int do_set, Value *val)
|
|||||||
static int trig_date_func(int do_set, Value *val)
|
static int trig_date_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
UNUSED(do_set);
|
UNUSED(do_set);
|
||||||
val->type = DATE_TYPE;
|
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
|
val->type = INT_TYPE;
|
||||||
val->v.val = 0;
|
val->v.val = 0;
|
||||||
} else {
|
} else {
|
||||||
|
val->type = DATE_TYPE;
|
||||||
val->v.val = LastTriggerDate;
|
val->v.val = LastTriggerDate;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -123,10 +123,10 @@ REM Mon OMITFUNC foo MSG bar
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Test default color
|
# Test default color
|
||||||
../src/remind -ppp - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
../src/remind -pppq - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
REM 2 MSG Normal
|
REM 2 MSG Normal
|
||||||
SET $DefaultColor "255 0 0"
|
SET $DefaultColor "255 0 0"
|
||||||
REM 3 MSG Red
|
REM 3 MSG %"Red%" on the calendar!
|
||||||
SET $DefaultColor "-1 -1 -1"
|
SET $DefaultColor "-1 -1 -1"
|
||||||
REM 4 MSG Normal
|
REM 4 MSG Normal
|
||||||
# Should give an error
|
# Should give an error
|
||||||
|
|||||||
120
tests/test.cmp
120
tests/test.cmp
@@ -1024,7 +1024,7 @@ set a057 value("a05"+"6")
|
|||||||
"a05" + "6" => "a056"
|
"a05" + "6" => "a056"
|
||||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||||
set a058 version()
|
set a058 version()
|
||||||
version() => "04.00.01"
|
version() => "04.00.03"
|
||||||
set a059 wkday(today())
|
set a059 wkday(today())
|
||||||
today() => 1991-02-16
|
today() => 1991-02-16
|
||||||
wkday(1991-02-16) => "Saturday"
|
wkday(1991-02-16) => "Saturday"
|
||||||
@@ -2594,7 +2594,7 @@ a086 4
|
|||||||
a109 2012-01-01
|
a109 2012-01-01
|
||||||
a128 2018-02-03@16:45
|
a128 2018-02-03@16:45
|
||||||
a039 "February"
|
a039 "February"
|
||||||
a058 "04.00.01"
|
a058 "04.00.03"
|
||||||
a077 "1992 92
|
a077 "1992 92
|
||||||
"
|
"
|
||||||
a096 -4
|
a096 -4
|
||||||
@@ -2766,7 +2766,7 @@ Variable Value
|
|||||||
$SubsIndent 0 [0, 132]
|
$SubsIndent 0 [0, 132]
|
||||||
$Sunday "Sunday"
|
$Sunday "Sunday"
|
||||||
$SuppressLRM 0 [0, 1]
|
$SuppressLRM 0 [0, 1]
|
||||||
$T 1990-01-01
|
$T 0
|
||||||
$Td -1
|
$Td -1
|
||||||
$Thursday "Thursday"
|
$Thursday "Thursday"
|
||||||
$TimeSep ":"
|
$TimeSep ":"
|
||||||
@@ -3943,6 +3943,118 @@ $MaxStringLen => 65535
|
|||||||
pad("foo", "0", 65536) => String too long
|
pad("foo", "0", 65536) => String too long
|
||||||
../tests/test.rem(799): String too long
|
../tests/test.rem(799): String too long
|
||||||
|
|
||||||
|
# Test OMIT
|
||||||
|
CLEAR-OMIT-CONTEXT
|
||||||
|
|
||||||
|
OMIT Apr
|
||||||
|
OMIT Jun THROUGH July 15
|
||||||
|
OMIT Sep 5 THROUGH Sep 10
|
||||||
|
OMIT 2024-12-25 THROUGH 2025-01-04
|
||||||
|
OMIT Apr 2022 through July
|
||||||
|
../tests/test.rem(808): Bad date specification
|
||||||
|
|
||||||
|
OMIT DUMP
|
||||||
|
Global Full OMITs (11 of maximum allowed 1000):
|
||||||
|
2024-12-25
|
||||||
|
2024-12-26
|
||||||
|
2024-12-27
|
||||||
|
2024-12-28
|
||||||
|
2024-12-29
|
||||||
|
2024-12-30
|
||||||
|
2024-12-31
|
||||||
|
2025-01-01
|
||||||
|
2025-01-02
|
||||||
|
2025-01-03
|
||||||
|
2025-01-04
|
||||||
|
Global Partial OMITs (81 of maximum allowed 366):
|
||||||
|
04-01
|
||||||
|
04-02
|
||||||
|
04-03
|
||||||
|
04-04
|
||||||
|
04-05
|
||||||
|
04-06
|
||||||
|
04-07
|
||||||
|
04-08
|
||||||
|
04-09
|
||||||
|
04-10
|
||||||
|
04-11
|
||||||
|
04-12
|
||||||
|
04-13
|
||||||
|
04-14
|
||||||
|
04-15
|
||||||
|
04-16
|
||||||
|
04-17
|
||||||
|
04-18
|
||||||
|
04-19
|
||||||
|
04-20
|
||||||
|
04-21
|
||||||
|
04-22
|
||||||
|
04-23
|
||||||
|
04-24
|
||||||
|
04-25
|
||||||
|
04-26
|
||||||
|
04-27
|
||||||
|
04-28
|
||||||
|
04-29
|
||||||
|
04-30
|
||||||
|
06-01
|
||||||
|
06-02
|
||||||
|
06-03
|
||||||
|
06-04
|
||||||
|
06-05
|
||||||
|
06-06
|
||||||
|
06-07
|
||||||
|
06-08
|
||||||
|
06-09
|
||||||
|
06-10
|
||||||
|
06-11
|
||||||
|
06-12
|
||||||
|
06-13
|
||||||
|
06-14
|
||||||
|
06-15
|
||||||
|
06-16
|
||||||
|
06-17
|
||||||
|
06-18
|
||||||
|
06-19
|
||||||
|
06-20
|
||||||
|
06-21
|
||||||
|
06-22
|
||||||
|
06-23
|
||||||
|
06-24
|
||||||
|
06-25
|
||||||
|
06-26
|
||||||
|
06-27
|
||||||
|
06-28
|
||||||
|
06-29
|
||||||
|
06-30
|
||||||
|
07-01
|
||||||
|
07-02
|
||||||
|
07-03
|
||||||
|
07-04
|
||||||
|
07-05
|
||||||
|
07-06
|
||||||
|
07-07
|
||||||
|
07-08
|
||||||
|
07-09
|
||||||
|
07-10
|
||||||
|
07-11
|
||||||
|
07-12
|
||||||
|
07-13
|
||||||
|
07-14
|
||||||
|
07-15
|
||||||
|
09-05
|
||||||
|
09-06
|
||||||
|
09-07
|
||||||
|
09-08
|
||||||
|
09-09
|
||||||
|
09-10
|
||||||
|
CLEAR-OMIT-CONTEXT
|
||||||
|
OMIT 2000-01-01 THROUGH 2020-12-31
|
||||||
|
../tests/test.rem(812): Too many full OMITs
|
||||||
|
|
||||||
|
OMIT Dec 5 2029 through Dec 4 2029
|
||||||
|
../tests/test.rem(814): Error: THROUGH date earlier than start date
|
||||||
|
|
||||||
# Don't want Remind to queue reminders
|
# Don't want Remind to queue reminders
|
||||||
EXIT
|
EXIT
|
||||||
|
|
||||||
@@ -7698,7 +7810,7 @@ February 29
|
|||||||
{
|
{
|
||||||
"monthname":"January","year":2012,"daysinmonth":31,"firstwkday":0,"mondayfirst":0,"daynames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"prevmonthname":"December","daysinprevmonth":31,"prevmonthyear":2011,"nextmonthname":"February","daysinnextmonth":29,"nextmonthyear":2012,"entries":[
|
"monthname":"January","year":2012,"daysinmonth":31,"firstwkday":0,"mondayfirst":0,"daynames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"prevmonthname":"December","daysinprevmonth":31,"prevmonthyear":2011,"nextmonthname":"February","daysinnextmonth":29,"nextmonthyear":2012,"entries":[
|
||||||
{"date":"2012-01-02","filename":"-","lineno":1,"d":2,"priority":5000,"body":"Normal"},
|
{"date":"2012-01-02","filename":"-","lineno":1,"d":2,"priority":5000,"body":"Normal"},
|
||||||
{"date":"2012-01-03","filename":"-","lineno":3,"passthru":"COLOR","d":3,"priority":5000,"r":255,"g":0,"b":0,"rawbody":"Red","body":"255 0 0 Red"},
|
{"date":"2012-01-03","filename":"-","lineno":3,"passthru":"COLOR","d":3,"priority":5000,"r":255,"g":0,"b":0,"rawbody":"%\"Red%\" on the calendar!","calendar_body":"Red","plain_body":"Red on the calendar!","body":"255 0 0 %\"Red%\" on the calendar!"},
|
||||||
{"date":"2012-01-04","filename":"-","lineno":5,"d":4,"priority":5000,"body":"Normal"}
|
{"date":"2012-01-04","filename":"-","lineno":5,"d":4,"priority":5000,"body":"Normal"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -798,6 +798,21 @@ set a pad(11:33, " ", 12)
|
|||||||
set a pad(11:33, " ", 12, 1)
|
set a pad(11:33, " ", 12, 1)
|
||||||
set a pad("foo", "0", $MaxStringLen+1)
|
set a pad("foo", "0", $MaxStringLen+1)
|
||||||
|
|
||||||
|
# Test OMIT
|
||||||
|
CLEAR-OMIT-CONTEXT
|
||||||
|
|
||||||
|
OMIT Apr
|
||||||
|
OMIT Jun THROUGH July 15
|
||||||
|
OMIT Sep 5 THROUGH Sep 10
|
||||||
|
OMIT 2024-12-25 THROUGH 2025-01-04
|
||||||
|
OMIT Apr 2022 through July
|
||||||
|
|
||||||
|
OMIT DUMP
|
||||||
|
CLEAR-OMIT-CONTEXT
|
||||||
|
OMIT 2000-01-01 THROUGH 2020-12-31
|
||||||
|
|
||||||
|
OMIT Dec 5 2029 through Dec 4 2029
|
||||||
|
|
||||||
# Don't want Remind to queue reminders
|
# Don't want Remind to queue reminders
|
||||||
EXIT
|
EXIT
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user