home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
- From: etxmesa@eos.ericsson.se (Michael Salmon)
- Subject: Re: how do I know on which console I work ?
- Message-ID: <1992Nov19.094105.5693@ericsson.se>
- Sender: news@ericsson.se
- Nntp-Posting-Host: eos6c02.ericsson.se
- Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
- Organization: Ericsson Telecom AB
- References: <1992Nov18.155304.736@vms.huji.ac.il>
- Distribution: comp.unix.questions,world
- Date: Thu, 19 Nov 1992 09:41:05 GMT
- Lines: 87
-
- In article <1992Nov18.155304.736@vms.huji.ac.il>, errera@shum.cc.huji.ac.il (errera alfred) writes:
- |> Hello.
- |> We have a system of some SPARC 1 & 2 and some sun386i used as X terminal.
- |> We do a lot of rlogin from one machine to another .
- |> My question is : how do I know what is the console I work on?
- |> namely how do I know the right setting for the DISPLAY variable so that
- |> X programs will run on my display even when I do rlogin ?
- |> please email or post the answer.
- |> thanks a lot.
- |> Eliel
- |> errera@shum.cc.huji.ac.il
-
- This is a repost. I have since used this technique very successfully.
- There is a catch though. Some systems only store the first 16
- characters of the remote sites name and that can cause a problem.
-
- In article <3842@bimacs.BITNET>
- yedidya@bimacs.BITNET (Yedidya Israel) writes:
- >
- >Hello net.
- >
- >Can I get help with writing a script that will define my DISPLAY
- >environment variable from .cshrc according to the environment I
- >telnetted/rlogined from.
- >
- >I.e. if I telnet from a regular terminal (say vt100) then do not
- >define $DISPLAY at all. If I telnet from an xterm or dxterm or aixterm
- >X environments define my $DISPLAY to the existing one (if exists) or
- >derive it from who am i.
-
- On our Apollo (BSD) systems I do:
-
- set host = `hostname`
- #
- # Set the default X Windows server name - set to the name of the host
- # the user logged in from, unless it was the terminal server (tserver).
- # Also strip off the local domain name (.chem.utoronto.ca) if possible.
- #
- setenv DISPLAY "${host}:0"
- set displayhost=`who am i | sed -e 's/.*(//' -e 's/).*$//' -e 's/\.chem\.utoronto\.ca$//'`
- if ("$#displayhost" == "1") then
- if ("$displayhost" != "tserver") then
- setenv DISPLAY $displayhost\:0
- endif
- endif
- unset displayhost
-
- and on our HP (SYSV-sortof) systems I do:
-
- set host = `hostname`
- #
- # Set the default X Windows server name - set to the name of the host
- # the user logged in from, unless it was the terminal server (tserver).
- # Also strip off the local domain name (.chem.utoronto.ca) if possible.
- #
- setenv DISPLAY "${host}:0"
- tty -s
- if ("$status" == "0") then
- set displayhost=`who am i -R | sed -e 's/.*(//' -e 's/).*$//' -e 's/\.chem\.utoronto\.ca$//'`
- if ("$#displayhost" == "1") then
- if ("$displayhost" != "tserver") then
- setenv DISPLAY $displayhost\:0
- endif
- endif
- unset displayhost
- endif
-
- You will have to surround this with code to only do it for $TERM types
- you want. You'll just have to trust the user hasn't messed with $TERM;
- if the wrong $TERM is propagated from the remote system, tough luck for
- the user. It is possible to send some messages to some terminals
- and check the response (this works for vt100/xterm) so that might be
- a way to check out the terminal type.
- --
- What are the chances that any computer system will ever "work" properly?
- ... and Slim just left town. -*- Mike Peterson, SysAdmin, U/Toronto Chemistry
-
- --
-
- Michael Salmon
-
- #include <standard.disclaimer>
- #include <witty.saying>
- #include <fancy.pseudo.graphics>
-
- Ericsson Telecom AB
- Stockholm
-