diff options
author | PA4WDH | 2023-05-24 12:57:25 +0200 |
---|---|---|
committer | PA4WDH | 2023-05-24 12:57:25 +0200 |
commit | 16fb812a46d0e8cde432b58f7dbf6fce147eb89f (patch) | |
tree | 9e019f98e515cb21e6c38ff487a82fe375675991 /argparse.c | |
parent | Detect program name from argv[0] (diff) | |
download | cputemp2maxfreq-16fb812a46d0e8cde432b58f7dbf6fce147eb89f.tar.gz cputemp2maxfreq-16fb812a46d0e8cde432b58f7dbf6fce147eb89f.tar.bz2 cputemp2maxfreq-16fb812a46d0e8cde432b58f7dbf6fce147eb89f.zip |
Add CSV logging
Diffstat (limited to 'argparse.c')
-rw-r--r-- | argparse.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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; |