Fix dtprintinfo parser
authorEdmond ORIGNAC <Edmond.Orignac@wanadoo.fr>
Sat, 21 Mar 2015 11:43:18 +0000 (12:43 +0100)
committerJon Trulson <jon@radscan.com>
Sun, 22 Mar 2015 02:14:16 +0000 (20:14 -0600)
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

index c52d5b2e5b35fd40cb2e4dc09a39700b28871c12..eca6258a7879f1b2b4762fc83f48049a0196fa78 100644 (file)
@@ -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);