aboutsummaryrefslogtreecommitdiffstats
path: root/argparse.c
diff options
context:
space:
mode:
authorPA4WDH2024-08-24 12:43:34 +0200
committerPA4WDH2024-08-24 12:43:34 +0200
commita13b6a07822e9807af50bd67bfe64ccba03b5b00 (patch)
tree125b82a0e3cf114fce7522ccd1ef1ebdc936d5c3 /argparse.c
parentAdd ebuild for version 0.5 (diff)
downloadcputemp2maxfreq-a13b6a07822e9807af50bd67bfe64ccba03b5b00.tar.gz
cputemp2maxfreq-a13b6a07822e9807af50bd67bfe64ccba03b5b00.tar.bz2
cputemp2maxfreq-a13b6a07822e9807af50bd67bfe64ccba03b5b00.zip
Add -k option to keep state on successul exit
Diffstat (limited to 'argparse.c')
-rw-r--r--argparse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/argparse.c b/argparse.c
index 1eae42b..e46eab7 100644
--- a/argparse.c
+++ b/argparse.c
@@ -25,6 +25,9 @@ void printhelp()
" A sensor name, for example \"Core 0\"\n"
" The word \"auto\" autodetects a valid sensor\n"
" Default: %s\n"
+ "-k Keep last state on successful exit, set CPU to lowest frequency\n"
+ " on error.\n"
+ " Default: Always set CPU to lowest frequency on exit\n"
"-p <time> Poll interval in seconds\n"
" Default: %d\n"
"-s <step> Step size in Khz when increasing/decreasing CPU speed\n"
@@ -70,7 +73,7 @@ void argparse(int argc, char **argv)
memcpy(&userconfig,&config,sizeof(struct s_config));
// Parse options
- while((opt=getopt(argc,argv,"c:C:d:f:g:hi:l:mp:s:t:u"))!=-1)
+ while((opt=getopt(argc,argv,"c:C:d:f:g:hi:kl:mp:s:t:u"))!=-1)
{
DEBUG1_ARGPARSE("Argument: %c Value: %s\n",opt,optarg);
switch(opt)
@@ -103,6 +106,9 @@ void argparse(int argc, char **argv)
case 'i':
strncpy(userconfig.temp_input,optarg,sizeof(userconfig.temp_input));
break;
+ case 'k':
+ userconfig.keepstate=1;
+ break;
case 'l':
strncpy(userconfig.logger_name,optarg,sizeof(userconfig.logger_name));
break;