summaryrefslogtreecommitdiff
path: root/kern/fmt.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-24 06:45:44 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-24 06:48:21 +0100
commit7dcf6715ffb3cc2f00f6327b896d16f173a1b082 (patch)
tree210570e98e074d7abade0d22c64e05b9c02435ba /kern/fmt.c
parentbe5b9d6ab9f7e7a81c367e4bb0823ba11f85940f (diff)
New errno.h standard header
Use standard errno codes. This change also adds strerror to string.h.
Diffstat (limited to 'kern/fmt.c')
-rw-r--r--kern/fmt.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/kern/fmt.c b/kern/fmt.c
index 097ba23..f43a608 100644
--- a/kern/fmt.c
+++ b/kern/fmt.c
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdarg.h>
@@ -24,7 +25,6 @@
#include <stdio.h>
#include <string.h>
-#include <kern/error.h>
#include <kern/fmt.h>
#include <kern/macros.h>
#include <kern/types.h>
@@ -401,12 +401,12 @@ fmt_sprintf_state_consume(struct fmt_sprintf_state *state)
c = fmt_consume(&state->format);
if (c == '\0') {
- return ERROR_IO;
+ return EIO;
}
if (c != '%') {
fmt_sprintf_state_produce_raw_char(state, c);
- return ERROR_AGAIN;
+ return EAGAIN;
}
fmt_sprintf_state_consume_flags(state);
@@ -783,7 +783,7 @@ fmt_vsnprintf(char *str, size_t size, const char *format, va_list ap)
for (;;) {
error = fmt_sprintf_state_consume(&state);
- if (error == ERROR_AGAIN) {
+ if (error == EAGAIN) {
continue;
} else if (error) {
break;
@@ -1066,7 +1066,7 @@ fmt_sscanf_state_discard_char(struct fmt_sscanf_state *state, char c)
state->nr_convs = EOF;
}
- return ERROR_INVAL;
+ return EINVAL;
}
return 0;
@@ -1083,7 +1083,7 @@ fmt_sscanf_state_consume(struct fmt_sscanf_state *state)
c = fmt_consume(&state->format);
if (c == '\0') {
- return ERROR_IO;
+ return EIO;
}
if (c != '%') {
@@ -1093,7 +1093,7 @@ fmt_sscanf_state_consume(struct fmt_sscanf_state *state)
return error;
}
- return ERROR_AGAIN;
+ return EAGAIN;
}
fmt_sscanf_state_consume_flags(state);
@@ -1185,7 +1185,7 @@ fmt_sscanf_state_produce_int(struct fmt_sscanf_state *state)
if (i == 0) {
if (c == '\0') {
fmt_sscanf_state_report_error(state);
- return ERROR_INVAL;
+ return EINVAL;
}
buf[0] = '0';
@@ -1379,7 +1379,7 @@ fmt_sscanf_state_produce_str(struct fmt_sscanf_state *state)
if (state->str == orig) {
fmt_sscanf_state_report_error(state);
- return ERROR_INVAL;
+ return EINVAL;
}
if (dest != NULL) {
@@ -1414,7 +1414,7 @@ fmt_sscanf_state_produce(struct fmt_sscanf_state *state)
return fmt_sscanf_state_discard_char(state, '%');
default:
fmt_sscanf_state_report_error(state);
- return ERROR_INVAL;
+ return EINVAL;
}
}
@@ -1442,7 +1442,7 @@ fmt_vsscanf(const char *str, const char *format, va_list ap)
for (;;) {
error = fmt_sscanf_state_consume(&state);
- if (error == ERROR_AGAIN) {
+ if (error == EAGAIN) {
continue;
} else if (error) {
break;