www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.syserror on linux

I noticed that syserror only works for Win32... thats no good!  Since all
the linux error codes are conveniently stored in errno.h, I hacked
together a sed script to put an edited copy (take out the lines that have
macros in them) to output something that can be inserted into the switch.
I don't know how standard the errno.h with my kernel (2.6.x) is, and I'm
assuming that it hasn't changed too much.

Here's the sed:
sed -e 's/#define[ \t]*E[A-Z0-9]*[ \t]*/case /' -e 's/[ \t]\/*\*[ \t]*/:
result="/' -e 's/[ \t]*\*\//"; break;/'

My modified std.syserror

Any good?

I should add that I haven't tested it on windoze (since I don't own it)
but I'm relatively sure it'll still work on windows.

Jun 25 2004