summaryrefslogtreecommitdiff
path: root/cmd/cmd_resize.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cmd_resize.c')
-rw-r--r--cmd/cmd_resize.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/cmd_resize.c b/cmd/cmd_resize.c
new file mode 100644
index 0000000..532c43c
--- /dev/null
+++ b/cmd/cmd_resize.c
@@ -0,0 +1,40 @@
+#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_resize( cmd_arg_t *arg )
+{
+ int argc = arg->argc;
+ char **argv = arg->argv;
+ int *type = arg->type;
+
+ int resize;
+
+ if ( argc != 1 )
+ {
+ printf("Needed one argument\n");
+ return -1;
+ }
+
+ printf("%d %s\n",type[0],argv[0]);
+
+ if ((type[0] != CMDT_INT) && (type[0] != CMDT_HEX) )
+ {
+ printf("Unknown type of argument\n");
+ return -1;
+ }
+
+ resize = atoi( argv[0] );
+ if (resize < 0)
+ return -1;
+
+ file_resize( g_file, resize );
+
+ return 0;
+} \ No newline at end of file