home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 22109 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.7 KB  |  122 lines

  1. Path: sparky!uunet!wupost!news.ecn.bgu.edu!mp.cs.niu.edu!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!spool.mu.edu!agate!ucbvax!TGV.COM!mahan
  2. From: mahan@TGV.COM (Patrick L. Mahan)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: Tracking DECW$DISPLAY
  5. Message-ID: <930126111628.2d200242@TGV.COM>
  6. Date: 26 Jan 93 19:16:28 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 110
  11.  
  12. In <01GTXUFF9BMA8ZDVA9@POMONA.CLAREMONT.EDU> GREG@POMONA.CLAREMONT.EDU writes:
  13. #
  14. # Is there any way (such as a code to $GETDVI) to examine a _WSAn: device
  15. # created with the SET DISPLAY command and determine what node it points
  16. # to (ie the value of the /NODE qualifier to the SET DISPLAY)?
  17.  
  18. Below the signature is a quick a simple program called WSA.C that allows
  19. you to programmically retrieve the values stored in the UCB of the WSA
  20. device.  I take no credit for this code.  It was written by John McMahon
  21. of TGV, Inc.
  22.  
  23. --
  24. Patrick L. Mahan
  25.  
  26. --- TGV Window Washer ------------------------------- Mahan@TGV.COM ---------
  27.  
  28. Waking a person unnecessarily should not be considered  - Lazarus Long
  29. a capital crime.  For a first offense, that is            From the Notebooks of
  30.                               Lazarus Long
  31.  
  32. =================================== WSA.H ====================================
  33. #define IO$M_WS_DISPLAY 64
  34. #define    DECW$C_WS_DSP_NODE 1
  35. #define    DECW$C_WS_DSP_TRANSPORT 2
  36. #define    DECW$C_WS_DSP_SERVER 3
  37. #define    DECW$C_WS_DSP_SCREEN 4
  38.  
  39. =================================== WSA.C ====================================
  40. #include "wsa.h"
  41. #include <ssdef>
  42. #include <iodef>
  43. main()
  44. {
  45.     unsigned int     status;
  46.     extern int     sys$assign();
  47.     extern int     sys$qiow();     
  48.     unsigned int     channel;
  49.     char         node_name[255];
  50.     char        server_name[255];
  51.     char        transport_name[255];
  52.     char        screen_name[255];
  53.     char        output_string[1024];
  54.     unsigned long    iosb[2];
  55.  
  56. /* Input - display_name is a descriptor containing the logical name/device
  57.    of the display */
  58.  
  59.     int        display_name[2];
  60.     char *        display_name_string = "DECW$DISPLAY";
  61.  
  62.     display_name[0] = strlen(display_name_string);
  63.     display_name[1] = display_name_string;
  64.  
  65. /* Assign a channel to the device */
  66.  
  67.     status = sys$assign(&display_name,&channel,0,0);
  68.     if (status != SS$_NORMAL) exit(status);
  69.  
  70. /* Get the node information */
  71.  
  72.     status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
  73.                          node_name,sizeof(node_name),DECW$C_WS_DSP_NODE,0,0,0);
  74.     if (status != SS$_NORMAL) exit(status);
  75.     if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
  76.     node_name[iosb[1]] = 0;
  77.  
  78. /* Get the transport information */
  79.  
  80.     status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
  81.                          transport_name,sizeof(transport_name),
  82.              DECW$C_WS_DSP_TRANSPORT,
  83.                          0,0,0);
  84.     if (status != SS$_NORMAL) exit(status);
  85.     if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
  86.     transport_name[iosb[1]] = 0;
  87.  
  88. /* Get the server information */
  89.  
  90.     status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
  91.                          server_name,sizeof(server_name),
  92.              DECW$C_WS_DSP_SERVER,0,0,0);
  93.     if (status != SS$_NORMAL) exit(status);
  94.     if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
  95.     server_name[iosb[1]] = 0;
  96.  
  97. /* Get the screen information */
  98.  
  99.     status = sys$qiow(0,channel,IO$_SENSEMODE|IO$M_WS_DISPLAY,&iosb,0,0,
  100.                          screen_name,sizeof(screen_name),DECW$C_WS_DSP_SCREEN,
  101.                  0,0,0);
  102.     if (status != SS$_NORMAL) exit(status);
  103.     if (iosb[0] != SS$_NORMAL) exit(iosb[0]);
  104.     screen_name[iosb[1]] = 0;
  105.  
  106. /* get rid of the channel */
  107.  
  108.     status = sys$dassgn(channel);
  109.     if (status != SS$_NORMAL) exit(status);
  110.  
  111. /* build the output string */
  112.  
  113.     sprintf(output_string,"%s/%s/%s/%s",node_name,transport_name,
  114.         server_name,screen_name);
  115.     printf("%s\n",output_string);
  116.  
  117.     exit(SS$_NORMAL);
  118.     
  119. }
  120.  
  121.  
  122.