aboutsummaryrefslogtreecommitdiffstats
path: root/core.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2016-05-23 21:51:44 +0100
committerFreeArtMan <dos21h@gmail.com>2016-05-23 21:51:44 +0100
commitcb141140579d796ae5cafe6da52b4f0b87be6a84 (patch)
tree61e0130a1581e1ba99dabed32c82782699db064c /core.c
parent4baa01f8cd595cb0517d8f7f665d5be92528b6c2 (diff)
downloadihe-cb141140579d796ae5cafe6da52b4f0b87be6a84.tar.gz
ihe-cb141140579d796ae5cafe6da52b4f0b87be6a84.zip
Simplifying logic. Removing buffer features
Diffstat (limited to 'core.c')
-rw-r--r--core.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/core.c b/core.c
index a152656..90f8fd9 100644
--- a/core.c
+++ b/core.c
@@ -121,7 +121,11 @@ int file_open_fn( file_t *ft, const char *filename, int flags )
ft->fd = fd;
ft->flags = flags;
- ft->filename = filename;
+
+ uint8_t fn_sz = strlen( filename );
+ char *fn = malloc( fn_sz );
+ memcpy( fn, filename, fn_sz );
+ ft->filename = fn;
/* set current file cursor postion and file size */
@@ -314,6 +318,15 @@ int file_s_mode( file_t *ft, int mode )
return ret;
}
+int file_s_bufs( file_t *ft, unsigned int size )
+{
+ int ret = 0;
+
+ ft->blk_size = size;
+
+ return ret;
+}
+
int file_close( file_t *ft )
{
@@ -322,13 +335,13 @@ int file_close( file_t *ft )
if ( ft->fd < 1 )
{
printf("File descriptor <1\n");
- ret = -1;
+ return -1;
}
if ( ft->filename == NULL )
{
printf("File name is empty\n");
- ret = -1;
+ return -1;
}
fd_close( ft->fd );