# HG changeset patch # User John W. Eaton # Date 1626976423 14400 # Node ID 218716316e6235b3c939e1470ecbede8182aa02f # Parent 68fa4ac060cefcadfda289b7075136020c40b2ae# Parent 0f41e117789f348ac0d935d235b02bd7c04e47a4 maint: Merge stable to default. diff -r 68fa4ac060ce -r 218716316e62 liboctave/wrappers/getopt-wrapper.c --- a/liboctave/wrappers/getopt-wrapper.c Thu Jul 22 19:06:00 2021 +0200 +++ b/liboctave/wrappers/getopt-wrapper.c Thu Jul 22 13:53:43 2021 -0400 @@ -121,3 +121,20 @@ { return optind; } + +int +octave_get_opterr_wrapper (void) +{ + return opterr; +} + +int +octave_set_opterr_wrapper (int val) +{ + int retval = opterr; + + opterr = val; + + return retval; +} + diff -r 68fa4ac060ce -r 218716316e62 liboctave/wrappers/getopt-wrapper.h --- a/liboctave/wrappers/getopt-wrapper.h Thu Jul 22 19:06:00 2021 +0200 +++ b/liboctave/wrappers/getopt-wrapper.h Thu Jul 22 13:53:43 2021 -0400 @@ -52,6 +52,9 @@ extern OCTAVE_API int octave_optind_wrapper (void); +extern OCTAVE_API int octave_get_opterr_wrapper (void); +extern OCTAVE_API int octave_set_opterr_wrapper (int val); + #if defined __cplusplus } #endif diff -r 68fa4ac060ce -r 218716316e62 src/main.in.cc --- a/src/main.in.cc Thu Jul 22 19:06:00 2021 +0200 +++ b/src/main.in.cc Thu Jul 22 13:53:43 2021 -0400 @@ -278,6 +278,13 @@ bool warn_display = true; bool no_display = false; + // Disable error reporting in getopt. We want to silently recognize + // and process a few special arguments here and pass everything on to + // the real Octave program where incorrect usage errors may be + // reported. + + octave_set_opterr_wrapper (0); + while (true) { int long_idx;