diff options
author | PA4WDH | 2024-09-01 16:51:48 +0200 |
---|---|---|
committer | PA4WDH | 2024-09-01 16:51:48 +0200 |
commit | d59831d74e2c8a67cbee03f2630bac1753635a93 (patch) | |
tree | c86f9aa9d694e7b64c0f864bfa35c8ca8ee694fc /argparse.c | |
parent | Add more compiler warnings (diff) | |
download | cputemp2maxfreq-d59831d74e2c8a67cbee03f2630bac1753635a93.tar.gz cputemp2maxfreq-d59831d74e2c8a67cbee03f2630bac1753635a93.tar.bz2 cputemp2maxfreq-d59831d74e2c8a67cbee03f2630bac1753635a93.zip |
Include GPL version 3 license and copyright notices
Diffstat (limited to 'argparse.c')
-rw-r--r-- | argparse.c | 52 |
1 files changed, 49 insertions, 3 deletions
@@ -1,3 +1,21 @@ +/* This file is part of cputemp2maxfreq. + + Copyright (C) 2023-2024 pa4wdh + + cputemp2maxfreq is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License , or + (at your option) any later version. + + cputemp2maxfreq is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cputemp2maxfreq; see the file COPYING. If not, see + <http://www.gnu.org/licenses>. +*/ #include <stdio.h> #include <unistd.h> #include <stdlib.h> @@ -5,6 +23,7 @@ #include "cputemp2maxfreq.h" #include "debug.h" #include "logger.h" +#include "version.h" extern struct s_config config; @@ -50,12 +69,36 @@ void printhelp() " Default timestamp format is: YYYY-MM-DD HH:MM:SS\n" "\n" "Other options:\n" - "-h Display this help text\n", + "-h Display this help text\n" + "-v Display version and license information\n", config.name,config.fallback_freq,config.governor,config.temp_input,config.interval, config.freq_step,config.max_temp/1000,config.logger_name ); } +void printversion() +{ + printf("%s version %s\n\n",config.name,version()); + printf( + "Copyright 2023, 2024 pa4wdh\n" + "\n" + "%s is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation; either version 3 of the License , or\n" + "(at your option) any later version.\n" + "\n" + "%s is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with %s; see the file COPYING. If not, see\n" + "<http://www.gnu.org/licenses>.\n", + config.name,config.name,config.name + ); +} + void argparse(int argc, char **argv) { int opt; @@ -77,7 +120,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:kl:mp:P:s:t:u"))!=-1) + while((opt=getopt(argc,argv,"c:C:d:f:g:hi:kl:mp:P:s:t:uv"))!=-1) { DEBUG1_ARGPARSE("Argument: %c Value: %s\n",opt,optarg); switch(opt) @@ -106,7 +149,7 @@ void argparse(int argc, char **argv) break; case 'h': printhelp(); - exit(1); + exit(0); case 'i': strncpy(userconfig.temp_input,optarg,sizeof(userconfig.temp_input)); break; @@ -139,6 +182,9 @@ void argparse(int argc, char **argv) case 'u': userconfig.use_unixtime=1; break; + case 'v': + printversion(); + exit(0); default: printhelp(); exit(1); |