This file is indexed.

/usr/bin/palm-datebook-reminders is in chiark-scripts 4.3.0.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/perl

# Copyright 2003 Ian Jackson <ian@chiark.greenend.org.uk>
#
# This script and its documentation (if any) are free software; you
# can redistribute it and/or modify them under the terms of the GNU
# General Public License as published by the Free Software Foundation;
# either version 3, or (at your option) any later version.
# 
# chiark-named-conf and its manpage are distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, consult the Free Software Foundation's
# website at www.fsf.org, or the GNU Project website at www.gnu.org.

use Palm::PDB;
use Palm::Datebook;
use Time::Local;
use POSIX;

$us= $0 =~ m,[^/]+$, ? $& : $0;

$detail= 86400*2;
$lookforward= 86400*(7*4+1);
# run at 15:00 daily

sub setfilename($) {
    die "$us: only one filename at a time please\n" if defined $filename;
    $filename= $_[0];
}

while (@ARGV) {
    $_= shift @ARGV;
    if (m,^(?:\-t)?(\d+)/(\d+)$,) {
	($detail,$lookforward)=($1+0,$2+0);
    } elsif (m,^[./],) {
	setfilename($_);
    } elsif (m/^\-f/) {
	setfilename($');
    } else {
	die "$us: unknown argument/option \`$_'\n";
    }
}

$filename= "DatebookDB.pdb" if !defined $filename;

defined($now= time) or die $!;
stat $filename or die "$us: $filename: $!\n";
$backuptime= (stat _)[10];

$pdb = new Palm::PDB or die $!;
$pdb->Load($filename) or die $!;



foreach $record (@{ $pdb->{records} }) {
    if ($record->{start_hour} != 255) {
	$timestr= sprintf("%02d:%02d-%02d:%02d",
			  $record->{start_hour},
			  $record->{start_minute},
			  $record->{end_hour},
			  $record->{end_minute});
	@lt=(0, $record->{start_minute}, $record->{start_hour});
    } else {
	@lt=(0, 0, 9);
	$timestr= "           ";
    }
    if ($record->{repeat}{type}) {
	$timestr= "onwards    ";
    }
    
    push @lt, $record->{day}, $record->{month}-1,  $record->{year}-1900;
    defined($ettt= timelocal @lt) or die $!;

    next if ($ettt < $now - 86400 ||
	     $ettt > $now + $lookforward);

    @lt2= localtime($ettt) or die $!;
    defined($dowstr= strftime "%a", @lt2) or die $!;

    $datestr= sprintf("%04d-%02d-%02d",
		      $record->{year},
		      $record->{month},
		      $record->{day});
    
    $timesortkey= "$datestr $timestr";
    $evhead= "$datestr $dowstr $timestr";

    $desc= $record->{description};
    $desc =~ s/\x93/\~/g;
    $desc =~ s/\xa3/L/g;
    $desc =~ s/[^\n -\176]/ sprintf "\\x%02x", ord $& /eg;
    $desc =~ s/^ +//;
    $desc =~ s/\n+$//;
    $desc .= "\n";

    if ($desc =~ m/^(.{0,51})\n/) {
	$descsumm= $1;
    } elsif ($desc =~ m/^.{48}/) {
	$descsumm= $&.'...';
    } else {
	$descsumm= " --- no description ?! ---";
    }
    $kind= $ettt < $now + $detail ? 'detail' : 'forward';

    push @{ $events{$kind} }, {
	TSK => $timesortkey,
	Headline => sprintf("%s  %s", $evhead, $descsumm),
	Desc => $desc
	};
}

sub sectline_detail(){ return "Imminent events"; }
sub sectline_forward(){ return "Forthcoming events"; }

sub headline(){
    printf("%s\n", $ev->{Headline})
	or die $!;
}

sub print_forward(){ headline(); }
sub print_detail(){
    print "\n" or die $!;
    headline();
    $_= $ev->{Desc};
    s/^/    /gm;
    print $_ or die $!;
}

foreach $kind (qw(detail forward)) {
    $sectline= &{"sectline_$kind"};
    printf("%s\n%s\n",
	   $sectline,
	   '-'x(length $sectline))
	or die $!;
    if (!@{ $events{$kind} }) {
	printf("None scheduled.\n")
	    or die $!;
    }
    foreach $ev (sort { $a->{TSK} cmp $b->{TSK} } @{ $events{$kind} }) {
	&{"print_$kind"};
    }
    print "\n" or die $!;
}

@lt2= localtime $backuptime or die $!;
defined ($syncstr= strftime "%Y-%m-%d %a %H:%M", @lt2) or die $!;

print("Date of last synch: $syncstr\n".
      "Events entered on PDA after this date are omitted.\n")
    or die $!;
       
close STDOUT or die $!;