From d61c7f8dcda0ca8438c56c6abb2da4ce988a5061 Mon Sep 17 00:00:00 2001 From: celso Date: Fri, 11 Nov 2022 21:32:45 -0300 Subject: [PATCH] started working on argv parsing --- src/homemade_speedstep.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/homemade_speedstep.c b/src/homemade_speedstep.c index e8ef509..28d5529 100644 --- a/src/homemade_speedstep.c +++ b/src/homemade_speedstep.c @@ -51,6 +51,14 @@ int stringtoint(char number[], int length){ return result; } +int stringlength(char string[]){ + int i = 0; + while(string[i]!='\0'){ + i++; + } + return i; +} + int main(int argc, char** argv){ if (argc == 1 || comparestrings(argv[1], "-h") == 0 || comparestrings(argv[1], "--help") == 0){ @@ -64,6 +72,8 @@ int main(int argc, char** argv){ printf(" see homemade_speedstep --help\n"); return 1; } + int maxtemp = stringtoint(argv[1], stringlength(argv[1])); + int mintemp = stringtoint(argv[2], stringlength(argv[2])); char gov[20]; FILE *govfile = fopen(CURGOV, "r"); getfilec(govfile, gov);