chris@minnie.UUCP (Chris Grevstad) (03/25/86)
Running 4.2BSD on an Integrated Solutions 68010 machine. What I would like to know is if there is some way for a process to examine the environment of a non-related process. What I want in particular is a way to determine, from an external process, a terminal's type without resorting to the possibly inaccurate file /etc/ttytype. The examining process is running as root. NOTE: This is NOT the case of a process trying to determine it's own environment. Thanks for any advice that you can give me. -- Chris Grevstad {sdcsvax,hplabs}!sdcrdcf!psivax!nrcvax!chris ucbvax!calma!nrcvax!chris ihnp4!nrcvax!chris "No, I'll tell you the truth. She was a striptease dancer. I saw her first in an obscene movie, one of those things in obscenacolor. Naked of course. They had a Kodiak bear strapped to a table, muzzled..."
mcb@styx.UUCP (Michael C. Berch) (04/09/86)
In article <171@minnie.UUCP> chris@minnie.UUCP (Chris Grevstad) writes: > Running 4.2BSD on an Integrated Solutions 68010 machine. What I would > like to know is if there is some way for a process to examine the > environment of a non-related process. What I want in particular is a > way to determine, from an external process, a terminal's type without > resorting to the possibly inaccurate file /etc/ttytype. > The examining process is running as root. There's undoubtedly a more elegant way to do this, but you can get the entire environment of a process using the 'e' option of ps(1). (i.e., "ps ewwNNNNN" where NNNNN is the process number. The 'ww' is to get the "widest" display so the lengthy string is not truncated. This is known to work on a VAX 780 running 4.2BSD. You can fork off a ps(1) and read the output through a pipe, muck around in the result to find TERM, and you're off to the races! Michael C. Berch Control Data Corp. / Lawrence Livermore Natl. Laboratory ARPA: mcb@lll-tis-b.ARPA UUCP: {ihnp4,dual}!lll-lcc!styx!mcb