summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2010-05-12 20:06:21 +0200
committerJohannes Weiner <hannes@cmpxchg.org>2010-05-12 20:06:21 +0200
commitc76f1eddf200d748823e15c1d95d6be7a553ca0d (patch)
tree3532a658802027b448248181d6e4638698e58bca
parentf15144e93318b1a92c037f7481d85456978fefef (diff)
lib: error reporting fixes
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--lib/io.c6
-rw-r--r--lib/regex.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/io.c b/lib/io.c
index 3dfbe1f..d452238 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -63,7 +63,7 @@ static sheep_t open(struct sheep_vm *vm, unsigned int nr_args)
filp = fopen(path->bytes, "r");
if (!filp) {
- fprintf(stderr, "%s: can not open file\n", path->bytes);
+ sheep_error(vm, "can not open `%s'", path->bytes);
return NULL;
}
@@ -98,7 +98,7 @@ static sheep_t read(struct sheep_vm *vm, unsigned int nr_args)
return NULL;
if (!file->filp) {
- fprintf(stderr, "reading from closed file\n");
+ sheep_error(vm, "file is already closed");
return NULL;
}
@@ -120,7 +120,7 @@ static sheep_t write(struct sheep_vm *vm, unsigned int nr_args)
return NULL;
if (!file->filp) {
- fprintf(stderr, "writing to closed file\n");
+ sheep_error(vm, "file is already closed");
return NULL;
}
diff --git a/lib/regex.c b/lib/regex.c
index 897b4c9..88618cb 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -36,7 +36,7 @@ static sheep_t match(struct sheep_vm *vm, unsigned int nr_args)
regex = sheep_rawstring(regex_);
if (regcomp(&reg, regex, REG_EXTENDED)) {
- fprintf(stderr, "match: invalid regular expression\n");
+ sheep_error(vm, "invalid regular expression");
goto out;
}