Compare commits

..

No commits in common. "ed23a887f993fc4b8594657fadabb188fc2c287a" and "58f9c0cf9e115883369b586688a4ac97f4ff8765" have entirely different histories.

3 changed files with 11 additions and 4 deletions

View File

@ -89,8 +89,6 @@ geadline2(prompt, text)
esccode('D'); esccode('D');
} }
} }
} else if (c == '\n') {
return buf;
} else { } else {
size = size + 1; size = size + 1;
if (size >= capacity) { if (size >= capacity) {
@ -117,11 +115,16 @@ geadline2(prompt, text)
esccode('D'); esccode('D');
} }
i = i + 1; i = i + 1;
if (c == '\n')
return buf;
} }
} }
} }
geadline(prompt) => geadline2(prompt, NULL); geadline(prompt)
{
geadline2(prompt, NULL);
}
esccode(c) esccode(c)
{ {

View File

@ -1,3 +1,3 @@
yo yo
bozo bozo
zboo z^[[Dbo^[[C^[[C^[[Co

View File

@ -6,13 +6,17 @@ main()
ptr = geadline(""); ptr = geadline("");
test_str(ptr, "yo", ""); test_str(ptr, "yo", "");
free(ptr);
ptr = geadline(""); ptr = geadline("");
test_str(ptr, "bozo", ""); test_str(ptr, "bozo", "");
free(ptr);
ptr = geadline(""); ptr = geadline("");
test_str(ptr, "bozo", "arrow"); test_str(ptr, "bozo", "arrow");
free(ptr);
ptr = geadline(""); ptr = geadline("");
test_num(ptr, 0, ""); test_num(ptr, 0, "");
free(ptr);
} }