From owner-freebsd-current Tue May 14 7: 7:52 2002 Delivered-To: freebsd-current@freebsd.org Received: from shale.csir.co.za (shale.csir.co.za [146.64.46.5]) by hub.freebsd.org (Postfix) with ESMTP id D816D37B403; Tue, 14 May 2002 07:07:35 -0700 (PDT) Received: (from reg@localhost) by shale.csir.co.za (8.11.6/8.11.6) id g4EE7El15811; Tue, 14 May 2002 16:07:14 +0200 (SAT) (envelope-from reg) Date: Tue, 14 May 2002 16:07:14 +0200 From: Jeremy Lea To: Maxim Sobolev Cc: "Bruce A. Mah" , current@FreeBSD.org, ports@FreeBSD.org Subject: Re: pkg_version in C [was: Re: Perl scripts that need rewriting - Progress!] Message-ID: <20020514160714.D13083@shale.csir.co.za> References: <200205091933.g49JXMjV041629@grimreaper.grondar.org> <20020514145039.B13083@shale.csir.co.za> <3CE10EE1.27F9718@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <3CE10EE1.27F9718@FreeBSD.org>; from sobomax@FreeBSD.org on Tue, May 14, 2002 at 04:19:29PM +0300 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, 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... > 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. > + funny: > + warnx("This is a very funny looking INDEX!"); > + return 1; > > I don't think this is a good choice for an error message. ;-) Regards, -Jeremy -- FreeBSD - Because the best things in life are free... http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message