Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!zephyr!tektronix!tekcrl!trost From: trost@crl.labs.tek.com (Bill Trost) Newsgroups: gnu.emacs Subject: finger.el Message-ID: <4341@tekcrl.LABS.TEK.COM> Date: 19 Jul 89 22:13:19 GMT Sender: ftp@tekcrl.LABS.TEK.COM Lines: 41 I posted this locally to tek without any reaction locally, so I guess that means I can foist it off on the rest of the world.... Here's a little function that uses the TCP stuff to talk to finger daemons. Lots more pleasant than running who in a subshell or users.el or any of those other hacks. It was mostly inspired by the fact that finger doesn't work on Tektronix boxes.... Enjoy! (defun finger (who) "Display information about users." (interactive "sFinger: ") (cond ((null who) (setq who "@localhost")) ((not (string-match "@" who)) (setq who (concat who "@localhost")))) (with-output-to-temp-buffer "*finger*" (let ((stream (open-network-stream "finger" "*finger*" (substring who (1+ (string-match "@" who))) "finger"))) (set-process-filter stream 'finger-process-filter) (set-process-sentinel stream 'ignore) (process-send-string stream (concat (substring who 0 (string-match "@" who)) "\n"))))) (defun finger-process-filter (process s) (save-excursion (set-buffer (process-buffer process)) (while (< 0 (length s)) (let ((l (string-match "\r" s))) (insert (substring s 0 l)) (setq s (cond (l (substring s (1+ l))) (t ""))))))) Bill Trost, Computer Research Labs, Tektronix trost@crl.labs.tek.com / tektronix!crl.labs!trost (trost@reed.bitnet, but probably tektronix!reed!trost)