mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 04:03:56 +00:00
[LOG2LINES]
Improve Log2lines.exe help usage by Victor Martinez Calvo CORE-7427 #resolve svn path=/trunk/; revision=61670
This commit is contained in:
parent
aaf0f8ce65
commit
38e6fa7f14
2 changed files with 20 additions and 2 deletions
|
@ -566,6 +566,7 @@ int
|
||||||
main(int argc, const char **argv)
|
main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
int optInit = 0;
|
||||||
int optCount = 0;
|
int optCount = 0;
|
||||||
|
|
||||||
dbgIn = stdin;
|
dbgIn = stdin;
|
||||||
|
@ -579,9 +580,10 @@ main(int argc, const char **argv)
|
||||||
memset(&revinfo, 0, sizeof(REVINFO));
|
memset(&revinfo, 0, sizeof(REVINFO));
|
||||||
clearLastLine();
|
clearLastLine();
|
||||||
|
|
||||||
optionInit(argc, argv);
|
optInit = optionInit(argc, argv);
|
||||||
optCount = optionParse(argc, argv);
|
optCount = optionParse(argc, argv);
|
||||||
if (optCount < 0)
|
|
||||||
|
if (optCount < 0 || optInit < 0)
|
||||||
{
|
{
|
||||||
return optCount;
|
return optCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,9 @@ char opt_7z[PATH_MAX]; // -z <opt_7z>
|
||||||
char opt_scanned[LINESIZE]; // all scanned options
|
char opt_scanned[LINESIZE]; // all scanned options
|
||||||
char opt_SourcesPath[LINESIZE]; //sources path
|
char opt_SourcesPath[LINESIZE]; //sources path
|
||||||
|
|
||||||
|
/* optionInit returns 0 for normal operation, and -1 in case just "loglines.exe" was written.
|
||||||
|
In such case, the help is shown */
|
||||||
|
|
||||||
int optionInit(int argc, const char **argv)
|
int optionInit(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -64,8 +67,20 @@ int optionInit(int argc, const char **argv)
|
||||||
l2l_dbg(1, "Trunk build revision: %d\n", revinfo.buildrev);
|
l2l_dbg(1, "Trunk build revision: %d\n", revinfo.buildrev);
|
||||||
|
|
||||||
strcpy(opt_scanned, "");
|
strcpy(opt_scanned, "");
|
||||||
|
|
||||||
|
//The user introduced "log2lines.exe" or "log2lines.exe /?"
|
||||||
|
//Let's help the user
|
||||||
|
if ((argc == 1) ||
|
||||||
|
((argc == 2) && (argv[1][0] == '/') && (argv[1][1] == '?')))
|
||||||
|
{
|
||||||
|
opt_help++;
|
||||||
|
usage(1);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((argv[i][0] == '-') && (i+1 < argc))
|
if ((argv[i][0] == '-') && (i+1 < argc))
|
||||||
{
|
{
|
||||||
//Because these arguments can contain spaces we cant use getopt(), a known bug:
|
//Because these arguments can contain spaces we cant use getopt(), a known bug:
|
||||||
|
@ -90,6 +105,7 @@ int optionInit(int argc, const char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(opt_scanned, argv[i]);
|
strcat(opt_scanned, argv[i]);
|
||||||
strcat(opt_scanned, " ");
|
strcat(opt_scanned, " ");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue