From: Gib Copeland [copeland@jenni.path.uiowa.edu] Sent: Thursday, September 21, 2000 7:35 PM To: Info-VAX@Mvb.Saic.Com Subject: Re: Alternative to REPLY/ENABLE=TAPES ? You can use the program below to dump current OPCOM requests to SYS$OUTPUT. Redirect to a file or pipe and search for whatever you're after. Gib -- #include #include #include #include #include #include #include #include #include #include #include #define OPC_BUFSIZ 4096 main() { char devnam_string[16]; $DESCRIPTOR (devnam, devnam_string); /* Pseudoterm device name */ $DESCRIPTOR (mbxnam, "TMP_OPC_MBX"); /* Mailbox name */ /* OPCOM message buffer */ static struct { char type; char enable[3]; int mask; short ounit; char nlen; char name[16]; } msgbuf; /* Descriptor for same */ struct dsc$descriptor_s opc_d = {sizeof(msgbuf), DSC$K_DTYPE_T, DSC$K_CLASS_S, (char *)&msgbuf}; /* Item list for GETDVI */ struct { short len1; short item1; char *buf_addr1; unsigned short *ret_len1; short len2; short item2; char *buf_addr2; int *ret_len2; int end; } item_list = {devnam.dsc$w_length, DVI$_DEVNAM, devnam.dsc$a_pointer, &devnam.dsc$w_length, 4, DVI$_UNIT, (char *)&msgbuf.ounit, 0, 0}; struct { /* I/O buffer start/end */ char *start; char *end; } ret_addr; struct { /* Structure for mailbox input */ short wrdbuf[11]; char chrbuf[OPC_BUFSIZ]; } reply; int status; int chars[3] = /* Desired terminal characteristics */ {0, TT$M_NOBRDCST, TT2$M_BRDCSTMBX}; short ft_chan; /* Pseudoterm channel */ short mbx_chan; /* & associated mailbox */ short iosb[4]; /* I/O status block */ /* Allocate I/O buffers for a pseudoterminal */ status = sys$expreg (6, &ret_addr, 0, 0); if ( !$VMS_STATUS_SUCCESS(status) ) return status; /* Create a pseudoterminal */ status = ptd$create (&ft_chan, 0, &chars, sizeof(chars), 0, 0, 0, &ret_addr); if ( !$VMS_STATUS_SUCCESS(status) ) return status; /* Get the pseudoterm's device name */ status = sys$getdviw (0, ft_chan, 0, &item_list, &iosb, 0, 0, 0); if ( !$VMS_STATUS_SUCCESS(status) ) return status; /* Create associated mailbox */ status = sys$crembx (0, &mbx_chan, OPC_BUFSIZ, OPC_BUFSIZ*2, 0x0ff00, 0, &mbxnam); if ( !$VMS_STATUS_SUCCESS(status) ) return status; status = sys$assign (&devnam, &ft_chan, 0, &mbxnam); if ( !$VMS_STATUS_SUCCESS(status) ) return status; memcpy (&msgbuf, &0, sizeof(msgbuf)); msgbuf.type = OPC$_RQ_TERME; msgbuf.enable[0] = 1; msgbuf.mask = 0x1ff; msgbuf.nlen = devnam.dsc$w_length; strncpy( &msgbuf.name[0], devnam_string, msgbuf.nlen ); status = sys$sndopr (&opc_d, 0); if ( !$VMS_STATUS_SUCCESS(status) ) return status; msgbuf.type = OPC$_RQ_STATUS; status = sys$sndopr (&opc_d, 0); if ( !$VMS_STATUS_SUCCESS(status) ) return status; for (;;) { status = sys$qiow (0, mbx_chan, IO$_READVBLK|IO$M_NOW, &iosb, 0, 0, &reply, OPC_BUFSIZ, 0, 0, 0, 0); if (iosb[1] == 0) break; if ( !$VMS_STATUS_SUCCESS(status) ) return status; if ( !$VMS_STATUS_SUCCESS(iosb[0]) ) return status; if ( reply.wrdbuf[0] == MSG$_TRMBRDCST ) { reply.chrbuf[reply.wrdbuf[10]] = 0; printf ("%s\n", &reply.chrbuf[0]); } } }