summaryrefslogtreecommitdiff
path: root/cmd
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 /cmd
parent4baa01f8cd595cb0517d8f7f665d5be92528b6c2 (diff)
downloadihe-cb141140579d796ae5cafe6da52b4f0b87be6a84.tar.gz
ihe-cb141140579d796ae5cafe6da52b4f0b87be6a84.zip
Simplifying logic. Removing buffer features
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cmd_blk.c20
-rw-r--r--cmd/cmd_info.c11
2 files changed, 18 insertions, 13 deletions
diff --git a/cmd/cmd_blk.c b/cmd/cmd_blk.c
index db64f42..e497780 100644
--- a/cmd/cmd_blk.c
+++ b/cmd/cmd_blk.c
@@ -8,10 +8,26 @@ extern file_t *g_file;
extern buf_t *g_buf;
extern int g_flags;
+/*
+ * blk - show block size
+ * blk <num> - set block size
+ */
int c_blk( cmd_arg_t *arg )
{
- printf("FILE BLOCK SIZE %u\n", g_file->blk_size );
- printf("BUFFER BLOCK SIZE %d (MAX %d)\n", g_buf->size, g_buf->buf_size );
+ int argc = arg->argc;
+ char **argv = arg->argv;
+ int *type = arg->type;
+ if ( argc == 0)
+ {
+ printf("FILE BLOCK SIZE %u\n", g_file->blk_size );
+ } else if ( argc == 1 )
+ {
+ if ((type[0] == CMDT_INT) || (type[0] == CMDT_HEX))
+ g_file->blk_size = atoi( argv[0] );
+ } else
+ {
+ return -1;
+ }
return 0;
} \ No newline at end of file
diff --git a/cmd/cmd_info.c b/cmd/cmd_info.c
index b06f8bc..8744efe 100644
--- a/cmd/cmd_info.c
+++ b/cmd/cmd_info.c
@@ -30,16 +30,5 @@ int c_info( cmd_arg_t *arg )
printf("BLOCK : %u\n", g_file->blk_size );
}
- if ( g_buf == NULL )
- {
- printf("buffer not initialised\n");
- } else
- {
- printf("BUF:\n");
- printf("ADDR : %p\n", g_buf->buf);
- printf("SIZE : %d\n", g_buf->size);
- printf("BUFSIZE: %d\n", g_buf->buf_size);
- }
-
return 0;
} \ No newline at end of file