Code formating
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
#include "util.h"
|
||||
#include "parameteroperation.h"
|
||||
#include "util.h"
|
||||
|
||||
int ParameterOperation_Parse(int argumentCount, char *arguments[], TParameterOperation parameterOperations[], void *data) {
|
||||
int ParameterOperation_Parse(int argumentCount, char *arguments[],
|
||||
TParameterOperation parameterOperations[],
|
||||
void *data) {
|
||||
int processedParams = 0;
|
||||
char **currentArguments = arguments + 1;
|
||||
for (int i = 1; i < argumentCount; i++) {
|
||||
char *currentArgument = currentArguments[0];
|
||||
currentArguments++;
|
||||
if (currentArgument[0] != '-') {
|
||||
Print("Error: Garbage found \"%s\" in position %d.\n", arguments[i], i + 1);
|
||||
Print("Error: Garbage found \"%s\" in position %d.\n", arguments[i],
|
||||
i + 1);
|
||||
return -1;
|
||||
}
|
||||
while (currentArgument[0] == '-') {
|
||||
@@ -18,14 +21,19 @@ int ParameterOperation_Parse(int argumentCount, char *arguments[], TParameterOpe
|
||||
int j = 0;
|
||||
while (parameterOperations[j].Name != NULL) {
|
||||
ParameterOperation parameterOperation = ¶meterOperations[j];
|
||||
if (String_CompareCaseInsensitive(currentArgument, parameterOperation->Name) == 0) {
|
||||
if (String_CompareCaseInsensitive(currentArgument,
|
||||
parameterOperation->Name) == 0) {
|
||||
if ((i + parameterOperation->NumItems) >= argumentCount) {
|
||||
Print("Error: Parsing parameter \"-%s\" in position %d, missig parameter data.\n", parameterOperations[j].Name, i + 1);
|
||||
Print("Error: Parsing parameter \"-%s\" in position %d, "
|
||||
"missig parameter data.\n",
|
||||
parameterOperations[j].Name, i + 1);
|
||||
return -1;
|
||||
}
|
||||
bool result = parameterOperation->SetFunc(parameterOperation->NumItems, currentArguments, data);
|
||||
bool result = parameterOperation->SetFunc(
|
||||
parameterOperation->NumItems, currentArguments, data);
|
||||
if (result == false) {
|
||||
Print("Error: Parsing parameter \"-%s\" in position %d.\n", parameterOperations[j].Name, i + 1);
|
||||
Print("Error: Parsing parameter \"-%s\" in position %d.\n",
|
||||
parameterOperations[j].Name, i + 1);
|
||||
return -1;
|
||||
}
|
||||
currentArguments += parameterOperation->NumItems;
|
||||
@@ -37,7 +45,8 @@ int ParameterOperation_Parse(int argumentCount, char *arguments[], TParameterOpe
|
||||
j++;
|
||||
}
|
||||
if (processed == false) {
|
||||
Print("Error: Unknow parameter \"%s\" in position %d.\n", arguments[i], i + 1);
|
||||
Print("Error: Unknow parameter \"%s\" in position %d.\n",
|
||||
arguments[i], i + 1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user