[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: errorcode.inc in tarballs

From: James McCoy <jamessan_at_jamessan.com>
Date: Thu, 10 Aug 2017 15:48:13 -0400

On Aug 10, 2017 15:29, "Philip Martin" <philip_at_codematters.co.uk> wrote:

Branko ─îibej <brane_at_apache.org> writes:

> Would be better to generate this header at build time ... but to do that
> in a cross-platform manner, we'd have to write a C program to do that.

Even that is hard, I know of no easy way for C code to convert an error
number into a symbolic name. Going from names to numbers would require
us to know, and hard-code, the names.

One way to convert numbers to names is to parse the C header, which on
my Linux system involves following several include directives to find
the underlying files:

  awk '/#define\sE.*[0-9]/{printf "{%s, \"%s\"},\n", $3, $2 }' \
    /usr/include/asm-generic/errno-base.h \

The approach that moreutils'[0] errno utility takes[1] looks useful.

[0]: https://joeyh.name/code/moreutils/
[1]: https://sources.debian.net/src/moreutils/0.60-1/Makefile/#L41-L45 to
generate the array consumed by

Received on 2017-08-10 21:48:27 CEST

This is an archived mail posted to the Subversion Dev mailing list.