[comp.windows.x] How do you get the IP addr for the DISPLAY var?

dalka@cbnewsc.att.com (kenneth.j.dalka) (04/03/91)

I'm using an X windowing terminal with a UNIX system V machine and I'd like
to set the DISPLAY variable automatically from a shell script (or C program).
The problem is that I'd like to make it terminal independent. Rather that
setting some pre determined IP address in my .profile, I'd like to be able
to walk down the hall and log on with some other terminal if need be. The
only way I can see that this would work is if I could somehow ask UNIX
what my IP address is. It must know because I can login and talk to unix
before I get to X. If UNIX can send characters back to me, then it knows
where I am. But I can't find any place in UNIX where the info is stored.

PS. I don't want some dumb shell to ask me to type in my IP as I login.
-- 

					Ken Dalka (Bell Labs)
					att!ihlpf!dalka
					IHC 1U-228 (708) 305-4449

dalka@cbnewsc.att.com (kenneth.j.dalka) (04/04/91)

From article <1991Apr3.144934.13473@cbnewsc.att.com>, by dalka@cbnewsc.att.com (kenneth.j.dalka):
> 
> I'm using an X windowing terminal with a UNIX system V machine and I'd like
> to set the DISPLAY variable automatically from a shell script (or C program).
> The problem is that I'd like to make it terminal independent. Rather that
> setting some pre determined IP address in my .profile, I'd like to be able
> to walk down the hall and log on with some other terminal if need be. The
> only way I can see that this would work is if I could somehow ask UNIX
> what my IP address is. It must know because I can login and talk to unix
> before I get to X. If UNIX can send characters back to me, then it knows
> where I am. But I can't find any place in UNIX where the info is stored.
> 
> PS. I don't want some dumb shell to ask me to type in my IP as I login.
> -- 
> 
> 					Ken Dalka (Bell Labs)
> 					att!ihlpf!dalka
> 					IHC 1U-228 (708) 305-4449


I got a number of mail responses to this article and I guess I wasn't clear
about one main point. The X windowing terminal I am talking about is NOT
a workstation. It is a AT&T 730X. This is one of a few X terminals on the
market that only have enough smarts to run the X server in ROM. This terminal
does not run UNIX. I still have to login to some machine to run my
applications. If I run "hostname" I do not get the name of the terminal. I get
the name of the UNIX system I logged in to. I need the IP address of the 
terminal.

I did get one response that suggested I look into the utmp file. This
seems to be a BSD feature and does not exists in System V. This does solve
my problem when I login to a SUN. Unfortunately I have both a System V machine
and a SUN I need to login to. 

Anybody got any other suggestions? Thanks for the responses I've gotten so 
far.
-- 

					Ken Dalka (Bell Labs)
					att!ihlpf!dalka
					IHC 1U-228 (708) 305-4449