]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
cups/dest.c: Remove an underscore from queue name
authorZdenek Dohnal <zdohnal@redhat.com>
Thu, 18 Feb 2021 07:49:56 +0000 (08:49 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 18 Feb 2021 07:49:56 +0000 (08:49 +0100)
If the underscore is a last character in queue name, remove it - it
looks better in print dialogs.

CHANGES.md
cups/dest.c

index 15db8fa3f7a3f0ca12bcbe4fad9dfd3cf2d417fb..e317297ff255dbd07f83ce4de5fd5c6148594dc4 100644 (file)
@@ -7,6 +7,7 @@ Changes in CUPS v2.4.0
 - The `cupsfilter` command now shows error messages when options are used
   incorrectly (Issue #88)
 - Documentation fixes (Issue #92)
+- Remove underscore from queue name if it is the last character (PR #56)
 
 
 Changes in CUPS v2.3.4
index 2017792a74df77ed578cf4bfdede62c3c946fa8c..9b176dc0a3864102f27117ce1dad937548384b2e 100644 (file)
@@ -4369,5 +4369,12 @@ cups_queue_name(
       *nameptr++ = '_';
   }
 
+ /*
+  * Remove an underscore if it is the last character
+  * and isn't the only character in the string
+  */
+  if (nameptr[-1] == '_' && nameptr > (name + 1))
+    nameptr--;
+
   *nameptr = '\0';
 }