auto-sync

This commit is contained in:
rusEfi 2014-10-12 16:06:19 -05:00
parent 3e80f6a78a
commit 81542a4223
3 changed files with 18 additions and 1 deletions

View File

@ -153,6 +153,17 @@ static void echo(int value) {
print("got value: %d\r\n", value);
}
char *unquote(char *line) {
if (line[0] == '"') {
int len = strlen(line);
if (line[len - 1] == '"') {
line[len - 1] = 0;
return line + 1;
}
}
return line;
}
int findEndOfToken(const char *line) {
if (line[0] == '"') {
/**

View File

@ -132,7 +132,7 @@ int main(void) {
testFLStack();
// resizeMap();
printf("Success 20131009\r\n");
printf("Success 20131012\r\n");
return EXIT_SUCCESS;
}

View File

@ -284,6 +284,12 @@ void testConsoleLogic(void) {
cmd = "\"h e\" ha";
assertEquals(5, findEndOfToken(cmd));
strcpy(buffer, "echo");
assertTrue(strEqual("echo", unquote(buffer)));
strcpy(buffer, "\"echo\"");
assertTrueM("unquote quoted", strEqual("echo", unquote(buffer)));
char *ptr = validateSecureLine(UNKNOWN_COMMAND);
assertEquals(0, strcmp(UNKNOWN_COMMAND, ptr));