From: Martin Ling Date: Thu, 11 Sep 2014 15:16:04 +0000 (+0100) Subject: scpi: Remove trailing carriage returns. X-Git-Tag: libsigrok-0.4.0~1008 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=edbd09250b185950646ee5928b2e7112161168cc;p=libsigrok.git scpi: Remove trailing carriage returns. --- diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c index 8d46d849..fbb57472 100644 --- a/src/scpi/scpi.c +++ b/src/scpi/scpi.c @@ -405,6 +405,10 @@ SR_PRIV int sr_scpi_get_string(struct sr_scpi_dev_inst *scpi, if (response->len >= 1 && response->str[response->len - 1] == '\n') g_string_truncate(response, response->len - 1); + /* Get rid of trailing carriage return if present */ + if (response->len >= 1 && response->str[response->len - 1] == '\r') + g_string_truncate(response, response->len - 1); + *scpi_response = response->str; g_string_free(response, FALSE);