mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
posix main shell: fix getchar() return value and check for EOF to avoid busy loop
This commit is contained in:
parent
226d7c79da
commit
4eda0ed782
@ -533,11 +533,15 @@ int main(int argc, char **argv)
|
||||
|
||||
while (!_ExitFlag) {
|
||||
|
||||
char c = getchar();
|
||||
int c = getchar();
|
||||
string add_string; // string to add at current cursor position
|
||||
bool update_prompt = true;
|
||||
|
||||
switch (c) {
|
||||
case EOF:
|
||||
_ExitFlag = true;
|
||||
break;
|
||||
|
||||
case 127: // backslash
|
||||
if (mystr.length() - cursor_position > 0) {
|
||||
mystr.erase(mystr.length() - cursor_position - 1, 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user