started working on argv parsing

This commit is contained in:
celso 2022-11-11 21:32:45 -03:00
parent 86a1552530
commit d61c7f8dcd
1 changed files with 10 additions and 0 deletions

View File

@ -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);