delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/02/09/11:31:49

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=KYNyazT1UEzwSnL88im70FtgQBEeopUg36yUgOdK3JM
bDJ49eqQs7HDqgFmKUPddd9Mftl7/ark7hapHoi0ANfvYfEUuG7awQ+sk5VvoZUD
SFYq2Kg5t+UyIadthv6epSK2cXpXytcLI3dLxJjCVC/akjKbq/TzY7YO5jlcnAYk
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=wBe/CJ5r0lkqEApv4pQbNZcIs4k=; b=vz9MOl8o0Yr1C5M70
3MXyPtY0ccvKMoZ3KMYH2msb2Fo2bpGtAVNsKAEAlRNzymNcuKMpRr+TMtAy/V30
AX5BAQcW7t+COmGfag7kS/+0g5NU9Vtbn7nlZOdzbClPQU3XeYAtArhEzodrdZal
HqQE12GWFIhoSEHAZ1/e5XHFp4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2
X-HELO: limerock03.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
Message-ID: <52F7AD54.60901@cornell.edu>
Date: Sun, 09 Feb 2014 11:31:16 -0500
From: Ken Brown <kbrown AT cornell DOT edu>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)
References: <52F339CA DOT 5070305 AT gmail DOT com> <20140206090117 DOT GD2821 AT calimero DOT vinschen DOT de> <52F361C5 DOT 3000807 AT gmail DOT com> <20140206141321 DOT GI2821 AT calimero DOT vinschen DOT de> <52F40208 DOT 5030901 AT etr-usa DOT com> <20140207094917 DOT GN2821 AT calimero DOT vinschen DOT de> <52F4E540 DOT 2010606 AT tiscali DOT co DOT uk> <52F51D19 DOT 6080807 AT etr-usa DOT com> <31347914-BB4F-4039-984B-731B6C72F903 AT etr-usa DOT com> <20140209161045 DOT GC2821 AT calimero DOT vinschen DOT de> <20140209161609 DOT GD2821 AT calimero DOT vinschen DOT de>
In-Reply-To: <20140209161609.GD2821@calimero.vinschen.de>
X-IsSubscribed: yes

On 2/9/2014 11:16 AM, Corinna Vinschen wrote:
> On Feb  9 17:10, Corinna Vinschen wrote:
>> On Feb  9 08:45, Warren Young wrote:
>>> On Feb 7, 2014, at 10:51 AM, Warren Young <warren AT etr-usa DOT com> wrote:
>>>
>>>> Here's a better check that doesn't give false positives:
>>>>
>>>>     $ cat <<END > checkfile
>>>>     #!/bin/sh
>>>>     if egrep -q '_getgrent(32|64)' "$1" ; then echo $1 ; fi
>>>>     END
>>>>     $ find /bin -name \*.exe -exec ./checkfile {} \;
>>>
>>> The strings(1) call got left out of that test.  Here’s a working variant, which tests for getpwent() calls instead:
>>>
>>>      $ cat <<END > checkfile
>>>      if strings "$1" | egrep -q '^getpwent$' ; then echo $1 ; fi
>>>      END
>>>      $ find /bin -name \*.exe -exec sh checkfile {} \;
>>>
>>> Alas, Vim *does* call this API.  Results:
>>
>> It does so to evaluate a ~user in a path and I guess that's what other
>> apps do as well.  This is kind of weird since it would obviously not be
>> necessary to enumerate accounts for this functionality:
>>
>>    if (~ in path)
>>      if (~ is solo)
>>        getpwuid(getuid ())
>>      else
>>        getpwname (username after the ~);
>
> Huh, even though tcsh calls getpwent as well, this works fine:
>
>    $ cd ~foo
>
> with foo being some not yet cached user name.
>
> However, with my current code this:
>
>    $ cd ~<TAB>
>
> only returns the cached user entries.

emacs uses getpwent (on systems that provide it) for a similar reason: 
to provide tab completion on commands that expect a user name.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019