make deffile a local
parent
af8d4ecf88
commit
196ec1aac9
9
main.cc
9
main.cc
|
@ -207,8 +207,6 @@ static ConstCharRange ob_compare_subst(
|
||||||
|
|
||||||
static ThreadPool tpool;
|
static ThreadPool tpool;
|
||||||
|
|
||||||
static ConstCharRange deffile = "obuild.cfg";
|
|
||||||
|
|
||||||
struct ObState: CsState {
|
struct ObState: CsState {
|
||||||
ConstCharRange progname;
|
ConstCharRange progname;
|
||||||
int jobs = 1;
|
int jobs = 1;
|
||||||
|
@ -497,7 +495,7 @@ struct ObState: CsState {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int print_help(bool error) {
|
int print_help(bool error, ConstCharRange deffile) {
|
||||||
ostd::Stream &os = error ? ostd::err : ostd::out;
|
ostd::Stream &os = error ? ostd::err : ostd::out;
|
||||||
os.writeln(
|
os.writeln(
|
||||||
"Usage: ", progname, " [options] [action]\n",
|
"Usage: ", progname, " [options] [action]\n",
|
||||||
|
@ -526,6 +524,7 @@ int main(int argc, char **argv) {
|
||||||
os.add_ident(cscript::ID_VAR, "numjobs", 4096, 1, &os.jobs);
|
os.add_ident(cscript::ID_VAR, "numjobs", 4096, 1, &os.jobs);
|
||||||
|
|
||||||
ConstCharRange fcont;
|
ConstCharRange fcont;
|
||||||
|
ConstCharRange deffile = "obuild.cfg";
|
||||||
|
|
||||||
int posarg = argc;
|
int posarg = argc;
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
@ -535,7 +534,7 @@ int main(int argc, char **argv) {
|
||||||
os.ignore_env = true;
|
os.ignore_env = true;
|
||||||
continue;
|
continue;
|
||||||
} else if ((argn == 'h') || (!argv[i][2] && ((i + 1) >= argc))) {
|
} else if ((argn == 'h') || (!argv[i][2] && ((i + 1) >= argc))) {
|
||||||
return os.print_help(argn != 'h');
|
return os.print_help(argn != 'h', deffile);
|
||||||
}
|
}
|
||||||
ConstCharRange val = (argv[i][2] == '\0') ? argv[++i] : &argv[i][2];
|
ConstCharRange val = (argv[i][2] == '\0') ? argv[++i] : &argv[i][2];
|
||||||
switch (argn) {
|
switch (argn) {
|
||||||
|
@ -559,7 +558,7 @@ int main(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return os.print_help(true);
|
return os.print_help(true, deffile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
posarg = i;
|
posarg = i;
|
||||||
|
|
Loading…
Reference in New Issue