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 wrap: on
line diff
--- a/actions.c	Sun Mar 02 16:17:18 2008 +0100
+++ b/actions.c	Sun Mar 02 16:26:06 2008 +0100
@@ -115,7 +115,7 @@
 
 	if (node->down == NULL || node->down->right == NULL) {
 		fprintf(stderr, "error: while requires two sons");
-		exit(1); /* FIXME other error code */
+		exit(7);
 	}
 
 	return1 = action(node->down);
@@ -145,7 +145,7 @@
 unsigned char action_while(struct Node* node) {
 	if (node->down == NULL || node->down->right == NULL) {
 		fprintf(stderr, "error: while requires two sons");
-		exit(1); /* FIXME other error code */
+		exit(7);
 	}
 	while (action(node->down)) {
 		action(node->down->right);
--- a/baum.1	Sun Mar 02 16:17:18 2008 +0100
+++ b/baum.1	Sun Mar 02 16:26:06 2008 +0100
@@ -78,6 +78,10 @@
 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.
 
 .TP
+.B if
+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.
+
+.TP
 .B number
 Executes it's leftmost son. Returns the internal value.
 
@@ -93,6 +97,11 @@
 .B times
 Copies everything below the node and pastes it as last brother(s). Returns 0 always.
 
+.TP
+.B while
+Executes it's second son as long the first son returns a logical true (not `0'). Requires two sons. Returns 0 always;
+
+
 
 
 
@@ -123,6 +132,10 @@
 node name too long, or no value given
 
 .TP
+.BI 7
+a node has not the required amount of sons
+
+.TP
 .BI 126
 invalid command line options