From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/6746 Path: main.gmane.org!not-for-mail From: Sudish Joseph Newsgroups: gmane.emacs.gnus.general Subject: Re: Is Username Expansion possible in GNUS? Date: 17 Jun 1996 22:38:45 -0400 Sender: sj@mindspring.com Message-ID: References: <199606171821.OAA21210@thuban.gsfc.nasa.gov> NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035147158 4603 80.91.224.250 (20 Oct 2002 20:52:38 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:52:38 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.7.5/8.6.9) with SMTP id TAA08820 for ; Mon, 17 Jun 1996 19:50:24 -0700 Original-Received: from atreides.erehwon.org (sj@user-168-121-167-78.dialup.mindspring.com [168.121.167.78]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Tue, 18 Jun 1996 04:35:21 +0200 Original-Received: (from sj@localhost) by atreides.erehwon.org (8.7.5/8.7.3) id WAA00383; Mon, 17 Jun 1996 22:38:46 -0400 Original-To: ding@ifi.uio.no In-Reply-To: "Edward J. Sabol"'s message of Mon, 17 Jun 1996 14:21:09 -0400 Original-Lines: 33 X-Mailer: Gnus v5.2.12/Emacs 19.31 Xref: main.gmane.org gmane.emacs.gnus.general:6746 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:6746 "Edward J. Sabol" writes: > It doesn't use getpwnam(3); instead it loads /etc/passwd into a > buffer and searches that. > > For large sites, one is more likely to use YP, NIS, NIS+, Ph, or > Kerberos to look up such information. In such case, I believe you Isn't getpwnam() supposed to work under all those conditions? Hallvard Furuseth's idea was cool, so I did it using perl. Not beautiful, but it works. -Sudish (defun getpwnam (name) "Results of getpwnam(name) as a list of 9 strings; nil on failure" (save-excursion (set-buffer (get-buffer-create " *getpwnam*")) (if (or (/= 0 (call-process "perl" nil t nil "-e" (format "print join ':', getpwnam('%s')" name))) (bobp)) (not (kill-buffer (current-buffer))) ; crockery (goto-char 1) (save-match-data (looking-at "\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\):\\(.*\\)") (let ((l (list (match-string 1) (match-string 2) (match-string 3) (match-string 4) (match-string 5) (match-string 6) (match-string 7) (match-string 8) (match-string 9)))) (kill-buffer (current-buffer)) l)))))