aboutsummaryrefslogtreecommitdiffstats
path: root/argparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'argparse.c')
-rw-r--r--argparse.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/argparse.c b/argparse.c
index 7df1239..75ca20d 100644
--- a/argparse.c
+++ b/argparse.c
@@ -14,6 +14,9 @@ void printhelp()
"Usage: %s <options>\n"
"\n"
"Options:\n"
+ "-c <file> Write CSV log for later analysis to file. Append data if the\n"
+ " file already exists\n"
+ "-C <file> Same as -c but overwrite existing file\n"
"-f <frequency> Fallback frequency in KHz, used when everything fails\n"
" Default: %ld\n"
"-g <governor> cpufreq governor to use, use \"keep\" to keep current governor\n"
@@ -56,11 +59,19 @@ void argparse(int argc, char **argv)
memcpy(&userconfig,&config,sizeof(struct s_config));
// Parse options
- while((opt=getopt(argc,argv,"f:g:hi:l:mp:s:t:"))!=-1)
+ while((opt=getopt(argc,argv,"c:C:f:g:hi:l:mp:s:t:"))!=-1)
{
DEBUG1_ARGPARSE("Argument: %c Value: %s\n",opt,optarg);
switch(opt)
{
+ case 'c':
+ strncpy(userconfig.csvlog,optarg,sizeof(userconfig.csvlog));
+ userconfig.csvoverwrite=0;
+ break;
+ case 'C':
+ strncpy(userconfig.csvlog,optarg,sizeof(userconfig.csvlog));
+ userconfig.csvoverwrite=1;
+ break;
case 'f':
userconfig.fallback_freq=strtoll(optarg,NULL,10);
break;