#ifdef public_domain_notice Copyright (c) 1996 David P. Murphy for Datametrics Systems Corporation --- please send all comments and bug reports to murphy@connor.datametrics.com Permission is granted to any individual or institution to use, copy, or redistribute this software so long as all of the original files are included, that it is not sold for profit, and that this copyright notice is retained. Use at your own risk. Neither Murphy nor Datametrics assumes responsibility. Do not taunt Happy Fun Ball. #endif /* test the HOLMES software */ #include #include #include #include #include #include #include #include #ifdef VAXC #define sys$enqw SYS$ENQW #define sys$setimr SYS$SETIMR #define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL #endif #include #include #include "sherlock.h" /* use this to create timers manually */ #define KLUNKS_PER_SEC 10000000 typedef unsigned long CONDVAL; $DESCRIPTOR(TheImage, "SHERLOCK_HOLMES"); $DESCRIPTOR(TheName, "SH_SHOW"); $DESCRIPTOR(Name1, "TEST_HOLMES_LOCK_ONE"); $DESCRIPTOR(Name2, "TEST_HOLMES_LOCK_TWO"); $DESCRIPTOR(Name3, "TEST_HOLMES_LOCK_THREE"); $DESCRIPTOR(Name4, "TEST_HOLMES_LOCK_FOUR"); main( /* mep */ int argc, char *argv[], char *envp[] ) { int tmpfd; CONDVAL (*fncptr)(); long deltaTime[2]; long lksb[6]; char reply[100]; /* create and open some files using various modes * to test the SHOW OPEN FILES command */ tmpfd = creat("SYS$LOGIN:READONLY.TMP", 0666); close(tmpfd); tmpfd = creat("SYS$LOGIN:MODIFY.TMP", 0666); close(tmpfd); fopen("SYS$LOGIN:READONLY.TMP", "r"); fopen("SYS$LOGIN:WRITEONLY.TMP", "w"); fopen("SYS$LOGIN:MODIFY.TMP", "r+"); /* start some timers to test the SHOW TIMERS command */ deltaTime[1] = -1; deltaTime[0] = 130 * -1 * KLUNKS_PER_SEC; sys$setimr(0, deltaTime, NULL, 668); deltaTime[0] = 70 * -1 * KLUNKS_PER_SEC; sys$setimr(0, deltaTime, NULL, 666); deltaTime[0] = 10 * -1 * KLUNKS_PER_SEC; sys$setimr(0, deltaTime, NULL, 664); /* request some resources to test the SHOW LOCKS command */ sys$enqw(0, LCK$K_CRMODE, &lksb, LCK$M_SYSTEM, &Name1, 0, 0, 0, 0, 0, 0); sys$enqw(0, LCK$K_NLMODE, &lksb, 0, &Name2, 0, 0, 0, 0, 0, 0); sys$enqw(0, LCK$K_EXMODE, &lksb, 0, &Name3, 0, 0, 0, 0, 0, 0); sys$enqw(0, LCK$K_EXMODE, &lksb, 0, &Name4, 0, 0, 0, 0, 0, 0); lksb[2] = 0x11111111; lksb[3] = 0x22222222; lksb[4] = 0x33333333; lksb[5] = 0x44444444; sys$enqw(0, LCK$K_PWMODE, &lksb, LCK$M_VALBLK | LCK$M_CONVERT, NULL, 0, 0, 0, 0, 0, 0); /* invoke the SH_Show() function in SHERLOCK.EXE */ fncptr = NULL; lib$find_image_symbol(&TheImage, &TheName, &fncptr, NULL); if (fncptr != NULL) { (*fncptr)(SHERLOCK_M_ALL, NULL, NULL, NULL, NULL); } if (isatty(fileno(stdin))) { printf("\n\n\nall done, press : "); fgets(reply, sizeof(reply), stdin); } else { printf("\n\n\nall done!\n"); } /* all done */ exit(EXIT_SUCCESS); }