Log in

Registration

Lars Wirzenius: errno lookups on the command line

Posted: June 5, 2012 / in: Linux / No comments

I’ve had a little command line tool called

1
errno

for many years now.
It’s a short Python script, and lets me look up Unix

1
errno

names and values
given values or names.


1
2
3
4
5
$ errno 2
ENOENT 2 No such file or directory
$ errno EEXIST
EEXIST 17 File exists
$

This is occasionally very useful when reading logs from various programs.
I thought it might be useful for others as well, so I decided to rewrite
it in C so I can offer it to become part of
moreutils.

It is now in the master branch of moreutils.

Today I added a couple of options:

1
--list

lists all the

1
errno

values,
and

1
--search

does a full text (case insensitive) search of all
descriptions. I also added a script that lets you do the search in all
installed locales. (These changes are waiting for Joey to merge them.
Meanwhile, they’re at
gitorious.)


1
2
3
4
5
6
$ errno-all onnistu | sort -u
EDEADLOCK 0 Onnistui
ENOMEM 12 Muistin varaaminen ei onnistu
ENOTSUP 0 Onnistui
EWOULDBLOCK 0 Onnistui
$

(That’s Finnish.)

Hopefully others will find this useful as well.

Article source: Go to Source
Feed source: http://planet.debian.org/rss20.xml
License: The original licenses are retained – MIT (Expat) License

© Copyrights and Licenses, 2014 - Linux-Support.com The Professional Linux and OSS Services Portal