Gracefully handle an *empty* argument array (argc < 1), which apparently is possible on Linux and maybe others.
This commit is contained in:
parent
4caad0d279
commit
1c587be39b
@ -158,6 +158,12 @@ int MAIN(const int argc, CHR *const argv[])
|
||||
/* Parse arguments */
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
FPUTS(T("Error: Argument array is empty. The program was called incorrectly!\n\n"), stderr);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
FPRINTF(stderr, T("Error: Nothing to do. Please type '%") T(PRISTR) T(" --help' for details!\n\n"), get_file_name(argv[0U]));
|
||||
|
Loading…
Reference in New Issue
Block a user