From a7ce03c62697637913460e4be5b1a295abf4b189 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Thu, 18 Feb 2021 08:49:56 +0100 Subject: [PATCH] cups/dest.c: Remove an underscore from queue name If the underscore is a last character in queue name, remove it - it looks better in print dialogs. --- CHANGES.md | 1 + cups/dest.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 15db8fa3f7..e317297ff2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/cups/dest.c b/cups/dest.c index 2017792a74..9b176dc0a3 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -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'; } -- 2.47.2