Mercurial > baum
changeset 38:ff01f0f076e4
option_verbose is now global; stuff about warning when (expected) nodes are not there
author | meillo@marmaro.de |
---|---|
date | Sat, 01 Mar 2008 20:04:08 +0100 |
parents | 29172b6e802a |
children | 96e2d58bc346 |
files | actions.c baum.c baum.h |
diffstat | 3 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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) {