]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
remove whitespaces from printer message 166/head
authorTreffner Thomas <treffner@logmedia.at>
Thu, 10 Oct 2019 08:31:26 +0000 (10:31 +0200)
committerTreffner Thomas <treffner@logmedia.at>
Thu, 10 Oct 2019 08:31:26 +0000 (10:31 +0200)
utils/cups-browsed.c

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