srt@ucla-cs.ARPA (Scott Turner) (05/06/86)
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
ramin@rtgvax.UUCP (05/22/86)
In article <12607@ucla-cs.ARPA>, srt@ucla-cs.ARPA (Scott Turner) writes: > 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. > Thanks Tim, this is a handy feature... though I think if I have the time I might add another option to it so you can say "month -B +12d" for it to scan ahead for the next 12 days... This way you can foresee thinks coming up instead of during that day alone... Of course if YOU want to add it on... (:-) Anyway... a minor mishap in the -B flag was that events crossing midnight still said "PM" instead of "AM". The fix is trivial. The following is a simple "diff -e" for "psched.c" to solve that problem... --------- 38c (((ehour % 24) < 12) ? "AM" : "PM")); . --------- thanks again... ramin -- =--------------------------------------=-------------------------------------= : alias: ramin firoozye' : USps: Systems Control Inc. : : uucp: ...!shasta \ : 1801 Page Mill Road : : ...!lll-lcc \ : Palo Alto, CA 94303 : : ...!ihnp4 \...!ramin@rtgvax : ^G: (415) 494-1165 x-1777 : =--------------------------------------=-------------------------------------=