summaryrefslogtreecommitdiff
path: root/errno
diff options
context:
space:
mode:
Diffstat (limited to 'errno')
-rwxr-xr-xerrno20
1 files changed, 20 insertions, 0 deletions
diff --git a/errno b/errno
new file mode 100755
index 0000000..d801faa
--- /dev/null
+++ b/errno
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import errno
+import os
+import sys
+
+toname = dict((str(getattr(errno, x)), x)
+ for x in dir(errno)
+ if x.startswith("E"))
+tocode = dict((x, getattr(errno, x))
+ for x in dir(errno)
+ if x.startswith("E"))
+
+for arg in sys.argv[1:]:
+ if arg in tocode:
+ print arg, tocode[arg], os.strerror(tocode[arg])
+ elif arg in toname:
+ print toname[arg], arg, os.strerror(int(arg))
+ else:
+ print "Unknown:", arg