james@yunexus.UUCP (James Pierre Lewis) (02/01/89)
Vcalendar is a calendar/schedule keeping program that allows one to keep track of appointments, classes, meetings, and dates, etc. It is posted upon request from panetta@duphy4.drexel.edu. Vcalendar is written in C running on VAX/VMS 4.xx or higher. It is free. If you are interested, please cut the three parts - VCAL1.SHAR, VCAL2.SHAR and VCAL3.SHAR; follow the instructions in 0REAME.1ST and have fun. -----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT----- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # 0readme.1st # build.com # bulletin.mem # bulletin.rno # decode.c # do-appts.c # do-calls.c # This archive created: Tue Jan 31 21:48:00 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'0readme.1st'" '(427 characters)' if test -f '0readme.1st' then echo shar: will not over-write existing file "'0readme.1st'" else sed 's/^ X//' << \SHAR_EOF > '0readme.1st' XATTENTION: X XPlease do the following steps to build VCAL: X X1) @BUILD.COM X X2) Replace the default directory (CS) in the following line in VCAL.H: X X #define REMIND_IMAGE "RUN CS:DO_CALLS.EXE" X -- X X with your system's default directory where VCAL resides. X X3) Replace the default directory (CS:) in VCALENDAR.CLD. X X...Have fun...Please send suggestions, complaints to ...yunexus!james. X X SHAR_EOF if test 427 -ne "`wc -c < '0readme.1st'`" then echo shar: error transmitting "'0readme.1st'" '(should have been 427 characters)' fi fi # end of overwriting check echo shar: extracting "'build.com'" '(574 characters)' if test -f 'build.com' then echo shar: will not over-write existing file "'build.com'" else sed 's/^ X//' << \SHAR_EOF > 'build.com' X$! X$! Building VCAL Software Package - March 7, 1987 X$! X$ Variable: X$! X$ link_it = "link/notra/nodeb" X$! X$ Compile: X$! X$ cc vcal, vcal-util, do-appts, do-calls, vcal-sum, - X vcal-remind, vcal-purge X$ message vcal-msg.msg X$! X$ Link: X$! X$ define lnk$library sys$library:vaxcrtl X$ 'link_it' vcal, do-appts, vcal-util, vcal-msg X$ 'link_it' vcal-remind, vcal-util, vcal-msg X$ 'link_it' vcal-purge, vcal-util, vcal-msg X$ 'link_it' vcal-sum, vcal-util, vcal-msg X$ 'link_it' do-calls, vcal-util, vcal-msg X$! X$ Command: X$! X$ set command vcalendar.cld X$! X$ Finish: X$! X$ exit SHAR_EOF if test 574 -ne "`wc -c < 'build.com'`" then echo shar: error transmitting "'build.com'" '(should have been 574 characters)' fi fi # end of overwriting check echo shar: extracting "'bulletin.mem'" '(5784 characters)' if test -f 'bulletin.mem' then echo shar: will not over-write existing file "'bulletin.mem'" else sed 's/^ X//' << \SHAR_EOF > 'bulletin.mem' X X X X Abstract X X If you forget your dates or are late on your appointments most of the X times, VCAL may be the right tool for you. X X History X X There have been many versions of VCAL. One of those written by Mike X Essex at Berkeley. His version, which has been reported to work on X UNIX Version 7, BSD 4.3, and ULTRIX, was written in C using C curses X and Termcap. It could, perhaps, be ported to VAX/VMS without making X changes. However, excellent VAX/VMS screen management features are X not fully utilized; therefore, VCAL was then C-modified using SMG. X There are differences and similarities between UNIX C and VAX C; and C X curses and SMG. However, they are not discussed here. X X VAX/VMS VCAL Features X X VCAL provides you a calendar of each month. From this calendar, you X can pick any day to record appointments (Day Picking Phase). When a X day is picked, you enter the second phase (Appointments Making Phase). X You can switch back and forth between these two phases. You can X record 17 appointments for a day. The length of each appointments is X 60 characters. Just think that you are using a calendar pad. The X design was based on this philosophy. It sounds complicated, but don't X worry! The software is a menu-driven one, so it will help you when X you go along. You just have to pay attention to the small help window X in the lower left-hand corner. X X That's not all. VCAL does also provides you the reminding service for X today if you want. Before the appointment time approximately 5 X minutes, it will beep at your terminal, displaying the scheduled X activity you had recorded before. X X That's still not all. VCAL, furthermore, provides you the X appointments summary for any month between the year 1900 and 9999 if X you want. X X Finally, when your appointments file grows bigger until it reaches the X threshold size, you will be notified to purge all old appointments X leaving only appointments for the current month and the future ones. X X What does it cost you? Nothing! If you are interested, then continue X reading. X X VAX/VMS VCAL Commands X X 1) To record appointments, please type: X X $ VCAL X X Then follow the instructions provided in the small lower left-hand X window. When you complete and exit, the file APPOINTMENTS.DAT is X created in your main directory. DONOT delete this file. It is where X all appointments are kept. If you frequently purge all old X appointments, the size of this file will be at maximum 1 block. X X 2) To ask for reminding service for today: X X $ VCAL/REMIND/MIN=[min] /* 5 <= min <= 20 */ X X A sub-process is created. It hibernates until approximately 5 minutes X before each appointment for that day, wakes up reminding you the X scheduled event, then goes back into hibernation until no more X appointments. The sub-process then terminates. In terms of system X resources, it doesn't bog down any thing because when the process X hibernates, it is swapped out of memory. When you log out, the X sub-process is automatically terminated also. If you want to X terminate this sub-process instead, just type: X X $ STOP REM_username /* For example, $ STOP REM_CS100002 */ X X 3) To ask for an appointments summary for a month, please type: X X $ VCAL/SUMMARY X X The summary for this month's appointments will be displayed on screen. X You can re-direct the output to a file by typing: X X $ VCAL/SUMMARY/OUT=[file] X X You can also add the qualifiers /MON=[month], and /YEAR=[year] to the X command. Month is any month. i.e., JANUARY, FEBRUARY, etc. Year is X any year from 1900 to 9999. X X 4) To purge all old appointments leaving only current month's X appointments and future ones, please type: X X $ VCAL/PURGE X X 5) To get help such as this one, just type: X X $ HELP VCAL X X Limitation X X VCAL expects you to enter the hour in the format "hhhh". If the hour X is not understood, say 2500, then it is set to 0000. X X If you have several appointments scheduled for the same hour, you will X be reminded for the first one only. X X User's Comments X X To help us doing a good job at releasing future softwares, please X spend a few minutes of your times answering the following X questionaires and mail them to JAMES before March 30, 1987. X X 1) Do you gain any benefit from using this software? Please clarify. X X 2) Do you find that the software is easy to use? Please clarify. X X 3) In the next release of this software, what features do you want X this software to have? X X 4) What area of Computer Science are you interested in the most? X X Acknowledgements X X I would like to thank Mike Essex and those who did wrote VCAL. Only X they can tell the differences and enhancements. Special thanks are X pre-said to those who will response to the above questionaires. X X ---------- X X UNIX is a trademark of Bell Laboratories. X VAX/VMS is a trademark of Digital Equipment Corporation. SHAR_EOF if test 5784 -ne "`wc -c < 'bulletin.mem'`" then echo shar: error transmitting "'bulletin.mem'" '(should have been 5784 characters)' fi fi # end of overwriting check echo shar: extracting "'bulletin.rno'" '(5025 characters)' if test -f 'bulletin.rno' then echo shar: will not over-write existing file "'bulletin.rno'" else sed 's/^ X//' << \SHAR_EOF > 'bulletin.rno' X.page size 1000, 80 X.left margin 5 X.right margin 75 X.autoparagraph X.c;Abstract X.skip XIf you forget your dates or are late on your appointments most of the Xtimes, VCAL may be the right tool for you. X.skip X.c;History X.skip XThere have been many versions of VCAL. One of those written by Mike XEssex at Berkeley. His version, which has been reported to work on UNIX XVersion 7, BSD 4.3, and ULTRIX, was written in C using C curses and Termcap. It Xcould, perhaps, be ported to VAX/VMS without making changes. However, excellent XVAX/VMS screen management features are not fully utilized; therefore, VCAL was Xthen C-modified using SMG. There are differences and similarities between UNIX XC and VAX C; and C curses and SMG. However, they are not discussed here. X.skip X.c;VAX/VMS VCAL Features X.skip XVCAL provides you a calendar of each month. From this Xcalendar, you can pick any day to record appointments (Day Picking Phase). When Xa day is picked, you enter the second phase (Appointments Making Phase). You Xcan switch back and forth between these two phases. You can record 17 Xappointments for a day. The length of each appointments is 60 characters. Just Xthink that you are using a calendar pad. The design was based on this Xphilosophy. It sounds complicated, but don't worry! The software is a Xmenu-driven one, so it will help you when you go along. You just have to pay Xattention to the small help window in the lower left-hand corner. X.skip XThat's not all. VCAL does also provides you the reminding service for today if Xyou want. Before the appointment time approximately 5 minutes, it will beep at Xyour terminal, displaying the scheduled activity you had recorded before. X.skip XThat's still not all. VCAL, furthermore, provides you the appointments summary Xfor any month between the year 1900 and 9999 if you want. X.skip XFinally, when your appointments file grows bigger until it reaches the threshold Xsize, you will be notified to purge all old appointments leaving only Xappointments for the current month and the future ones. X.skip XWhat does it cost you? Nothing! If you are interested, then continue reading. X.skip X.c;VAX/VMS VCAL Commands X.skip X1) To record appointments, please type: X.skip X$ VCAL X.skip XThen follow the instructions provided in the small lower left-hand window. When Xyou complete and exit, the file APPOINTMENTS.DAT is created in your main Xdirectory. DONOT delete this file. It is where all appointments are kept. If Xyou frequently purge all old appointments, the size of this file will be at Xmaximum 1 block. X.skip X2) To ask for reminding service for today: X.skip X$ VCAL/REMIND/MIN=[min]#####/* 5 <= min <= 20 */ X.SKIP XA sub-process is created. It hibernates until approximately 5 minutes before Xeach appointment for that day, wakes up reminding you the scheduled event, then Xgoes back into hibernation until no more appointments. The sub-process then Xterminates. In terms of system resources, it doesn't bog down any thing because Xwhen the process hibernates, it is swapped out of memory. When you log out, the Xsub-process is automatically terminated also. If you want to terminate this Xsub-process instead, just type: X.skip X$ STOP REM__username#####/* For example, $ STOP REM__CS100002 */ X.skip X3) To ask for an appointments summary for a month, please type: X.skip X$ VCAL/SUMMARY X.SKIP XThe summary for this month's appointments will be displayed on screen. You can Xre-direct the output to a file by typing: X.skip X$ VCAL/SUMMARY/OUT=[file] X.skip XYou can also add the qualifiers /MON=[month], and /YEAR=[year] to the command. XMonth is any month. i.e., JANUARY, FEBRUARY, etc. Year is any year from 1900 to X9999. X.skip X4) To purge all old appointments leaving only current month's appointments and Xfuture ones, please type: X.skip X$ VCAL/PURGE X.SKIP X5) To get help such as this one, just type: X.skip X$ HELP VCAL X.SKIP X.c;Limitation X.skip XVCAL expects you to enter the hour in the format "hhhh". If the hour is not Xunderstood, say 2500, then it is set to 0000. X.skip XIf you have several appointments scheduled for the same hour, you will be Xreminded for the first one only. X.skip X.c;User's Comments X.skip XTo help us doing a good job at releasing future softwares, please spend a few Xminutes of your times answering the following questionaires and mail them to XJAMES before March 30, 1987. X.skip X1) Do you gain any benefit from using this software? Please clarify. X.skip X2) Do you find that the software is easy to use? Please clarify. X.skip X3) In the next release of this software, what features do you want this Xsoftware to have? X.skip X4) What area of Computer Science are you interested in the most? X.skip X.c;Acknowledgements X.skip XI would like to thank Mike Essex and those who did wrote VCAL. Only they can Xtell the differences and enhancements. Special thanks are pre-said to those who Xwill response to the above questionaires. X.skip X.repeat 10 '-' X.skip XUNIX is a trademark of Bell Laboratories. X.break XVAX/VMS is a trademark of Digital Equipment Corporation. SHAR_EOF if test 5025 -ne "`wc -c < 'bulletin.rno'`" then echo shar: error transmitting "'bulletin.rno'" '(should have been 5025 characters)' fi fi # end of overwriting check echo shar: extracting "'decode.c'" '(501 characters)' if test -f 'decode.c' then echo shar: will not over-write existing file "'decode.c'" else sed 's/^ X//' << \SHAR_EOF > 'decode.c' X#include <ctype.h> X#include <stdio.h> X#include "vcal.h" X Xmain() X{ X char basedata[MAX_BUF], X *c, X file_nam[FILE_LEN], X key[MAX_BUF]; X FILE *fptr; X X printf("Enter the file to decode: "); X gets(file_nam); X printf("Enter the username: "); X gets(key); X X for (c = key; *c; *c = _toupper(*c), c++); X X strcat(key, "-VCAL"); X fptr = fopen(file_nam, "r"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X printf("%s\n", basedata); X } X} SHAR_EOF if test 501 -ne "`wc -c < 'decode.c'`" then echo shar: error transmitting "'decode.c'" '(should have been 501 characters)' fi fi # end of overwriting check echo shar: extracting "'do-appts.c'" '(25439 characters)' if test -f 'do-appts.c' then echo shar: will not over-write existing file "'do-appts.c'" else sed 's/^ X//' << \SHAR_EOF > 'do-appts.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <ctype.h> X#include <descrip.h> X#include <smgdef.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar msgdata[MAX_ENT][MAX_BUF]; /* message pointers */ X Xchar dayw[] = X { X " S M T W T F S " X }; X Xchar *smon[] = X { X "JANUARY ", "FEBRUARY ", "MARCH ", "APRIL ", X "MAY ", "JUNE ", "JULY ", "AUGUST ", X "SEPTEMBER ", "OCTOBER ", "NOVEMBER ", "DECEMBER " X }; X Xint active[33], /* active day */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X monthdata[MAX_ENT], /* month data */ X msgcnt = NULL, /* entries count */ X notclear = FALSE, /* clear flag */ X tmonth, /* current month */ X tday, /* current day */ X tyear, /* current year */ X xposition[32], /* x coordinate */ X yposition[32], /* y coordinate */ X yeardata[MAX_ENT]; /* year data */ X Xint mon[] = X { X 0, X 31, 29, 31, 30, X 31, 30, 31, 31, X 30, 31, 30, 31 X }; X Xdo_appts() X{ X extern int reset_tty(), X updatedata(); X int day, X i, X j, X key, X month, X stat, X year; X X timeset(); X month = tmonth; X day = tday; X year = tyear; X X loaddata(); X exit_handler(updatedata, __); X exit_handler(reset_tty, __); X cal(day, month, year); X help_one(); X movcur(day); X X while ((key = get_key(vcal_id)) != SMG$K_TRM_CTRLZ) X { X switch(key) { X X case 'P' & CHAR_MASK: /* previous month */ X case 'p' & CHAR_MASK: X if (--month < 1) X { X month = 12; X year--; X } X X if (notclear) X clearmsgs(); X clearcar(); X X if ((month == tmonth) && (year == tyear)) X day = tday; X else day = 1; X X cal(day, month, year); X break; X X case 'N' & CHAR_MASK: /* next month */ X case 'n' & CHAR_MASK: X if (++month == 13) X { X month = 1; X year++; X } X X if (notclear) X clearmsgs(); X clearcar(); X X if ((month == tmonth) && (year == tyear)) X day = tday; X else day = 1; X X cal(day, month, year); X break; X X case 'D' & CHAR_MASK: /* display notes */ X case 'd' & CHAR_MASK: X notes(day, month, year); X break; X X case 'E' & CHAR_MASK: /* erase a day's notes */ X case 'e' & CHAR_MASK: X clearday(day, month, year); X X if (notclear) X clearmsgs(); X break; X X case 'M' & CHAR_MASK: /* make appointments */ X case 'm' & CHAR_MASK: X help_two(); X notes(day, month, year); X modnotes(day, month, year); X help_one(); X break; X X case SMG$K_TRM_UP: /* up a day */ X if ((day -= 7) <= NULL) X { X day += 35; X day = (day > mon[month]) ? day - 7 : day; X } X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_DOWN: /* down a day */ X if ((day += 7) > mon[month]) X { X day %= 7; X day = (day == NULL) ? 7 : day; X } X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_LEFT: /* left a day */ X day = (--day <= NULL) ? mon[month] : day; X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_RIGHT: /* right a day */ X day = (++day > mon[month]) ? 1 : day; X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X } X X movcur(day); /* day right now */ X } X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = *msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X warng(VCAL_FILE, 1, 1); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[i][MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X { X CHK_STAT("", __, OWN_MSG, VCAL_PURGE); X break; X } X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xwarng(msg_id, xpos, ypos) X Xint msg_id, X xpos, X ypos; X{ X char tmp[MSG_BUF]; X short msg_len = NULL; X int stat; X $DESCRIPTOR(msg_buf, tmp); X $DESCRIPTOR(wait_buf, WAIT_MSG); X X stat = sys$getmsg(msg_id, &msg_len, &msg_buf, __, __); X tmp[msg_len] = NULL; msg_buf.dsc$w_length = msg_len; X stat = smg$put_line(&vcal_id, &msg_buf, __, __, __, &WRAP, __, __); X stat = smg$put_chars(&vcal_id, &wait_buf, __, __, __,__, __, __); X X if (get_key(vcal_id) == SMG$K_TRM_CTRLZ) X sys$exit(SS$_NORMAL); X else stat = smg$erase_display(&vcal_id, __, __, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xcal(day, month, year) X Xint day, X month, X year; X{ X char tmp[MAX_BUF]; X int d, X i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X stat = smg$put_chars(&vcal_id, mkdesc(VCAL_TITLE), &1, &1, __, X &(SMG$M_REVERSE|SMG$M_BOLD), __, __); X stat = smg$put_chars(&vcal_id, mkdesc(EXIT_MSG), &1, &46, __, X &SMG$M_BOLD, __, __); X stat = smg$draw_line(&vcal_id, &2, &1, &2, &VCAL_WID); X sprintf(tmp, "\t\t\t\t%s%u", smon[month-1], year); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &3, &1, __, X &SMG$M_REVERSE, __, __); X stat = smg$draw_line(&vcal_id, &4, &1, &4, &VCAL_WID); X stat = smg$put_chars(&vcal_id, mkdesc(dayw), &6, &1, __, __, __, __); X stat = smg$set_cursor_abs(&vcal_id, &TXT_ROW, &1); X X d = jan1(year); X mon[2] = 29; X mon[9] = 30; X X for (i = 1; i <= 32; active[i] = FALSE, i++); X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month)) X active[daydata[i]] = TRUE; X } X X switch((jan1(year + 1) + 7 - d) % 7) { X X case 1: /* non-leap year */ X mon[2] = 28; X break; X X default: /* 1752 */ X mon[9] = 19; X break; X X case 2: /* leap year */ X ; X } X X for (i = 1; i < month; d += mon[i], i++); /* day begin of year */ X X for (i = NULL, d %= 7; i < (5 * d); i++) /* first day of week */ X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X } X X for (j = 1, k = NULL, i = d; j <= 31; j++) X { X xposition[j] = (i*5) + 2; X yposition[j] = (k*2) + 7; X X if (++i == 7) X { X i = NULL; X k++; X } X } X X for (i = 1; i <= mon[month]; i++) X { X if (i == 3 && mon[month] == 19) X { X i += 11; X mon[month] += 11; X } X X if (active[i] == TRUE) X { X if (i > 9) X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X sprintf(tmp, "%d", i / 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X stat = smg$put_chars(&vcal_id, &blank, __, X __, __, &SMG$M_REVERSE, __, __); X } X X sprintf(tmp, "%d", i % 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, &SMG$M_REVERSE, __, __); X stat = smg$set_cursor_rel(&vcal_id, __, &2); X } X else X { X if (i > 9) X { X sprintf(tmp, " %d", i / 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, __, __, __); X } X else stat = smg$set_cursor_rel(&vcal_id, __, &2); X X sprintf(tmp, "%d ", i % 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, __, __, __); X X } X X if (++d == 7) X { X d = NULL; X stat = smg$put_line(&vcal_id, &blank, &2, __, X __, __, __, __); X X } X } X} X X/*----------------------------------------------------------------------------*/ X Xjan1(year) X Xint year; X{ X register int y, X d; X X y = year; X d = 4 + y + (y + 3) / 4; X X if (y > 1800) X { X d -= (y - 1701) / 100; X d += (y - 1601) / 400; X } X X d = (y > 1752) ? d + 3 : d; X X return (d % 7); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_one() X{ X char *txt[4] = { X { "Cursors : Up, Down, Left, Right" }, X { "P/p, N/n : Previous, Next month" }, X { "D/d, E/e : Display, Erase appointments" }, X { "M/m : Make appointments" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &38, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_two() X{ X char *txt[4] = { X { "Cursors : Up, Down" }, X { "I/i : Input an appointment" }, X { "E/e : Erase an appointment" }, X { "P/p : Pick another day" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &30, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_three() X{ X char *txt[4] = { X { "Cursors : Left, Right" }, X { "<CR> : End inputing an appointment" }, X { "<CTRL-A> : Toggle overtrike/insert" }, X { "<CTRL-U> : Start inputing again" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &38, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_four() X{ X char *txt[4] = { X { " A T T E N T I O N " }, X { "* Appointments file is now full *" }, X { "* Please purge old appointments *" } X }; X int i, X stat; X $DESCRIPTOR(wait_buf, WAIT_MSG); X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &33, __, __, __); X X for (i = NULL; i < 3; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X stat = smg$put_chars(&hlp_id, &wait_buf, &4, &1, __, X &SMG$M_BOLD, __, __); X X if (get_key(hlp_id) == SMG$K_TRM_CTRLZ) X sys$exit(SS$_NORMAL); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X tyear = tp->tm_year; X tmonth = tp->tm_mon + 1; X tday = tp->tm_mday; X tyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xmovcur(day) X Xint day; X{ X int col = xposition[day] + 1, X row = yposition[day] + 1, X stat; X X stat = smg$set_cursor_abs(&vcal_id, &row, &col); X} X X/*----------------------------------------------------------------------------*/ X Xclearmsgs() X{ X int i, X stat; X X notclear = FALSE; X X for (i = 5; i < 25; i++) X { X stat = smg$erase_chars(&vcal_id, &TXT_LEN, &i, &TXT_COL); X } X} X X/*----------------------------------------------------------------------------*/ X Xclearcar() X{ X int i, X j = TXT_COL - 1, X stat; X X stat = smg$erase_line(&vcal_id, &3, &1); X X for (i = TXT_ROW; i < 19; i++) X { X stat = smg$erase_chars(&vcal_id, &j, &i, &1); X } X} X X/*----------------------------------------------------------------------------*/ X Xnotes(day, month, year) X Xint day, X month, X year; X{ X char tmp[MAX_BUF]; X int i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X notclear = TRUE; X X for (i = NULL; i <= MAX_MSG; dayindex[i] = -1, i++); X X sprintf(tmp, "%s", "Time Message"); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &5, &TXT_COL, X __, __, __, __); X sprintf(tmp, "%-3.3s %2.2d, %2.2d", smon[month - 1], day, year); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &5, &69, __, __, __, __); X sprintf(tmp, "%s", "hhhh <------------------------------->"); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &6, &TXT_COL, X __, __, __, __); X X for (i = j = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X X for (i = NULL, k = TXT_ROW; i < j; i++, k++) X { X sprintf(tmp, "%-*.*s", MAX_TXT, MAX_TXT, msgdata[dayindex[i]]); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &k, X &TXT_COL, __, __, __, __); X } X X for (msgcnt = i = NULL; i < MAX_ENT; i++) X { X if (daydata[i] == NULL) X { X dayindex[j++] = i; X X if (j > MAX_MSG) X break; X } X else msgcnt++; X } X} X X/*----------------------------------------------------------------------------*/ X Xclearday(day, month, year) X Xint day, X month, X year; X{ X int i, X stat; X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X msgcnt--; X active[day] = FALSE; X daydata[i] = monthdata[i] = yeardata[i] = NULL; X X if (*msgdata[i]) X { X *msgdata[i] = NULL; X } X } X } X X i = yposition[day] + 1; X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], &1, &2, X &SMG$M_REVERSE, &SMG$M_REVERSE); X X} X X/*----------------------------------------------------------------------------*/ X Xupdatedata(final_stat) X Xint *final_stat; X{ X char *c, X key[MAX_BUF], X tmp1[MAX_BUF], X tmp2[MAX_BUF], X tmpnam[MAX_BUF]; X int i, X stat; X FILE *tptr; X X c = mktemp("SYS$LOGIN:TMPXXXXXX"); X sprintf(tmpnam, "%s.DAT", c); X X tptr = fopen(tmpnam, "w", "fop = cif", "mrs = 80", "rat = cr", X "rfm = var, stm"); X cuserid(key); X strcat(key, "-VCAL"); X X stat = lib$disable_ctrl(&LIB$M_CLI_CTRLY, __); X X for (i = NULL; i < MAX_ENT; i++) X { X if (daydata[i] != NULL) X { X strcpy(tmp1, msgdata[i]); X tmp1[4] = NULL; X sprintf(tmp2, "%d,%d,%d,%4.4s,%s", X monthdata[i], daydata[i], yeardata[i], X tmp1, &tmp1[6]); X crypt_it(tmp2, key); X fprintf(tptr, "%s\n", tmp2); X } X } X X fclose(tptr); X delete(APPTS_FILE); X stat = lib$rename_file(mkdesc(tmpnam), mkdesc(APPTS_FILE), __, X __, __, __, __, __, __, __, __, __); X X stat = lib$enable_ctrl(&LIB$M_CLI_CTRLY, __); X stat = sys$exit(*final_stat); /* exit normally */ X} X X/*----------------------------------------------------------------------------*/ X Xmodnotes(day, month, year) X Xint day, X month, X year; X{ X int i, X key = NULL, X stat, X upbound, X xcoord = TXT_COL, X ycoord = TXT_ROW; X X stat = smg$set_cursor_abs(&vcal_id, &ycoord, &xcoord); X X for (i = NULL; i < MAX_MSG && dayindex[i] != -1; i++); X X if (i == MAX_MSG) X upbound = VCAL_LEN - TXT_ROW; X else upbound = i - 1; X X i = NULL; X X while ((key != 'P' & CHAR_MASK) && (key != 'p' & CHAR_MASK)) X { X switch(key = get_key(vcal_id)) { X X case SMG$K_TRM_DOWN: /* down a line */ X i++; X X if (++ycoord > (upbound + TXT_ROW)) X { X ycoord = TXT_ROW; X i = NULL; X } X break; X X case SMG$K_TRM_UP: /* up a line */ X i--; X X if (--ycoord < TXT_ROW) X { X ycoord = upbound + TXT_ROW; X i = upbound; X } X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X X case SMG$K_TRM_CTRLZ: /* ctrl-z to exit */ X stat = sys$exit(SS$_NORMAL); X break; X X case 'I' & CHAR_MASK: /* input a line */ X case 'i' & CHAR_MASK: X if (msgcnt < MAX_ENT) X { X help_three(); X get_txt(xcoord, ycoord, i, day, month, year); X X help_two(); X } X else X { X help_four(); X help_two(); X } X break; X X case 'E' & CHAR_MASK: /* erase a line */ X case 'e' & CHAR_MASK: X daydata[dayindex[i]] = NULL; X monthdata[dayindex[i]] = NULL; X yeardata[dayindex[i]] = NULL; X X if (*msgdata[dayindex[i]]) X { X msgcnt--; X *msgdata[dayindex[i]] = NULL; X } X X stat = smg$erase_chars(&vcal_id, &TXT_LEN, X &ycoord, &TXT_COL); X break; X X case 'P' & CHAR_MASK: /* pick another day */ X case 'p' & CHAR_MASK: X if (notclear) X clearmsgs(); X break; X } X X stat = smg$set_cursor_abs(&vcal_id, &ycoord, &xcoord); X } X X active[day] = FALSE; X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month)) X active[daydata[i]] = TRUE; X } X X i = yposition[day] + 1; X X if (active[day] == NULL) X { X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], X &1, &2, &SMG$M_REVERSE, &SMG$M_REVERSE); X } X else X { X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], X &1, &2, &SMG$M_REVERSE, __); X } X} X X/*----------------------------------------------------------------------------*/ X Xget_txt(xcoord, ycoord, i, day, month, year) X Xint day, X i, X month, X xcoord, X ycoord, X year; X{ X static char *c, X *d, X hnum[3], X mnum[3], X num[5], X tmp[MAX_BUF]; X char s[2]; X static int cnt, X k, X ovr_stk = TRUE; X int j, X l, X m, X key, X stat; X $DESCRIPTOR(blank, " "); X X if (*msgdata[dayindex[i]]) X fill_fld(msgdata[dayindex[i]], tmp, MAX_TXT + 1); X else fill_fld("", tmp, MAX_TXT + 1); X X cnt = k = NULL; X stat = smg$change_rendition(&vcal_id, &ycoord, &xcoord, X &1, &TXT_LEN, &SMG$M_REVERSE, __); X X while ((key = get_key(vcal_id)) != SMG$K_TRM_CR) X { X switch(key) { X X case SMG$K_TRM_LEFT: /* move left */ X if (cnt <= R_MAR) X { X if (cnt > NULL) X { X if (--cnt == 5) X { X cnt = 3; X stat = smg$set_cursor_rel( X &vcal_id, __, &-3); X } X else X { X stat = smg$set_cursor_rel( X &vcal_id, __, &-1); X } X } X } X else X { X stat = smg$return_cursor_pos(&vcal_id, &l, &m); X X if (--cnt == R_MAR) X { X k = NULL; X stat = smg$put_chars(&vcal_id, X mkdesc(tmp), __, &TXT_COL, X __, &SMG$M_REVERSE, __, __); X m = TXT_COL + cnt; X } X else X { X k--; X m--; X } X X stat = smg$set_cursor_abs(&vcal_id, &l, &m); X } X break; X X case SMG$K_TRM_RIGHT: /* move right */ X if (cnt < R_MAR) X { X if (++cnt == 4) X { X cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, X &3); X } X else stat = smg$set_cursor_rel(&vcal_id, __, X &1); X } X else if (cnt < MAX_TXT) X { X stat = smg$return_cursor_pos(&vcal_id, &l, &m); X cnt++; X k++; X X if (m == TXT_COL + R_MAR) X { X d = tmp + k; X stat = smg$put_chars(&vcal_id, X mkdesc(d), __, &TXT_COL, X __, &SMG$M_REVERSE, __, __); X } X else X { X m++; X stat = smg$set_cursor_abs(&vcal_id, X &l, &m); X } X } X break; X X case SMG$K_TRM_CTRLA: /* insert, overstrike */ X ovr_stk = ovr_stk ? FALSE : TRUE; X break; X X case SMG$K_TRM_CTRLU: /* input again */ X cnt = NULL; X fill_fld("", tmp, MAX_TXT + 1); X stat = smg$erase_chars(&vcal_id, &TXT_LEN, X &ycoord, &TXT_COL); X stat = smg$change_rendition(&vcal_id, &ycoord, &xcoord, X &1, &TXT_LEN, &SMG$M_REVERSE, __); X stat = smg$set_cursor_abs(&vcal_id, &ycoord, X &TXT_COL); X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X X case SMG$K_TRM_DELETE: /* delete a char */ X del_char(tmp, &cnt, &k); X break; X X case NULL: /* nothing return */ X break; X X default: /* input text in */ X if ((*s = (char *) key) > QST_MARK) X { X s[1] = NULL; X ins_char(s, tmp, &cnt, &k, ovr_stk); X } X break; X } X } X X for (c = tmp + MAX_TXT - 1; *c == ' '; c--); X X *++c = NULL; X X for (c = tmp; *c == ' '; c++); X X if (*c) X { X if (*msgdata[dayindex[i]] == NULL) X { X msgcnt++; X } X X for (j = NULL; j < 4 && isdigit(c[j]); num[j] = c[j], j++); X X if (j != 4) X { X for (j = NULL; j < 4; c[j++] = '0'); X } X else X { X num[4] = NULL; X hnum[0] = num[0]; hnum[1] = num[1]; hnum[2] = NULL; X mnum[0] = num[2]; mnum[1] = num[3]; mnum[2] = NULL; X X if ((j = atoi(hnum)) < NULL || j > 24) X { X for (j = NULL; j < 2; c[j++] = '0'); X } X X if ((j = atoi(mnum)) < NULL || j > 60) X { X for (j = 2; j < 4; c[j++] = '0'); X } X } X X strcpy(msgdata[dayindex[i]], c); X daydata[dayindex[i]] = day; X monthdata[dayindex[i]] = month; X yeardata[dayindex[i]] = year; X } X else X { X daydata[dayindex[i]] = NULL; X monthdata[dayindex[i]] = NULL; X yeardata[dayindex[i]] = NULL; X X if (*msgdata[dayindex[i]]) X { X msgcnt--; X *msgdata[dayindex[i]] = NULL; X } X } X X stat = smg$erase_chars(&vcal_id, &TXT_LEN, &ycoord, &TXT_COL); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &ycoord, &xcoord, X __, __, __, __); X X if (c[0] == '0' && c[1] == '0' && c[2] == '0' && c[3] == '0') X { X stat = smg$ring_bell(&vcal_id, __); X } X} X X/*----------------------------------------------------------------------------*/ X Xdel_char(tmp, cnt, l_mar) X Xchar *tmp; Xint *cnt, X *l_mar; X{ X char *c, X s[2]; X int i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X if ((*cnt <= R_MAR) && (*cnt > NULL)) X { X switch(--(*cnt)) { X X case 0: X case 1: X case 2: X case 3: X stat = smg$set_cursor_rel(&vcal_id, __, &-1); X X for (i = *cnt; i <= 3; i++) X { X tmp[i] = tmp[i + 1]; X s[0] = tmp[i]; s[1] = NULL; X stat = smg$put_chars(&vcal_id, mkdesc(s), X __, __, __, &SMG$M_REVERSE, __, __); X } X X i = TXT_COL + *cnt; X stat = smg$set_cursor_abs(&vcal_id, __, &i); X break; X X case 5: X *cnt = 3; X stat = smg$set_cursor_rel(&vcal_id, __, &-3); X stat = smg$put_chars(&vcal_id, &blank, X __, __, __, &SMG$M_REVERSE, __, __); X stat = smg$set_cursor_rel(&vcal_id, __, &-1); X tmp[*cnt] = ' '; X break; X X default: X for (i = *cnt; i < MAX_TXT; tmp[i] = tmp[i + 1], i++); X X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), X __, &TXT_COL, __, &SMG$M_REVERSE, __, __); X k--; X stat = smg$set_cursor_abs(&vcal_id, &j, &k); X break; X } X } X else if (*cnt > R_MAR) X { X for (--(*cnt), i = *cnt; i < MAX_TXT; tmp[i] = tmp[i + 1], i++); X X if (*cnt == R_MAR) X *l_mar = NULL; X else --(*l_mar); X X c = tmp + (*cnt - R_MAR); X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X} X X/*----------------------------------------------------------------------------*/ X Xins_char(s, tmp, cnt, l_mar, ovr_stk) X Xchar *s, X *tmp; Xint *cnt, X *l_mar, X ovr_stk; X{ X char *c; X int i, X j, X k, X stat; X X if (ovr_stk) X { X if (*cnt < R_MAR) X { X tmp[*cnt] = s[0]; X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X __, __, &SMG$M_REVERSE, __, __); X X if (++(*cnt) == 4) X { X *cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, &2); X tmp[4] = tmp[5] = ' '; X } X } X else if (*cnt < MAX_TXT) X { X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X X (*cnt)++; X (*l_mar)++; X X if (k == TXT_COL + R_MAR) X { X c = tmp + *l_mar; X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X &k, __, &SMG$M_REVERSE, __, __); X } X } X } X else X { X if (*cnt < R_MAR) X { X if (*cnt <= 3) X { X for (i = 3; i > *cnt; tmp[i] = tmp[i - 1], --i); X } X else X { X for (i = MAX_TXT - 1; i > *cnt; --i) X tmp[i] = tmp[i - 1]; X } X X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), X __, &TXT_COL, __, &SMG$M_REVERSE, __, __); X k++; X stat = smg$set_cursor_abs(&vcal_id, &j, &k); X X if (++(*cnt) == 4) X { X *cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, &2); X tmp[4] = tmp[5] = ' '; X } X } X else if (*cnt < MAX_TXT) X { X for (i = MAX_TXT - 1; i > *cnt; --i) X tmp[i] = tmp[i - 1]; X X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X X (*cnt)++; X (*l_mar)++; X X if (k == TXT_COL + R_MAR) X { X c = tmp + *l_mar; X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X &k, __, &SMG$M_REVERSE, __, __); X } X } X } X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (strncmp(msgdata[dayindex[j]], X msgdata[dayindex[j + 1]], 4) > NULL) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 25439 -ne "`wc -c < 'do-appts.c'`" then echo shar: error transmitting "'do-appts.c'" '(should have been 25439 characters)' fi fi # end of overwriting check echo shar: extracting "'do-calls.c'" '(6041 characters)' if test -f 'do-calls.c' then echo shar: will not over-write existing file "'do-calls.c'" else sed 's/^ X//' << \SHAR_EOF > 'do-calls.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <descrip.h> X#include <lnmdef.h> X#include <iodef.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar msgdata[MAX_ENT][MAX_BUF];/* message pointers */ Xint ampm, /* am or pm */ X day, /* day */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X dow, /* dow */ X hour, /* hour */ X mhour, /* mhour */ X min, /* minute */ X month, /* month */ X monthdata[MAX_ENT], /* month data */ X year, /* year */ X yeardata[MAX_ENT], /* year data */ X sec, /* second */ X timedata[MAX_ENT]; /* time data */ X Xmain() X{ X int cnt, X i, X j, X nowtime, X timeout, X tmin, X stat; X $DESCRIPTOR(tty, "TT"); X X stat = sys$assign(&tty, &tty_chan, __, __); X X if (!((stat & STS$M_SUCCESS) >> STS$V_SUCCESS)) X warng(stat); X X get_data(&tmin); X tmin = tmin * 60; X loaddata(); X timeset(); X X for (i = j = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X timeset(); X X for (i = NULL; i < j; i++) X { X nowtime = (mhour * 60) + min; X X if (timedata[dayindex[i]] > nowtime) X { X timeout = (timedata[dayindex[i]] - nowtime) * 60; X timeout = timeout > tmin ? timeout - tmin : NULL; X ringer(timeout, msgdata[dayindex[i]], X timedata[dayindex[i]]); X } X } X} X X/*----------------------------------------------------------------------------*/ X Xget_data(tmin) X Xint *tmin; X{ X char eqv_str[MAX_BUF]; X int stat; X $DESCRIPTOR(log_nam, VCAL_MIN); X $DESCRIPTOR(tab_nam, "LNM$JOB"); X ITEM_LST item_lst[] = X { X { 2, LNM$_STRING, eqv_str, 0 }, X { 0, 0, 0, 0 } X }; X X stat = sys$trnlnm(__, &tab_nam, &log_nam, __, &item_lst); X X *tmin = atoi(eqv_str); X *tmin = (*tmin < 5 || *tmin > 20) ? 5 : *tmin; X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l, X msgtime; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = *msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X warng(VCAL_ACCESS); X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k] = NULL; X msgtime = atoi(tmp); X timedata[i] = ((msgtime / 100) * 60) + X (msgtime % 100); X k = NULL; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[i][MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xwarng(msg_id) X Xint msg_id; X{ X char tmp[MSG_BUF]; X short msg_len; X int car_ret = 0x00000020, /* ret, <message>, ret */ X func = IO$_WRITEVBLK | IO$M_BREAKTHRU | X IO$M_REFRESH | IO$M_CANCTRLO, X stat; X $DESCRIPTOR(msg_buf, tmp); X X stat = sys$getmsg(msg_id, &msg_len, &msg_buf, __, __); X tmp[msg_len] = NULL; X stat = sys$qiow(__, tty_chan, func, __, __, __, tmp, strlen(tmp), X __, car_ret, __, __); X stat = sys$exit(SS$_NORMAL); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X struct tm *localtime(); X X struct tm *tp; X int tloc; X X time(&tloc); X tp = localtime(&tloc); X dow = tp->tm_wday; X year = tp->tm_year; X month = tp->tm_mon + 1; X day = tp->tm_mday; X hour = tp->tm_hour; X mhour = tp->tm_hour; X min = tp->tm_min; X sec = tp->tm_sec; X year += LYEAR; X X if (sec >= 30) X { X if (++min == 60) X { X ++mhour; X ++hour; X min = 0; X } X } X X hour = hour > 12 ? hour - 12 : hour; X ampm = mhour >= 12 ? TRUE : FALSE; X} X X/*----------------------------------------------------------------------------*/ X Xringer(delay, message, at) X Xchar *message; Xint at, X delay; X{ X char tmp[MAX_BUF]; X int car_ret = 0x00000020, /* ret, <message>, ret */ X func = IO$_WRITEVBLK | IO$M_BREAKTHRU | X IO$M_REFRESH | IO$M_CANCTRLO, X stat; X X sleep(delay); X timeset(); X sprintf(tmp, "%c%s - Time %d:%02d %2s - %s", X BEL, "*VCAL*", at / 60, at % 60, (ampm) ? "PM" : "AM", message); X stat = sys$qiow(__, tty_chan, func, __, __, __, tmp, strlen(tmp), X __, car_ret, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (timedata[dayindex[j]] > timedata[dayindex[j + 1]]) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 6041 -ne "`wc -c < 'do-calls.c'`" then echo shar: error transmitting "'do-calls.c'" '(should have been 6041 characters)' fi fi # end of overwriting check # End of shell archive exit 0
james@yunexus.UUCP (James Pierre Lewis) (02/01/89)
Vcalendar is a calendar/schedule keeping program that allows one to keep track of appointments, classes, meetings, and dates, etc. It is posted upon request from panetta@duphy4.drexel.edu. Vcalendar is written in C running on VAX/VMS 4.xx or higher. It is free. If you are interested, please cut the three parts - VCAL1.SHAR, VCAL2.SHAR and VCAL3.SHAR; follow the instructions in 0REAME.1ST and have fun. -----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT----- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # olddo-appts.c # olddo-calls.c # oldvcal-purge.c # oldvcal-sum.c # smgtrmptr.h # vcal-msg.msg # This archive created: Tue Jan 31 21:49:02 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'olddo-appts.c'" '(25422 characters)' if test -f 'olddo-appts.c' then echo shar: will not over-write existing file "'olddo-appts.c'" else sed 's/^ X//' << \SHAR_EOF > 'olddo-appts.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <ctype.h> X#include <descrip.h> X#include <smgdef.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar *msgdata[MAX_ENT]; /* message pointers */ X Xchar dayw[] = X { X " S M T W T F S " X }; X Xchar *smon[] = X { X "JANUARY ", "FEBRUARY ", "MARCH ", "APRIL ", X "MAY ", "JUNE ", "JULY ", "AUGUST ", X "SEPTEMBER ", "OCTOBER ", "NOVEMBER ", "DECEMBER " X }; X Xint active[33], /* active day */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X monthdata[MAX_ENT], /* month data */ X msgcnt = NULL, /* entries count */ X notclear = FALSE, /* clear flag */ X tmonth, /* current month */ X tday, /* current day */ X tyear, /* current year */ X xposition[32], /* x coordinate */ X yposition[32], /* y coordinate */ X yeardata[MAX_ENT]; /* year data */ X Xint mon[] = X { X 0, X 31, 29, 31, 30, X 31, 30, 31, 31, X 30, 31, 30, 31 X }; X Xdo_appts() X{ X extern int reset_tty(), X updatedata(); X int day, X i, X j, X key, X month, X stat, X year; X X timeset(); X month = tmonth; X day = tday; X year = tyear; X X loaddata(); X exit_handler(updatedata, __); X exit_handler(reset_tty, __); X cal(day, month, year); X help_one(); X movcur(day); X X while ((key = get_key(vcal_id)) != SMG$K_TRM_CTRLZ) X { X switch(key) { X X case 'P' & CHAR_MASK: /* previous month */ X case 'p' & CHAR_MASK: X if (--month < 1) X { X month = 12; X year--; X } X X if (notclear) X clearmsgs(); X clearcar(); X X if ((month == tmonth) && (year == tyear)) X day = tday; X else day = 1; X X cal(day, month, year); X break; X X case 'N' & CHAR_MASK: /* next month */ X case 'n' & CHAR_MASK: X if (++month == 13) X { X month = 1; X year++; X } X X if (notclear) X clearmsgs(); X clearcar(); X X if ((month == tmonth) && (year == tyear)) X day = tday; X else day = 1; X X cal(day, month, year); X break; X X case 'D' & CHAR_MASK: /* display notes */ X case 'd' & CHAR_MASK: X notes(day, month, year); X break; X X case 'E' & CHAR_MASK: /* erase a day's notes */ X case 'e' & CHAR_MASK: X clearday(day, month, year); X X if (notclear) X clearmsgs(); X break; X X case 'M' & CHAR_MASK: /* make appointments */ X case 'm' & CHAR_MASK: X help_two(); X notes(day, month, year); X modnotes(day, month, year); X help_one(); X break; X X case SMG$K_TRM_UP: /* up a day */ X if ((day -= 7) <= NULL) X { X day += 35; X day = (day > mon[month]) ? day - 7 : day; X } X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_DOWN: /* down a day */ X if ((day += 7) > mon[month]) X { X day %= 7; X day = (day == NULL) ? 7 : day; X } X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_LEFT: /* left a day */ X day = (--day <= NULL) ? mon[month] : day; X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_RIGHT: /* right a day */ X day = (++day > mon[month]) ? 1 : day; X X if (notclear) X clearmsgs(); X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X } X X movcur(day); /* day right now */ X } X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X warng(VCAL_FILE, 1, 1); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X msgdata[i] = malloc(MAX_BUF); X strcpy(msgdata[i], tmp); X msgdata[MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X { X CHK_STAT("", __, OWN_MSG, VCAL_PURGE); X break; X } X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xwarng(msg_id, xpos, ypos) X Xint msg_id, X xpos, X ypos; X{ X char tmp[MSG_BUF]; X short msg_len; X int stat; X $DESCRIPTOR(msg_buf, tmp); X $DESCRIPTOR(wait_buf, WAIT_MSG); X X stat = sys$getmsg(msg_id, &msg_len, &msg_buf, __, __); X tmp[msg_len] = NULL; X stat = smg$put_line(&vcal_id, &msg_buf, __, __, __, &WRAP, __, __); X stat = smg$put_chars(&vcal_id, &wait_buf, __, __, __,__, __, __); X X if (get_key(vcal_id) == SMG$K_TRM_CTRLZ) X sys$exit(SS$_NORMAL); X else stat = smg$erase_display(&vcal_id, __, __, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xcal(day, month, year) X Xint day, X month, X year; X{ X char tmp[MAX_BUF]; X int d, X i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X stat = smg$put_chars(&vcal_id, mkdesc(VCAL_TITLE), &1, &1, __, X &(SMG$M_REVERSE|SMG$M_BOLD), __, __); X stat = smg$put_chars(&vcal_id, mkdesc(EXIT_MSG), &1, &46, __, X &SMG$M_BOLD, __, __); X stat = smg$draw_line(&vcal_id, &2, &1, &2, &VCAL_WID); X sprintf(tmp, "\t\t\t\t%s%u", smon[month-1], year); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &3, &1, __, X &SMG$M_REVERSE, __, __); X stat = smg$draw_line(&vcal_id, &4, &1, &4, &VCAL_WID); X stat = smg$put_chars(&vcal_id, mkdesc(dayw), &6, &1, __, __, __, __); X stat = smg$set_cursor_abs(&vcal_id, &TXT_ROW, &1); X X d = jan1(year); X mon[2] = 29; X mon[9] = 30; X X for (i = 1; i <= 32; active[i] = FALSE, i++); X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month)) X active[daydata[i]] = TRUE; X } X X switch((jan1(year + 1) + 7 - d) % 7) { X X case 1: /* non-leap year */ X mon[2] = 28; X break; X X default: /* 1752 */ X mon[9] = 19; X break; X X case 2: /* leap year */ X ; X } X X for (i = 1; i < month; d += mon[i], i++); /* day begin of year */ X X for (i = NULL, d %= 7; i < (5 * d); i++) /* first day of week */ X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X } X X for (j = 1, k = NULL, i = d; j <= 31; j++) X { X xposition[j] = (i*5) + 2; X yposition[j] = (k*2) + 7; X X if (++i == 7) X { X i = NULL; X k++; X } X } X X for (i = 1; i <= mon[month]; i++) X { X if (i == 3 && mon[month] == 19) X { X i += 11; X mon[month] += 11; X } X X if (active[i] == TRUE) X { X if (i > 9) X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X sprintf(tmp, "%d", i / 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$set_cursor_rel(&vcal_id, __, &1); X stat = smg$put_chars(&vcal_id, &blank, __, X __, __, &SMG$M_REVERSE, __, __); X } X X sprintf(tmp, "%d", i % 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, &SMG$M_REVERSE, __, __); X stat = smg$set_cursor_rel(&vcal_id, __, &2); X } X else X { X if (i > 9) X { X sprintf(tmp, " %d", i / 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, __, __, __); X } X else stat = smg$set_cursor_rel(&vcal_id, __, &2); X X sprintf(tmp, "%d ", i % 10); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), __, X __, __, __, __, __); X X } X X if (++d == 7) X { X d = NULL; X stat = smg$put_line(&vcal_id, &blank, &2, __, X __, __, __, __); X X } X } X} X X/*----------------------------------------------------------------------------*/ X Xjan1(year) X Xint year; X{ X register int y, X d; X X y = year; X d = 4 + y + (y + 3) / 4; X X if (y > 1800) X { X d -= (y - 1701) / 100; X d += (y - 1601) / 400; X } X X d = (y > 1752) ? d + 3 : d; X X return (d % 7); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_one() X{ X char *txt[4] = { X { "Cursors : Up, Down, Left, Right" }, X { "P/p, N/n : Previous, Next month" }, X { "D/d, E/e : Display, Erase appointments" }, X { "M/m : Make appointments" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &38, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_two() X{ X char *txt[4] = { X { "Cursors : Up, Down" }, X { "I/i : Input an appointment" }, X { "E/e : Erase an appointment" }, X { "P/p : Pick another day" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &30, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_three() X{ X char *txt[4] = { X { "Cursors : Left, Right" }, X { "<CR> : End inputing an appointment" }, X { "<CTRL-A> : Toggle overtrike/insert" }, X { "<CTRL-U> : Start inputing again" } X }; X int i, X stat; X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &38, __, __, __); X X for (i = NULL; i < 4; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X} X X/*----------------------------------------------------------------------------*/ X Xhelp_four() X{ X char *txt[4] = { X { " A T T E N T I O N " }, X { "* Appointments file is now full *" }, X { "* Please purge old appointments *" } X }; X int i, X stat; X $DESCRIPTOR(wait_buf, WAIT_MSG); X X stat = smg$unpaste_virtual_display(&hlp_id, &pstbrd_id); X stat = smg$erase_display(&hlp_id, __, __, __, __); X stat = smg$change_virtual_display(&hlp_id, &4, &33, __, __, __); X X for (i = NULL; i < 3; i++) X { X stat = smg$put_line(&hlp_id, mkdesc(txt[i]), &1, __, X __, __, __, __); X } X X stat = smg$paste_virtual_display(&hlp_id, &pstbrd_id, &20, &2); X stat = smg$put_chars(&hlp_id, &wait_buf, &4, &1, __, X &SMG$M_BOLD, __, __); X X if (get_key(hlp_id) == SMG$K_TRM_CTRLZ) X sys$exit(SS$_NORMAL); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X tyear = tp->tm_year; X tmonth = tp->tm_mon + 1; X tday = tp->tm_mday; X tyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xmovcur(day) X Xint day; X{ X int col = xposition[day] + 1, X row = yposition[day] + 1, X stat; X X stat = smg$set_cursor_abs(&vcal_id, &row, &col); X} X X/*----------------------------------------------------------------------------*/ X Xclearmsgs() X{ X int i, X stat; X X notclear = FALSE; X X for (i = 5; i < 25; i++) X { X stat = smg$erase_chars(&vcal_id, &TXT_LEN, &i, &TXT_COL); X } X} X X/*----------------------------------------------------------------------------*/ X Xclearcar() X{ X int i, X j = TXT_COL - 1, X stat; X X stat = smg$erase_line(&vcal_id, &3, &1); X X for (i = TXT_ROW; i < 19; i++) X { X stat = smg$erase_chars(&vcal_id, &j, &i, &1); X } X} X X/*----------------------------------------------------------------------------*/ X Xnotes(day, month, year) X Xint day, X month, X year; X{ X char tmp[MAX_BUF]; X int i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X notclear = TRUE; X X for (i = NULL; i <= MAX_MSG; dayindex[i] = -1, i++); X X sprintf(tmp, "%s", "Time Message"); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &5, &TXT_COL, X __, __, __, __); X sprintf(tmp, "%-3.3s %2.2d, %2.2d", smon[month - 1], day, year); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &5, &69, __, __, __, __); X sprintf(tmp, "%s", "hhhh <------------------------------->"); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &6, &TXT_COL, X __, __, __, __); X X for (i = j = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X X for (i = NULL, k = TXT_ROW; i < j; i++, k++) X { X sprintf(tmp, "%-*.*s", MAX_TXT, MAX_TXT, msgdata[dayindex[i]]); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &k, X &TXT_COL, __, __, __, __); X } X X for (msgcnt = i = NULL; i < MAX_ENT; i++) X { X if (daydata[i] == NULL) X { X dayindex[j++] = i; X X if (j > MAX_MSG) X break; X } X else msgcnt++; X } X} X X/*----------------------------------------------------------------------------*/ X Xclearday(day, month, year) X Xint day, X month, X year; X{ X int i, X stat; X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X msgcnt--; X active[day] = FALSE; X daydata[i] = monthdata[i] = yeardata[i] = NULL; X X if (msgdata[i]) X { X free(msgdata[i]); X msgdata[i] = NULL; X } X } X } X X i = yposition[day] + 1; X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], &1, &2, X &SMG$M_REVERSE, &SMG$M_REVERSE); X X} X X/*----------------------------------------------------------------------------*/ X Xupdatedata(final_stat) X Xint *final_stat; X{ X char *c, X key[MAX_BUF], X tmp1[MAX_BUF], X tmp2[MAX_BUF], X tmpnam[MAX_BUF]; X int i, X stat; X FILE *tptr; X X c = mktemp("SYS$LOGIN:TMPXXXXXX"); X sprintf(tmpnam, "%s.DAT", c); X X tptr = fopen(tmpnam, "w", "fop = cif", "mrs = 80", "rat = cr", X "rfm = var, stm"); X cuserid(key); X strcat(key, "-VCAL"); X X stat = lib$disable_ctrl(&LIB$M_CLI_CTRLY, __); X X for (i = NULL; i < MAX_ENT; i++) X { X if (daydata[i] != NULL) X { X strcpy(tmp1, msgdata[i]); X tmp1[4] = NULL; X sprintf(tmp2, "%d,%d,%d,%4.4s,%s", X monthdata[i], daydata[i], yeardata[i], X tmp1, &tmp1[6]); X crypt_it(tmp2, key); X fprintf(tptr, "%s\n", tmp2); X } X } X X fclose(tptr); X delete(APPTS_FILE); X stat = lib$rename_file(mkdesc(tmpnam), mkdesc(APPTS_FILE), __, X __, __, __, __, __, __, __, __, __); X X stat = lib$enable_ctrl(&LIB$M_CLI_CTRLY, __); X stat = sys$exit(*final_stat); /* exit normally */ X} X X/*----------------------------------------------------------------------------*/ X Xmodnotes(day, month, year) X Xint day, X month, X year; X{ X int i, X key = NULL, X stat, X upbound, X xcoord = TXT_COL, X ycoord = TXT_ROW; X X stat = smg$set_cursor_abs(&vcal_id, &ycoord, &xcoord); X X for (i = NULL; i < MAX_MSG && dayindex[i] != -1; i++); X X if (i == MAX_MSG) X upbound = VCAL_LEN - TXT_ROW; X else upbound = i - 1; X X i = NULL; X X while ((key != 'P' & CHAR_MASK) && (key != 'p' & CHAR_MASK)) X { X switch(key = get_key(vcal_id)) { X X case SMG$K_TRM_DOWN: /* down a line */ X i++; X X if (++ycoord > (upbound + TXT_ROW)) X { X ycoord = TXT_ROW; X i = NULL; X } X break; X X case SMG$K_TRM_UP: /* up a line */ X i--; X X if (--ycoord < TXT_ROW) X { X ycoord = upbound + TXT_ROW; X i = upbound; X } X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X X case SMG$K_TRM_CTRLZ: /* ctrl-z to exit */ X stat = sys$exit(SS$_NORMAL); X break; X X case 'I' & CHAR_MASK: /* input a line */ X case 'i' & CHAR_MASK: X if (msgcnt < MAX_ENT) X { X help_three(); X get_txt(xcoord, ycoord, i, day, month, year); X X help_two(); X } X else X { X help_four(); X help_two(); X } X break; X X case 'E' & CHAR_MASK: /* erase a line */ X case 'e' & CHAR_MASK: X daydata[dayindex[i]] = NULL; X monthdata[dayindex[i]] = NULL; X yeardata[dayindex[i]] = NULL; X X if (msgdata[dayindex[i]]) X { X msgcnt--; X free(msgdata[dayindex[i]]); X msgdata[dayindex[i]] = NULL; X } X X stat = smg$erase_chars(&vcal_id, &TXT_LEN, X &ycoord, &TXT_COL); X break; X X case 'P' & CHAR_MASK: /* pick another day */ X case 'p' & CHAR_MASK: X if (notclear) X clearmsgs(); X break; X } X X stat = smg$set_cursor_abs(&vcal_id, &ycoord, &xcoord); X } X X active[day] = FALSE; X X for (i = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month)) X active[daydata[i]] = TRUE; X } X X i = yposition[day] + 1; X X if (active[day] == NULL) X { X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], X &1, &2, &SMG$M_REVERSE, &SMG$M_REVERSE); X } X else X { X stat = smg$change_rendition(&vcal_id, &i, &xposition[day], X &1, &2, &SMG$M_REVERSE, __); X } X} X X/*----------------------------------------------------------------------------*/ X Xget_txt(xcoord, ycoord, i, day, month, year) X Xint day, X i, X month, X xcoord, X ycoord, X year; X{ X static char *c, X *d, X hnum[3], X mnum[3], X num[5], X tmp[MAX_BUF]; X char s[2]; X static int cnt, X k, X ovr_stk = TRUE; X int j, X l, X m, X key, X stat; X $DESCRIPTOR(blank, " "); X X if (msgdata[dayindex[i]]) X fill_fld(msgdata[dayindex[i]], tmp, MAX_TXT + 1); X else fill_fld("", tmp, MAX_TXT + 1); X X cnt = k = NULL; X stat = smg$change_rendition(&vcal_id, &ycoord, &xcoord, X &1, &TXT_LEN, &SMG$M_REVERSE, __); X X while ((key = get_key(vcal_id)) != SMG$K_TRM_CR) X { X switch(key) { X X case SMG$K_TRM_LEFT: /* move left */ X if (cnt <= R_MAR) X { X if (cnt > NULL) X { X if (--cnt == 5) X { X cnt = 3; X stat = smg$set_cursor_rel( X &vcal_id, __, &-3); X } X else X { X stat = smg$set_cursor_rel( X &vcal_id, __, &-1); X } X } X } X else X { X stat = smg$return_cursor_pos(&vcal_id, &l, &m); X X if (--cnt == R_MAR) X { X k = NULL; X stat = smg$put_chars(&vcal_id, X mkdesc(tmp), __, &TXT_COL, X __, &SMG$M_REVERSE, __, __); X m = TXT_COL + cnt; X } X else X { X k--; X m--; X } X X stat = smg$set_cursor_abs(&vcal_id, &l, &m); X } X break; X X case SMG$K_TRM_RIGHT: /* move right */ X if (cnt < R_MAR) X { X if (++cnt == 4) X { X cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, X &3); X } X else stat = smg$set_cursor_rel(&vcal_id, __, X &1); X } X else if (cnt < MAX_TXT) X { X stat = smg$return_cursor_pos(&vcal_id, &l, &m); X cnt++; X k++; X X if (m == TXT_COL + R_MAR) X { X d = tmp + k; X stat = smg$put_chars(&vcal_id, X mkdesc(d), __, &TXT_COL, X __, &SMG$M_REVERSE, __, __); X } X else X { X m++; X stat = smg$set_cursor_abs(&vcal_id, X &l, &m); X } X } X break; X X case SMG$K_TRM_CTRLA: /* insert, overstrike */ X ovr_stk = ovr_stk ? FALSE : TRUE; X break; X X case SMG$K_TRM_CTRLU: /* input again */ X cnt = NULL; X fill_fld("", tmp, MAX_TXT + 1); X stat = smg$erase_chars(&vcal_id, &TXT_LEN, X &ycoord, &TXT_COL); X stat = smg$change_rendition(&vcal_id, &ycoord, &xcoord, X &1, &TXT_LEN, &SMG$M_REVERSE, __); X stat = smg$set_cursor_abs(&vcal_id, &ycoord, X &TXT_COL); X break; X X case SMG$K_TRM_CTRLW: /* refresh screen */ X stat = smg$repaint_screen(&pstbrd_id); X break; X X case SMG$K_TRM_DELETE: /* delete a char */ X del_char(tmp, &cnt, &k); X break; X X case NULL: /* nothing return */ X break; X X default: /* input text in */ X if ((*s = (char *) key) > QST_MARK) X { X s[1] = NULL; X ins_char(s, tmp, &cnt, &k, ovr_stk); X } X break; X } X } X X for (c = tmp + MAX_TXT - 1; *c == ' '; c--); X X *++c = NULL; X X for (c = tmp; *c == ' '; c++); X X if (*c) X { X if (msgdata[dayindex[i]] == NULL) X { X msgcnt++; X msgdata[dayindex[i]] = malloc(MAX_BUF); X } X X for (j = NULL; j < 4 && isdigit(c[j]); num[j] = c[j], j++); X X if (j != 4) X { X for (j = NULL; j < 4; c[j++] = '0'); X } X else X { X num[4] = NULL; X hnum[0] = num[0]; hnum[1] = num[1]; hnum[2] = NULL; X mnum[0] = num[2]; mnum[1] = num[3]; mnum[2] = NULL; X X if ((j = atoi(hnum)) < NULL || j > 24) X { X for (j = NULL; j < 2; c[j++] = '0'); X } X X if ((j = atoi(mnum)) < NULL || j > 60) X { X for (j = 2; j < 4; c[j++] = '0'); X } X } X X strcpy(msgdata[dayindex[i]], c); X daydata[dayindex[i]] = day; X monthdata[dayindex[i]] = month; X yeardata[dayindex[i]] = year; X } X else X { X daydata[dayindex[i]] = NULL; X monthdata[dayindex[i]] = NULL; X yeardata[dayindex[i]] = NULL; X X if (msgdata[dayindex[i]]) X { X msgcnt--; X free(msgdata[dayindex[i]]); X msgdata[dayindex[i]] = NULL; X } X } X X stat = smg$erase_chars(&vcal_id, &TXT_LEN, &ycoord, &TXT_COL); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), &ycoord, &xcoord, X __, __, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xdel_char(tmp, cnt, l_mar) X Xchar *tmp; Xint *cnt, X *l_mar; X{ X char *c, X s[2]; X int i, X j, X k, X stat; X $DESCRIPTOR(blank, " "); X X if ((*cnt <= R_MAR) && (*cnt > NULL)) X { X switch(--(*cnt)) { X X case 0: X case 1: X case 2: X case 3: X stat = smg$set_cursor_rel(&vcal_id, __, &-1); X X for (i = *cnt; i <= 3; i++) X { X tmp[i] = tmp[i + 1]; X s[0] = tmp[i]; s[1] = NULL; X stat = smg$put_chars(&vcal_id, mkdesc(s), X __, __, __, &SMG$M_REVERSE, __, __); X } X X i = TXT_COL + *cnt; X stat = smg$set_cursor_abs(&vcal_id, __, &i); X break; X X case 5: X *cnt = 3; X stat = smg$set_cursor_rel(&vcal_id, __, &-3); X stat = smg$put_chars(&vcal_id, &blank, X __, __, __, &SMG$M_REVERSE, __, __); X stat = smg$set_cursor_rel(&vcal_id, __, &-1); X tmp[*cnt] = ' '; X break; X X default: X for (i = *cnt; i < MAX_TXT; tmp[i] = tmp[i + 1], i++); X X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), X __, &TXT_COL, __, &SMG$M_REVERSE, __, __); X k--; X stat = smg$set_cursor_abs(&vcal_id, &j, &k); X break; X } X } X else if (*cnt > R_MAR) X { X for (--(*cnt), i = *cnt; i < MAX_TXT; tmp[i] = tmp[i + 1], i++); X X if (*cnt == R_MAR) X *l_mar = NULL; X else --(*l_mar); X X c = tmp + (*cnt - R_MAR); X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X} X X/*----------------------------------------------------------------------------*/ X Xins_char(s, tmp, cnt, l_mar, ovr_stk) X Xchar *s, X *tmp; Xint *cnt, X *l_mar, X ovr_stk; X{ X char *c; X int i, X j, X k, X stat; X X if (ovr_stk) X { X if (*cnt < R_MAR) X { X tmp[*cnt] = s[0]; X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X __, __, &SMG$M_REVERSE, __, __); X X if (++(*cnt) == 4) X { X *cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, &2); X tmp[4] = tmp[5] = ' '; X } X } X else if (*cnt < MAX_TXT) X { X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X X (*cnt)++; X (*l_mar)++; X X if (k == TXT_COL + R_MAR) X { X c = tmp + *l_mar; X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X &k, __, &SMG$M_REVERSE, __, __); X } X } X } X else X { X if (*cnt < R_MAR) X { X if (*cnt <= 3) X { X for (i = 3; i > *cnt; tmp[i] = tmp[i - 1], --i); X } X else X { X for (i = MAX_TXT - 1; i > *cnt; --i) X tmp[i] = tmp[i - 1]; X } X X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X stat = smg$put_chars(&vcal_id, mkdesc(tmp), X __, &TXT_COL, __, &SMG$M_REVERSE, __, __); X k++; X stat = smg$set_cursor_abs(&vcal_id, &j, &k); X X if (++(*cnt) == 4) X { X *cnt = 6; X stat = smg$set_cursor_rel(&vcal_id, __, &2); X tmp[4] = tmp[5] = ' '; X } X } X else if (*cnt < MAX_TXT) X { X for (i = MAX_TXT - 1; i > *cnt; --i) X tmp[i] = tmp[i - 1]; X X tmp[*cnt] = s[0]; X stat = smg$return_cursor_pos(&vcal_id, &j, &k); X X (*cnt)++; X (*l_mar)++; X X if (k == TXT_COL + R_MAR) X { X c = tmp + *l_mar; X stat = smg$put_chars(&vcal_id, mkdesc(c), __, X &TXT_COL, __, &SMG$M_REVERSE, __, __); X } X else X { X stat = smg$put_chars(&vcal_id, mkdesc(s), __, X &k, __, &SMG$M_REVERSE, __, __); X } X } X } X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (strncmp(msgdata[dayindex[j]], X msgdata[dayindex[j + 1]], 4) > NULL) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 25422 -ne "`wc -c < 'olddo-appts.c'`" then echo shar: error transmitting "'olddo-appts.c'" '(should have been 25422 characters)' fi fi # end of overwriting check echo shar: extracting "'olddo-calls.c'" '(6063 characters)' if test -f 'olddo-calls.c' then echo shar: will not over-write existing file "'olddo-calls.c'" else sed 's/^ X//' << \SHAR_EOF > 'olddo-calls.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <descrip.h> X#include <lnmdef.h> X#include <iodef.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar *msgdata[MAX_ENT]; /* message pointers */ Xint ampm, /* am or pm */ X day, /* day */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X dow, /* dow */ X hour, /* hour */ X mhour, /* mhour */ X min, /* minute */ X month, /* month */ X monthdata[MAX_ENT], /* month data */ X year, /* year */ X yeardata[MAX_ENT], /* year data */ X sec, /* second */ X timedata[MAX_ENT]; /* time data */ X Xmain() X{ X int cnt, X i, X j, X nowtime, X timeout, X tmin, X stat; X $DESCRIPTOR(tty, "TT"); X X stat = sys$assign(&tty, &tty_chan, __, __); X X if (!((stat & STS$M_SUCCESS) >> STS$V_SUCCESS)) X warng(stat); X X get_data(&tmin); X tmin = tmin * 60; X loaddata(); X timeset(); X X for (i = j = NULL; i < MAX_ENT; i++) X { X if ((yeardata[i] == year) && X (monthdata[i] == month) && (daydata[i] == day)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X timeset(); X X for (i = NULL; i < j; i++) X { X nowtime = (mhour * 60) + min; X X if (timedata[dayindex[i]] > nowtime) X { X timeout = (timedata[dayindex[i]] - nowtime) * 60; X timeout = timeout > tmin ? timeout - tmin : NULL; X ringer(timeout, msgdata[dayindex[i]], X timedata[dayindex[i]]); X } X } X} X X/*----------------------------------------------------------------------------*/ X Xget_data(tmin) X Xint *tmin; X{ X char eqv_str[MAX_BUF]; X int stat; X $DESCRIPTOR(log_nam, VCAL_MIN); X $DESCRIPTOR(tab_nam, "LNM$JOB"); X ITEM_LST item_lst[] = X { X { 2, LNM$_STRING, eqv_str, 0 }, X { 0, 0, 0, 0 } X }; X X stat = sys$trnlnm(__, &tab_nam, &log_nam, __, &item_lst); X X *tmin = atoi(eqv_str); X *tmin = (*tmin < 5 || *tmin > 20) ? 5 : *tmin; X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l, X msgtime; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X warng(VCAL_ACCESS); X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k] = NULL; X msgtime = atoi(tmp); X timedata[i] = ((msgtime / 100) * 60) + X (msgtime % 100); X k = NULL; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X msgdata[i] = malloc(MAX_BUF); X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xwarng(msg_id) X Xint msg_id; X{ X char tmp[MSG_BUF]; X short msg_len; X int car_ret = 0x00000020, /* ret, <message>, ret */ X func = IO$_WRITEVBLK | IO$M_BREAKTHRU | X IO$M_REFRESH | IO$M_CANCTRLO, X stat; X $DESCRIPTOR(msg_buf, tmp); X X stat = sys$getmsg(msg_id, &msg_len, &msg_buf, __, __); X tmp[msg_len] = NULL; X stat = sys$qiow(__, tty_chan, func, __, __, __, tmp, strlen(tmp), X __, car_ret, __, __); X stat = sys$exit(SS$_NORMAL); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X struct tm *localtime(); X X struct tm *tp; X int tloc; X X time(&tloc); X tp = localtime(&tloc); X dow = tp->tm_wday; X year = tp->tm_year; X month = tp->tm_mon + 1; X day = tp->tm_mday; X hour = tp->tm_hour; X mhour = tp->tm_hour; X min = tp->tm_min; X sec = tp->tm_sec; X year += LYEAR; X X if (sec >= 30) X { X if (++min == 60) X { X ++mhour; X ++hour; X min = 0; X } X } X X hour = hour > 12 ? hour - 12 : hour; X ampm = mhour >= 12 ? TRUE : FALSE; X} X X/*----------------------------------------------------------------------------*/ X Xringer(delay, message, at) X Xchar *message; Xint at, X delay; X{ X char tmp[MAX_BUF]; X int car_ret = 0x00000020, /* ret, <message>, ret */ X func = IO$_WRITEVBLK | IO$M_BREAKTHRU | X IO$M_REFRESH | IO$M_CANCTRLO, X stat; X X sleep(delay); X timeset(); X sprintf(tmp, "%c%s - Time %d:%02d %2s - %s", X BEL, "*VCAL*", at / 60, at % 60, (ampm) ? "PM" : "AM", message); X stat = sys$qiow(__, tty_chan, func, __, __, __, tmp, strlen(tmp), X __, car_ret, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (timedata[dayindex[j]] > timedata[dayindex[j + 1]]) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 6063 -ne "`wc -c < 'olddo-calls.c'`" then echo shar: error transmitting "'olddo-calls.c'" '(should have been 6063 characters)' fi fi # end of overwriting check echo shar: extracting "'oldvcal-purge.c'" '(3877 characters)' if test -f 'oldvcal-purge.c' then echo shar: will not over-write existing file "'oldvcal-purge.c'" else sed 's/^ X//' << \SHAR_EOF > 'oldvcal-purge.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <descrip.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar *msgdata[MAX_ENT]; /* message pointers */ X Xint daydata[MAX_ENT], /* day data */ X monthdata[MAX_ENT], /* month data */ X tmonth, /* current month */ X tday, /* current day */ X tyear, /* current year */ X yeardata[MAX_ENT]; /* year data */ X Xmain() X{ X timeset(); X loaddata(); X updatedata(); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X tyear = tp->tm_year; X tmonth = tp->tm_mon + 1; X tday = tp->tm_mday; X tyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X CHK_STAT("", __, OWN_MSG, VCAL_ACCESS); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X msgdata[i] = malloc(MAX_BUF); X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xupdatedata(final_stat) X Xint *final_stat; X{ X char *c, X key[MAX_BUF], X tmp1[MAX_BUF], X tmp2[MAX_BUF], X tmpnam[MAX_BUF]; X int i, X stat; X FILE *fptr; X X c = mktemp("SYS$LOGIN:TMPXXXXXX"); X sprintf(tmpnam, "%s.DAT", c); X fptr = fopen(tmpnam, "w", "fop = cif", "mrs = 80", "rat = cr", X "rfm = var, stm"); X cuserid(key); X strcat(key, "-VCAL"); X X stat = lib$disable_ctrl(&LIB$M_CLI_CTRLY, __); X X for (i = NULL; i < MAX_ENT; i++) X { X X if ((daydata[i] != NULL) && X ((monthdata[i] >= tmonth) && (yeardata[i] >= tyear))) X { X strcpy(tmp1, msgdata[i]); X tmp1[4] = NULL; X sprintf(tmp2, "%d,%d,%d,%4.4s,%s", X monthdata[i], daydata[i], yeardata[i], X tmp1, &tmp1[6]); X crypt_it(tmp2, key); X fprintf(fptr, "%s\n", tmp2); X } X } X X fclose(fptr); X delete(APPTS_FILE); X stat = lib$rename_file(mkdesc(tmpnam), mkdesc(APPTS_FILE), __, X __, __, __, __, __, __, __, __, __); X X stat = lib$enable_ctrl(&LIB$M_CLI_CTRLY, __); X} SHAR_EOF if test 3877 -ne "`wc -c < 'oldvcal-purge.c'`" then echo shar: error transmitting "'oldvcal-purge.c'" '(should have been 3877 characters)' fi fi # end of overwriting check echo shar: extracting "'oldvcal-sum.c'" '(7830 characters)' if test -f 'oldvcal-sum.c' then echo shar: will not over-write existing file "'oldvcal-sum.c'" else sed 's/^ X//' << \SHAR_EOF > 'oldvcal-sum.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <climsgdef.h> X#include <descrip.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar *msgdata[MAX_ENT]; /* message pointers */ X Xint cday, /* current day */ X cmonth, /* current month */ X cyear, /* current year */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X monthdata[MAX_ENT], /* month data */ X yeardata[MAX_ENT]; /* year data */ X Xmain() X{ X char file_nam[FILE_LEN]; X int month, X year; X X timeset(); X year = cyear; X month = cmonth; X get_data(&month, &year, file_nam); X X if (*file_nam) X stdout = freopen(file_nam, "w", stdout, "shr = nil"); X X if (stdout == NULL) X { X CHK_STAT("", __, OWN_MSG, VCAL_INVFILE); X } X X loaddata(); X fprintf(stdout, X " A P P O I N T M E N T S L I S T\n"); X repeat('-', 78); X table(month, year); X repeat('-', 78); X} X X/*----------------------------------------------------------------------------*/ X Xget_data(month, year, file_nam) X Xchar *file_nam; Xint *month, X *year; X{ X char month_tmp[MAX_BUF], X year_tmp[MAX_BUF]; X short len = NULL; X int stat; X struct { X int : 32; X struct { X char *month_nam; X int : 32; X } month_tbl[12]; X } key_tbl = X { X 24, X { X { "7JANUARY", 1 }, X { "8FEBRUARY", 2 }, X { "5MARCH", 3 }, X { "5APRIL", 4 }, X { "3MAY", 5 }, X { "3JUN", 6 }, X { "4JULY", 7 }, X { "6AUGUST", 8 }, X { "9SEPTEMBER", 9 }, X { "8OCTOBER", 10 }, X { "8NOVEMBER", 11 }, X { "8DECEMBER", 12 } X } X }; X $PTR_DESCRIPTOR(FILE_LEN, file_inp, file_nam); X $DESCRIPTOR(file_lbl, OUT_FILE); X $DESCRIPTOR(month_inp, month_tmp); X $DESCRIPTOR(month_lbl, MONTH); X $DESCRIPTOR(year_inp, year_tmp); X $DESCRIPTOR(year_lbl, YEAR); X X if ((stat = cli$present(&month_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&month_lbl, &month_inp, &len); X month_tmp[len] = NULL; X stat = lib$lookup_key(mkdesc(month_tmp), &key_tbl, month, X __, __); X CHK_STAT("", stat, SS$_NORMAL, VCAL_INVMONTH); X } X X if ((stat = cli$present(&year_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&year_lbl, &year_inp, &len); X year_tmp[len] = NULL; X *year = atoi(year_tmp); X X if (*year == NULL || *year > UYEAR || *year < LYEAR) X { X CHK_STAT("", __, OWN_MSG, VCAL_INVYEAR); X } X } X X if ((stat = cli$present(&file_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&file_lbl, &file_inp, &len); X file_nam[len] = NULL; X } X} X X/*----------------------------------------------------------------------------*/ X Xrepeat(c, num) X Xchar c; Xint num; X{ X char tmp[MAX_BUF]; X int i; X X for (i = NULL; i < num; tmp[i] = c, i++); X X tmp[0] = tmp[num - 1] = '+'; X tmp[i] = NULL; X fprintf(stdout, "%s\n", tmp); X} X X/*----------------------------------------------------------------------------*/ X Xtable(month, year) X Xint month, X year; X{ X char *dayw[] = X { X "Sat ", "Sun ", "Mon ", "Tue ", X "Wed ", "Thu ", "Fri " X }; X char *smon[] = X { X "JANUARY ", "FEBRUARY ", "MARCH ", "APRIL ", X "MAY ", "JUNE ", "JULY ", "AUGUST ", X "SEPTEMBER ", "OCTOBER ", "NOVEMBER ", "DECEMBER " X }; X int dow, X first, X i, X j, X monthday = NULL; X X fprintf(stdout, X "| %-10.10s %4.4u \ X |\n", smon[month-1], year); X X while (++monthday <= 31) X { X first = TRUE; X X for (i = j = NULL; i <= MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month) && X (daydata[i] == monthday)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X X for (i = NULL; i < j; i++) X { X if (first == TRUE) X { X dow = getdow(monthday, month, year); X first = FALSE; X fprintf(stdout, X "| \ X |\n"); X fprintf(stdout, X "| %-7.7s%2d %-64.64s|\n", dayw[dow], X monthday, msgdata[dayindex[i]]); X } X else fprintf(stdout, X "| %-64.64s|\n", X msgdata[dayindex[i]]); X } X } X} X X/*----------------------------------------------------------------------------*/ X Xgetdow(tday, tmonth, tyear) X Xint tday, X tmonth, X tyear; X{ X X static int mdays[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; X int day = 1, X days, X mcnt, X month = 1, X year = 79; X X X if ((tmonth == month) && (tyear == year)) X days = abs(day - tday); X else X { X days = mdays[month] - day; X X if (tyear == year) X { X while (++month < tmonth) X { X days += mdays[month]; X days = ((month == 2) && ((year % 4) == 0)) ? X days + 1 : days; X } X } X else X { X while (++month < 13) X { X days += mdays[month]; X days = ((month == 2) && ((year % 4) == 0)) ? X days + 1 : days; X } X X while (++year < tyear) X { X days += 365; X days = ((year % 4) == 0) ? days + 1 : days; X } X X for (mcnt = 1; mcnt < tmonth; mcnt++) X { X days += mdays[mcnt]; X days = ((mcnt == 2) && ((tyear % 4) == 0)) ? X days + 1 : days; X } X } X X days += tday; X } X X return (days % 7); X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X CHK_STAT("", __, OWN_MSG, VCAL_ACCESS); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X msgdata[i] = malloc(MAX_BUF); X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X cyear = tp->tm_year; X cmonth = tp->tm_mon + 1; X cday = tp->tm_mday; X cyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (strncmp(msgdata[dayindex[j]], X msgdata[dayindex[j + 1]], 4) > NULL) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 7830 -ne "`wc -c < 'oldvcal-sum.c'`" then echo shar: error transmitting "'oldvcal-sum.c'" '(should have been 7830 characters)' fi fi # end of overwriting check echo shar: extracting "'smgtrmptr.h'" '(7309 characters)' if test -f 'smgtrmptr.h' then echo shar: will not over-write existing file "'smgtrmptr.h'" else sed 's/^ X//' << \SHAR_EOF > 'smgtrmptr.h' X/* SMGTRMPTR.H Definitions */ X X#define SMG$K_ADVANCED_VIDEO 1 X#define SMG$K_ANSI_CRT 2 X#define SMG$K_AUTO_MARGIN 3 X#define SMG$K_BACKSPACE 4 X#define SMG$K_BLOCK_MODE 5 X#define SMG$K_DEC_CRT 6 X#define SMG$K_EDIT 7 X#define SMG$K_EIGHT_BIT 8 X#define SMG$K_FULLDUP 9 X#define SMG$K_IGNORE_NEWLINE 10 X#define SMG$K_INSERT_MODE_NULLS 11 X#define SMG$K_LOWERCASE 12 X#define SMG$K_NO_ERASE 13 X#define SMG$K_NO_SCROLL 14 X#define SMG$K_OVERSTRIKE 15 X#define SMG$K_PRINTER_PORT 16 X#define SMG$K_REGIS 17 X#define SMG$K_SCOPE 18 X#define SMG$K_SIXEL_GRAPHICS 19 X#define SMG$K_SOFT_CHARACTERS 20 X#define SMG$K_PHYSICAL_TABS 21 X#define SMG$K_PHYSICAL_FF 22 X#define SMG$K_UNDERLINE 23 X#define SMG$K_CURSOR_REPORT_ANSI 24 X#define SMG$K_DEC_CRT_2 25 X#define SMG$K_DEC_CRT_3 26 X#define SMG$K_SET_CURSOR_COL_ROW 27 X#define SMG$K_PRIVATE_BOO_1 211 X#define SMG$K_PRIVATE_BOO_2 212 X#define SMG$K_PRIVATE_BOO_3 213 X#define SMG$K_PRIVATE_BOO_4 214 X#define SMG$K_PRIVATE_BOO_5 215 X#define SMG$K_PRIVATE_BOO_6 216 X#define SMG$K_PRIVATE_BOO_7 217 X#define SMG$K_PRIVATE_BOO_8 218 X#define SMG$K_PRIVATE_BOO_9 219 X#define SMG$K_PRIVATE_BOO_10 220 X#define SMG$K_MAX_BOOLEAN_CODE 220 X#define SMG$K_COLUMNS 221 X#define SMG$K_CR_FILL 222 X#define SMG$K_FRAME 223 X#define SMG$K_LF_FILL 224 X#define SMG$K_NUMBER_FN_KEYS 225 X#define SMG$K_ROWS 226 X#define SMG$K_VMS_TERMINAL_NUMBER 227 X#define SMG$K_WIDE_SCREEN_COLUMNS 228 X#define SMG$K_PRIVATE_NUM_1 431 X#define SMG$K_PRIVATE_NUM_2 432 X#define SMG$K_PRIVATE_NUM_3 433 X#define SMG$K_PRIVATE_NUM_4 434 X#define SMG$K_PRIVATE_NUM_5 435 X#define SMG$K_PRIVATE_NUM_6 436 X#define SMG$K_PRIVATE_NUM_7 437 X#define SMG$K_PRIVATE_NUM_8 438 X#define SMG$K_PRIVATE_NUM_9 439 X#define SMG$K_PRIVATE_NUM_10 440 X#define SMG$K_MAX_NUMERIC_CODE 440 X#define SMG$K_BEGIN_ALTERNATE_CHAR 441 X#define SMG$K_BEGIN_BLINK 442 X#define SMG$K_BEGIN_BOLD 443 X#define SMG$K_BEGIN_DELETE_MODE 444 X#define SMG$K_BEGIN_INSERT_MODE 445 X#define SMG$K_BEGIN_LINE_DRAWING_CHAR 446 X#define SMG$K_BEGIN_REVERSE 447 X#define SMG$K_BEGIN_UNDERSCORE 448 X#define SMG$K_BOTTOM_T_CHAR 449 X#define SMG$K_CLEAR_TAB 450 X#define SMG$K_CROSS_CHAR 451 X#define SMG$K_CURSOR_DOWN 452 X#define SMG$K_CURSOR_LEFT 453 X#define SMG$K_CURSOR_RIGHT 454 X#define SMG$K_CURSOR_UP 455 X#define SMG$K_DARK_SCREEN 456 X#define SMG$K_DELETE_CHAR 457 X#define SMG$K_DELETE_LINE 458 X#define SMG$K_DEVICE_ATTRIBUTES 459 X#define SMG$K_DOUBLE_HIGH_BOTTOM 460 X#define SMG$K_DOUBLE_HIGH_TOP 461 X#define SMG$K_DOUBLE_WIDE 462 X#define SMG$K_DUPLICATE 463 X#define SMG$K_END_ALTERNATE_CHAR 464 X#define SMG$K_END_BLINK 465 X#define SMG$K_END_BOLD 466 X#define SMG$K_END_DELETE_MODE 467 X#define SMG$K_END_INSERT_MODE 468 X#define SMG$K_END_LINE_DRAWING_CHAR 469 X#define SMG$K_END_REVERSE 470 X#define SMG$K_END_UNDERSCORE 471 X#define SMG$K_ERASE_TO_END_DISPLAY 472 X#define SMG$K_ERASE_TO_END_LINE 473 X#define SMG$K_ERASE_WHOLE_DISPLAY 474 X#define SMG$K_ERASE_WHOLE_LINE 475 X#define SMG$K_HOME 476 X#define SMG$K_HORIZONTAL_BAR 477 X#define SMG$K_INIT_STRING 478 X#define SMG$K_INSERT_CHAR 479 X#define SMG$K_INSERT_LINE 480 X#define SMG$K_INSERT_PAD 481 X#define SMG$K_KEY_0 482 X#define SMG$K_KEY_1 483 X#define SMG$K_KEY_2 484 X#define SMG$K_KEY_3 485 X#define SMG$K_KEY_4 486 X#define SMG$K_KEY_5 487 X#define SMG$K_KEY_6 488 X#define SMG$K_KEY_7 489 X#define SMG$K_KEY_8 490 X#define SMG$K_KEY_9 491 X#define SMG$K_KEY_BACKSPACE 492 X#define SMG$K_KEY_COMMA 493 X#define SMG$K_KEY_DOWN_ARROW 494 X#define SMG$K_KEY_E1 495 X#define SMG$K_KEY_E2 496 X#define SMG$K_KEY_E3 497 X#define SMG$K_KEY_E4 498 X#define SMG$K_KEY_E5 499 X#define SMG$K_KEY_E6 500 X#define SMG$K_KEY_ENTER 501 X#define SMG$K_KEY_F1 502 X#define SMG$K_KEY_F2 503 X#define SMG$K_KEY_F3 504 X#define SMG$K_KEY_F4 505 X#define SMG$K_KEY_F5 506 X#define SMG$K_KEY_F6 507 X#define SMG$K_KEY_F7 508 X#define SMG$K_KEY_F8 509 X#define SMG$K_KEY_F9 510 X#define SMG$K_KEY_F10 511 X#define SMG$K_KEY_F11 512 X#define SMG$K_KEY_F12 513 X#define SMG$K_KEY_F13 514 X#define SMG$K_KEY_F14 515 X#define SMG$K_KEY_F15 516 X#define SMG$K_KEY_F16 517 X#define SMG$K_KEY_F17 518 X#define SMG$K_KEY_F18 519 X#define SMG$K_KEY_F19 520 X#define SMG$K_KEY_F20 521 X#define SMG$K_KEY_LEFT_ARROW 522 X#define SMG$K_KEY_MINUS 523 X#define SMG$K_KEY_PERIOD 524 X#define SMG$K_KEY_PF1 525 X#define SMG$K_KEY_PF2 526 X#define SMG$K_KEY_PF3 527 X#define SMG$K_KEY_PF4 528 X#define SMG$K_KEY_RIGHT_ARROW 529 X#define SMG$K_KEY_UP_ARROW 530 X#define SMG$K_LABEL_F1 531 X#define SMG$K_LABEL_F2 532 X#define SMG$K_LABEL_F3 533 X#define SMG$K_LABEL_F4 534 X#define SMG$K_LABEL_F5 535 X#define SMG$K_LABEL_F6 536 X#define SMG$K_LABEL_F7 537 X#define SMG$K_LABEL_F8 538 X#define SMG$K_LABEL_F9 539 X#define SMG$K_LABEL_F10 540 X#define SMG$K_LABEL_F11 541 X#define SMG$K_LABEL_F12 542 X#define SMG$K_LABEL_F13 543 X#define SMG$K_LABEL_F14 544 X#define SMG$K_LABEL_F15 545 X#define SMG$K_LABEL_F16 546 X#define SMG$K_LABEL_F17 547 X#define SMG$K_LABEL_F18 548 X#define SMG$K_LABEL_F19 549 X#define SMG$K_LABEL_F20 550 X#define SMG$K_LEFT_T_CHAR 551 X#define SMG$K_LIGHT_SCREEN 552 X#define SMG$K_LOWER_LEFT_CORNER 553 X#define SMG$K_LOWER_RIGHT_CORNER 554 X#define SMG$K_NAME 555 X#define SMG$K_NEWLINE_CHAR 556 X#define SMG$K_PAD_CHAR 557 X#define SMG$K_RESTORE_CURSOR 558 X#define SMG$K_RIGHT_T_CHAR 559 X#define SMG$K_SAVE_CURSOR 560 X#define SMG$K_SCROLL_FORWARD 561 X#define SMG$K_SCROLL_REVERSE 562 X#define SMG$K_SEL_ERASE_TO_END_DISPLAY 563 X#define SMG$K_SEL_ERASE_TO_END_LINE 564 X#define SMG$K_SEL_ERASE_WHOLE_DISPLAY 565 X#define SMG$K_SEL_ERASE_WHOLE_LINE 566 X#define SMG$K_SET_APPLICATION_KEYPAD 567 X#define SMG$K_SET_CHAR_NOT_SEL_ERASE 568 X#define SMG$K_SET_CHAR_SEL_ERASE 569 X#define SMG$K_SET_CURSOR_ABS 570 X#define SMG$K_SET_NUMERIC_KEYPAD 571 X#define SMG$K_SET_SCROLL_REGION 572 X#define SMG$K_SET_TAB 573 X#define SMG$K_SINGLE_HIGH 574 X#define SMG$K_TAB_CHAR 575 X#define SMG$K_TOP_T_CHAR 576 X#define SMG$K_UNDERLINE_CHAR 577 X#define SMG$K_UPPER_LEFT_CORNER 578 X#define SMG$K_UPPER_RIGHT_CORNER 579 X#define SMG$K_VERTICAL_BAR 580 X#define SMG$K_WIDTH_NARROW 581 X#define SMG$K_WIDTH_WIDE 582 X#define SMG$K_CURSOR_POSITION_REPORT 583 X#define SMG$K_REQUEST_CURSOR_POSITION 584 X#define SMG$K_CR_GRAPHIC 585 X#define SMG$K_FF_GRAPHIC 586 X#define SMG$K_LF_GRAPHIC 587 X#define SMG$K_HT_GRAPHIC 588 X#define SMG$K_VT_GRAPHIC 589 X#define SMG$K_TRUNCATION_ICON 590 X#define SMG$K_CURSOR_NEXT_LINE 591 X#define SMG$K_CURSOR_PRECEDING_LINE 592 X#define SMG$K_INDEX 593 X#define SMG$K_REVERSE_INDEX 594 X#define SMG$K_BEGIN_NORMAL_RENDITION 595 X#define SMG$K_BEGIN_AUTOWRAP_MODE 596 X#define SMG$K_END_AUTOWRAP_MODE 597 X#define SMG$K_BEGIN_AUTOREPEAT_MODE 598 X#define SMG$K_END_AUTOREPEAT_MODE 599 X#define SMG$K_SET_ORIGIN_RELATIVE 600 X#define SMG$K_SET_ORIGIN_ABSOLUTE 601 X#define SMG$K_ERASE_LINE_TO_CURSOR 602 X#define SMG$K_NEXT_LINE 603 X#define SMG$K_BEGIN_AUTOPRINT_MODE 604 X#define SMG$K_END_AUTOPRINT_MODE 605 X#define SMG$K_PRINT_SCREEN 606 X#define SMG$K_SET_CURSOR_ON 607 X#define SMG$K_SET_CURSOR_OFF 608 X#define SMG$K_SET_PRINTER_OUTPUT 609 X#define SMG$K_SET_SCREEN_OUTPUT 610 X#define SMG$K_ERASE_DISPLAY_TO_CURSOR 611 X#define SMG$K_PRIVATE_STR_1 651 X#define SMG$K_PRIVATE_STR_2 652 X#define SMG$K_PRIVATE_STR_3 653 X#define SMG$K_PRIVATE_STR_4 654 X#define SMG$K_PRIVATE_STR_5 655 X#define SMG$K_PRIVATE_STR_6 656 X#define SMG$K_PRIVATE_STR_7 657 X#define SMG$K_PRIVATE_STR_8 658 X#define SMG$K_PRIVATE_STR_9 659 X#define SMG$K_PRIVATE_STR_10 660 SHAR_EOF if test 7309 -ne "`wc -c < 'smgtrmptr.h'`" then echo shar: error transmitting "'smgtrmptr.h'" '(should have been 7309 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal-msg.msg'" '(619 characters)' if test -f 'vcal-msg.msg' then echo shar: will not over-write existing file "'vcal-msg.msg'" else sed 's/^ X//' << \SHAR_EOF > 'vcal-msg.msg' X.TITLE vcal_mssg X.FACILITY vcal,1/PREFIX=VCAL_ X X.SEVERITY INFORMATIONAL X XFILE <Appointments file did not exist. It has just been created> X X.SEVERITY WARNING X X X.SEVERITY ERROR X XACCESS <Appointments file cannot be accessed at the moment> XINVFILE <File could not be created. Check the file specification> XINVMIN <Invalid minutes before a scheduled event. Min from 5 up to 20> XINVMONTH <Invalid month> XINVYEAR <Invalid year. Start from year 1900 up to year 9999 only> XNOT_COMP <TTY is not VT100 compatible> XNOT_TRM <TTY is not a terminal> XPURGE <Old appointments should be purged. Appointments file is full> X X.END SHAR_EOF if test 619 -ne "`wc -c < 'vcal-msg.msg'`" then echo shar: error transmitting "'vcal-msg.msg'" '(should have been 619 characters)' fi fi # end of overwriting check # End of shell archive exit 0
james@yunexus.UUCP (James Pierre Lewis) (02/01/89)
Vcalendar is a calendar/schedule keeping program that allows one to keep track of appointments, classes, meetings, and dates, etc. It is posted upon request from panetta@duphy4.drexel.edu. Vcalendar is written in C running on VAX/VMS 4.xx or higher. It is free. If you are interested, please cut the three parts - VCAL1.SHAR, VCAL2.SHAR and VCAL3.SHAR; follow the instructions in 0REAME.1ST and have fun. -----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT-----CUT----- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # vcal-purge.c # vcal-remind.c # vcal-sum.c # vcal-util.c # vcal.c # vcal.h # vcalendar.cld # vcalendar.rnh # This archive created: Tue Jan 31 21:50:25 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'vcal-purge.c'" '(3855 characters)' if test -f 'vcal-purge.c' then echo shar: will not over-write existing file "'vcal-purge.c'" else sed 's/^ X//' << \SHAR_EOF > 'vcal-purge.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <descrip.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar msgdata[MAX_ENT][MAX_BUF]; /* message pointers */ X Xint daydata[MAX_ENT], /* day data */ X monthdata[MAX_ENT], /* month data */ X tmonth, /* current month */ X tday, /* current day */ X tyear, /* current year */ X yeardata[MAX_ENT]; /* year data */ X Xmain() X{ X timeset(); X loaddata(); X updatedata(); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X tyear = tp->tm_year; X tmonth = tp->tm_mon + 1; X tday = tp->tm_mday; X tyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = *msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X CHK_STAT("", __, OWN_MSG, VCAL_ACCESS); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[i][MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xupdatedata(final_stat) X Xint *final_stat; X{ X char *c, X key[MAX_BUF], X tmp1[MAX_BUF], X tmp2[MAX_BUF], X tmpnam[MAX_BUF]; X int i, X stat; X FILE *fptr; X X c = mktemp("SYS$LOGIN:TMPXXXXXX"); X sprintf(tmpnam, "%s.DAT", c); X fptr = fopen(tmpnam, "w", "fop = cif", "mrs = 80", "rat = cr", X "rfm = var, stm"); X cuserid(key); X strcat(key, "-VCAL"); X X stat = lib$disable_ctrl(&LIB$M_CLI_CTRLY, __); X X for (i = NULL; i < MAX_ENT; i++) X { X X if ((daydata[i] != NULL) && X ((monthdata[i] >= tmonth) && (yeardata[i] >= tyear))) X { X strcpy(tmp1, msgdata[i]); X tmp1[4] = NULL; X sprintf(tmp2, "%d,%d,%d,%4.4s,%s", X monthdata[i], daydata[i], yeardata[i], X tmp1, &tmp1[6]); X crypt_it(tmp2, key); X fprintf(fptr, "%s\n", tmp2); X } X } X X fclose(fptr); X delete(APPTS_FILE); X stat = lib$rename_file(mkdesc(tmpnam), mkdesc(APPTS_FILE), __, X __, __, __, __, __, __, __, __, __); X X stat = lib$enable_ctrl(&LIB$M_CLI_CTRLY, __); X} SHAR_EOF if test 3855 -ne "`wc -c < 'vcal-purge.c'`" then echo shar: error transmitting "'vcal-purge.c'" '(should have been 3855 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal-remind.c'" '(2154 characters)' if test -f 'vcal-remind.c' then echo shar: will not over-write existing file "'vcal-remind.c'" else sed 's/^ X//' << \SHAR_EOF > 'vcal-remind.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <climsgdef.h> X#include <descrip.h> X#include <lnmdef.h> X#include <stdio.h> X#include "vcal.h" X Xmain() X{ X char min[MAX_BUF], X prc_nam[MAX_BUF], X tmp[MAX_BUF]; X int flag = 0x00000001, /* no wait */ X stat; X $DESCRIPTOR(image, REMIND_IMAGE); X $DESCRIPTOR(log_nam, VCAL_MIN); X $DESCRIPTOR(tab_nam, "LNM$JOB"); X ITEM_LST item_lst[] = X { X { 2, LNM$_STRING, min, 0 }, X { 0, 0, 0, 0 } X }; X X cuserid(tmp); X sprintf(prc_nam, "REM_%s", tmp); X prc_nam[15] = NULL; X get_data(min); X X stat = sys$crelnm(__, &tab_nam, &log_nam, __, &item_lst); X CHK_STAT("", __, SYS_MSG, stat); X X stat = lib$spawn(&image, __, __, &flag, mkdesc(prc_nam), __, __, __, X __, __, __, __); X CHK_STAT("", __, SYS_MSG, stat); X} X X/*----------------------------------------------------------------------------*/ X Xget_data(min) X Xchar *min; X{ X char min_tmp[MAX_BUF]; X short len = NULL; X int i, X stat; X $DESCRIPTOR(min_inp, min_tmp); X $DESCRIPTOR(min_lbl, MIN); X X if ((stat = cli$present(&min_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&min_lbl, &min_inp, &len); X min_tmp[len] = NULL; X X if ((i = atoi(min_tmp)) < 5 || i > 20) X { X CHK_STAT("", __, OWN_MSG, VCAL_INVMIN); X } X X sprintf(min, "%-2.2s", min_tmp); X } X else sprintf(min, "%-2.2s", DEF_MIN); X} SHAR_EOF if test 2154 -ne "`wc -c < 'vcal-remind.c'`" then echo shar: error transmitting "'vcal-remind.c'" '(should have been 2154 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal-sum.c'" '(7808 characters)' if test -f 'vcal-sum.c' then echo shar: will not over-write existing file "'vcal-sum.c'" else sed 's/^ X//' << \SHAR_EOF > 'vcal-sum.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <climsgdef.h> X#include <descrip.h> X#include <stdio.h> X#include <time.h> X#include "vcal.h" X Xchar msgdata[MAX_ENT][MAX_BUF]; /* message pointers */ X Xint cday, /* current day */ X cmonth, /* current month */ X cyear, /* current year */ X daydata[MAX_ENT], /* day data */ X dayindex[MAX_MSG], /* day index to day, month, year */ X monthdata[MAX_ENT], /* month data */ X yeardata[MAX_ENT]; /* year data */ X Xmain() X{ X char file_nam[FILE_LEN]; X int month, X year; X X timeset(); X year = cyear; X month = cmonth; X get_data(&month, &year, file_nam); X X if (*file_nam) X stdout = freopen(file_nam, "w", stdout, "shr = nil"); X X if (stdout == NULL) X { X CHK_STAT("", __, OWN_MSG, VCAL_INVFILE); X } X X loaddata(); X fprintf(stdout, X " A P P O I N T M E N T S L I S T\n"); X repeat('-', 78); X table(month, year); X repeat('-', 78); X} X X/*----------------------------------------------------------------------------*/ X Xget_data(month, year, file_nam) X Xchar *file_nam; Xint *month, X *year; X{ X char month_tmp[MAX_BUF], X year_tmp[MAX_BUF]; X short len = NULL; X int stat; X struct { X int : 32; X struct { X char *month_nam; X int : 32; X } month_tbl[12]; X } key_tbl = X { X 24, X { X { "7JANUARY", 1 }, X { "8FEBRUARY", 2 }, X { "5MARCH", 3 }, X { "5APRIL", 4 }, X { "3MAY", 5 }, X { "3JUN", 6 }, X { "4JULY", 7 }, X { "6AUGUST", 8 }, X { "9SEPTEMBER", 9 }, X { "8OCTOBER", 10 }, X { "8NOVEMBER", 11 }, X { "8DECEMBER", 12 } X } X }; X $PTR_DESCRIPTOR(FILE_LEN, file_inp, file_nam); X $DESCRIPTOR(file_lbl, OUT_FILE); X $DESCRIPTOR(month_inp, month_tmp); X $DESCRIPTOR(month_lbl, MONTH); X $DESCRIPTOR(year_inp, year_tmp); X $DESCRIPTOR(year_lbl, YEAR); X X if ((stat = cli$present(&month_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&month_lbl, &month_inp, &len); X month_tmp[len] = NULL; X stat = lib$lookup_key(mkdesc(month_tmp), &key_tbl, month, X __, __); X CHK_STAT("", stat, SS$_NORMAL, VCAL_INVMONTH); X } X X if ((stat = cli$present(&year_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&year_lbl, &year_inp, &len); X year_tmp[len] = NULL; X *year = atoi(year_tmp); X X if (*year == NULL || *year > UYEAR || *year < LYEAR) X { X CHK_STAT("", __, OWN_MSG, VCAL_INVYEAR); X } X } X X if ((stat = cli$present(&file_lbl)) == CLI$_PRESENT) X { X stat = cli$get_value(&file_lbl, &file_inp, &len); X file_nam[len] = NULL; X } X} X X/*----------------------------------------------------------------------------*/ X Xrepeat(c, num) X Xchar c; Xint num; X{ X char tmp[MAX_BUF]; X int i; X X for (i = NULL; i < num; tmp[i] = c, i++); X X tmp[0] = tmp[num - 1] = '+'; X tmp[i] = NULL; X fprintf(stdout, "%s\n", tmp); X} X X/*----------------------------------------------------------------------------*/ X Xtable(month, year) X Xint month, X year; X{ X char *dayw[] = X { X "Sat ", "Sun ", "Mon ", "Tue ", X "Wed ", "Thu ", "Fri " X }; X char *smon[] = X { X "JANUARY ", "FEBRUARY ", "MARCH ", "APRIL ", X "MAY ", "JUNE ", "JULY ", "AUGUST ", X "SEPTEMBER ", "OCTOBER ", "NOVEMBER ", "DECEMBER " X }; X int dow, X first, X i, X j, X monthday = NULL; X X fprintf(stdout, X "| %-10.10s %4.4u \ X |\n", smon[month-1], year); X X while (++monthday <= 31) X { X first = TRUE; X X for (i = j = NULL; i <= MAX_ENT; i++) X { X if ((yeardata[i] == year) && (monthdata[i] == month) && X (daydata[i] == monthday)) X { X dayindex[j++] = i; X } X X if (j > MAX_MSG) X break; X } X X sort(j - 1); X X for (i = NULL; i < j; i++) X { X if (first == TRUE) X { X dow = getdow(monthday, month, year); X first = FALSE; X fprintf(stdout, X "| \ X |\n"); X fprintf(stdout, X "| %-7.7s%2d %-64.64s|\n", dayw[dow], X monthday, msgdata[dayindex[i]]); X } X else fprintf(stdout, X "| %-64.64s|\n", X msgdata[dayindex[i]]); X } X } X} X X/*----------------------------------------------------------------------------*/ X Xgetdow(tday, tmonth, tyear) X Xint tday, X tmonth, X tyear; X{ X X static int mdays[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; X int day = 1, X days, X mcnt, X month = 1, X year = 79; X X X if ((tmonth == month) && (tyear == year)) X days = abs(day - tday); X else X { X days = mdays[month] - day; X X if (tyear == year) X { X while (++month < tmonth) X { X days += mdays[month]; X days = ((month == 2) && ((year % 4) == 0)) ? X days + 1 : days; X } X } X else X { X while (++month < 13) X { X days += mdays[month]; X days = ((month == 2) && ((year % 4) == 0)) ? X days + 1 : days; X } X X while (++year < tyear) X { X days += 365; X days = ((year % 4) == 0) ? days + 1 : days; X } X X for (mcnt = 1; mcnt < tmonth; mcnt++) X { X days += mdays[mcnt]; X days = ((mcnt == 2) && ((tyear % 4) == 0)) ? X days + 1 : days; X } X } X X days += tday; X } X X return (days % 7); X} X X/*----------------------------------------------------------------------------*/ X Xloaddata() X{ X char basedata[MAX_BUF], X key[MAX_BUF], X tmp[MAX_BUF]; X int field, X i, X j, X k, X l; X FILE *fptr; X X for (i = NULL; i < MAX_ENT; i++) X { X daydata[i] = monthdata[i] = yeardata[i] = *msgdata[i] = NULL; X } X X if (access(APPTS_FILE, __) == -1) X { X CHK_STAT("", __, OWN_MSG, VCAL_ACCESS); X } X X fptr = fopen(APPTS_FILE, "r"); X i = NULL; X cuserid(key); X strcat(key, "-VCAL"); X X while(fgets(basedata, MAX_BUF, fptr) != NULL) X { X basedata[strlen(basedata) - 1] = NULL; X crypt_it(basedata, key); X j = k = field = NULL; X X while(basedata[j] != NULL ) X { X if (basedata[j] != ',') X tmp[k++] = basedata[j]; X else X { X switch(field) { X X case 0 : X tmp[k] = NULL; X monthdata[i] = atoi(tmp); X k = NULL; X break; X X case 1 : X tmp[k] = NULL; X daydata[i] = atoi(tmp); X k = NULL; X break; X X case 2 : X tmp[k] = NULL; X yeardata[i] = atoi(tmp); X k = NULL; X break; X X case 3 : X tmp[k++] = ' '; X tmp[k++] = ' '; X break; X } X field++; X } X j++; X } X X tmp[k] = NULL; X strncpy(msgdata[i], tmp, MAX_BUF); X msgdata[i][MAX_BUF - 1] = NULL; X X if (++i >= MAX_ENT) X break; X } X X fclose(fptr); X} X X/*----------------------------------------------------------------------------*/ X Xtimeset() X{ X int tloc; X struct tm *localtime(), X *tp; X X time(&tloc); X tp = localtime(&tloc); X X cyear = tp->tm_year; X cmonth = tp->tm_mon + 1; X cday = tp->tm_mday; X cyear += LYEAR; X} X X/*----------------------------------------------------------------------------*/ X Xsort(upbound) X Xint upbound; X{ X int i, X j, X k; X X for (i = upbound; i > NULL; i--) X { X for (j = NULL; j < i; j++) X { X if (strncmp(msgdata[dayindex[j]], X msgdata[dayindex[j + 1]], 4) > NULL) X { X k = dayindex[j]; X dayindex[j] = dayindex[j + 1]; X dayindex[j + 1] = k; X } X } X } X} SHAR_EOF if test 7808 -ne "`wc -c < 'vcal-sum.c'`" then echo shar: error transmitting "'vcal-sum.c'" '(should have been 7808 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal-util.c'" '(7891 characters)' if test -f 'vcal-util.c' then echo shar: will not over-write existing file "'vcal-util.c'" else sed 's/^ X//' << \SHAR_EOF > 'vcal-util.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include <dcdef.h> X#include <descrip.h> X#include <dvidef.h> X#include <iodef.h> X#include <stdio.h> X#include <ttdef.h> X#include <tt2def.h> X#include <smgdef.h> X#include "smgtrmptr.h" X#include "vcal.h" X Xsetup_tty() X{ X int i, X stat; X ITEM_LST item_lst[] = X { X { 4, DVI$_DEVCLASS, &tty_class, 0 }, X { 4, DVI$_DEVTYPE, &tty_type, 0 }, X { 4, DVI$_DEVDEPEND, &tty_depend, 0 }, X { 0, 0, 0, 0 } X }; X $DESCRIPTOR(tty, "TT"); X X stat = sys$getdvi(__, __, &tty, &item_lst, __, __, __, __); X CHK_STAT("", tty_class, DC$_TERM, VCAL_NOT_TRM); X X stat = sys$assign(&tty, &tty_chan, __, __); X CHK_STAT("", __, SYS_MSG, stat); X X stat = sys$qiow(__, tty_chan, IO$_SENSEMODE, __, __, __, tty_oldchar, X 12, __, __, __, __); X X for (i = NULL; i < 3; i++) X tty_newchar[i] = tty_oldchar[i]; /* new tty mode */ X X tty_newchar[1] &= ~TT$M_MECHTAB; /* no tabbing is allowed */ X tty_newchar[1] &= ~TT$M_WRAP; /* no wrapping is allowed */ X X stat = sys$qiow(__, tty_chan, IO$_SETMODE, __, __, __, tty_newchar, X 12, __, __, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xfresh_tty() X{ X char tty_clear[ESC_LEN], X tty_nowrap[ESC_LEN], X tty_setorigin[ESC_LEN], X tty_setscroll[ESC_LEN]; X int esc_len, X stat; X ESC_ARG std_region = { 2, 1, 24}; /* Normal scrolling */ X X if (tty_depend & TT$M_SCOPE) X { X stat = smg$init_term_table_by_type(&tty_type, &tty_entry, __); X CHK_STAT("", __, SYS_MSG, stat); X X stat = smg$get_term_data(&tty_entry, &SMG$K_ERASE_WHOLE_DISPLAY, X &ESC_LEN, &esc_len, tty_clear, __); X tty_clear[esc_len] = 0; X X stat = smg$get_term_data(&tty_entry, &SMG$K_SET_SCROLL_REGION, X &ESC_LEN, &esc_len, tty_setscroll, &std_region); X tty_setscroll[esc_len] = 0; X X stat = smg$get_term_data(&tty_entry, &SMG$K_SET_ORIGIN_ABSOLUTE, X &ESC_LEN, &esc_len, tty_setorigin, __); X tty_setorigin[esc_len] = 0; X X stat = smg$get_term_data(&tty_entry, &SMG$K_END_AUTOWRAP_MODE, X &ESC_LEN, &esc_len, tty_nowrap, __); X tty_nowrap[esc_len] = 0; X X if (*tty_clear && *tty_setscroll && X *tty_setorigin && *tty_nowrap) X { X printf("%s%s%s%s", tty_clear, tty_setscroll, X tty_setorigin, tty_nowrap); X } X else X { X CHK_STAT("", __, OWN_MSG, VCAL_NOT_COMP); X } X } X else X { X CHK_STAT("", __, OWN_MSG, VCAL_NOT_COMP); X } X} X X/*----------------------------------------------------------------------------*/ X Xcreat_window() X{ X int stat; X X stat = smg$create_pasteboard(&pstbrd_id, __, &BRD_LEN, &BRD_WID, __); X stat = smg$create_virtual_display(&VCAL_LEN, &VCAL_WID, &vcal_id, X __, __, __); X stat = smg$paste_virtual_display(&vcal_id, &pstbrd_id, X &TOP_ROW, &TOP_COL); X stat = smg$create_virtual_display(&VCAL_LEN, &VCAL_WID, &hlp_id, X &SMG$M_BORDER, __, __); X stat = smg$create_virtual_keyboard(&keybrd_id, __, __, __); X} X X/*----------------------------------------------------------------------------*/ X Xctrl_trap() X{ X extern int trap_ast(); X int stat; X X stat = smg$set_out_of_band_asts(&pstbrd_id, &CTRL_MASK, &trap_ast, __); X} X X/*----------------------------------------------------------------------------*/ X Xtrap_ast() X{ X int stat; X X stat = smg$cancel_input(&keybrd_id); /* cancel pending I/O */ X stat = sys$canexh(__); /* cancel exit handler */ X stat = smg$delete_pasteboard(&pstbrd_id, __); /* clear it */ X stat = smg$delete_virtual_keyboard(&keybrd_id); /* reset keyboard */ X stat = sys$qiow(__, tty_chan, IO$_SETMODE, __, __, __, tty_oldchar, X 12, __, __, __, __); /* reset tty mode */ X stat = sys$cancel(tty_chan); /* Cancel pending I/O. */ X stat = sys$dassgn(tty_chan); /* Cancel a channel for I/O. */ X stat = sys$exit(SS$_NORMAL); /* exit normally */ X} X X/*----------------------------------------------------------------------------*/ X Xchar X*mkstr(len) X Xint len; X{ X char *s; X int i; X X s = malloc(len + 1); X X for (i = NULL; i < len; s[i] = ' ', i++); X X s[len] = NULL; X X return s; X} X X/*----------------------------------------------------------------------------*/ X Xstruct dsc$descriptor X*mkdesc(str) X Xchar *str; X{ X struct dsc$descriptor *p; X X p = (struct dsc$descriptor *) malloc(sizeof(struct dsc$descriptor)); X X p->dsc$w_length = strlen(str); X p->dsc$b_dtype = DSC$K_DTYPE_T; X p->dsc$b_class = DSC$K_CLASS_S; X p->dsc$a_pointer = str; X X return p; X} X X/*----------------------------------------------------------------------------*/ X Xget_key(id) X Xint id; X{ X int func = IO$M_NOECHO | IO$M_ESCAPE | IO$M_NOFILTR, X len = 0, X stat, X trm_cd = 0; X struct dsc$descriptor *tmp; X X tmp = mkdesc(mkstr(ESC_LEN)); X stat = smg$read_string(&keybrd_id, tmp, __, &KEY_LEN, &func, __, X __, &len, &trm_cd, &id, __, __, __); X X switch(trm_cd) { X X case SMG$K_TRM_UP: X case SMG$K_TRM_DOWN: X case SMG$K_TRM_LEFT: X case SMG$K_TRM_RIGHT: X case SMG$K_TRM_CR: X case SMG$K_TRM_SPACE: X case SMG$K_TRM_DELETE: X case SMG$K_TRM_CTRLA: X case SMG$K_TRM_CTRLU: X case SMG$K_TRM_CTRLW: X case SMG$K_TRM_CTRLZ: X return trm_cd; X break; X X default: X if (!len) X return NULL; X else return (*tmp->dsc$a_pointer & CHAR_MASK); X break; X } X} X X/*----------------------------------------------------------------------------*/ X Xexit_handler(handler_rtn, arg) X Xint (*handler_rtn)(), X *arg[]; X{ X int stat; X EXIT_BLK *exit_blk; X X exit_blk = (EXIT_BLK *) malloc(sizeof(EXIT_BLK)); X X exit_blk->nxt = 0; X exit_blk->exit_rtn = handler_rtn; X exit_blk->num_arg = 2; X exit_blk->final_stat = malloc(sizeof(int)); X exit_blk->arg = (int *) arg; X X stat = sys$dclexh(exit_blk); X} X X/*----------------------------------------------------------------------------*/ X Xreset_tty(final_stat) X Xint *final_stat; X{ X int stat; X X stat = smg$delete_pasteboard(&pstbrd_id, &CLEAR); /* clear it */ X stat = smg$delete_virtual_keyboard(&keybrd_id); /* reset keyboard */ X stat = sys$qiow(__, tty_chan, IO$_SETMODE, __, __, __, tty_oldchar, X 12, __, __, __, __); /* reset tty mode */ X stat = sys$cancel(tty_chan); /* Cancel pending I/O. */ X stat = sys$dassgn(tty_chan); /* Cancel a channel for I/O. */ X} X X/*----------------------------------------------------------------------------*/ X Xcrypt_it(x, key) X Xchar *x, X *key; X{ X char c; X int i, X j, X k; X X for (i = k = NULL, j = strlen(key); *x; x++, i = ++k % j) X { X c = *x; X *x = (*x & ~key[i]) | (~*x & key[i]); X *x = (*x == NULL || X *x == CR || X *x == LF || X *x == FF ) ? c : *x; X } X} X X/*----------------------------------------------------------------------------*/ X Xfill_fld(src, dest, len) X Xchar *src, X *dest; Xint len; X{ X int i; X X /* X * Copy a src to dest field. The field is padded with blanks. X * Therefore, pointer must be correct at the boundary. X */ X X for (i = 1; i <= len && *src; *dest = *src, i++, dest++, src++); X X for (; i <= len; *dest = ' ', i++, dest++); X X dest[len] = NULL; X} SHAR_EOF if test 7891 -ne "`wc -c < 'vcal-util.c'`" then echo shar: error transmitting "'vcal-util.c'" '(should have been 7891 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal.c'" '(993 characters)' if test -f 'vcal.c' then echo shar: will not over-write existing file "'vcal.c'" else sed 's/^ X//' << \SHAR_EOF > 'vcal.c' X/* X * ------------------------------------------------------- X * Neither York University, Department of Computer X * Science nor the author assume any responsibility X * for the use or reliability of this software. X * X * Copyright (C) 1987, York University X * Department of Computer Science X * X * General permission to copy or modify, but not for X * profit, is hereby granted, provided that the above X * copyright notice is included and reference made to X * the fact that reproduction privileges were granted X * by the York University, Department of Computer Science. X * ------------------------------------------------------- X * X * Written by: James Pierre Lewis X * Department of Computer Science X * York University X * 1987 - Version V1.0 X */ X X#include "vcal.h" X Xmain() X{ X setup_tty(); X fresh_tty(); X creat_window(); X ctrl_trap(); X do_appts(); X} SHAR_EOF if test 993 -ne "`wc -c < 'vcal.c'`" then echo shar: error transmitting "'vcal.c'" '(should have been 993 characters)' fi fi # end of overwriting check echo shar: extracting "'vcal.h'" '(3554 characters)' if test -f 'vcal.h' then echo shar: will not over-write existing file "'vcal.h'" else sed 's/^ X//' << \SHAR_EOF > 'vcal.h' X#include <ssdef.h> X#include <stsdef.h> X X/* Volatile definitions that can be customized to your needs */ X/* */ X/* LYEAR should be changed when the year 2000 comes. That's */ X/* a long way to go. */ X/* MAX_ENT shoud not be changed to a value less than MAX_MSG */ X/* */ X X#define APPTS_FILE "SYS$LOGIN:APPOINTMENTS.DAT" X#define LYEAR 1900 X#define MAX_ENT 1000 /* Maximum entries in the file */ X#define REMIND_IMAGE "RUN CS:DO-CALLS.EXE" X X/* Static definitions that should not be changed carelessly */ X X#define __ 0 X#define CHAR_MASK 0xffffffff X#define CLEAR 1 X#define CR '\015' X#define CTRL_MASK 0x02000008 X#define BEL '\007' X#define BRD_LEN 24 X#define BRD_WID 80 X#define DEF_MIN "5" X#define ESC_LEN 20 X#define EXIT_MSG "Press <CTRL-Z> to complete and exit" X#define FF '\014' X#define FILE_LEN 256 X#define KEY_LEN 1 X#define LF '\012' X#define LIB$M_CLI_CTRLY 0x02000000 X#define MAX_BUF 80 X#define MAX_MSG 17 X#define MAX_TXT 61 X#define MIN "MIN" X#define MONTH "MONTH" X#define MSG_BUF 256 X#define OUT_FILE "FILE" X#define OWN_MSG -1 X#define QST_MARK '\037' X#define WAIT_MSG "Press <RETURN> to continue ..." X#define R_MAR 38 X#define SYS_MSG 0 X#define TOP_ROW 1 X#define TOP_COL 1 X#define TXT_COL 42 X#define TXT_LEN 39 X#define TXT_ROW 8 X#define UYEAR 9999 X#define VCAL_LEN 24 X#define VCAL_MIN "VCAL_MIN" X#define VCAL_TITLE "V I S U A L C A L E N D A R" X#define VCAL_WID 80 X#define WRAP 1 X#define YEAR "YEAR" X X#define CHK_STAT(msg, lft_val, rht_val, stat) { \ X switch(rht_val) {\ X case OWN_MSG: \ X lib$signal(stat); \ X if (*msg) \ X fprintf(stderr, " \\%s\\\r\n", msg); \ X sys$exit(SS$_NORMAL); \ X break; \ X case SYS_MSG: \ X if (!((stat & STS$M_SUCCESS) >> STS$V_SUCCESS)) \ X { \ X lib$signal(stat); \ X if (*msg) \ X fprintf(stderr, " \\%s\\\r\n", msg); \ X sys$exit(SS$_NORMAL); \ X } \ X break; \ X default: \ X if (lft_val != rht_val) \ X { \ X lib$signal(stat); \ X if (*msg) \ X fprintf(stderr, " \\%s\\\r\n", msg); \ X sys$exit(SS$_NORMAL); \ X } \ X break; \ X } \ X} X X#define $PTR_DESCRIPTOR(len, name, str) struct dsc$descriptor_s name = \ X { len, DSC$K_DTYPE_T, DSC$K_CLASS_S, str } X Xtypedef struct X { X short : 16; /* buffer length */ X short : 16; /* item code */ X int *buf_addr; X int *len_addr; X } ITEM_LST; X Xtypedef struct X { X int : 32; /* number of arguments */ X int : 32; /* first argument */ X int : 32; /* second argument */ X } ESC_ARG; X Xtypedef struct X { X int nxt; /* forward link */ X int (*exit_rtn)(); /* handler address */ X int num_arg; /* number of arguments */ X int *final_stat; /* final status */ X int arg; /* /* optional argument */ X } EXIT_BLK; X Xextern short tty_chan; /* tty channel */ X Xextern int hlp_id, /* help display */ X keybrd_id, /* keyboard id */ X pstbrd_id, /* pasteboard id */ X tty_class, /* terminal class */ X tty_depend, /* terminal dependency */ X tty_entry, /* terminal entry */ X tty_newchar[3], /* new characteristics */ X tty_oldchar[3], /* old characteristics */ X tty_type, /* terminal type */ X vcal_id; /* calendar display */ X Xglobalvalue X int VCAL_ACCESS, /* no access to appointments file */ X VCAL_FILE, /* file creation */ X VCAL_INVFILE, /* file creation problem */ X VCAL_INVMIN, /* invalid min */ X VCAL_INVMONTH, /* invalid month */ X VCAL_INVYEAR, /* invalid year */ X VCAL_NOT_COMP, /* terminal not compatible */ X VCAL_NOT_TRM, /* not a terminal */ X VCAL_PURGE; /* old entries should be purged */ SHAR_EOF if test 3554 -ne "`wc -c < 'vcal.h'`" then echo shar: error transmitting "'vcal.h'" '(should have been 3554 characters)' fi fi # end of overwriting check echo shar: extracting "'vcalendar.cld'" '(836 characters)' if test -f 'vcalendar.cld' then echo shar: will not over-write existing file "'vcalendar.cld'" else sed 's/^ X//' << \SHAR_EOF > 'vcalendar.cld' Xdefine verb vcalendar X image CS:vcal.exe X noparameters X qualifier purge, X label=purge, X nonnegatable, X syntax=purge X qualifier remind, X label=remind, X nonnegatable, X syntax=remind X qualifier summary X label=summary X nonnegatable, X syntax=summary X disallow any2(purge, remind, summary) Xdefine syntax purge X image CS:vcal-purge.exe X noparameters X noqualifiers Xdefine syntax remind X image CS:vcal-remind.exe X noparameters X qualifier min, X label=min, X nonnegatable, X value(type=$number, required) Xdefine syntax summary X image CS:vcal-sum.exe X noparameters X qualifier month, X label=month, X nonnegatable, X value(type=$quoted_string, required) X qualifier year, X label=year, X nonnegatable, X value(type=$number, required) X qualifier out, X label=file, X nonnegatable, X value(type=$file, required) SHAR_EOF if test 836 -ne "`wc -c < 'vcalendar.cld'`" then echo shar: error transmitting "'vcalendar.cld'" '(should have been 836 characters)' fi fi # end of overwriting check echo shar: extracting "'vcalendar.rnh'" '(5905 characters)' if test -f 'vcalendar.rnh' then echo shar: will not over-write existing file "'vcalendar.rnh'" else sed 's/^ X//' << \SHAR_EOF > 'vcalendar.rnh' X1 VCALENDAR X.lm+2 .s1 XThe command $ VCALENDAR invokes the calendar utility. This utility Xhelps you to keep track of your appointments. X.s1 .lit XFormat: X X $ VCALENDAR [/qualifiers] X.end lit X.lm-2 X2 Acknowledgements X.lm+2 .s1 XThanks to Mike Essex at Berkeley who, together with many others, wrote VCAL. XMike's version has been reported to work on XUNIX XVersion 7, BSD 4.3, and ULTRIX. The software was written in C using C curses Xand Termcap. XIt Xcould, perhaps, be ported to VAX/VMS without making changes. However, excellent XVAX/VMS screen management features are not fully utilized; therefore, VCAL was Xthen C-modified using SMG. There are differences and similarities between UNIX XC and VAX C; and C curses and SMG. However, they are not discussed here. X.lm-2 X2 Features X.lm+2 .s1 X VCAL provides you a calendar of each month. From this Xcalendar, you can pick any day to record appointments (Day Picking Phase). When Xa day is picked, you enter the second phase (Appointments Making Phase). You Xcan switch back and forth between these two phases. You can record 17 Xappointments for a day. The length of each appointments is 60 characters. Just Xthink that you are using a calendar pad. The design was based on this Xphilosophy. It sounds complicated, but don't worry! The software is a Xmenu-driven one, so it will help you when you go along. You just have to pay Xattention to the small help window in the lower left-hand corner. X.s1 XThat's not all. VCAL does also provides you the reminding service for today if Xyou want. Before the appointment time approximately 5 minutes, it will beep at Xyour terminal, displaying the scheduled activity you had recorded before. You Xcould set the reminding service to remind you from 5 to 20 minutes before Xschedule events. X.s1 XThat's still not all. VCAL, furthermore, provides you the appointments summary Xfor any month between the year 1900 and 9999 if you want. X.s1 XFinally, when your appointments file grows bigger until it reaches the threshold Xsize, you will be notified to purge all old appointments leaving only Xappointments for the current month and the future ones. X.lm-2 X2 Limitations X.lm+2 .s1 XVCAL expects you to enter the hour in the format "hhhh". If the hour is not Xunderstood, say 2500, then it is set to 0000. X.s1 XIf you have several appointments scheduled for the same hour, you may be Xreminded for the first one only. X.lm-2 X2 Commands X.lm+2 .s1 X1) To record appointments, please type: X.skip X$ VCAL X.skip XThen follow the instructions provided in the small lower left-hand window. When Xyou complete and exit, the file APPOINTMENTS.DAT is created in your main Xdirectory. DONOT delete this file. It is where all appointments are kept. If Xyou frequently purge all old appointments, the size of this file will be at Xmaximum 1 block. X.skip X2) To ask for reminding service for today: X.skip X$ VCAL/REMIND/MIN=[min]#####/* 5 <= min <= 20. Default = 5 min. */ X.SKIP XA sub-process is created. It hibernates until approximately 5 minutes before Xeach appointment for that day, wakes up reminding you the scheduled event, then Xgoes back into hibernation until no more appointments. (You could set the Xreminding service to remind you from 5 to 20 minutes before schedule events). XThe sub-process then terminates. In terms of system resources, it doesn't bog Xdown any thing because when the process hibernates, it is swapped out of Xmemory. When you log out, the sub-process is automatically terminated also. If Xyou want to terminate this sub-process instead, just type: X.skip X$ STOP REM__username#####/* For example, $ STOP REM__CS100002 */ X.skip X3) To ask for an appointments summary for a month, please type: X.skip X$ VCAL/SUMMARY X.SKIP XThe summary for this month's appointments will be displayed on screen. You can Xre-direct the output to a file by typing: X.skip X$ VCAL/SUMMARY/OUT=[file] X.skip XYou can also add the qualifiers /MON=[month], and /YEAR=[year] to the command. XMonth is any month. i.e., JANUARY, FEBRUARY, etc. Year is any year from 1900 to X9999. X.skip X4) To purge all old appointments leaving only current month's appointments and Xfuture ones, please type: X.skip X$ VCAL/PURGE X.SKIP X5) To get help such as this one, just type: X.skip X$ HELP VCAL X.SKIP X.lm-2 X2 Qualifiers X.lm+2 .s1 XIf there is no qualifier specified, VCAL will display a calendar of each month. XFrom this calendar, you can pick any day to make appointments. X.lm-2 X/SUMMARY X.lit X /SUMMARY X.end lit X.lm+2 .s1 XDisplays the appointments summary for the current month if no /MON and /YEAR Xare specified. X.lm-2 X/MIN X.lit X /MIN=[min] /* 5 <= min <= 20. Default = 5 min. */ X.end lit X.lm+2 .s1 XIf you want the reminding sub-process wakes up earlier than 5 minutes before Xscheduled events, use this qualifier together with /REMIND. X.lm-2 X/OUT X.lit X /OUT=[file] X.end lit X.lm+2 .s1 XIf you want to re-direct the output of appointments summary to a file, then Xuse this qualifier. X.lm-2 X/REMIND X.lit X /REMIND X.end lit X.lm+2 .s1 XCall for the reminding service. A sub-process is created under the name X"REM__username", i.e., REM__CS100002. It hibernates until approximately 5 Xminutes before each appointment for that day, wakes up reminding you the Xscheduled event, then goes back into hibernation until no more appointments. X(You could set the reminding service to remind you from 5 to 20 minutes before Xschedule events). The sub-process then terminates. In terms of system resources, Xit doesn't bog down any thing because when the process hibernates, it is Xswapped out of memory. When you log out, the sub-process is automatically Xterminated also. If you want to terminate this sub-process instead, just type: X$ STOP REM__username. X.lm-2 X/PURGE X.lit X /PURGE X.end lit X.lm+2 .s1 XWhen your APPOINTMENTS.DAT in the main directory grows bigger to a threshold Xsize, you will be notified to purge old appointments leaving behind those of Xcurrent and future months. SHAR_EOF if test 5905 -ne "`wc -c < 'vcalendar.rnh'`" then echo shar: error transmitting "'vcalendar.rnh'" '(should have been 5905 characters)' fi fi # end of overwriting check # End of shell archive exit 0