visual calendar
Scott Turner
srt at ucla-cs.ARPA
Tue May 6 08:30:54 AEST 1986
I've added a small feature to Tim Stoehr's visual calendar feature. The
change consists of a new flag (-B) and a new command (B). Both give you
a short listing of the day's events in this sort of format:
10:00AM-11:00AM Foo Class
3:00PM- 6:00PM Bar Seminar: The Micro-Lenat
The intention is that -B is useful for building a calendar(1) type
reminding, either as mail or in your .login.
The shar file consists of a new file "psched.c" (you'll have to mod your
Makefile) and three *.diff files made with diff -e. These should be applied
to month.c, month.man and user.c. See the man page for diff if you don't know
how to use these files.
-- Scott
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by srt on Mon May 5 11:59:22 PDT 1986
# Contents: month.diff man.diff user.diff psched.c
echo x - month.diff
sed 's/^@//' > "month.diff" <<'@//E*O*F month.diff//'
93a
case 'B':
get_current_date();
read_schedule();
psched2();
exit(0);
break;
@.
@//E*O*F month.diff//
chmod u=rw,g=,o= month.diff
echo x - man.diff
sed 's/^@//' > "man.diff" <<'@//E*O*F man.diff//'
213a
Specifying the -B (Book) flag prints out the list of scheduled events
for the current day.
@.
103a
'B' will list all your events for the current day.
@.
@//E*O*F man.diff//
chmod u=rw,g=rw,o=rw man.diff
echo x - user.diff
sed 's/^@//' > "user.diff" <<'@//E*O*F user.diff//'
171a
case 'B':
psched();
break;
@.
@//E*O*F user.diff//
chmod u=rw,g=,o= user.diff
echo x - psched.c
sed 's/^@//' > "psched.c" <<'@//E*O*F psched.c//'
#include <curses.h>
#include "month.h"
/*
My attempt to write a routine that will print out the schedule for
the day, i.e.,
8:45 - 9:45 Foo Bar Baz
and so on...
*/
psched()
{
short i, shour, sminute, ehour, eminute, n;
struct event_rec *events_today[MAX_DAILY_EVENTS];
get_daily_events(events_today);
for ( n = 0; events_today[n]; n++);
sort_events(events_today,n);
clear();
move(0,0);
i = 0;
while (events_today[i]) {
shour = events_today[i]->hour;
sminute = events_today[i]->minute;
ehour = shour + (events_today[i]->duration_hours);
eminute = sminute + (events_today[i]->duration_minutes);
printw("%2d:%02d%2s-%2d:%02d%2s ",(shour <= 12) ? shour : (shour % 12),sminute,
((shour < 12) ? "AM" : "PM"),
(ehour <= 12) ? ehour : (ehour % 12),eminute,
((ehour < 12) ? "AM" : "PM"));
printw("%s\n", events_today[i]->event_string);
i++;
}
refresh();
get_char();
clear();
print_screen();
}
psched2()
{
short i, shour, sminute, ehour, eminute, n;
struct event_rec *events_today[MAX_DAILY_EVENTS];
get_daily_events(events_today);
for ( n = 0; events_today[n]; n++);
sort_events(events_today,n);
i = 0;
while (events_today[i]) {
shour = events_today[i]->hour;
sminute = events_today[i]->minute;
ehour = shour + (events_today[i]->duration_hours);
eminute = sminute + (events_today[i]->duration_minutes);
printf("%2d:%02d%2s-%2d:%02d%2s ",(shour <= 12) ? shour : (shour % 12),sminute,
((shour < 12) ? "AM" : "PM"),
(ehour <= 12) ? ehour : (ehour % 12),eminute,
((ehour < 12) ? "AM" : "PM"));
printf("%s\n", events_today[i]->event_string);
i++;
}
}
@//E*O*F psched.c//
chmod u=rw,g=,o= psched.c
exit 0
More information about the Comp.sources.bugs
mailing list