From cb141140579d796ae5cafe6da52b4f0b87be6a84 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Mon, 23 May 2016 21:51:44 +0100 Subject: Simplifying logic. Removing buffer features --- cmd/cmd_blk.c | 20 ++++++++++++++++++-- cmd/cmd_info.c | 11 ----------- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'cmd') 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 - 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 -- cgit v1.2.3