about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--numericx.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/numericx.c b/numericx.c
index 1b28dfe..2684ee4 100644
--- a/numericx.c
+++ b/numericx.c
@@ -79,16 +79,16 @@ numeral_infinity(char const* to_first, size_t cases)
 }
 
 void
-increment(numeral_ptr* numeral, char* num_first, char* num_last)
+increment(numeral_ptr* numeral, char* num_first, char* num_last, char* brand_new_digit)
 {
 	bool cycled = false;
 
 	if( numeral->symbol == num_last )
 	{
 		if( numeral->next == NULL )
-			numeral->next = new_digit(numeral, num_first);
+			numeral->next = new_digit(numeral, brand_new_digit);
 		else
-			increment(numeral->next, num_first, num_last);
+			increment(numeral->next, num_first, num_last, brand_new_digit);
 
 		cycled = true;
 	}
@@ -238,7 +238,7 @@ main(int argc, char* argv[])
 		}
 
 		if( TO_FIRST_NUMBER_VOID )
-			increment(result, to_first, to_last);
+			increment(result, to_first, to_last, to_first);
 	}
 
 	/* increments until it finishes */
@@ -249,12 +249,15 @@ main(int argc, char* argv[])
 			puts("----");
 			print_numeral(result);
 		}
-		increment(result, to_first, to_last);
+		if( TO_INFINITE_BASE )
+			increment(result, to_first, to_last, (to_first + 1));
+		else
+			increment(result, to_first, to_last, to_first);
 
 		if(DEBUG)
 			print_numeral(counting);
 
-		increment(counting, from_first, from_last);
+		increment(counting, from_first, from_last, from_first);
 	}
 	if(DEBUG)
 		puts("----");