# HG changeset patch # User meillo@marmaro.de # Date 1204398248 -3600 # Node ID ff01f0f076e4cffb12ff5de8db742694b0315e59 # Parent 29172b6e802ad2c6d234ff8790785d8367f73717 option_verbose is now global; stuff about warning when (expected) nodes are not there diff -r 29172b6e802a -r ff01f0f076e4 actions.c --- a/actions.c Sat Mar 01 17:55:42 2008 +0100 +++ b/actions.c Sat Mar 01 20:04:08 2008 +0100 @@ -14,7 +14,9 @@ unsigned char action(struct Node* node) { if (node == NULL) { - fprintf(stderr, "action of non existing node\n"); + if (option_verbose) { + fprintf(stderr, "warning: action of non existing node\n"); + } return 0; } @@ -67,7 +69,9 @@ unsigned char action_number(struct Node* node) { - action(node->down); + if (node->down != NULL) { + action(node->down); + } return node->value; } diff -r 29172b6e802a -r ff01f0f076e4 baum.c --- a/baum.c Sat Mar 01 17:55:42 2008 +0100 +++ b/baum.c Sat Mar 01 20:04:08 2008 +0100 @@ -17,8 +17,6 @@ #define VERSION "0.3" -int option_verbose = 0; - struct Node* root = 0; struct Stackitem* stack = NULL; @@ -224,6 +222,8 @@ /* main */ int main(int argc, char* argv[]) { unsigned char shell_return = 0; + + option_verbose = 0; while (--argc > 0 && (*++argv)[0] == '-') { if (strcmp(argv[0], "--version") == 0) { diff -r 29172b6e802a -r ff01f0f076e4 baum.h --- a/baum.h Sat Mar 01 17:55:42 2008 +0100 +++ b/baum.h Sat Mar 01 20:04:08 2008 +0100 @@ -1,3 +1,4 @@ +int option_verbose; void logit(char* text);