summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
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