Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NNN40_CLI by
Diff: CLI_Source/command-interpreter.cpp
- Revision:
- 21:72d7a6e85d7f
- Parent:
- 20:bd1760975052
- Child:
- 24:838a0b25934b
diff -r bd1760975052 -r 72d7a6e85d7f CLI_Source/command-interpreter.cpp
--- a/CLI_Source/command-interpreter.cpp	Wed Oct 19 10:34:28 2016 +0000
+++ b/CLI_Source/command-interpreter.cpp	Thu Oct 20 03:14:33 2016 +0000
@@ -91,12 +91,17 @@
 	
 	return result;
 }
-int cyntecAtoInt(uint8_t *str, uint8_t len)
+int cyntecAtoInt(uint8_t *str)
 {
 	int result = 0;
 	uint8_t i = 0;
+	bool is_negative = false;
 	
-	while( *str != '\0' && i < len)
+	if (*str == '-') {
+		is_negative = true;
+		str++;
+	}
+	while( *str != '\0')
 	{
 		result *= 10;
 		result = result + ( *str - '0' );
@@ -104,7 +109,10 @@
 		i++;
 	}
 	
-	return result;
+	if (is_negative)
+		return -result;
+	else
+		return result;
 }
 uint8_t cyntecArgToUint8(uint8_t *str, uint8_t len)
 {
    