buddylistgrapher
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 diff
1.1 Binary file graph has changed
2.1 --- a/graph.cpp Mon May 28 18:43:49 2007 +0200 2.2 +++ b/graph.cpp Mon May 28 20:03:27 2007 +0200 2.3 @@ -144,13 +144,16 @@ 2.4 int main(int argc, char **argv){ 2.5 if (argc == 2) { 2.6 if (strcmp(argv[1], "--version") == 0) { 2.7 - cout << "Buddylistgrapher 2.0" << endl; 2.8 - cout << "====================" << endl; 2.9 - cout << "by Julian Forster (and a little bit by Markus Schnalke)" << endl; 2.10 - cout << "http://progmaschine.de.vu" << endl; 2.11 + cout << "Buddylistgrapher (C++)" << endl; 2.12 + cout << "======================" << endl; 2.13 + cout << "version 2.0" << endl; 2.14 + cout << endl; 2.15 + cout << "by Julian Forster (http://progmaschine.de.vu)" << endl; 2.16 + cout << "and a little bit by Markus Schnalke (http://prog.marmaro.de)" << endl; 2.17 } else if (strcmp(argv[1], "--help") == 0) { 2.18 - cout << "Buddylistgrapher 2.0" << endl; 2.19 - cout << "====================" << endl; 2.20 + cout << "Buddylistgrapher" << endl; 2.21 + cout << "================" << endl; 2.22 + cout << endl; 2.23 cout << "usage: " << argv[0] << " <input.txt>" << endl; 2.24 cout << endl; 2.25 cout << "The grapher generates output to stdout." << endl;
3.1 --- a/graph2.sh Mon May 28 18:43:49 2007 +0200 3.2 +++ b/graph2.sh Mon May 28 20:03:27 2007 +0200 3.3 @@ -7,9 +7,28 @@ 3.4 3.5 if [ $# -eq 1 ]; then 3.6 if [ $1 = '--version' ] ; then 3.7 - echo 'Buddylistgrapher' 3.8 - echo 'shellscript edition' 3.9 - echo 'version 0.1' 3.10 + echo 'Buddylistgrapher (shell)' 3.11 + echo '========================' 3.12 + echo 'version 0.2' 3.13 + echo 3.14 + echo 'by Julian Forster (http://progmaschine.de.vu)' 3.15 + echo 'and Markus Schnalke (http://prog.marmaro.de)' 3.16 + exit 0 3.17 + elif [ $1 = '--help' ] ; then 3.18 + echo 'Buddylistgrapher (shell)' 3.19 + echo '========================' 3.20 + echo 3.21 + echo "usage: $0 <input.txt>" 3.22 + echo 3.23 + echo "The grapher generates output to stdout." 3.24 + echo "This output is the input for the graphviz tools." 3.25 + echo 3.26 + echo "You can use it like this:" 3.27 + echo "$0 input.txt | dot -Tpng > pic.png" 3.28 + echo 3.29 + echo "ToDo:" 3.30 + echo "The program was written for one specific kind of input data," 3.31 + echo "so there is still some work to do to use it for general input." 3.32 exit 0 3.33 else 3.34 3.35 @@ -19,22 +38,19 @@ 3.36 # extract all needed lines 3.37 grep -e "Profil von:" -e "Nachricht schreiben" $1 > $file 3.38 3.39 + 3.40 # collect all profil names (we only want them as nodes) 3.41 cat $file | while read line ; do 3.42 echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2 3.43 done 3.44 echo >> $file2 3.45 3.46 -#cat $file2 3.47 -#exit 3.48 - 3.49 3.50 # output 3.51 echo "digraph G {" 3.52 3.53 cat $file | while read line ; do 3.54 - isProfil=`echo $line | grep "Profil von:"` 3.55 - if [ -n "$isProfil" ] ; then 3.56 + if [ -n "`echo $line | grep "Profil von:"`" ] ; then 3.57 name=$(echo $line | awk '{ print $3 }') 3.58 else 3.59 buddy=$(echo $line | awk '{ print $3 }') 3.60 @@ -46,7 +62,7 @@ 3.61 3.62 echo "}" 3.63 3.64 - #rm $file $file2 3.65 + rm $file $file2 3.66 exit 0 3.67 3.68 fi