Added list of #defines from HP-UX.

This commit is contained in:
hjp 2003-02-14 11:59:43 +00:00
parent 7fdaf9d95c
commit a1822cb42c
5 changed files with 158 additions and 7 deletions

View File

@ -1,6 +1,9 @@
# $Id: GNUmakefile,v 1.2 1998-05-31 01:20:06 hjp Exp $ # $Id: GNUmakefile,v 1.3 2003-02-14 11:59:43 hjp Exp $
# $Log: GNUmakefile,v $ # $Log: GNUmakefile,v $
# Revision 1.2 1998-05-31 01:20:06 hjp # Revision 1.3 2003-02-14 11:59:43 hjp
# Added list of #defines from HP-UX.
#
# Revision 1.2 1998/05/31 01:20:06 hjp
# GNUmakerules split into GNUmakerules and GNUmakevars. # GNUmakerules split into GNUmakerules and GNUmakevars.
# #
@ -9,7 +12,10 @@ include GNUmakerules
all: errno all: errno
errno: errno: errno.o errno_list.o
errno_list.c: errno.list make_errno_list
./make_errno_list
clean: clean:
rm errno rm errno
install: $(BINDIR)/errno install: $(BINDIR)/errno

View File

@ -2,6 +2,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "errno_list.h"
char *cmnd; char *cmnd;
static void usage(void) { static void usage(void) {
@ -16,15 +18,26 @@ int main(int argc, char **argv) {
cmnd = argv[0]; cmnd = argv[0];
if (argc <= 1) { if (argc <= 1) {
int e; int i;
for (e = 0;; e++) { for (i = 0; i < wke_nr; i++) {
printf("%d\t%s\n", e, strerror(e)); int e = wke[i].number;
char *d = wke[i].define;
printf("%d\t%s\t%s\n", e, d, strerror(e));
} }
} else { } else {
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
int e = strtoul(argv[i], NULL, 0); int e = strtoul(argv[i], NULL, 0);
char *d = "(unknown)";
int j;
printf("%d\t%s\n", e, strerror(e)); for (j = 0; j < wke_nr; j++) {
if (wke[j].number == e) {
d = wke[j].define;
break;
}
}
printf("%d\t%s\t%s\n", e, d, strerror(e));
} }
} }
return 0; return 0;

112
errno/errno.list Normal file
View File

@ -0,0 +1,112 @@
E2BIG
EACCES
EADDRINUSE
EADDRNOTAVAIL
EADV
EAFNOSUPPORT
EAGAIN
EALREADY
EBADF
EBADMSG
EBADVER
EBUSY
ECANCELED
ECHILD
ECHRNG
ECOMM
ECONFIG
ECONNABORTED
ECONNREFUSED
ECONNRESET
EDEADLK
EDESTADDRREQ
EDOM
EDOTDOT
EDQUOT
EEXIST
EFAULT
EFBIG
EHOSTDOWN
EHOSTUNREACH
EIDRM
EILSEQ
EINPROGRESS
EINTR
EINVAL
EIO
EISCONN
EISDIR
EL2HLT
EL2NSYNC
EL3HLT
EL3RST
ELNRNG
ELOOP
EMFILE
EMLINK
EMSGSIZE
EMULTIHOP
ENAMETOOLONG
ENETDOWN
ENETRESET
ENETUNREACH
ENFILE
ENOBUFS
ENOCSI
ENODATA
ENODEV
ENOENT
ENOEXEC
ENOLCK
ENOLINK
ENOLOAD
ENOMATCH
ENOMEM
ENOMSG
ENONET
ENOPKG
ENOPROTOOPT
ENOREG
ENOSPC
ENOSR
ENOSTR
ENOSYM
ENOSYS
ENOTBLK
ENOTCONN
ENOTDIR
ENOTEMPTY
ENOTSOCK
ENOTSUP
ENOTTY
ENOUNLD
ENOUNREG
ENXIO
EOPNOTSUPP
EOVERFLOW
EPERM
EPFNOSUPPORT
EPIPE
EPROTO
EPROTONOSUPPORT
EPROTOTYPE
ERANGE
EREFUSED
ERELOC
EREMOTE
EREMOTERELEASE
EROFS
ESHUTDOWN
ESOCKTNOSUPPORT
ESPIPE
ESRCH
ESRMNT
ESTALE
ETIME
ETIMEDOUT
ETOOMANYREFS
ETXTBSY
EUNATCH
EUSERS
EWOULDBLOCK
EXDEV

9
errno/errno_list.h Normal file
View File

@ -0,0 +1,9 @@
#include <stddef.h>
typedef struct {
int number;
char *define;
} errno_T;
extern errno_T wke[];
extern const size_t wke_nr;

11
errno/make_errno_list Executable file
View File

@ -0,0 +1,11 @@
echo '#include <errno.h>' > errno_list.c
echo '#include "errno_list.h"' >> errno_list.c
echo 'errno_T wke[] = {' >> errno_list.c
for e in `cat errno.list`
do
echo " #if defined($e)" >> errno_list.c
echo " { $e, \"$e\" }," >> errno_list.c
echo " #endif" >> errno_list.c
done
echo '};' >> errno_list.c
echo 'const size_t wke_nr = sizeof(wke)/sizeof(wke[0]);' >> errno_list.c