summaryrefslogtreecommitdiff
path: root/main_complete.c
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-07-09 11:42:29 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-07-09 11:42:29 +0200
commit233dd597324bc9f857790367233b0599c52a1170 (patch)
treee138b7a968b33b0742c6a43506cc5730ff9255f2 /main_complete.c
parentd9b84dd3d45d9997022f1cf6bb9a4f5f6ae5885d (diff)
parent9ade9fd834a59e505c4856a206851c8256d08abe (diff)
Merge branch 'master' of https://git.oftal.dk/hugin
Diffstat (limited to 'main_complete.c')
-rw-r--r--main_complete.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/main_complete.c b/main_complete.c
index a79dbc5..8eb4b7e 100644
--- a/main_complete.c
+++ b/main_complete.c
@@ -30,13 +30,17 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-
+#include <errno.h>
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
int main(int argc, char *argv[])
{
- int fd = open("/tmp/my.log", O_CREAT | O_RDWR, 0777);
+ const char *mylog = "/tmp/my.log";
+ int fd = open(mylog, O_CREAT | O_RDWR, 0777);
if(fd == -1) {
+ printf("Could not open '%s' for writing: %s", mylog, strerror(errno));
return 1;
}
hug_status_t status = hug_init(HUG_FLAG_USE_MUTEX |
@@ -63,10 +67,13 @@ int main(int argc, char *argv[])
INFO(example, "We are up and running");
DEBUG(example, "Or are we %d?", 42);
- int a = 0;
- DEBUG(foo, "Or are we %d?", 1/a);
+
+ DEBUG(foo, "Or are we %d?", 42);
hug_close();
+ unlink(mylog);
+ unlink("/tmp/my.log2");
+
return 0;
}