From: smccam Date: Fri, 31 Oct 2008 23:24:01 +0000 (+0000) Subject: Die with an explicit error message if the user tries a multi-character X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=a0fc0ac7758b6a1561ba5ec753c6e2cbafb83f4b;p=francis%2Fstp.git Die with an explicit error message if the user tries a multi-character option, rather than silently ignoring the remaining characters git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@37 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/parser/main.cpp b/parser/main.cpp index 35047d7..4f1034e 100644 --- a/parser/main.cpp +++ b/parser/main.cpp @@ -83,7 +83,7 @@ int main(int argc, char ** argv) { helpstring += "-h : help\n"; for(int i=1; i < argc;i++) { - if(argv[i][0] == '-') + if(argv[i][0] == '-') { switch(argv[i][1]) { case 'a' : BEEV::optimize = false; @@ -151,7 +151,14 @@ int main(int argc, char ** argv) { return -1; break; } - else { + if(argv[i][2]) { + fprintf(stderr, "Multiple character options are not allowed.\n"); + fprintf(stderr, "(-ab is not an abbreviation for -a -b)\n"); + fprintf(stderr,usage,prog); + cout << helpstring; + return -1; + } + } else { infile = argv[i]; yyin = fopen(infile,"r"); if(yyin == NULL) {