summaryrefslogtreecommitdiffstats
path: root/src/tntfs.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/tntfs.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/tntfs.c')
-rw-r--r--src/tntfs.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/tntfs.c b/src/tntfs.c
index 18ec2c0..9594f8e 100644
--- a/src/tntfs.c
+++ b/src/tntfs.c
@@ -74,38 +74,31 @@ static void dump_NTFS(disk_t *disk_car, const partition_t *partition, const unsi
static int ntfs_boot_sector_command(char **current_cmd, const char *options)
{
- while(*current_cmd[0]==',')
- (*current_cmd)++;
- if(strncmp(*current_cmd,"rebuildbs",9)==0)
+ skip_comma_in_command(current_cmd);
+ if(check_command(current_cmd,"rebuildbs",9)==0)
{
- (*current_cmd)+=9;
return 'R';
}
- else if(strncmp(*current_cmd,"dump",4)==0)
+ else if(check_command(current_cmd,"dump",4)==0)
{
- (*current_cmd)+=4;
return 'D';
}
- else if(strncmp(*current_cmd,"list",4)==0)
+ else if(check_command(current_cmd,"list",4)==0)
{
- (*current_cmd)+=4;
return 'L';
}
- else if(strncmp(*current_cmd,"originalntfs",12)==0)
+ else if(check_command(current_cmd,"originalntfs",12)==0)
{
- (*current_cmd)+=12;
if(strchr(options,'O')!=NULL)
return 'O';
}
- else if(strncmp(*current_cmd,"backupntfs",10)==0)
+ else if(check_command(current_cmd,"backupntfs",10)==0)
{
- (*current_cmd)+=10;
if(strchr(options,'B')!=NULL)
return 'B';
}
- else if(strncmp(*current_cmd,"repairmft",9)==0)
+ else if(check_command(current_cmd,"repairmft",9)==0)
{
- (*current_cmd)+=9;
if(strchr(options,'M')!=NULL)
return 'M';
}
@@ -114,11 +107,9 @@ static int ntfs_boot_sector_command(char **current_cmd, const char *options)
static int is_no_confirm_command(char **current_cmd)
{
- while(*current_cmd[0]==',')
- (*current_cmd)++;
- if(strncmp(*current_cmd,"noconfirm",9)==0)
+ skip_comma_in_command(current_cmd);
+ if(check_command(current_cmd,"noconfirm",9)==0)
{
- (*current_cmd)+=9;
return 1;
}
return 0;