return nonzero exit code on parse failure
This commit is contained in:
parent
257b7c45c7
commit
587a612650
@ -100,6 +100,7 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
int option_index;
|
int option_index;
|
||||||
|
int rv = 0;
|
||||||
const char * output_fname = nullptr;
|
const char * output_fname = nullptr;
|
||||||
|
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -118,7 +119,7 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
if (optind >= argc)
|
if (optind >= argc)
|
||||||
{
|
{
|
||||||
return -2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * input_fname = argv[optind];
|
const char * input_fname = argv[optind];
|
||||||
@ -136,6 +137,10 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
emit_c(node, output_fname);
|
emit_c(node, output_fname);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rv = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Clean up temporary files. */
|
/* Clean up temporary files. */
|
||||||
if (preprocessed_fname_created)
|
if (preprocessed_fname_created)
|
||||||
@ -143,5 +148,5 @@ int main(int argc, char * argv[])
|
|||||||
unlink(preprocessed_fname);
|
unlink(preprocessed_fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return rv;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user