This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)


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@etr-usa.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.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpeU9r2EsZCs.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]