Compare commits

...

12 Commits

Author SHA1 Message Date
Dianne Skoll
0416d6da9c Update to version 06.00.02. 2025-09-01 10:02:14 -04:00
Dianne Skoll
5d46df871f Clamp trigger() to "1 January 1990 AT 00:00" if UTC flag is used. 2025-08-28 13:30:21 -04:00
Dianne Skoll
c5d661124c Never return a year < 1990 from trigger() 2025-08-28 12:53:28 -04:00
Dianne Skoll
2f239f77a5 Default $ParseUntriggered to 0 instead of 1 2025-08-27 11:34:10 -04:00
Dianne Skoll
1ef05d3f85 Slight efficiency improvement. 2025-08-21 11:50:45 -04:00
Dianne Skoll
7c56aad791 FIx tests. 2025-08-21 11:49:16 -04:00
Dianne Skoll
5f0f68f508 Allow '-i$foo' to be interpreted as '-i$foo=0' 2025-08-20 10:27:22 -04:00
Dianne Skoll
71bfe31002 Make IS_INTERACTIVE() macro. 2025-08-19 21:39:31 -04:00
Dianne Skoll
4661b454c0 Don't add *everything* to history, LOL. 2025-08-19 21:32:26 -04:00
Dianne Skoll
d41520a04f Better example. 2025-08-19 15:54:03 -04:00
Dianne Skoll
0206e538e0 Avoid -Wunused-result warning. 2025-08-19 15:22:05 -04:00
Dianne Skoll
6689cbfda3 Explicitly set latitude and longitude in test files. 2025-08-19 15:04:03 -04:00
16 changed files with 1378 additions and 1307 deletions

