changeset 2:6c327ae23d2c

added --help to shell edition some cleanups
author meillo@marmaro.de
date Mon, 28 May 2007 20:03:27 +0200
parents 8d8b41f7c0bc
children 2064a5a65b7e b82703cc3dd4
files graph graph.cpp graph2.sh
diffstat 3 files changed, 34 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
Binary file graph has changed
--- a/graph.cpp	Mon May 28 18:43:49 2007 +0200
+++ b/graph.cpp	Mon May 28 20:03:27 2007 +0200
@@ -144,13 +144,16 @@
 int main(int argc, char **argv){
     if (argc == 2) {
         if (strcmp(argv[1], "--version") == 0) {
-          cout << "Buddylistgrapher 2.0" << endl;
-          cout << "====================" << endl;
-          cout << "by Julian Forster (and a little bit by Markus Schnalke)" << endl;
-          cout << "http://progmaschine.de.vu" << endl;
+          cout << "Buddylistgrapher (C++)" << endl;
+          cout << "======================" << endl;
+          cout << "version 2.0" << endl;
+          cout << endl;
+          cout << "by Julian Forster (http://progmaschine.de.vu)" << endl;
+          cout << "and a little bit by Markus Schnalke (http://prog.marmaro.de)" << endl;
         } else if (strcmp(argv[1], "--help") == 0) {
-          cout << "Buddylistgrapher 2.0" << endl;
-          cout << "====================" << endl;
+          cout << "Buddylistgrapher" << endl;
+          cout << "================" << endl;
+          cout << endl;
           cout << "usage: " << argv[0] << " <input.txt>" << endl;
           cout << endl;
           cout << "The grapher generates output to stdout." << endl;
--- a/graph2.sh	Mon May 28 18:43:49 2007 +0200
+++ b/graph2.sh	Mon May 28 20:03:27 2007 +0200
@@ -7,9 +7,28 @@
 
 if [ $# -eq 1 ]; then
   if [ $1 = '--version' ] ; then
-    echo 'Buddylistgrapher'
-    echo 'shellscript edition'
-    echo 'version 0.1'
+    echo 'Buddylistgrapher (shell)'
+    echo '========================'
+    echo 'version 0.2'
+    echo
+    echo 'by Julian Forster (http://progmaschine.de.vu)'
+    echo 'and Markus Schnalke (http://prog.marmaro.de)'
+    exit 0
+  elif [ $1 = '--help' ] ; then
+    echo 'Buddylistgrapher (shell)'
+    echo '========================'
+    echo
+    echo "usage: $0 <input.txt>"
+    echo
+    echo "The grapher generates output to stdout."
+    echo "This output is the input for the graphviz tools."
+    echo
+    echo "You can use it like this:"
+    echo "$0 input.txt | dot -Tpng > pic.png"
+    echo
+    echo "ToDo:"
+    echo "The program was written for one specific kind of input data,"
+    echo "so there is still some work to do to use it for general input."
     exit 0
   else
 
@@ -19,22 +38,19 @@
     # extract all needed lines
     grep -e "Profil von:" -e "Nachricht schreiben" $1 > $file
 
+
     # collect all profil names (we only want them as nodes)
     cat $file | while read line ; do
       echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2
     done
     echo >> $file2
 
-#cat $file2
-#exit 
-
 
     # output
     echo "digraph G {"
     
     cat $file | while read line ; do
-      isProfil=`echo $line | grep "Profil von:"`
-      if [ -n "$isProfil" ] ; then
+      if [ -n "`echo $line | grep "Profil von:"`" ] ; then
         name=$(echo $line |  awk '{ print $3 }')
       else
         buddy=$(echo $line |  awk '{ print $3 }')
@@ -46,7 +62,7 @@
 
     echo "}"
 
-    #rm $file $file2
+    rm $file $file2
     exit 0
 
   fi