]> sigrok.org Git - libsigrok.git/commitdiff
scpi: Remove trailing carriage returns.
authorMartin Ling <redacted>
Thu, 11 Sep 2014 15:16:04 +0000 (16:16 +0100)
committerBert Vermeulen <redacted>
Thu, 11 Sep 2014 15:20:28 +0000 (17:20 +0200)
src/scpi/scpi.c

index 8d46d849b0748ae7f4c76bc6499ba40c1c419cec..fbb57472b3301bb4510a622e6295d04bc0438b58 100644 (file)
@@ -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);