wpa_cli: Add newline to end of responses in interactive mode

Some of the wpa_supplicant control interface commands, like WPS_PIN,
may not include a newline in the end of the response. This can result
in the response being lost when wpa_cli redraws the screen after an
event message. Add a newline after such responses in interactive mode
to avoid the problem.
This commit is contained in:
Jouni Malinen 2011-02-21 22:50:11 +02:00 committed by Jouni Malinen
parent e4ac6417c7
commit a432bafbca

View file

@ -254,6 +254,8 @@ static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd, int print)
if (print) { if (print) {
buf[len] = '\0'; buf[len] = '\0';
printf("%s", buf); printf("%s", buf);
if (interactive && len > 0 && buf[len - 1] != '\n')
printf("\n");
} }
return 0; return 0;
} }