Diff between 7b8c87ccc2480deafa8483e125eae742d289116f and e51d6c5f2e5105669812667c49a053d0f38af6b5

Changed Files

File Additions Deletions Status
client/player.c +4 -8 modified
src/shared/shell.c +5 -5 modified

Full Patch

diff --git a/client/player.c b/client/player.c
index 1f10387..e73ed6a 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3000,11 +3000,11 @@ static bool transport_recv(struct io *io, void *user_data)
 		return true;
 	}
 
-	bt_shell_printf("[seq %d] recv: %u bytes\n", transport->seq, ret);
+	bt_shell_echo("[seq %d] recv: %u bytes", transport->seq, ret);
 
 	transport->seq++;
 
-	if (transport->fd) {
+	if (transport->fd >= 0) {
 		len = write(transport->fd, buf, ret);
 		if (len < 0)
 			bt_shell_printf("Unable to write: %s (%d)",
@@ -3378,7 +3378,6 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)
 
 	for (i = 0; i < num; i++, transport->seq++) {
 		ssize_t ret;
-		int queued;
 		int secs = 0, nsecs = 0;
 
 		ret = read(fd, buf, transport->mtu[1]);
@@ -3400,13 +3399,10 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)
 
 		elapsed_time(!transport->seq, &secs, &nsecs);
 
-		ioctl(transport->sk, TIOCOUTQ, &queued);
-
-		bt_shell_printf("[seq %d %d.%03ds] send: %zd bytes "
-				"(TIOCOUTQ %d bytes)\n",
+		bt_shell_echo("[seq %d %d.%03ds] send: %zd bytes ",
 				transport->seq, secs,
 				(nsecs + 500000) / 1000000,
-				ret, queued);
+				ret);
 	}
 
 	free(buf);
diff --git a/src/shared/shell.c b/src/shared/shell.c
index 3c0e61d..3358b38 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -580,15 +580,15 @@ void bt_shell_echo(const char *fmt, ...)
 {
 	va_list args;
 	char *str;
-	int err;
+	int ret;
 
 	va_start(args, fmt);
-	err = vasprintf(&str, fmt, args);
-	if (!err)
-		err = asprintf(&str, COLOR_HIGHLIGHT "%s#" COLOR_OFF, str);
+	ret = vasprintf(&str, fmt, args);
+	if (ret >= 0)
+		ret = asprintf(&str, COLOR_HIGHLIGHT "%s " COLOR_OFF "#", str);
 	va_end(args);
 
-	if (err)
+	if (ret < 0)
 		return;
 
 	rl_save_prompt();