commit 52546d2557ba3afa4b5740b2d944b26a20b064ed
parent 63e5f20194aba81a970f919d73d3d2e6f29e18af
Author: Rolf Eike Beer <eike@sf-mail.de>
Date: Fri, 12 Jul 2019 19:38:57 +0200
get rid of error_* variables and just #define them to their errno equivalents
Diffstat:
M | Makefile | | | 8 | ++------ |
M | TARGETS | | | 1 | - |
M | error.3 | | | 27 | +-------------------------- |
D | error.c | | | 95 | ------------------------------------------------------------------------------- |
M | error.h | | | 26 | +++++++++++++------------- |
5 files changed, 16 insertions(+), 141 deletions(-)
diff --git a/Makefile b/Makefile
@@ -506,12 +506,8 @@ compile envread.c env.h str.h
./compile envread.c
error.a: \
-makelib error.o error_str.o error_temp.o
- ./makelib error.a error.o error_str.o error_temp.o
-
-error.o: \
-compile error.c error.h
- ./compile error.c
+makelib error_str.o error_temp.o
+ ./makelib error.a error_str.o error_temp.o
error_str.o: \
compile error_str.c error.h
diff --git a/TARGETS b/TARGETS
@@ -86,7 +86,6 @@ subfdin.o
subfdins.o
substdio_copy.o
substdio.a
-error.o
error_str.o
error_temp.o
error.a
diff --git a/error.3 b/error.3
@@ -6,31 +6,6 @@ error \- syscall error codes
.br
.B #include <errno.h>
-extern int \fBerror_intr\fP;
-.br
-extern int \fBerror_nomem\fP;
-.br
-extern int \fBerror_noent\fP;
-.br
-extern int \fBerror_txtbsy\fP;
-.br
-extern int \fBerror_io\fP;
-.br
-extern int \fBerror_exist\fP;
-.br
-extern int \fBerror_timeout\fP;
-.br
-extern int \fBerror_inprogress\fP;
-.br
-extern int \fBerror_wouldblock\fP;
-.br
-extern int \fBerror_again\fP;
-.br
-extern int \fBerror_pipe\fP;
-.br
-extern int \fBerror_perm\fP;
-.br
-extern int \fBerror_acces\fP;
.SH DESCRIPTION
UNIX syscalls provide detailed error codes in the
.B errno
@@ -39,7 +14,7 @@ The
.B error
library provides portable names for a variety of possible
.B errno
-values.
+values. Do not use in new code.
.SH "SEE ALSO"
error_str(3),
error_temp(3)
diff --git a/error.c b/error.c
@@ -1,95 +0,0 @@
-#include <errno.h>
-#include "error.h"
-
-/* warning: as coverage improves here, should update error_{str,temp} */
-
-int error_intr =
-#ifdef EINTR
-EINTR;
-#else
--1;
-#endif
-
-int error_nomem =
-#ifdef ENOMEM
-ENOMEM;
-#else
--2;
-#endif
-
-int error_noent =
-#ifdef ENOENT
-ENOENT;
-#else
--3;
-#endif
-
-int error_txtbsy =
-#ifdef ETXTBSY
-ETXTBSY;
-#else
--4;
-#endif
-
-int error_io =
-#ifdef EIO
-EIO;
-#else
--5;
-#endif
-
-int error_exist =
-#ifdef EEXIST
-EEXIST;
-#else
--6;
-#endif
-
-int error_timeout =
-#ifdef ETIMEDOUT
-ETIMEDOUT;
-#else
--7;
-#endif
-
-int error_inprogress =
-#ifdef EINPROGRESS
-EINPROGRESS;
-#else
--8;
-#endif
-
-int error_wouldblock =
-#ifdef EWOULDBLOCK
-EWOULDBLOCK;
-#else
--9;
-#endif
-
-int error_again =
-#ifdef EAGAIN
-EAGAIN;
-#else
--10;
-#endif
-
-int error_pipe =
-#ifdef EPIPE
-EPIPE;
-#else
--11;
-#endif
-
-int error_perm =
-#ifdef EPERM
-EPERM;
-#else
--12;
-#endif
-
-int error_acces =
-#ifdef EACCES
-EACCES;
-#else
--13;
-#endif
diff --git a/error.h b/error.h
@@ -3,19 +3,19 @@
#include <errno.h>
-extern int error_intr;
-extern int error_nomem;
-extern int error_noent;
-extern int error_txtbsy;
-extern int error_io;
-extern int error_exist;
-extern int error_timeout;
-extern int error_inprogress;
-extern int error_wouldblock;
-extern int error_again;
-extern int error_pipe;
-extern int error_perm;
-extern int error_acces;
+#define error_intr EINTR
+#define error_nomem ENOMEM
+#define error_noent ENOENT
+#define error_txtbsy ETXTBSY
+#define error_io EIO
+#define error_exist EEXIST
+#define error_timeout ETIMEDOUT
+#define error_inprogress EINPROGRESS
+#define error_wouldblock EWOULDBLOCK
+#define error_again EAGAIN
+#define error_pipe EPIPE
+#define error_perm EPERM
+#define error_acces EACCES
extern char *error_str();
extern int error_temp();