summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.c b/util.c
index b0d8efe..d167193 100644
--- a/util.c
+++ b/util.c
@@ -48,4 +48,14 @@ char *alloc_new_str_s(char *str, size_t size)
char *alloc_new_str(char *str)
{
return alloc_new_str_s(str, strlen(str));
+}
+
+off_t file_size(const char *fname)
+{
+ struct stat st;
+ if ( !stat( fname, &st ) )
+ {
+ return st.st_size;
+ }
+ return 0; //hehe if error or file is 0, same woop woop
} \ No newline at end of file