2024-12-11 12:45:26 +01:00
|
|
|
#include <locale.h>
|
1997-12-05 09:39:46 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2003-02-14 12:59:43 +01:00
|
|
|
#include "errno_list.h"
|
|
|
|
|
2003-02-27 14:28:45 +01:00
|
|
|
char errno_c_rcs_id[] = "$Id: errno.c,v 1.5 2003-02-27 13:28:45 hjp Exp $";
|
1997-12-05 09:39:46 +01:00
|
|
|
char *cmnd;
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int i;
|
|
|
|
|
2024-12-11 12:45:26 +01:00
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
|
1997-12-05 09:39:46 +01:00
|
|
|
cmnd = argv[0];
|
|
|
|
|
1999-07-09 23:04:43 +02:00
|
|
|
if (argc <= 1) {
|
2003-02-14 12:59:43 +01:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < wke_nr; i++) {
|
|
|
|
int e = wke[i].number;
|
|
|
|
char *d = wke[i].define;
|
|
|
|
printf("%d\t%s\t%s\n", e, d, strerror(e));
|
1999-07-09 23:04:43 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 1; i < argc; i++) {
|
2003-02-14 16:45:28 +01:00
|
|
|
char *p;
|
|
|
|
int e = strtoul(argv[i], &p, 0);
|
|
|
|
|
|
|
|
if (*p) {
|
|
|
|
/* This is not a number, so we assume it is a define */
|
|
|
|
char *d = argv[i];
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < wke_nr; j++) {
|
|
|
|
if (strcmp(wke[j].define, d) == 0) {
|
|
|
|
e = wke[j].number;
|
|
|
|
printf("%d\t%s\t%s\n", e, d, strerror(e));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* it is a number */
|
|
|
|
char *d = "(unknown)";
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < wke_nr; j++) {
|
|
|
|
if (wke[j].number == e) {
|
|
|
|
d = wke[j].define;
|
|
|
|
break;
|
|
|
|
}
|
2003-02-14 12:59:43 +01:00
|
|
|
}
|
2003-02-14 16:45:28 +01:00
|
|
|
|
|
|
|
printf("%d\t%s\t%s\n", e, d, strerror(e));
|
2003-02-14 12:59:43 +01:00
|
|
|
}
|
1999-07-09 23:04:43 +02:00
|
|
|
|
|
|
|
}
|
1997-12-05 09:39:46 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
1999-07-09 23:04:43 +02:00
|
|
|
/*
|
|
|
|
* vim:sw=4
|
|
|
|
*/
|