mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Add $WarningLevel special variable.
This commit is contained in:
18
configure
vendored
18
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.72 for remind 06.01.02.
|
||||
# Generated by GNU Autoconf 2.72 for remind 06.01.03.
|
||||
#
|
||||
#
|
||||
# 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.01.02'
|
||||
PACKAGE_STRING='remind 06.01.02'
|
||||
PACKAGE_VERSION='06.01.03'
|
||||
PACKAGE_STRING='remind 06.01.03'
|
||||
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.01.02 to adapt to many kinds of systems.
|
||||
'configure' configures remind 06.01.03 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.01.02:";;
|
||||
short | recursive ) echo "Configuration of remind 06.01.03:";;
|
||||
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.01.02
|
||||
remind configure 06.01.03
|
||||
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.01.02, which was
|
||||
It was created by remind $as_me 06.01.03, 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.01.02, which was
|
||||
This file was extended by remind $as_me 06.01.03, 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.01.02
|
||||
remind config.status 06.01.03
|
||||
configured by $0, generated by GNU Autoconf 2.72,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(remind, 06.01.02, , , https://dianne.skoll.ca/projects/remind/)
|
||||
AC_INIT(remind, 06.01.03, , , https://dianne.skoll.ca/projects/remind/)
|
||||
AC_CONFIG_SRCDIR([src/queue.c])
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
"$TerminalBackground" "$Thursday" "$TimeSep" "$TimetIs64bit" "$Tm" "$Today" "$TodoFilter"
|
||||
"$Tomorrow" "$Tt" "$Tuesday" "$Tw" "$Ty" "$U" "$Ud" "$Um"
|
||||
"$UntimedFirst" "$Use256Colors" "$UseBGVTColors" "$UseTrueColors"
|
||||
"$UseVTColors" "$Uw" "$Uy" "$Was" "$Wednesday")
|
||||
"$UseVTColors" "$Uw" "$Uy" "$WarningLevel" "$Was" "$Wednesday")
|
||||
#'(lambda (a b) (> (length a) (length b)))))
|
||||
|
||||
(defconst remind-time-words
|
||||
|
||||
11
src/dorem.c
11
src/dorem.c
@@ -1211,13 +1211,16 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
}
|
||||
|
||||
/* Check for some warning conditions */
|
||||
if (trig->addomit) {
|
||||
if (trig->y == NO_YR || trig->m == NO_MON || trig->d == NO_DAY || trig->rep != NO_REP) {
|
||||
if (trig->scanfrom == NO_SCANFROM) {
|
||||
Wprint(tr("Warning: Consider using SCANFROM with recurring ADDOMIT"));
|
||||
if (warning_level("06.01.03")) {
|
||||
if (trig->addomit) {
|
||||
if (trig->y == NO_YR || trig->m == NO_MON || trig->d == NO_DAY || trig->rep != NO_REP) {
|
||||
if (trig->scanfrom == NO_SCANFROM) {
|
||||
Wprint(tr("Warning: Consider using SCANFROM with recurring ADDOMIT"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!s->nonconst_expr) {
|
||||
if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL) {
|
||||
if (DSE(trig->y, trig->m, trig->d) > trig->until) {
|
||||
|
||||
@@ -63,6 +63,7 @@ EXTERN INIT( int MaxLateMinutes, 0);
|
||||
EXTERN INIT( int NumTrustedUsers, 0);
|
||||
EXTERN INIT( char const *MsgCommand, NULL);
|
||||
EXTERN INIT( char const *QueuedMsgCommand, NULL);
|
||||
EXTERN INIT( char const *WarningLevel, NULL);
|
||||
EXTERN INIT( int ShowAllErrors, 0);
|
||||
EXTERN INIT( int DebugFlag, 0);
|
||||
EXTERN INIT( int DoCalendar, 0);
|
||||
|
||||
@@ -301,3 +301,4 @@ int tz_convert(int year, int month, int day, int hour, int minute, char const *s
|
||||
int AdjustTriggerForTimeZone(Trigger *trig, int dse, TimeTrig *tim);
|
||||
void EnterTimezone(char const *tz);
|
||||
void ExitTimezone(char const *tz);
|
||||
int warning_level(char const *which);
|
||||
|
||||
@@ -348,3 +348,10 @@ line_range(int lineno_start, int lineno)
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
int
|
||||
warning_level(char const *which)
|
||||
{
|
||||
if (!WarningLevel) return 1;
|
||||
return strcmp(WarningLevel, which) >= 0;
|
||||
}
|
||||
|
||||
33
src/var.c
33
src/var.c
@@ -26,6 +26,8 @@
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
#include "err.h"
|
||||
#include "version.h"
|
||||
|
||||
#define UPPER(c) (islower(c) ? toupper(c) : c)
|
||||
|
||||
#define VARIABLE GetErr(E_VAR)
|
||||
@@ -189,6 +191,36 @@ static int latitude_func(int do_set, Value *val)
|
||||
return latitude_longitude_func(do_set, val, &Latitude, -90.0, 90.0);
|
||||
}
|
||||
|
||||
static int warning_level_func(int do_set, Value *val)
|
||||
{
|
||||
int a, b, c;
|
||||
if (do_set) {
|
||||
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (!val->v.str || ! (*val->v.str)) {
|
||||
if (WarningLevel) free((void *) WarningLevel);
|
||||
WarningLevel = NULL;
|
||||
return OK;
|
||||
}
|
||||
if (sscanf(val->v.str, "%d.%d.%d", &a, &b, &c) != 3) {
|
||||
return E_BAD_NUMBER;
|
||||
}
|
||||
if (WarningLevel) free((void *) WarningLevel);
|
||||
WarningLevel = StrDup(val->v.str);
|
||||
if (!WarningLevel) return E_NO_MEM;
|
||||
return OK;
|
||||
}
|
||||
if (!WarningLevel) {
|
||||
val->v.str = StrDup(VERSION);
|
||||
} else {
|
||||
val->v.str = StrDup(WarningLevel);
|
||||
}
|
||||
if (!val->v.str) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int oncefile_func(int do_set, Value *val)
|
||||
{
|
||||
if (do_set) {
|
||||
@@ -1083,6 +1115,7 @@ static SysVar SysVarArr[] = {
|
||||
{"UseVTColors", 0, INT_TYPE, &UseVTColors, 0, 0 },
|
||||
{"Uw", 0, SPECIAL_TYPE, today_wday_func, 0, 0 },
|
||||
{"Uy", 0, SPECIAL_TYPE, today_year_func, 0, 0 },
|
||||
{"WarningLevel", 1, SPECIAL_TYPE, warning_level_func, 0, 0 },
|
||||
{"Was", 1, TRANS_TYPE, "was", 0, 0 },
|
||||
{"Wednesday", 1, TRANS_TYPE, "Wednesday", 0, 0 }
|
||||
};
|
||||
|
||||
@@ -838,6 +838,15 @@ set c mbchar(0x1F642) * 40
|
||||
DUMP
|
||||
EOF
|
||||
|
||||
# Test $WarningLevel
|
||||
../src/remind -de -h --flush -q - 2025-01-01 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
REM Monday ADDOMIT MSG woohoo!
|
||||
set $WarningLevel "06.01.02"
|
||||
REM Tuesday ADDOMIT MSG Cabbage.
|
||||
EOF
|
||||
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
|
||||
@@ -1046,7 +1046,7 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "06.01.02"
|
||||
version() => "06.01.03"
|
||||
set a059 wkday(today())
|
||||
today() => 1991-02-16
|
||||
wkday(1991-02-16) => "Saturday"
|
||||
@@ -2609,7 +2609,7 @@ a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a007 "1991-02-16"
|
||||
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a008 "11:44"
|
||||
a058 "06.01.02"
|
||||
a058 "06.01.03"
|
||||
a059 "Saturday"
|
||||
a010 12
|
||||
a060 6
|
||||
@@ -5562,8 +5562,8 @@ REM SATISFY ""
|
||||
REM SATISFY [version() > "01.00.00"]
|
||||
../tests/test.rem(1074): SATISFY: expression has no reference to trigdate() or $T...
|
||||
../tests/test.rem(1074): Trig = Saturday, 16 February, 1991
|
||||
version() => "06.01.02"
|
||||
"06.01.02" > "01.00.00" => 1
|
||||
version() => "06.01.03"
|
||||
"06.01.03" > "01.00.00" => 1
|
||||
../tests/test.rem(1074): Trig(satisfied) = Saturday, 16 February, 1991
|
||||
REM SATISFY [max(x, max(x, 1, 2, 3), 4, 5, 6) * 5]
|
||||
../tests/test.rem(1075): SATISFY: expression has no reference to trigdate() or $T...
|
||||
@@ -23716,7 +23716,7 @@ SECURITY: Won't read world-writable file or directory!
|
||||
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
|
||||
06.01.02
|
||||
06.01.03
|
||||
Enabling test mode: This is meant for the acceptance test.
|
||||
Do not use --test in production.
|
||||
In test mode, the system time is fixed at 2025-01-06@19:00
|
||||
@@ -24856,6 +24856,7 @@ $UseTrueColors
|
||||
$UseVTColors
|
||||
$Uw
|
||||
$Uy
|
||||
$WarningLevel
|
||||
$Was
|
||||
$Wednesday
|
||||
No reminders.
|
||||
@@ -39900,3 +39901,10 @@ Variable Value
|
||||
a "¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢"
|
||||
b "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
|
||||
c "🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂"
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
REM Monday ADDOMIT MSG woohoo!
|
||||
-stdin-(3): Warning: Consider using SCANFROM with recurring ADDOMIT
|
||||
set $WarningLevel "06.01.02"
|
||||
REM Tuesday ADDOMIT MSG Cabbage.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user