Compare commits

...

2 Commits

Author SHA1 Message Date
Dianne Skoll
ae17834610 Commit before switching branches.
All checks were successful
Remind unit tests / tests (push) Successful in 52s
2025-02-10 13:49:50 -05:00
Dianne Skoll
5acbb907b4 Issue warning if a substitution sequence related to time is used without an AT clause.
All checks were successful
Remind unit tests / tests (push) Successful in 31s
2025-02-10 09:23:43 -05:00
8 changed files with 97 additions and 2 deletions

1
.gitignore vendored
View File

@@ -35,3 +35,4 @@ www/Makefile
gmon.out
tests/once.timestamp
src/xlat.c
cremind/Makefile.PL

3
configure vendored
View File

@@ -4209,7 +4209,7 @@ printf "%s\n" "#define CONFIG_CMD \"$CONFIG_CMD\"" >>confdefs.h
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind"
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind cremind/Makefile.PL"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4911,6 +4911,7 @@ do
"man/remind.1") CONFIG_FILES="$CONFIG_FILES man/remind.1" ;;
"man/tkremind.1") CONFIG_FILES="$CONFIG_FILES man/tkremind.1" ;;
"scripts/tkremind") CONFIG_FILES="$CONFIG_FILES scripts/tkremind" ;;
"cremind/Makefile.PL") CONFIG_FILES="$CONFIG_FILES cremind/Makefile.PL" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@@ -95,7 +95,7 @@ AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_SUBST(PERLARTIFACTS)
AC_SUBST(RELEASE_DATE)
AC_CONFIG_FILES([src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind])
AC_CONFIG_FILES([src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind cremind/Makefile.PL])
AC_OUTPUT
chmod a+x rem2pdf/bin/rem2pdf
chmod a+x scripts/tkremind

21
cremind/Makefile.PL.in Normal file
View File

@@ -0,0 +1,21 @@
use ExtUtils::MakeMaker;
{
# Override pod2man options
package MY;
sub manifypods {
my ($self,%attribs) = @_;
my $result = $self->SUPER::manifypods(%attribs);
$result =~ s/^(POD2MAN_EXE\s*=\s*)(.+)$/$1$2 --center 'VERSION @VERSION@' --date '@RELEASE_DATE@'/m;
return $result;
}
}
WriteMakefile(
NAME => 'cremind"
AUTHOR => q{Dianne Skoll <dianne@skoll.ca>},
VERSION => '@VERSION@',
PREREQ_PM => {
'Curses::UI' => 0,
},
EXE_FILES => [ 'bin/cremind' ]
);

43
cremind/bin/cremind Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/perl
use strict;
use warnings;
use Curses::UI;
my $panes;
my $cui = Curses::UI->new(
-clear_on_exit => 1,
-color_support => 1,
);
sub check_window_size {
if ($Curses::LINES < 24 || $Curses::COLS < 80) {
$cui->dialog("This program needs a terminal window at least 24 lines by 80 columns. This one is " . $Curses::LINES . " by " . $Curses::COLS);
exit(1);
}
}
sub create_panes {
$panes->{calendar} = $cui->add(
'calendar', 'Window',
-x => 0,
-y => 0,
-bfg => 'green',
-width => 23,
-border => 1,
-height => 10);
$panes->{calendar}->add('cal', 'TextViewer',
-text =>
" March 2025\n" .
"Su Mo Tu We Th Fr Sa\n" .
" 1 2 3 4 5 6 7\n" .
" 8 9 10 11 12 13 14\n" .
"15 16 17 18 19 20 21\n" .
"22 23 24 25 26 27 28\n" .
"29 30 31\n")
}
check_window_size();
create_panes();
alarm(3);
$cui->mainloop();

View File

@@ -79,6 +79,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
int origLen = DBufLen(dbuf);
int altmode;
int r;
int origtime;
Value v;
UserFunc *func;
@@ -87,6 +88,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
if (tt) {
tim = tt->ttime;
}
origtime = tim;
if (tim == NO_TIME) tim = curtime;
tdiff = tim - curtime;
adiff = ABS(tdiff);
@@ -405,6 +407,12 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
Eprint("%s", GetErr(r));
}
}
if (origtime == NO_TIME) {
if ((c >= '0' && c <= '9') || (c == '!')) {
Wprint(tr("`%%%c' substitution sequence should not be used without an AT clause"), c);
}
}
switch(UPPER(c)) {
case 'A':
if (altmode == '*' || !strcmp(tr("on"), "")) {

View File

@@ -690,6 +690,11 @@ set a "\x0P"
set a "\x00P"
EOF
# Test diagnostics when using a timed substitution without an AT clause
../src/remind - 1 Feb 2024 1:00 <<EOF >> ../tests/test.out 2>&1
REM MSG %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %! hahaha
EOF
# Test translate table dumping
../src/remind - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
TRANSLATE "\x03" "BREAK"

View File

@@ -24548,6 +24548,7 @@ TRANSLATE "Warning: Useless use of UNTIL with fully-specified date and no *rep"
TRANSLATE "Warning: Variable name `%.*s...' truncated to `%.*s'" ""
TRANSLATE "You have OMITted everything! The space-time continuum is at risk." ""
TRANSLATE "\\x00 is not a valid escape sequence" ""
TRANSLATE "`%%%c' substitution sequence should not be used without an AT clause" ""
TRANSLATE "did you mean" ""
TRANSLATE "here" ""
TRANSLATE "psmoon() is deprecated; use SPECIAL MOON instead." ""
@@ -24691,6 +24692,21 @@ a "xPOO"
-stdin-(24): \x00 is not a valid escape sequence
-stdin-(25): \x00 is not a valid escape sequence
-stdin-(26): \x00 is not a valid escape sequence
-stdin-(1): `%0' substitution sequence should not be used without an AT clause
-stdin-(1): `%1' substitution sequence should not be used without an AT clause
-stdin-(1): `%2' substitution sequence should not be used without an AT clause
-stdin-(1): `%3' substitution sequence should not be used without an AT clause
-stdin-(1): `%4' substitution sequence should not be used without an AT clause
-stdin-(1): `%5' substitution sequence should not be used without an AT clause
-stdin-(1): `%6' substitution sequence should not be used without an AT clause
-stdin-(1): `%7' substitution sequence should not be used without an AT clause
-stdin-(1): `%8' substitution sequence should not be used without an AT clause
-stdin-(1): `%9' substitution sequence should not be used without an AT clause
-stdin-(1): `%!' substitution sequence should not be used without an AT clause
Reminders for Thursday, 1st February, 2024:
s now at 1:00am at 01:00 0 0 from now 0 0 s is hahaha
# Translation table
TRANSLATE "LANGID" "en"
TRANSLATE "\x03" "BREAK"