<DT><A HREF="ypserv-2.8.92-20030610.diff">ypserv-2.8.92-20030610.diff</A> - 2003-06-02</DT>
<dd>Porting ypserv to non-linux platforms.</dd>
+ <dt><a href="plan2icalendar">plan2icalendar</A> -
+ 2002-01-10</dt>
+ <dd>Convert <a href="http://www.bitrot.de/plan.html">plan</a>
+ files to <a href="http://www.faqs.org/rfcs/rfc2445.html">iCalendar
+ format.</dd>
+
<DT><A HREF="gprof-callgraph/gprof-callgraph.pl">gprof-callgraph.pl</A>
- 2001-12-12</DT>
<DD>Create a VCG or a dot call graph file from the output generated
--- /dev/null
+#!/usr/bin/perl -w
+#
+# Author: Petter Reinholdtsen <pere@hungry.com>
+# Date: 2002-01-10
+#
+# Convert plan calender data to icalender format.
+#
+# plan, <URL:http://www.bitrot.de/>
+# icalendar, RFC 2445, <URL:http://www.faqs.org/rfcs/rfc2445.html">iCalendar>
+
+use Date::Parse;
+use Date::Format;
+
+my @events;
+
+my $mailto = "pere\@hungry.com";
+
+read_planfile(".plan.dir/dayplan");
+write_icalendar();
+
+sub read_planfile {
+ my ($planfile) = @_;
+ open(PLAN, "<$planfile") || die "Unable to read $planfile";
+ my $planver = <PLAN>;
+ chomp $planver;
+ while (<PLAN>) {
+ chomp;
+ if (m%\d+/\d+/\d+\s%) {
+ my ($date, $start, $duration) = split(/\s+/);
+ my $info = <PLAN>;
+ chomp $info;
+ my ($dontknow, $msg) = $info =~ m/^(.)\t(.+)$/;
+ print STDERR "E: $date $start $duration $msg\n";
+
+ my $timestamp = str2time("$date $start");
+ $isostartstamp = time2str("%Y%m%dT%H%M%S", $timestamp);
+
+ my @f = split(/:/, $duration);
+ $timestamp += ($f[0]*60*60 + $f[1]*60 +$f[2]);
+ $isoendstamp = time2str("%Y%m%dT%H%M%S", $timestamp);
+
+ print STDERR "IE: $isostartstamp $isoendstamp\n";
+ push(@events, {
+ organizer => "$mailto",
+ summary => $msg,
+ dtstart => $isostartstamp,
+ dtend => $isoendstamp,
+ priority => '1'
+ });
+ }
+ }
+ close(PLAN);
+}
+
+
+# BEGIN:VCALENDAR
+# PRODID
+# :-//K Desktop Environment//NONSGML KOrganizer//EN
+# VERSION
+# :2.0
+# BEGIN:VEVENT
+# CREATED
+# :20020110T153939
+# UID
+# :KOrganizer-141229514.660
+# SEQUENCE
+# :0
+# LAST-MODIFIED
+# :20020110T153939
+# DTSTAMP
+# :20020110T153952
+# ORGANIZER
+# :MAILTO:pre@diskless.uio.no
+# SUMMARY
+# :SL-veiledning
+# PRIORITY
+# :1
+# DTSTART
+# :20020114T151500
+# DTEND
+# :20020114T160000
+# END:VEVENT
+# END:VCALENDAR
+sub write_icalendar {
+ print <<EOF;
+BEGIN:VCALENDAR
+PRODID
+ :-//K Desktop Environment//NONSGML KOrganizer//EN
+VERSION
+ :2.0
+EOF
+ my $count = 0;
+ my $event;
+ for $event (@events) {
+ print <<EOF;
+BEGIN:VEVENT
+CREATED
+ :20020110T153939
+UID
+ :plan2icalendar-$count
+SEQUENCE
+ :$count
+LAST-MODIFIED
+ :20020110T153939
+DTSTAMP
+ :20020110T153952
+ORGANIZER
+ :MAILTO:$event->{organizer}
+SUMMARY
+ :$event->{summary}
+PRIORITY
+ :$event->{priority}
+DTSTART
+ :$event->{dtstart}
+DTEND
+ :$event->{dtend}
+END:VEVENT
+EOF
+ $count++;
+ }
+ print "END:VCALENDAR\n";
+}