Can I read someone else's environment?

Jim Webb jrw at hropus.UUCP
Fri Jun 20 03:24:08 AEST 1986


> I just kludged together a message system that puts a short note on the
> alert line (#25) of someone else's terminal.  This is preferable to
> write(1) for us, since we are usually editing files when a message
> scrambles the screen.  For hard-wired terminals I can get the terminal
> type from /etc/ttytypes, but is there any way I can read the terminal
> type for a dial-up line so that I know what escape codes to send?

If you have a nice system administrator, you could hack up the ps command
to look at the environment (it is passed right after the arguments to the
command) of the person's commands.  It should be noted that the person
needs to be running something other than his/her shell, as it usually
has just HOME, PATH, and SHELL set in it, everything else, namely TERM,
is set by the shell and is not part of its "environ" environment, but
rather these are stored in its data segment and passed to all children.

Just look at the code for the -f option and the rest should be quite
trivial.
-- 
Jim Webb                                        ihnp4!houxm!hropus!jrw



More information about the Comp.unix mailing list