summaryrefslogtreecommitdiff
path: root/err.c
diff options
context:
space:
mode:
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]);
+ }
+}