Jeremy Lea wrote:
> On Tue, May 14, 2002 at 04:19:29PM +0300, Maxim Sobolev wrote:
> > +++ version/perform.c 14 May 2002 12:41:41 -0000
> > [...]
> > + strlcpy(tmp, PORTS_DIR, PATH_MAX);
> > + strlcat(tmp, "/INDEX", PATH_MAX);
> > I'd suggest snprintf(3)
> Yeah. Like I said, it needs a bit of polishing. I tend to do things
> this way while I'm developing because I find it easier to keep track of
> what's going where in the string. There's also a bunch of places where
> the 'l' versions aren't needed...
Tastes differ, granted, but your version is inconsistent with the
existing coding style of pkg_install, where snprintf's are used in
> > Why noy use matchinstalled() which do something similar?
> I looked at it, but it was taking more code to make it work than to
> duplicate it because the -s flag is not a regex or a globing pattern.
> It's a poorly designed interface... Now that it's working I'll look at
> it again and see if I can get it to do the right thing. Simplifying
> working code is a lot easier than building it.
In this case you just need to call matchinstalled(MATCH_ALL, NULL,
NULL) and iterate over results, just like you do with your fts_read()
loop. This should make code a bit cleaner and more compact.
> > + funny:
> > + warnx("This is a very funny looking INDEX!");
> > + return 1;
> > I don't think this is a good choice for an error message.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message