1 /* 2 *errno.h shall give positive values for the 3 *error number symbolic constants 4 *author:ysun (at) lnxw.com 5 */ 6 #include <stdio.h> 7 #include <errno.h> 8 #define PTP_PASS 0 9 #define PTP_FAIL 1 10 #define PTP_UNRESOLVED 2 11 #define PTP_NOTINUSE 3 12 #define PTP_UNSUPPORTED 4 13 #define PTP_UNTESTED 5 14 #define PTP_UNINITIATED 6 15 #define PTP_NORESULT 7 16 17 struct unique { 18 int value; 19 char *name; 20 } sym[] = { { 21 E2BIG, "E2BIG"}, { 22 EACCES, "EACCES"}, { 23 EADDRINUSE, "EADDRINUSE"}, { 24 EADDRNOTAVAIL, "EADDRNOTAVAIL"}, { 25 EAFNOSUPPORT, "EAFNOSUPPORT"}, { 26 EAGAIN, "EAGAIN"}, { 27 EALREADY, "EALREADY"}, { 28 EBADF, "EBADF"}, { 29 EBADMSG, "EBADMSG"}, { 30 EBUSY, "EBUSY"}, { 31 ECANCELED, "ECANCELED"}, { 32 ECHILD, "ECHILD"}, { 33 ECONNABORTED, "ECONNABORTED"}, { 34 ECONNREFUSED, "ECONNREFUSED"}, { 35 ECONNRESET, "ECONNRESET"}, { 36 EDEADLK, "EDEADLK"}, { 37 EDESTADDRREQ, "EDESTADDRREQ"}, { 38 EDOM, "EDOM"}, { 39 EDQUOT, "EDQUOT"}, { 40 EEXIST, "EEXIST"}, { 41 EFAULT, "EFAULT"}, { 42 EFBIG, "EFBIG"}, { 43 EHOSTUNREACH, "EHOSTUNREACH"}, { 44 EIDRM, "EIDRM"}, { 45 EILSEQ, "EILSEQ"}, { 46 EINPROGRESS, "EINPROGRESS"}, { 47 EINTR, "EINTR"}, { 48 EINVAL, "EINVAL"}, { 49 EIO, "EIO"}, { 50 EISCONN, "EISCONN"}, { 51 EISDIR, "EISDIR"}, { 52 ELOOP, "ELOOP"}, { 53 EMFILE, "EMFILE"}, { 54 EMLINK, "EMLINK"}, { 55 EMSGSIZE, "EMSGSIZE"}, { 56 EMULTIHOP, "EMULTIHOP"}, { 57 ENAMETOOLONG, "ENAMETOOLONG"}, { 58 ENETDOWN, "ENETDOWN"}, { 59 ENETRESET, "ENETRESET"}, { 60 ENETUNREACH, "ENETUNREACH"}, { 61 ENFILE, "ENFILE"}, { 62 ENOBUFS, "ENOBUFS"}, 63 #ifdef ENODATA 64 { 65 ENODATA, "ENODATA"}, 66 #endif 67 { 68 ENODEV, "ENODEV"}, { 69 ENOENT, "ENOENT"}, { 70 ENOEXEC, "ENOEXEC"}, { 71 ENOLCK, "ENOLCK"}, { 72 ENOLINK, "ENOLINK"}, { 73 ENOMEM, "ENOMEM"}, { 74 ENOMSG, "ENOMSG"}, { 75 ENOPROTOOPT, "ENOPROTOOPT"}, { 76 ENOSPC, "ENOSPC"}, 77 #ifdef ENOSR 78 { 79 ENOSR, "ENOSR"}, 80 #endif 81 #ifdef ENOSTR 82 { 83 ENOSTR, "ENOSTR"}, 84 #endif 85 { 86 ENOSYS, "ENOSYS"}, { 87 ENOTCONN, "ENOTCONN"}, { 88 ENOTDIR, "ENOTDIR"}, { 89 ENOTEMPTY, "ENOTEMPTY"}, { 90 ENOTSOCK, "ENOTSOCK"}, { 91 ENOTSUP, "ENOTSUP"}, { 92 ENOTTY, "ENOTTY"}, { 93 ENXIO, "ENXIO"}, { 94 EOPNOTSUPP, "EOPNOTSUPP"}, { 95 EOVERFLOW, "EOVERFLOW"}, { 96 EPERM, "EPERM"}, { 97 EPIPE, "EPIPE"}, { 98 EPROTO, "EPROTO"}, { 99 EPROTONOSUPPORT, "EPROTONOSUPPORT"}, { 100 EPROTOTYPE, "EPROTOTYPE"}, { 101 ERANGE, "ERANGE"}, { 102 EROFS, "EROFS"}, { 103 EWOULDBLOCK, "EWOULDBLOCK"}, { 104 EXDEV, "EXDEV"}, { 105 0, 0} 106 }; 107 108 int main() 109 { 110 struct unique *tst = sym; 111 int ret = PTP_PASS; 112 while (tst->name) { 113 if (tst->value < 0) { 114 printf("Value of symbol %s is less than zero\n", 115 tst->name); 116 ret = PTP_FAIL; 117 } 118 tst++; 119 } 120 return ret; 121 } 122