Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!tuegate.tue.nl!tuewsd!wswietse From: wswietse@lso.win.tue.nl (Wietse Venema) Newsgroups: comp.unix.questions Subject: Re: Finding your remote host's name Message-ID: <1216@tuewsd.win.tue.nl> Date: 8 Jun 90 12:06:49 GMT References: <1990Jun6.091842.11335@dlcq15.datlog.co.uk> <1211@tuewsd.win.tue.nl> Sender: wswietse@win.tue.nl (Wietse Venema) Organization: Eindhoven University of Technology, The Netherlands Lines: 8 In article <1211@tuewsd.win.tue.nl> I write: > if (getpeername(0, &sa, &length) >= 0) { to obtain the name of the host one is logged in from. Obviously, this does not work when stdin is connected to a pty. Oops. Good thing this ain't comp.unix.wizards.