diff src/std.c @ 4:90cd3d9a6ca3

Moved function array declaration, modified the ftoa function so it does not return trailing 0s Also added a return value to sGet though that seems to break some things... The errors for this were very odd, see TODO notes in std.c and init.c
author Jonathan Pevarnek <pevarnj@gmail.com>
date Wed, 02 Mar 2011 00:37:32 -0500
parents 0aa0ad9e1cc3
children 348c59c36703
line wrap: on
line diff
--- a/src/std.c	Tue Mar 01 23:33:51 2011 -0500
+++ b/src/std.c	Wed Mar 02 00:37:32 2011 -0500
@@ -37,7 +37,10 @@
 			*a++ = ((int) d) + '0';
 			d -= (int) d;
 		}
-		*a = '\0';
+		a--; //move back to the last digit
+//		while(*a == '0') a--; //TODO figure out why this "works" even with the other version of init.c
+		while(*a == '0' || *a == '.') a--; //get to the first non-zero decimal digit
+		*(a + 1) = '\0';
 	}
 	return ret;
 }
@@ -88,10 +91,11 @@
 	return -1;
 }
 
-void sGet(char *a, unsigned int n) //TODO bug Jeff about getline
+char* sGet(char *a, unsigned int n) //TODO bug Jeff about getline
 {
 	int length = getline(a, n);
 	a[(length < n)?length:n - 1] = '\0';
+	return a;
 }
 
 int arrayLookup(char *text, const char array[][10], int last)