[RSYM/x64] Make command line compatible with x86 version

x86 version needs input and output file names as arguments, even if is called with
input file name = output file name.
x86 version also accepts a -s argument to the root path of ReactOS sources

Make x64 version take the same arguments.
This commit is contained in:
Hervé Poussineau 2021-02-22 14:17:32 +01:00
parent 05fbfb0cad
commit 4c930799f1

View file

@ -865,15 +865,47 @@ int main(int argc, char* argv[])
FILE_INFO File; FILE_INFO File;
FILE* outfile; FILE* outfile;
int ret; int ret;
int arg, argstate = 0;
char *SourcePath = NULL;
if (argc != 3) for (arg = 1; arg < argc; arg++)
{ {
fprintf(stderr, "Usage: rsym <exefile> <symfile>\n"); switch (argstate)
exit(1); {
default:
argstate = -1;
break;
case 0:
if (!strcmp(argv[arg], "-s"))
{
argstate = 1;
}
else
{
argstate = 2;
pszInFile = convert_path(argv[arg]);
}
break;
case 1:
free(SourcePath);
SourcePath = strdup(argv[arg]);
argstate = 0;
break;
case 2:
pszOutFile = convert_path(argv[arg]);
argstate = 3;
break;
}
} }
pszInFile = convert_path(argv[1]); if (argstate != 3)
pszOutFile = convert_path(argv[2]); {
fprintf(stderr, "Usage: rsym [-s <sources>] <input> <output>\n");
exit(1);
}
File.FilePtr = load_file(pszInFile, &File.cbInFileSize); File.FilePtr = load_file(pszInFile, &File.cbInFileSize);
if (!File.FilePtr) if (!File.FilePtr)