18
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for remind 06.00.01.
# Generated by GNU Autoconf 2.72 for remind 06.00.02.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
@@ -601,8 +601,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='remind'
PACKAGE_TARNAME='remind'
PACKAGE_VERSION='06.00.01'
PACKAGE_STRING='remind 06.00.01'
PACKAGE_VERSION='06.00.02'
PACKAGE_STRING='remind 06.00.02'
PACKAGE_BUGREPORT=''
PACKAGE_URL='https://dianne.skoll.ca/projects/remind/'
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures remind 06.00.01 to adapt to many kinds of systems.
'configure' configures remind 06.00.02 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1320,7 +1320,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of remind 06.00.01:";;
short | recursive ) echo "Configuration of remind 06.00.02:";;
esac
cat <<\_ACEOF
@@ -1408,7 +1408,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
remind configure 06.00.01
remind configure 06.00.02
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -1871,7 +1871,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by remind $as_me 06.00.01, which was
It was created by remind $as_me 06.00.02, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -4848,7 +4848,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by remind $as_me 06.00.01, which was
This file was extended by remind $as_me 06.00.02, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4913,7 +4913,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
remind config.status 06.00.01
remind config.status 06.00.02
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(remind, 06.00.01, , , https://dianne.skoll.ca/projects/remind/)
AC_INIT(remind, 06.00.02, , , https://dianne.skoll.ca/projects/remind/)
AC_CONFIG_SRCDIR([src/queue.c])
cat <<'EOF'

View File

@@ -1,5 +1,25 @@
CHANGES TO REMIND
* VERSION 6.0 Patch 2 - 2025-09-01
- CHANGE: Default $ParseUntriggered to 0 instead of 1. The default
could cause spurious warnings such as "type mismatch" warnings for
untriggered reminders.
- TEST FIX: Explicitly set latitude and longitude in test files.
- BUG FIX: remind: Don't add lines to "readline" history unless they
are actually being read from standard input.
- BUG FIX: remind: On the command-line, make "-i$foo" behave the same
way as "-i$foo=0" as was documented in the man page.
- BUG FIX: remind: Clamp the output of trigger() to "1 January 1990 AT
00:00" if the UTC flag is used, even if it would actually produce a
result in 1989.
- MINOR FIX: remind: Avoid "unused result" compiler warning.
* VERSION 6.0 Patch 1 - 2025-08-19
- NEW FEATURE: remind: Add readline support if input is taken from stdin

View File

@@ -11,8 +11,9 @@ reminder or alarm can consist of a message sent to standard output, or
a program to be executed.
.PP
If \fIfilename\fR is specified as a single dash '-', then \fBRemind\fR
takes its input from standard input.
takes its input from standard input. In this case, if \fBRemind\fR
has been compiled against the GNU Readline library, it will use
Readline to give you an interactive line-editing interface.
.PP
If \fIfilename\fR happens to be a directory rather than a plain file,
then \fBRemind\fR reads all of the files (but not any subdirectories!)
@@ -3194,25 +3195,26 @@ and ignore the attempt to set \fB$OnceFile\fR.
.RE
.TP
.B $ParseUntriggered
A flag indicating whether or not \fBRemind\fR should fully parse \fBREM\fR
statements that are not triggered. 0 means to skip parsing them and 1
(the default) means to parse them.
A flag indicating whether or not \fBRemind\fR should fully parse
\fBREM\fR statements that are not triggered. 0 (the default) means to
skip parsing them and 1 means to parse them.
.PP
.RS
For example, if we have the following \fBREM\fR statement:
.PP
.nf
REM 2020-01-01 MSG ["bad_expression" * 2]
REM 2020-01-01 MSG ["bad_expression" / 2]
.fi
.PP
Then by default, \fBRemind\fR will fully parse the line and issue
a "Type mismatch" error even if the reminder is not triggered. However,
if \fB$ParseUntriggered\fR is set to 0, then \fBRemind\fR will not
issue the error except on 2020-01-01, when the reminder is triggered.
Then if \fB$ParseUntriggered\fR is set to 1, \fBRemind\fR will fully
parse the line and issue a "Type mismatch" error even if the reminder
is not triggered. However, if \fB$ParseUntriggered\fR is set to 0,
the default, then \fBRemind\fR will not issue the error except on
2020-01-01, when the reminder is triggered.
.PP
Setting \fB$ParseUntriggered\fR to 0 may in some cases slightly
improve performance, at the risk of not catching errors until a
reminder is triggered.
Keeping \fB$ParseUntriggered\fR at 0 may slightly improve performance,
at the risk of not catching errors until a reminder is triggered. We recommend
leaving it set to 0.
.RE
.TP
.B $PrefixLineNo (read-only)
@@ -4836,6 +4838,11 @@ Finally:
.PP
returns "30 November 1994 AT 22:00" for EST, which is 5 hours behind UTC.
The value for your time zone may differ.
.PP
\fBtrigger()\fR will \fInever\fR return a date earlier than "1 January 1990"
even if the UTC flag dictates that it should. So do not use it for reminders
before about 2 January 1990 in your local time zone. I do not anticipate this
restriction being a real problem.
.RE
.TP
.B trigtags()

View File

@@ -278,6 +278,8 @@ int ReadLine(void)
return ReadLineFromFile(0);
}
#define IS_INTERACTIVE() (fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
/***************************************************************/
/* */
/* ReadLineFromFile */
@@ -304,7 +306,7 @@ static int ReadLineFromFile(int use_pclose)
LineNoStart = LineNo+1;
while(fp) {
#ifdef USE_READLINE
if (fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
if (IS_INTERACTIVE()) {
char *lin;
if (should_ignore_line()) {
if (read_some) {
@@ -410,7 +412,9 @@ static int ReadLineFromFile(int use_pclose)
}
#ifdef USE_READLINE_HISTORY
add_history(CurLine);
if (fp && IS_INTERACTIVE()) {
add_history(CurLine);
}
#endif
got_a_fresh_line();
clear_callstack();

View File

@@ -2179,6 +2179,10 @@ static int FTrigger(func_info *info)
tim = ARGV(1);
if (ARGV(2)) {
UTCToLocal(date, tim, &date, &tim);
if (date < 0) {
date = 0;
tim = 0;
}
}
} else if (Nargs > 1) {
/* Date Time */
@@ -2193,6 +2197,10 @@ static int FTrigger(func_info *info)
ASSERT_TYPE(1, INT_TYPE);
if (ARGV(1)) {
UTCToLocal(date, tim, &date, &tim);
if (date < 0) {
date = 0;
tim = 0;
}
}
}
}

View File

@@ -98,7 +98,7 @@ EXTERN INIT( int SortByPrio, SORT_NONE);
EXTERN INIT( int UntimedBeforeTimed, 0);
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
EXTERN INIT( int SysTime, -1);
EXTERN INIT( int ParseUntriggered, 1);
EXTERN INIT( int ParseUntriggered, 0);
EXTERN char const *InitialFile;
EXTERN int FileAccessDate;

View File

@@ -1017,17 +1017,15 @@ static void InitializeVar(char const *str)
return;
}
if (!*str) {
/* Setting a system var does require =expr on the commandline */
if (*varname == '$') {
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(E_MISS_EQ));
fprintf(ErrFp, "\n");
return;
}
val.type = INT_TYPE;
val.v.val = 0;
r = SetVar(varname, &val, 1);
if (!r) {
r = PreserveVar(varname);
if (*varname == '$') {
r = SetSysVar(varname+1, &val);
} else {
r = SetVar(varname, &val, 1);
if (!r) {
r = PreserveVar(varname);
}
}
if (r) {
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(r));

View File

@@ -2122,6 +2122,7 @@ System(char const *cmd, int is_queued)
int fd;
int status;
int do_exit = 0;
if (is_queued && IsServerMode()) {
do_exit = 1;
/* Server mode... redirect stdin and stdout to /dev/null */
@@ -2151,10 +2152,9 @@ System(char const *cmd, int is_queued)
}
/* This is the child process or original if we never forked */
if (JSONMode) {
(void) system_to_stderr(cmd);
} else {
(void) system(cmd);
(void) system1(cmd);
}
if (do_exit) {
/* In the child process, so exit! */

View File

@@ -295,3 +295,4 @@ int get_scanfrom(Trigger const *t);
void remove_trailing_newlines(DynamicBuffer *buf);
void set_cloexec(int fd);
int system_to_stderr(char const *cmd);
int system1(char const *cmd);

View File

@@ -31,6 +31,13 @@ static char const DontEscapeMe[] =
#include "globals.h"
#include "protos.h"
/* Call this instead of system() so if called ignores return code,
we don't get a compiler warning */
int system1(char const *cmd)
{
return system(cmd);
}
/***************************************************************/
/* */
/* system_to_stderr */

View File

@@ -1,4 +1,6 @@
set $AddBlankLines 0
SET $Latitude "45.42055556"
SET $Longitude "-75.68944444"
banner %
set d '2011-01-01'

View File

@@ -573,7 +573,7 @@ EOF
../src/remind --flush '-i$AddBlankLines' - <<'EOF' >> ../tests/test.out 2>&1
BANNER %
DUMP
DUMP $AddBlankLines
EOF
../src/remind --flush ../tests/expr.rem >> ../tests/test.out 2>&1
@@ -622,7 +622,7 @@ grep -F -v '$SysInclude' < ../tests/test.out > ../tests/test.out.1 && mv -f ../t
# If "man" accepts the --warnings flag, test all the man pages.
RUNMAN=0
man man | grep -e --warnings > /dev/null 2>&1
man man 2>&1 | grep -e --warnings > /dev/null 2>&1
if test "$?" = 0 ; then
RUNMAN=1
fi

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,9 @@
#
# ./test-rem # From WITHIN Remind source directory!
SET $Latitude "45.42055556"
SET $Longitude "-75.68944444"
# Should issue a warning
fset year(x) 1
@@ -977,10 +980,17 @@ set a htmlstriptags("this is > whut <b>foo</b>")
set a htmlstriptags("<img src=\"foo\">")
# $ParseUntriggered
# Default is 0
REM 2 Jan 1990 MSG ["bad_expr" / 2]
# Set to 1 explicitly
SET $ParseUntriggered 1
REM 2 Jan 1990 MSG ["bad_expr" / 2]
# Set to 0 explicitly
SET $ParseUntriggered 0
REM 2 Jan 1990 MSG ["bad_expr" / 2]
SET $ParseUntriggered 1
# String multiplication

View File

@@ -34,3 +34,5 @@ set a utctolocal('2051-01-01@04:44')
set a utctolocal('2050-03-13@05:00')
set a utctolocal('2050-11-06@04:00')
set a utctolocal('2050-11-06@07:00')
set a trigger('1990-01-01@1:22', 1)