Sfinx software tree - getscreen

Getscreen is an utility that tries to figure out behind which screen a user is sitting. It then has further options to search a database for the room number of this screen, and the closest printer (maybe entries for closest DAT drive etc. will be added in the future).

The program takes the options -screen (the default), -room (print room number), -printer (closest printer), -all (all of these options). If the option starts with +, it is removed from the list. E.g.

  getscreen -all +room
will print screen and printer, e.g.
  fluor hp5

The option -verbose can be used to get some explanatory text in the output, like:

   Screen: fluor  Printer: hp5

All options can be abbreviated.

A useful application of this utility is the following: a user might include in his/her .login file:

  setenv PRINTER `getscreen -printer`
  echo "Default printer is '$PRINTER'"
This will ensure that the printer closest to the user's screen is used, in stead of the system default (which, currently, is the printer closest to the workstation console).

Some notes about the algorithm

How does getscreen determine which screen you use ? Well, under X it is easy: just strip the :0.0 (or whatever number) from the DISPLAY variable.

For other environments, other tricks are used. The first method is to look in the list of most recent logins, using last (/etc/last -R on HP) and search for the right user name - tty combination. This will usually give the source of the login, e.g. the name of a PC or the machine you did a rlogin or telnet from.

However, this will not work in many cases, since it can only trace one step back in a chain of rlogins. It is highly recommended to use getscreen only in combination with Rlogin, the enhanced version of rlogin available in Sfinx. Or, on a PC, open a new session on another machine, in stead of using rlogin or telent from one workstation to another.


David.Jansen@strw.leidenuniv.nl
Last modified: Thu Apr 4 10:10:54 MET DST 1996