baum

changeset 52:201b4603671a

documented "if" and "while" in the man page; new error code 7
author meillo@marmaro.de
date Sun, 02 Mar 2008 16:26:06 +0100
parents 7d7abe88e71b
children 036779d5da75
files actions.c baum.1
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/actions.c	Sun Mar 02 16:17:18 2008 +0100
     1.2 +++ b/actions.c	Sun Mar 02 16:26:06 2008 +0100
     1.3 @@ -115,7 +115,7 @@
     1.4  
     1.5  	if (node->down == NULL || node->down->right == NULL) {
     1.6  		fprintf(stderr, "error: while requires two sons");
     1.7 -		exit(1); /* FIXME other error code */
     1.8 +		exit(7);
     1.9  	}
    1.10  
    1.11  	return1 = action(node->down);
    1.12 @@ -145,7 +145,7 @@
    1.13  unsigned char action_while(struct Node* node) {
    1.14  	if (node->down == NULL || node->down->right == NULL) {
    1.15  		fprintf(stderr, "error: while requires two sons");
    1.16 -		exit(1); /* FIXME other error code */
    1.17 +		exit(7);
    1.18  	}
    1.19  	while (action(node->down)) {
    1.20  		action(node->down->right);
     2.1 --- a/baum.1	Sun Mar 02 16:17:18 2008 +0100
     2.2 +++ b/baum.1	Sun Mar 02 16:26:06 2008 +0100
     2.3 @@ -78,6 +78,10 @@
     2.4  Creates a new number node as last brother. The value of the new node is ether read from standard input (if the node has no son), or the return value of the first son. Returns 0 always.
     2.5  
     2.6  .TP
     2.7 +.B if
     2.8 +Compares return value of first son and second son. The internal value defines how the comparation is done. 33 (`!') means not equal; 60 (`<') less than; 62 (`>') greater than; and everything else stands for equal. Requires two sons. Returns 1 for true and 0 for false.
     2.9 +
    2.10 +.TP
    2.11  .B number
    2.12  Executes it's leftmost son. Returns the internal value.
    2.13  
    2.14 @@ -93,6 +97,11 @@
    2.15  .B times
    2.16  Copies everything below the node and pastes it as last brother(s). Returns 0 always.
    2.17  
    2.18 +.TP
    2.19 +.B while
    2.20 +Executes it's second son as long the first son returns a logical true (not `0'). Requires two sons. Returns 0 always;
    2.21 +
    2.22 +
    2.23  
    2.24  
    2.25  
    2.26 @@ -123,6 +132,10 @@
    2.27  node name too long, or no value given
    2.28  
    2.29  .TP
    2.30 +.BI 7
    2.31 +a node has not the required amount of sons
    2.32 +
    2.33 +.TP
    2.34  .BI 126
    2.35  invalid command line options
    2.36