]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_cli: Add newline to end of responses in interactive mode
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 21 Feb 2011 20:50:11 +0000 (22:50 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 21 Feb 2011 20:50:11 +0000 (22:50 +0200)
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.

wpa_supplicant/wpa_cli.c

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