1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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.
This commit is contained in:
Edmond ORIGNAC 2015-03-21 12:43:18 +01:00 committed by Jon Trulson
parent 6c5bab0854
commit 51afe76f07

View file

@ -709,7 +709,7 @@ void LocalPrintJobs(char *printer, char **return_job_list, int *return_n_jobs)
static char *job_list = NULL; static char *job_list = NULL;
static int prev_buf_size = 0; 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); Invoke *_thread = new Invoke(buf, &output);
if (prev_buf_size == 0) 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; static int prev_buf_size = 0;
#if defined(__osf__) #if defined(__osf__)
sprintf(buf, "lpstat -o%s", printer); sprintf(buf, "LANG=C lpstat -o%s", printer);
#endif #endif
#if defined(linux) || defined(__OpenBSD__) #if defined(linux) || defined(__OpenBSD__)
snprintf(buf, 1000, "lpq -P%s", printer); snprintf(buf, 1000, "LANG=C lpq -P%s", printer);
#elif defined(__FreeBSD__) #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 #endif
Invoke *_thread = new Invoke(buf, &output); Invoke *_thread = new Invoke(buf, &output);