/ entropy-gathering / check-dict.c
check-dict.c
 1  #include <stdio.h>
 2  #include <inttypes.h>
 3  
 4  #include <descrip.h>
 5  #include <stsdef.h>
 6  #include <ssdef.h>
 7  #include <starlet.h>
 8  #include <efndef.h>
 9  #include <iledef.h>
10  #include <iosbdef.h>
11  #include <lib$routines.h>
12  #include "dict.h"
13  
14  #define errchk_ret(arg) if (!($VMS_STATUS_SUCCESS((arg)))) return (arg)
15  
16  int main()
17  {
18    int i, j;
19    ile3 null_item;
20    const $DESCRIPTOR(SYSDEVICE,"SYS$SYSDEVICE:");
21  
22    null_item.ile3$w_code = 0;
23    null_item.ile3$w_length = 0;
24    null_item.ile3$ps_bufaddr = NULL;
25    null_item.ile3$ps_retlen_addr = NULL;
26  
27    for (i = 0; i < dicts(); i++)
28      for (j = 0; j < num_items(i); j++) {
29        uint32_t status;
30        uint32_t efn;
31        iosb iosb;
32        ile3 itms[2];
33  
34        itms[0] = items(i)[j];
35        itms[1] = null_item;
36  
37        switch(i) {
38        case 0:			/* DVI */
39  	status = sys$getdviw(EFN$C_ENF, 0, &SYSDEVICE, itms, 0, 0, 0, 0, 0);
40  	break;
41        case 1:			/* JPI */
42  	status = sys$getjpiw(EFN$C_ENF, 0, 0, itms, 0, 0, 0);
43  	break;
44        case 2:			/* RMI */
45  	{
46  	  uint32_t status2;
47  	  /*
48  	   * The RMI service is a bit special, as there is no synchronous
49  	   * variant, so we MUST create an event flag to synchronise on.
50  	   */
51  	  status2 = lib$get_ef(&efn);
52  	  errchk_ret(status2);
53  	  status2 = sys$getrmi(EFN$C_ENF, 0, 0, itms, &iosb, 0, 0);
54  	  errchk_ret(status2);
55  	  status2 = sys$synch(efn, &iosb);
56  	  errchk_ret(status2);
57  	  status = iosb.iosb$l_getxxi_status;
58  	  status2 = lib$free_ef(&efn);
59  	  errchk_ret(status2);
60  	}
61  	break;
62        case 3:			/* SYI */
63  	status = sys$getsyiw(EFN$C_ENF, 0, 0, itms, 0, 0, 0);
64  	break;
65        }
66  
67  #ifndef DEBUG
68        if (!($VMS_STATUS_SUCCESS(status)))
69  #endif
70  	fprintf(stderr, "%s (%u) : %u\n",
71  		item_name(i, itms[0].ile3$w_code), itms[0].ile3$w_code,
72  		status);
73      }
74  }