From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5037 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: adding errc to support sed (FreeBSD) Date: Sat, 3 May 2014 18:38:40 -0700 Message-ID: <20140504013840.GB513@muslin> References: <536582B8.5030304@midipix.org> <20140504000453.GA16268@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1399167525 7507 80.91.229.3 (4 May 2014 01:38:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 May 2014 01:38:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5041-gllmg-musl=m.gmane.org@lists.openwall.com Sun May 04 03:38:35 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WglNs-0006bk-5K for gllmg-musl@plane.gmane.org; Sun, 04 May 2014 03:38:28 +0200 Original-Received: (qmail 15932 invoked by uid 550); 4 May 2014 01:38:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15905 invoked from network); 4 May 2014 01:38:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ejut6wIzK7/iBDR4GMoNuZr09Vf3x7rz6me0CYzvVjI=; b=MdbmuvxU2Al0puLxUzRhJMVuEUmCSx6Ufs8fPmPFxb/qtG13uuZiKE7RC1PuhRUcW5 QnrNzTaA/7XFn7AlRR0UDc59RjWXNUWN73eah2EdsevFoxqfqOKnVmnGh7K2OqXhXao2 jXghPWzx+zLkUw+L14GPR8gIvMvv9pLHjVBLRZtzBPfhfQEHu0Ccqq9GwPlaDAXkBDdi uz5rNbaqFQr4dUCAQVnMtkoRdl8g1vtvpJg9pnRpLvPgTYypmbsgmfD2s1VZEqNYc27m t/aHanhxPk5SkEY2FJdn0r7h4nEpJip/nOMLsTB6kEguIZctZR9zUbf/E+eaopb0Y0xG CzKw== X-Received: by 10.66.162.74 with SMTP id xy10mr54190031pab.4.1399167494431; Sat, 03 May 2014 18:38:14 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140504000453.GA16268@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:5037 Archived-At: On Sat, May 03, 2014 at 08:04:53PM -0400, Rich Felker wrote: > On Sat, May 03, 2014 at 07:58:48PM -0400, writeonce@midipix.org wrote: > > Greetings, > > > > The FreeBSD implementation of sed uses errc; its implementation > > should probably be as simple as: > > > > _Noreturn void errc(int eval, int status, const char *fmt, ...) > > { > > va_list ap; > > va_start(ap, fmt); > > vwarnx(status, fmt, ap); > > va_end(ap); > > exit(eval); > > } > > What's the difference between this and other forms in err.h? Is there > a 'v' version of it too? > There's errc(), verrc(), warnc(), and vwarnc(). All the *c variants add "int code" before char *fmt (int status in the example above), which allows passing an error that is not stored in errno. eg: void errc(int eval, int code, const char *fmt, ...); void verrc(int eval, int code, const char *fmt, va_list args); void warnc(int code, const char *fmt, ...); void vwarnc(int code, const char *fmt, va_list args); > > The FreeBSD sed also needs a couple of macros that are currently not > > defined, specifically ALLPERMS, DEFFILEMODE and REG_STARTEND. Any > > reason not to add them when _BSD_SOURCE is defined? > > Where would these be defined? If they're in a junk header I'm not so > opposed to them, but musl aims to have a cleaner namespace than legacy > systems, whereas at least ALLPERMS and DEFFILEMODE are ugly and don't > fit any sort of namespace pattern. ALLPERMS and DEFFILEMODE are in sys/stat.h. ALLPERMS is 07777; DEFFILEMODE is 0666. REG_STARTEND is in regex.h. > > As for REG_STARTEND, is it an alias for some regex flag that already > exists, or a feature that would need to be implemented? It's an extension to POSIX that got mentioned here in January of last year; it reuses pmatch[0] to provide a start and end (so as to handle embedded nulls or start after n bytes). > Rich HTH, Isaac Dunham