Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the address of a DECWindows Terminal

SOLVED
Go to solution
Heinz W Genhart
Honored Contributor

How to get the address of a DECWindows Terminal

Hi all

I need the address of a DECWindows terminal within a C program.

I could create a temporary file with the following contents.

$ SHOW DISPLAY

Device: WSA397: [super]
Node: 172.16.150.4
Transport: TCPIP
Server: 0
Screen: 0

I could then open the file and get the address 172.16.150.4 without any problem.

But is there another, better way to do this ? Is there a $QIO Sensmode function, which helps me to do this ?

Regards

Heinz
6 REPLIES
Karl Rohwedder
Honored Contributor

Re: How to get the address of a DECWindows Terminal

I don't know if it possible with some systemcalls (1991 the wizard negates this question).
To avoid the tmp-file you may use:
$ pipe sh disp/sym | sho sym decw$display_node | (read sys$pipe tmp ; ass/job/nolog &tmp tmp)
and the translate the logical tmp in C.

regards Kalle
Joseph Huber_1
Honored Contributor
Solution

Re: How to get the address of a DECWindows Terminal


An example of undocumented IO$_SENSEMODE | IO$M_WS_DISPLAY once posted to c.o.v. can be found at
http://wwwvms.mppmu.mpg.de/vmssig/src/c/decw_show_display.c

As always: this may or may not work.

http://www.mpp.mpg.de/~huber
Heinz W Genhart
Honored Contributor

Re: How to get the address of a DECWindows Terminal

Thanks a lot

In the meantime (ITRC was not reachable yesterday!) I found a own solution similar to the one from Karl.

system("PIPE SHOW DISPLAY/SYMB > NL:");
strcpy(nodename, getenv("DECW$DISPLAY_NODE"));
strcpy(transport, getenv("DECW$DISPLAY_TRANSPORT"));

But the statement 'system' does a SPAWN. I dont like this solution by creating a subprocess for such things.

I use now the solution proposed by Joseph. This is exactly what I'm looking for. Thanks Joseph.
In the code from Joseph I found a small mistake. QIO delivers the length of a string in IOSB[2] and not in IOSB[1]. After doing this change it works as I expected.
Thanks a lot

Heinz

Heinz W Genhart
Honored Contributor

Re: How to get the address of a DECWindows Terminal

Thanks for providing a solution very fast. See my comments in the last message

Heinz
Joseph Huber_1
Honored Contributor

Re: How to get the address of a DECWindows Terminal


Since there were a lot of downloads for the above decw_show_display.c, I have corrected the error, and a small one in addition (terminating the string returned by QIO with ASCII zero before printing or returning to caller).

http://www.mpp.mpg.de/~huber
Wim Van den Wyngaert
Honored Contributor

Re: How to get the address of a DECWindows Terminal

Do not forget the server (I use that when using KEA!X) and screen fields (I don't use them) !

Wim
Wim