From a0a377a84f2e3c33e5fff85dc4259945d235c671 Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Mon, 16 Jun 2008 18:57:28 +0200 Subject: [PATCH] Added switch to disable verbose exit codes. In the near future, the default exit code behavior should be made obsolete anyway, as the exit codes are not a nice way to report status. It used to be convenient for shell scripting in early times, when the parallel tests were run using the forward model checker, but no modern script should be relying on it. --- src/main.c | 9 ++++++++- src/switches.c | 17 +++++++++++++++++ src/switches.h | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 392f03b..a652ce8 100644 --- a/src/main.c +++ b/src/main.c @@ -234,7 +234,14 @@ main (int argc, char **argv) /* memory clean up? */ strings_cleanup (); - return exitcode; + if (switches.exitCodes) + { + return exitcode; + } + else + { + return 0; + } } //! Analyse the model diff --git a/src/switches.c b/src/switches.c index 756f8e8..4bf1aaf 100644 --- a/src/switches.c +++ b/src/switches.c @@ -108,6 +108,7 @@ switchesInit (int argc, char **argv) switches.monochrome = false; // default colors for dot switches.lightness = 0; // lightness correction switches.clusters = false; // default is no clusters for now + switches.exitCodes = true; // default is to flag exit codes // Process the environment variable SCYTHERFLAGS process_environment (); @@ -900,6 +901,22 @@ switcher (const int process, int index, int commandline) } } + if (detect (' ', "no-exitcodes", 0)) + { + if (!process) + { + if (switches.expert) + { + helptext (" --no-exitcodes", "Disable verbose exitcodes."); + } + } + else + { + switches.exitCodes = false; + return index; + } + } + /* ================== * Modelchecker only diff --git a/src/switches.h b/src/switches.h index b344787..c2d8a65 100644 --- a/src/switches.h +++ b/src/switches.h @@ -83,7 +83,8 @@ struct switchdata int plain; //!< Disable color output on terminal int monochrome; //!< Disable colors in dot output int lightness; //!< Lightness increment 0-100 - int clusters; //!> Enable clusters in output + int clusters; //!< Enable clusters in output + int exitCodes; //!< Enable verbose exit codes }; extern struct switchdata switches; //!< pointer to switchdata structure