Here is the patch generated by git format-patch -1

On 19/03/2015 19:21, Jon Trulson wrote:
On Wed, 18 Mar 2015, Edmond Orignac wrote:

I have just tried inserting the LANG=C in the commands used by
dtprintinfo using the latest CVS source. This allows dtprintinfo to
work with the fr_FR, it_IT, es_ES and de_DE locales at least on Linux.
There is still a message:
Unexpected legend column: File(s) != Files
due to a hardcoded if (strcmp(tmp, "Files"))
but it does not prevent the listing of the files in the queue.
I am attaching the patch.


Nice - but I need the patch in git's format-patch format :)
-jon


On 18/03/2015 02:21, Jon Trulson wrote:
On Mon, 16 Mar 2015, Edmond Orignac wrote:

I have found a problem with dtprintinfo when using CUPS with a locale
other than "C". If the locale is set to fr_FR.ISO8859-1 the CUPS lpq
message "no entries" is translated into "aucune entrée" and if it is
set
to it_IT.ISO8859-1 the message "no entries" becomes "nessuna voce". The
code
in programs/dtprintinfo/objects/PrintObj/ParseJobs.C (line 933)
will then fail to recognize that the print queue is empty and will
exit with the error message

*** STDERR(1): (/usr/dt/bin/dtexec) /usr/dt/bin/dtprintinfo: PID 4650:
sam. mars 14 19:02:32 2015
Unexpected legend column: aucune != Rank
Unexpected legend column: entrée != Owner

i. e. the "aucune entrée" message is treated as the legend line in the
lines 978 and following.

One possible workaround could be to set explicitly the environment to
LANG=C with a command "LANG=C lpq" in the lines 874 and 876.


This seems a reasonable approach, the somewhat more complicated
approach would be to internationalize those strings and use the proper
message catalogs to retrieve them. But there seem to be a lot of
hardcoded strings in that module.

Have you tried adding LANG=C as you suggest? If it works, send a
patch and I'll apply it.





>From 7a3ed17ee0beee032518e76c29276b6644305074 Mon Sep 17 00:00:00 2001
From: Edmond ORIGNAC <edmond.orig...@wanadoo.fr>
Date: Thu, 19 Mar 2015 21:17:24 +0100
Subject: [PATCH] With the non-C locales, dtprintinfo would fail to parse the 
output of lpq and exit
 immediately. To address that issue "LANG=C" is added to the shell command 
calling lpq.

---
 programs/dtprintinfo/objects/PrintObj/ParseJobs.C |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/programs/dtprintinfo/objects/PrintObj/ParseJobs.C 
b/programs/dtprintinfo/objects/PrintObj/ParseJobs.C
index c52d5b2..eca6258 100644
--- a/programs/dtprintinfo/objects/PrintObj/ParseJobs.C
+++ b/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);
-- 
1.6.4

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to