summaryrefslogtreecommitdiff
path: root/err.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2007-03-04 18:35:36 +0000
committerIan C <ianc@noddybox.co.uk>2007-03-04 18:35:36 +0000
commit954af9179665457b40453a0417ddf5b3949a0449 (patch)
treee3772817de5c79e29b602ebe47fe0129793f1470 /err.c
parent892e6e107dbf2386831bd00e7f1c2a0bbe8b2cbb (diff)
This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'err.c')
-rw-r--r--err.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/err.c b/err.c
new file mode 100644
index 0000000..2ae6008
--- /dev/null
+++ b/err.c
@@ -0,0 +1,36 @@
+/* Report Unix errors */
+#include <stdio.h>
+#include <errno.h>
+
+#if 0
+extern int sys_nerr;
+extern char *sys_errlist[];
+#endif
+
+main(argc,argv)
+int argc;
+char *argv[];
+
+{
+ int f,n;
+
+ if (argc==1)
+ {
+ fprintf(stderr,"%s:usage %s -t|err1 [.. errn]\n",argv[0],argv[0]);
+ exit(1);
+ }
+
+ if (!strcmp(argv[1],"-t"))
+ for(f=0;f<sys_nerr;f++)
+ printf("%3d : %s\n",f,sys_errlist[f]);
+ else
+ for(f=1;f<argc;f++)
+ {
+ n=strtol(argv[f],(char **)NULL,0);
+
+ if(n>=sys_nerr)
+ fprintf(stderr,"%s:errcode %d invalid!\n",argv[0],n);
+ else
+ printf("%3d : %s\n",n,sys_errlist[n]);
+ }
+}