1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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]);
}
}
|