From 30cda9e7da766789dca0d923ab4905e87549b9c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz>
Date: Fri, 25 Apr 2014 20:10:01 +0200
Subject: [PATCH] aderivation, aintegral, aepsilon: help

---
 aderivation/src/aderivation.cpp | 21 +++++++++++++++++----
 aepsilon/src/aepsilon.fsm.cpp   |  7 ++++---
 aintegral/src/aintegral.cpp     | 22 ++++++++++++++++++----
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/aderivation/src/aderivation.cpp b/aderivation/src/aderivation.cpp
index aafb5aeee0..27d31b2084 100644
--- a/aderivation/src/aderivation.cpp
+++ b/aderivation/src/aderivation.cpp
@@ -1,4 +1,6 @@
 #include <iostream>
+#include <cstring>
+
 
 #include <AlibException.h>
 #include <regexp/RegExp.h>
@@ -13,13 +15,24 @@ using namespace alib;
 using namespace regexp;
 using namespace std;
 
-/*
- * Usage:
- *  aderivative "a" "b" "cc" < regexp.xml
- */
+void help( void )
+{
+    cout << "aderivation 0.01" << endl;
+    cout << "Returns derivation of regexp over given string of symbols." << endl;
+    cout << "Usage: aintegral SYMBOL-1 SYMBOL-2 ... SYMBOL-n" << endl;
+}
 
 int main(int argc, char** argv)
 {
+    for( int i = 0; i < argc; i++ )
+    {
+        if( strcmp( argv[ i ], "--help" ) == 0 || strcmp( argv[ i ], "-h" ) == 0 )
+        {
+            help( );
+            return 0;
+        }
+    }
+
     try
     {
         list<Token> tokens;
diff --git a/aepsilon/src/aepsilon.fsm.cpp b/aepsilon/src/aepsilon.fsm.cpp
index dadd23e802..f4ab4bf828 100644
--- a/aepsilon/src/aepsilon.fsm.cpp
+++ b/aepsilon/src/aepsilon.fsm.cpp
@@ -24,10 +24,11 @@ int main(int argc, char** argv) {
         {
             for( int i = 1; i < argc; i++ )
             {
-                if( string( "-h" ).compare( argv[i] ) == 0 )
+                if( string( "-h" ).compare( argv[i] ) == 0 || string( "--help").compare( argv[i] ) == 0 )
                 {
-                    std::cout << "Removes eps transitions from NFA." << std::endl;
-                    std::cout << "Usage: aepsilon [automaton.xml]" << std::endl;
+                    std::cout << "aepsilon." << std::endl;
+                    std::cout << "Removes epsilon transitions from NFA." << std::endl;
+                    std::cout << "Usage: aepsilon" << std::endl;
                     return 1;
                 }
                 else
diff --git a/aintegral/src/aintegral.cpp b/aintegral/src/aintegral.cpp
index cb6b62fd6c..45953f0750 100644
--- a/aintegral/src/aintegral.cpp
+++ b/aintegral/src/aintegral.cpp
@@ -1,4 +1,5 @@
 #include <iostream>
+#include <cstring>
 
 #include <AlibException.h>
 #include <regexp/RegExp.h>
@@ -13,13 +14,26 @@ using namespace alib;
 using namespace regexp;
 using namespace std;
 
-/*
- * Usage:
- *  aintegral "a" "b" "cc" < regexp.xml
- */
+
+
+void help( void )
+{
+    cout << "aintegral 0.01" << endl;
+    cout << "Returns integral of regexp over given string of symbols." << endl;
+    cout << "Usage: aintegral SYMBOL-1 SYMBOL-2 ... SYMBOL-n" << endl;
+}
 
 int main(int argc, char** argv)
 {
+    for( int i = 0; i < argc; i++ )
+    {
+        if( strcmp( argv[ i ], "--help" ) == 0 || strcmp( argv[ i ], "-h" ) == 0 )
+        {
+            help( );
+            return 0;
+        }
+    }
+
     try
     {
         list<Token> tokens;
-- 
GitLab