From d6ed63c509b4c0fad7761ad8fea30a0bebe31455 Mon Sep 17 00:00:00 2001 From: Treffner Thomas Date: Thu, 10 Oct 2019 10:31:26 +0200 Subject: [PATCH] remove whitespaces from printer message --- utils/cups-browsed.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c index da5f621a2..8e3c7dffe 100644 --- a/utils/cups-browsed.c +++ b/utils/cups-browsed.c @@ -990,6 +990,26 @@ copy_default_str(void *data, void *user_data) return copy; } +char *strstrip(char *s) +{ + size_t size; + char *end; + + size = strlen(s); + + if (!size) + return s; + + end = s + size - 1; + while (end >= s && isspace(*end)) + end--; + *(end + 1) = '\0'; + + while (*s && isspace(*s)) + s++; + + return s; +} int compare_default_str(void *defstr_a, void *defstr_b, @@ -5790,6 +5810,7 @@ get_printer_attributes(const char* uri, int fallback_request, attr = ippFirstAttribute(response); while (attr) { ippAttributeString(attr, valuebuffer, sizeof(valuebuffer)); + strstrip(valuebuffer); if(!job_state_attributes){ debug_printf(" Attr: %s\n",ippGetName(attr)); debug_printf(" Value: %s\n", valuebuffer); -- 2.47.2