summaryrefslogtreecommitdiffstats
path: root/src/toptions.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:29:28 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:29:28 +0100
commit09ecae700f224a23cfd8f63f98cebeccbe768cc0 (patch)
tree83fbfb551cc9330a02dfb6762e2c4b8e6015eecb /src/toptions.c
parent331f0ef77e62140d0ee9252c33b23b383aa73084 (diff)
Use new functions check_command(), skip_comma_in_command() and get_int_from_command() to parse command line arguments
Diffstat (limited to 'src/toptions.c')
-rw-r--r--src/toptions.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/toptions.c b/src/toptions.c
index 70b5a67..232f414 100644
--- a/src/toptions.c
+++ b/src/toptions.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
+#include <assert.h>
#include "types.h"
#include "common.h"
#include "intrf.h"
@@ -81,41 +82,35 @@ static void interface_options_ncurses(int *dump_ind, int *align, unsigned int *e
void interface_options(int *dump_ind, int *align, unsigned int *expert, char**current_cmd)
{
+ assert(current_cmd!=NULL);
if(*current_cmd!=NULL)
{
int keep_asking=1;
do
{
- while(*current_cmd[0]==',')
- (*current_cmd)++;
- if(strncmp(*current_cmd,"dump",4)==0)
+ skip_comma_in_command(current_cmd);
+ if(check_command(current_cmd,"dump",4)==0)
{
- (*current_cmd)+=4;
*dump_ind=1;
}
- else if(strncmp(*current_cmd,"nodump",6)==0)
+ else if(check_command(current_cmd,"nodump",6)==0)
{
- (*current_cmd)+=6;
*dump_ind=0;
}
- else if(strncmp(*current_cmd,"align",5)==0)
+ else if(check_command(current_cmd,"align",5)==0)
{
- (*current_cmd)+=5;
*align=1;
}
- else if(strncmp(*current_cmd,"noalign",7)==0)
+ else if(check_command(current_cmd,"noalign",7)==0)
{
- (*current_cmd)+=7;
*align=0;
}
- else if(strncmp(*current_cmd,"expert",6)==0)
+ else if(check_command(current_cmd,"expert",6)==0)
{
- (*current_cmd)+=6;
*expert=1;
}
- else if(strncmp(*current_cmd,"noexpert",8)==0)
+ else if(check_command(current_cmd,"noexpert",8)==0)
{
- (*current_cmd)+=6;
*expert=0;
}
else