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 diff
1.1 --- a/actions.c Sat Mar 01 17:55:42 2008 +0100 1.2 +++ b/actions.c Sat Mar 01 20:04:08 2008 +0100 1.3 @@ -14,7 +14,9 @@ 1.4 1.5 unsigned char action(struct Node* node) { 1.6 if (node == NULL) { 1.7 - fprintf(stderr, "action of non existing node\n"); 1.8 + if (option_verbose) { 1.9 + fprintf(stderr, "warning: action of non existing node\n"); 1.10 + } 1.11 return 0; 1.12 } 1.13 1.14 @@ -67,7 +69,9 @@ 1.15 1.16 1.17 unsigned char action_number(struct Node* node) { 1.18 - action(node->down); 1.19 + if (node->down != NULL) { 1.20 + action(node->down); 1.21 + } 1.22 return node->value; 1.23 } 1.24
2.1 --- a/baum.c Sat Mar 01 17:55:42 2008 +0100 2.2 +++ b/baum.c Sat Mar 01 20:04:08 2008 +0100 2.3 @@ -17,8 +17,6 @@ 2.4 #define VERSION "0.3" 2.5 2.6 2.7 -int option_verbose = 0; 2.8 - 2.9 struct Node* root = 0; 2.10 struct Stackitem* stack = NULL; 2.11 2.12 @@ -224,6 +222,8 @@ 2.13 /* main */ 2.14 int main(int argc, char* argv[]) { 2.15 unsigned char shell_return = 0; 2.16 + 2.17 + option_verbose = 0; 2.18 2.19 while (--argc > 0 && (*++argv)[0] == '-') { 2.20 if (strcmp(argv[0], "--version") == 0) {