From d14d5ce06bdaefbd7219dabdcc7e1e97da8ef9d1 Mon Sep 17 00:00:00 2001 From: ccremers Date: Wed, 26 May 2004 19:40:40 +0000 Subject: [PATCH] - Added exit codes and use these in testl script. --- src/main.c | 20 +++++++++++++++++++- src/testl | 27 ++++++++++++++------------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main.c b/src/main.c index dfe3e8e..e6886b3 100644 --- a/src/main.c +++ b/src/main.c @@ -16,7 +16,14 @@ * * How to install Scyther. * - * \section coding Coding convertions + * \section exit Exit codes + * + * 0 Okay No attack found, claims encountered + * 1 Error Something went wrong (error) + * 2 Okay No attack found (because) no claims encountered + * 3 Okay Attack found + * + * \section coding Coding conventions * * Usually, each source file except main.c has an myfileInit() and myfileDone() function * available. These allow any initialisation and destruction of required structures. @@ -368,6 +375,17 @@ main (int argc, char **argv) if (sys->attack != NULL && sys->attack->length != 0) { attackDisplay(sys); + /* mark exit code */ + exitcode = 3; + } + else + { + /* check for no claims */ + if (sys->failed == 0) + { + /* mark exit code */ + exitcode = 2; + } } /* latex closeup */ diff --git a/src/testl b/src/testl index 9be507c..ec5544e 100755 --- a/src/testl +++ b/src/testl @@ -13,20 +13,21 @@ template=../src/attacktemplate if [ -f $file ] then - ../src/scyther --latex $file -o attack.tex - latex $template.tex - - mv $template.dvi attack.dvi - dvips attack.dvi -o attack.ps - - # also eps output now - ps2eps -f attack.ps - - xdvi attack.dvi # for Xdvi -# kdvi attack.dvi # for KDE environment -# kghostview attack.ps # postscript in KDE - + if [ "$?" -eq "3" ] + then + latex $template.tex + + mv $template.dvi attack.dvi + dvips attack.dvi -o attack.ps + + # also eps output now + ps2eps -f attack.ps + + xdvi attack.dvi # for Xdvi + # kdvi attack.dvi # for KDE environment + # kghostview attack.ps # postscript in KDE + fi else echo "No file $file found."