summaryrefslogtreecommitdiffstats
path: root/src/toptions.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-12-23 17:14:31 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-12-23 17:14:31 +0100
commit0a68c6d4732215866b1e30063e41f00a95e054f9 (patch)
tree9f591b3f32fcda5ba98d7141c7d850fa50f8920d /src/toptions.c
parent775ed679d3be5ab80d9283c5b9ce35155393b8e5 (diff)
Settings in TestDisk options menu can be set via command line
Diffstat (limited to 'src/toptions.c')
-rw-r--r--src/toptions.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/toptions.c b/src/toptions.c
index ab1990a..693860f 100644
--- a/src/toptions.c
+++ b/src/toptions.c
@@ -24,6 +24,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include "types.h"
#include "common.h"
#include "intrf.h"
@@ -80,7 +81,33 @@ 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)
{
- if(*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)
+ {
+ (*current_cmd)+=4;
+ *dump_ind=1;
+ }
+ else if(strncmp(*current_cmd,"align",5)==0)
+ {
+ (*current_cmd)+=5;
+ *align=1;
+ }
+ else if(strncmp(*current_cmd,"expert",6)==0)
+ {
+ (*current_cmd)+=6;
+ *expert=1;
+ }
+ else
+ keep_asking=0;
+ } while(keep_asking>0);
+ }
+ else
{
#ifdef HAVE_NCURSES
interface_options_ncurses(dump_ind, align, expert);