Relay-Version: version nyu B notes v1.6 9/18/89; site acf4.NYU.EDU From: lrb@rrivax.rri.uwo.ca (Lance R. Bailey) Date: 27 Aug 90 06:53 EDT Date-Received: 27 Aug 90 12:53 EDT Subject: schedular part 5 of 6 Message-ID: <914@ria.ccs.uwo.ca> Path: acf4!cmcl2!phri!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!news-server.csri.toronto.edu!utgpu!watserv1!ria!rrivax.rr Newsgroups: vmsnet.sources Organization: Robarts Research Institute -- London Canada Earth Sender: news@ria.ccs.uwo.ca Reply-To: lrb@rrivax.rri.uwo.ca Lines: 522 News-Software: VAX/VMS VNEWS 1.3-4 -+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+ XIf the spawning is successful, qv.com REDEFINES the symbol qvs to attach Xto the subprocess running quo_vadis. You thus reattach to quo_vadis by Xusing the same command as you used to fire it up. The original parametors Xare ignored when you attach. X X2 copyright X Xcopyright 1989,1990 lance r bailey X X2 help_and_bug_fixes X Xqueries to author:: X X Lance R. Bailey, Systems Manager `7C Robarts Research Institute X email: lrb@rri.uwo.ca `7C Clinical Trials Resources Group X vox: 519-663-3787 ext. 4108 `7C P.O. Box 5015, 100 Perth Dr. X fax: 519-663-3789 `7C London, Canada N6A 5K8 $ CALL UNPACK QUO_VADIS.HLP;13 438983277 $ create 'f' X$! run QV as a spawned job. X$! QV shoul be a symbol to a foreign command X$! X$ if "''QV'" .eqs. "" X$ then X$ write sys$output "symbol ""QV"" must be foreign command" X$ exit X$ endif X$! X$ token = "qv4" + f$getjpi("","USERNAME") X$`20 X$ spawn/nolog/process='token' QV -s 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8 X$ if $status .eq. %x1 then qvs=="attach ''token' !" X$! X$! EOF X$! $ CALL UNPACK QV.COM;21 90772463 $ create 'f' XQUO_VADIS X Xcontents X======== Xsource X QUO_VADIS.H X QUO_VADIS.C X READIT.C X SHOW_DAY.C X QV.COM X Xdocumentation X README.FIRST X ONLINE.HLB X QUO_VADIS.HLP X X Xrequirments X=========== XVAXC 3.0 XVMS 5.1 X X Xbuilding X======== Xedit quo_vadis.h to have the PRINTCOM define point to your printer of choice V. Xcompile the .c files. Xlink quo_vadis, readit, show_day X Xyou should have the following lines in you login.com to Xaid in linking: X`09$`09define lnk$library sys$library:vaxccurse.olb X`09$`09define lnk$library_1 sys$library:vaxcrtlg.olb X`09$`09define lnk$library_2 sys$library:vaxcrtl.olb X X Xsetup X===== XDefine a logical at the system level X`09$ define QUOVADIS$ROOT device:`5Bdirectory.specification`5D X XUsers should define define two symbols X`09$ QV == "$quovadis$root:quo_vadis.exe QV" X`09$ QVS == "@quovadis$root:qv.com" X XPut quo_vadis.exe, qv.com and online.hlb into quovadis$root: XPut quo_vadis.hlp into your help libraries if so desired. X X Xusage X===== X qv `5B-m`5D datafile `5B `5B-m`5D datafile ...`5D X Xyou must specify the datafile(s) that you wish to use. if you specify Xmore than one, you can alternate among them with the menu choice "Change_dat Va". XIf you only specify one, you will not have this menu choice. X XIf you wish to look at the data (for example, a Boss who wants to know where Xs/he is supposed to be) then do not use the -m parametors. If you wish to`20 Xedit (ie: add or delete) entries in the schedular, then use the -m (modify) Xparametor. This is intended for use by the person (secretary) who is Xresponsible for the booking of time. X XAt all times, the legal choices are displayed at the bottom of the screen, Xwith the option letters highlighted. just press the option key. As you Xproceed through the menus, the list of legal choices will change to reflect Xyour current state. X X Xusage (spawning) X================ X qvs `5B-m`5D datafile `5B `5B-m`5D datafile ...`5D X XThe com file qv.com is pointed to by the symbol qvs. This is important. XWhen qv.com is executed it fires up a spawning version of quo_vadis. That Xis, quo_vadis is fired up in a spawned process. When you quit from the`20 Xspawned version, quo_vadis remains alive as a subprocess. X XIf the spawning is successful, qv.com REDEFINES the symbol qvs to Xattach to the subprocess running quo_vadis. You thus reattach to Xquo_vadis by using the same command as you used to fire it up. The original Xparametors are ignored when you attach. X X Xdocumentation X============= Xthis is the install document. Xquo_vadis.hlp can be built into your systems help libraries. Xonline.hlb is a help library used during the running of quo_vadis. X X Xbackwards compatibilty X====================== Xthe data file format changed between version v.1 and v.2. because this is Xnot your problem, the program will reformat old into new on the fly if it Xhits old data. X X Xcopyright X========= Xcopyright 1989,1990 lance r bailey X vox: 519-663-3787 ext. 4108 `20 X fax: 519-663-3789 `20 X Xhelp and bug fixes X================== Xqueries to author X $ CALL UNPACK QV.RELEASE_NOTES;1 719482162 $ create 'f' X XThis release of quo_vadis will now be installed. The system will NOT reboot Xafter installation. Installation should continue for about 1 minutes. X $ CALL UNPACK QV.REMARKS;1 1934834943 $ create 'f' X/* X * readit.c X * read and write the daytime information for a daytimer X */ X X X/* format of file X * X`09%!%!%!%!%!%`09`09day header X`09yy:mm:dd:w`09`09date X`09entry`09`09`09first entry X`09...`09`09`09... X`09entry`09`09`09last entry X`09%!%!%!%!%!%`09`09day header X`09yy:mm:dd:w`09`09date X`09entry`09`09`09first entry X`09...`09`09`09... X`09entry`09`09`09last entry X X `09...`09... X `09...`09... X X`09%!%!%!%!%!%`09`09day header X`09yy:mm:dd:w`09`09date X`09entry`09`09`09first entry X`09...`09`09`09... X`09entry`09`09`09last entry X `09`09EOF X * X */ X X#include time X#include stdio X#include stat X X#include "quo_vadis.h" X Xextern char *weekdays`5B`5D; Xextern char *monthnames`5B`5D; X X X Xnewdata(datelastread,USER) X unsigned *datelastread; X char *USER; X`7B struct stat statbuf; X char DATAFILE`5B100`5D; X X sprintf(DATAFILE,"%s%s.dat",QVROOT,USER); X stat(DATAFILE,&statbuf); X if (statbuf.st_mtime > *datelastread) X `7B *datelastread = statbuf.st_mtime; X return 1; X `7D X else X return 0; X`7D X X X X/* X * get date X * open file X * while entries before today, skip X * until EOF read entries and store X * close file X * ALWAYS ENSURE THAT NDAYS IS AT LEAST ONE X */ Xreaddata(matrix,dates,USER,NDAYS) X char ((matrix`5BMAXDAYS`5D)`5BNUMSLOTS`5D)`5BSLOTSIZE`5D; X char (dates`5BMAXDAYS`5D)`5BDATESIZE`5D; X char *USER; X int NDAYS; X`7B struct tm *tms; X char today`5BDATESIZE`5D; X int i,j; X long now; X int numdaysread; X FILE *istream; X char inline`5B1024`5D; X char DATAFILE`5B100`5D; X char messentry`5B80`5D; X int olddata; X X numdaysread = 0; X X/*`20 X * wipe out the data X */ X for (i = 0; itm_year,tms->tm_mon+1, X tms->tm_mday,tms->tm_wday); X X X sprintf(DATAFILE,"%s%s.dat",QVROOT,USER); X istream = fopen(DATAFILE,"r"); X if (!istream) X `7B mstrcpy(dates`5B0`5D,today); X return 1; X `7D X X fgets(inline,1024,istream); /* discard first header */ X olddata= !strncmp(inline,OFHeader,strlen(OFHeader)); X fgets(inline,1024,istream); /* get first date */ X X/* spin through old data */ X while (strncmp(inline,today,8) < 0 && !feof(istream)) X `7B while ((strcmp(inline,FHeader)&&strcmp(inline,OFHeader))`20 X && !feof(istream V)) X `7B fgets(inline,1024,istream); X inline`5Bstrlen(inline)-1`5D=0; inline`5BSLOTSIZE-1`5D=0; X `7D X X fgets(inline,1024,istream); /* get next date */ X `7D X X while (!feof(istream)) X `7B inline`5BDATESIZE-1`5D=0; X mstrcpy(dates`5Bnumdaysread`5D,inline); X X fgets(inline,1024,istream); X inline`5Bstrlen(inline)-1`5D=0; inline`5BSLOTSIZE-1`5D=0; X X while ((strcmp(inline,FHeader)&&strcmp(inline,OFHeader))`20 X && !feof(istream)) X `7B if (olddata) X `7B mstrcpy(matrix`5Bnumdaysread`5D`5Batoi(inline)*3`5D,inline V+3); X mstrcpy(matrix`5Bnumdaysread`5D`5Batoi(inline)*3+1`5D,inline V+3); X mstrcpy(matrix`5Bnumdaysread`5D`5Batoi(inline)*3+2`5D,inline V+3); X `7D X else X mstrcpy(matrix`5Bnumdaysread`5D`5Batoi(inline)`5D,inline+4); X X fgets(inline,1024,istream); X inline`5Bstrlen(inline)-1`5D=0; inline`5BSLOTSIZE-1`5D=0; X `7D X X ++numdaysread; X fgets(inline,1024,istream); /* get new date */ X `7D X `20 X fclose(istream); X X if (!numdaysread) X `7B strcpy(dates`5B0`5D,today); X return 1; X `7D X X return numdaysread; X`7D X X X X Xshowdata(matrix,dates,N) X char ((matrix`5BMAXDAYS`5D)`5BNUMSLOTS`5D)`5BSLOTSIZE`5D; X char (dates`5BMAXDAYS`5D)`5BDATESIZE`5D; X int N; X`7B fprintf(stdout,"%d days in data \n",N); X dumpdata(matrix,dates,N,stdout); X`7D X X X Xwritedata(matrix,dates,N,updatetime,USER) X char ((matrix`5BMAXDAYS`5D)`5BNUMSLOTS`5D)`5BSLOTSIZE`5D; X char (dates`5BMAXDAYS`5D)`5BDATESIZE`5D; X int N; X unsigned *updatetime; X char *USER; X`7B FILE *ostream; X char syscommand`5B80`5D; X struct stat statbuf; X char DATAFILE`5B100`5D; X X sprintf(DATAFILE,"%s%s.dat",QVROOT,USER); X ostream = fopen(DATAFILE,"w"); X dumpdata(matrix,dates,N,ostream); X fclose(ostream); X X sprintf(syscommand,"purge/nolog %s",DATAFILE); X system(syscommand); X X stat(DATAFILE,&statbuf); X *updatetime = statbuf.st_mtime; X `20 X return; X`7D X X X X Xdumpdata(matrix,dates,N,ostream) X char ((matrix`5BMAXDAYS`5D)`5BNUMSLOTS`5D)`5BSLOTSIZE`5D; X char (dates`5BMAXDAYS`5D)`5BDATESIZE`5D; X int N; X FILE *ostream; X`7B int i,j; X X for (i=0;i