CryptoDit/argparse.c
2026-01-31 16:45:53 +01:00

23 lines
583 B
C

#include "argparse.h"
/*
* This function check all arguments
* Return the 0 if success or 1 if failed
*/
int check_arguments(char **args, const int len, char *buf_module, const size_t bufsize){
int i;
int res = -1;
// Bypass the first arguments, because it's the script itself
for (i = 1; i < len; i++){
// check if it's an option
if (args[i][0] == '-'){
if (args[i][1] == 'm') {
// Get the module
strcpy(buf_module, args[i + 1]);
res = 0;
}
}
}
return res;
}