summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2014-12-22 03:22:38 +0100
committerGDR! <gdr@gdr.name>2014-12-22 03:22:38 +0100
commitb8c1f1cf062ff681daf160411ad6c35ed7a49d42 (patch)
treeca3ccf0041c3c0542ef1e293f41a130f41d342ac /util.c
parent3f86c8bb935408fdfb056a412da23b6b181d0755 (diff)
Logging framework and command line options
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util.c b/util.c
index b523236..4b7aa26 100644
--- a/util.c
+++ b/util.c
@@ -1,3 +1,4 @@
1#include "log.h"
1#include "util.h" 2#include "util.h"
2#include <string.h> 3#include <string.h>
3#include <tox/tox.h> 4#include <tox/tox.h>
@@ -134,7 +135,7 @@ void* file_raw(char *path, uint32_t *size)
134 135
135 file = fopen(path, "rb"); 136 file = fopen(path, "rb");
136 if(!file) { 137 if(!file) {
137 fprintf(stderr, "File not found (%s)\n", path); 138 log_printf(L_WARNING, "File not found (%s)\n", path);
138 return NULL; 139 return NULL;
139 } 140 }
140 141
@@ -149,7 +150,7 @@ void* file_raw(char *path, uint32_t *size)
149 fseek(file, 0, SEEK_SET); 150 fseek(file, 0, SEEK_SET);
150 151
151 if(fread(data, len, 1, file) != 1) { 152 if(fread(data, len, 1, file) != 1) {
152 fprintf(stderr, "Read error (%s)\n", path); 153 log_printf(L_WARNING, "Read error (%s)\n", path);
153 fclose(file); 154 fclose(file);
154 free(data); 155 free(data);
155 return NULL; 156 return NULL;
@@ -157,7 +158,7 @@ void* file_raw(char *path, uint32_t *size)
157 158
158 fclose(file); 159 fclose(file);
159 160
160 fprintf(stderr, "Read %u bytes (%s)\n", len, path); 161 log_printf(L_DEBUG, "Read %u bytes (%s)\n", len, path);
161 162
162 if(size) { 163 if(size) {
163 *size = len; 164 *size = len;