From 51afe76f078fafa30aa6a71ffb5da3c14a7a456b Mon Sep 17 00:00:00 2001 From: Edmond ORIGNAC Date: Sat, 21 Mar 2015 12:43:18 +0100 Subject: [PATCH] Fix dtprintinfo parser When using a non C locale such as fr_FR.ISO8859-1, the CUPS messages returned by lpq are translated. However, the parser in ParseJobs.C can only handle messages in English. As a result, dtprintinfo exits immediately with an error message. To fix that problem we force a LANG=C environment when calling lpq so that messages will be in English and will be processed correctly by dtprintinfo parser. --- cde/programs/dtprintinfo/objects/PrintObj/ParseJobs.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cde/programs/dtprintinfo/objects/PrintObj/ParseJobs.C b/cde/programs/dtprintinfo/objects/PrintObj/ParseJobs.C index c52d5b2e..eca6258a 100644 --- a/cde/programs/dtprintinfo/objects/PrintObj/ParseJobs.C +++ b/cde/programs/dtprintinfo/objects/PrintObj/ParseJobs.C @@ -709,7 +709,7 @@ void LocalPrintJobs(char *printer, char **return_job_list, int *return_n_jobs) static char *job_list = NULL; static int prev_buf_size = 0; - sprintf(buf, "lpstat -i -o%s", printer); + sprintf(buf, "LANG=C lpstat -i -o%s", printer); Invoke *_thread = new Invoke(buf, &output); if (prev_buf_size == 0) @@ -868,12 +868,12 @@ void LocalPrintJobs(char *printer, char **return_job_list, int *return_n_jobs) static int prev_buf_size = 0; #if defined(__osf__) - sprintf(buf, "lpstat -o%s", printer); + sprintf(buf, "LANG=C lpstat -o%s", printer); #endif #if defined(linux) || defined(__OpenBSD__) - snprintf(buf, 1000, "lpq -P%s", printer); + snprintf(buf, 1000, "LANG=C lpq -P%s", printer); #elif defined(__FreeBSD__) - snprintf(buf, 1000, "/usr/local/bin/lpq -P%s", printer); + snprintf(buf, 1000, "LANG=C /usr/local/bin/lpq -P%s", printer); #endif Invoke *_thread = new Invoke(buf, &output); -- 2.25.1