aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/cmd_read.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cmd_read.c')
-rw-r--r--cmd/cmd_read.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd/cmd_read.c b/cmd/cmd_read.c
new file mode 100644
index 0000000..965ae5a
--- /dev/null
+++ b/cmd/cmd_read.c
@@ -0,0 +1,29 @@
+#include "buf.h"
+#include "core.h"
+
+#include "libcmd/cmd.h"
+#include "libcmd/cmd_parse.h"
+
+extern file_t *g_file;
+extern buf_t *g_buf;
+extern int g_flags;
+
+int c_read( cmd_arg_t *arg )
+{
+ int ret;
+
+ if ( g_buf->buf == NULL )
+ {
+ printf("Buffer mem not allocated\n");
+ return -1;
+ }
+
+ ret = file_read_blk( g_file, g_buf->buf );
+ printf("Readed %d bytes\n", ret);
+ if ( (ret >= 0) && (ret <= g_buf->buf_size) )
+ {
+ g_buf->size = ret;
+ }
+
+ return 0;
+} \ No newline at end of file