From owner-freebsd-current@FreeBSD.ORG Mon Jan 3 20:01:17 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0022B106566C for ; Mon, 3 Jan 2011 20:01:16 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (mail.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id D500B8FC12 for ; Mon, 3 Jan 2011 20:01:16 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id F2FCA5B30; Mon, 3 Jan 2011 11:53:50 -0800 (PST) To: Anonymous In-reply-to: Your message of "Mon, 03 Jan 2011 22:21:51 +0300." <8639p923ow.fsf@gmail.com> References: <4D1B0E41.40405@gmail.com> <4D21CC35.5060803@gmx.de> <20110103141830.GC3140@deviant.kiev.zoral.com.ua> <47B52F19-AB6B-4116-9F5E-219B26519115@FreeBSD.org> <86vd256e85.fsf@gmail.com> <20110103190245.4AA005B30@mail.bitblocks.com> <8639p923ow.fsf@gmail.com> Comments: In-reply-to Anonymous message dated "Mon, 03 Jan 2011 22:21:51 +0300." Date: Mon, 03 Jan 2011 11:53:50 -0800 From: Bakul Shah Message-Id: <20110103195350.F2FCA5B30@mail.bitblocks.com> Cc: freebsd-current@freebsd.org Subject: Re: No human readable message with g_vfs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jan 2011 20:01:17 -0000 On Mon, 03 Jan 2011 22:21:51 +0300 Anonymous wrote: > Bakul Shah writes: > > > On Mon, 03 Jan 2011 21:20:42 +0300 Anonymous wrote: > >>=20 > >> Do you mean perror(1)? > >>=20 > >> $ perror 5 > >> Input/output error > > > > I prefer mine: > > > > $ errno () { grep "^#.*\\<$*\\>" /usr/include/sys/errno.h } > > $ errno 5 > > #define EIO 5 /* Input/output error */ > > $ errno EIO > > #define EIO 5 /* Input/output error */ > > perror(1) displays localized messages > > $ LANG=3Dja_JP.UTF-8 perror 5 > =E5=85=A5=E5=87=BA=E5=8A=9B=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=A7=E3=81=99 > > $ LANG=3Duk_UA.UTF-8 perror 5 > =D0=9F=D0=BE=D0=BC=D0=B8=D0=BB=D0=BA=D0=B0 =D0=B2=D0=B2=D0=BE=D0=B4=D1=83= > -=D0=B2=D0=B8=D0=B2=D0=BE=D0=B4=D1=83 Yes, definitely useful. Perhaps strerror would be a better name? > but I have to agree that knowing errno macro is useful And you can use grep tricks :-) $ errno '[dD]evice' #define ENXIO 6 /* Device not configured */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device busy */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* Operation not supported by device */ #define ENOTTY 25 /* Inappropriate ioctl for device */ #define ENOSPC 28 /* No space left on device */