From db1f069b7f02a8e17a9e4abf8f182530b882c6c9 Mon Sep 17 00:00:00 2001 From: msweet Date: Fri, 14 Sep 2007 02:27:22 +0000 Subject: [PATCH] Merge changes from CUPS 1.3.1. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@470 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 51 +- CREDITS.txt | 5 +- INSTALL.txt | 2 +- Makefile | 7 +- README.txt | 2 +- backend/Makefile | 4 +- backend/ipp.c | 247 +- backend/lpd.c | 156 +- backend/pap.c | 119 +- backend/parallel.c | 37 +- backend/runloop.c | 16 +- backend/scsi-irix.c | 30 +- backend/scsi-linux.c | 25 +- backend/scsi.c | 9 +- backend/serial.c | 62 +- backend/socket.c | 93 +- backend/usb-darwin.c | 193 +- backend/usb-unix.c | 42 +- backend/usb.c | 22 +- cgi-bin/help.c | 1 + cgi-bin/template.c | 42 +- conf/mime.convs.in | 4 +- config-scripts/cups-common.m4 | 7 +- config-scripts/cups-directories.m4 | 32 +- config.h.in | 11 +- cups/auth.c | 4 +- cups/cups.h | 8 +- cups/http-addr.c | 25 +- cups/http-private.h | 7 +- cups/language.c | 103 +- cups/localize.c | 72 +- cups/mark.c | 4 +- cups/ppd.c | 4 +- cups/test.ppd | 16 +- cups/testppd.c | 16 +- doc/Makefile | 4 +- doc/cups-printable.css | 5 +- doc/cups.css | 7 +- doc/es/index.html.in | 4 +- doc/help/spec-ppd.html | 1548 ++++++++----- doc/help/translation.html | 21 +- filter/pstops.c | 4 +- filter/rastertolabel.c | 7 +- locale/Makefile | 20 +- locale/cups_da.po | 30 +- locale/cups_de.po | 28 +- locale/cups_es.po | 4 +- locale/cups_et.po | 880 +------- locale/cups_fr.po | 96 +- locale/cups_he.po | 792 +------ locale/cups_it.po | 10 +- locale/cups_ja.po | 16 +- locale/cups_ko.po | 16 +- locale/cups_no.po | 2 +- locale/cups_pl.po | 20 +- locale/cups_pt.po | 3112 +++++++------------------- locale/cups_pt_BR.po | 4 +- locale/cups_sv.po | 8 +- locale/cups_zh.po | 4 +- locale/cups_zh_TW.po | 6 +- monitor/bcp.c | 19 +- monitor/tbcp.c | 21 +- packaging/cups.list.in | 4 +- packaging/cups.spec.in | 4 +- scheduler/Makefile | 8 +- scheduler/auth.c | 62 +- scheduler/auth.h | 4 +- scheduler/client.c | 117 +- scheduler/client.h | 6 +- scheduler/conf.c | 4 +- scheduler/cups-driverd.c | 4 +- scheduler/cups-lpd.c | 4 +- scheduler/cupsfilter.c | 26 +- scheduler/ipp.c | 60 +- scheduler/job.c | 10 +- scheduler/listen.c | 4 +- scheduler/main.c | 16 +- scheduler/process.c | 4 +- scheduler/quotas.c | 10 +- scheduler/testlpd.c | 4 +- systemv/cupstestppd.c | 31 +- templates/de/admin.tmpl | 4 +- templates/es/admin.tmpl | 25 +- templates/es/classes.tmpl | 16 +- templates/es/printer-configured.tmpl | 2 +- templates/es/printers.tmpl | 14 +- templates/es/samba-export.tmpl | 6 +- templates/es/trailer.tmpl | 4 +- 88 files changed, 3354 insertions(+), 5265 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 68404a28a..a2ff9458b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,55 @@ -CHANGES.txt - 2007-08-13 +CHANGES.txt - 2007-09-13 ------------------------ +CHANGES IN CUPS V1.3.1 + + - Documentation updates. + - The USB backend on Mac OS X could hang if the driver and + printer did not match. + - Delegated Kerberos credentials were not working. + - "make distclean" incorrectly removed the edit-config.tmpl + files (STR #2508) + - Fix compile problem on HP-UX (STR #2501) + - The cupstestppd utility now tests for resolutions greater + than 99999 DPI to detect a missing "x" between the X and Y + resolutions. + - Fixed many problems in the various translations and added + a new "checkpo" utility to validate them. + - The cupstestppd utility now tests the custom page size code + for CUPS raster drivers. + - cupsLangDefault() did not attempt to return a language that + was supported by the calling application. + - If a remote printer stopped while a job was being sent, the + local queue would also get stopped and the job re-queued, + resulting in duplicate prints in some cases. + - A few Apple-specific job options needed to be omitted when + printing a banner page. + - The new peer credential support did not compile on FreeBSD + (STR #2495) + - Direct links to help files did not set the current section + so the table-of-contents was not shown. + - The configure script did not support --localedir=foo (STR #2488) + - The backends were not displaying their localized messages. + - CUPS-Authenticate-Job did not require Kerberos authentication + on queues protected by Kerberos. + - The Zebra ZPL driver did not work with Brady label printers + (STR #2487) + - Norwegian wasn't localized on Mac OS X. + - getnameinfo() returns an error on some systems when DNS is + not available, leading to numerous problems (STR #2486) + - The cupsfilter command did not work properly on Mac OS X. + - The scheduler makefile contained a typo (STR #2483) + - The TBCP and BCP port monitors did not handle the trailing + CTRL-D in some PostScript output properly. + - Fixed the localization instructions and German template for + the "Find New Printers" button (STR #2478) + - The web interface did not work with the Chinese localization + (STR #2477) + - The web interface home page did not work for languages that + were only partially localized (STR #2472) + - Updated the Spanish web interface localization (STR #2473) + - ppdLocalize() did not work for country-specific localizations. + CHANGES IN CUPS V1.3.0 diff --git a/CREDITS.txt b/CREDITS.txt index 9cbf832ed..ffaa9f3aa 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -1,4 +1,4 @@ -CREDITS.txt - 2007-02-05 +CREDITS.txt - 2007-09-10 ------------------------ Few projects are completed by one person, and CUPS is no exception. We'd @@ -19,6 +19,7 @@ like to thank the following individuals for their contributions: Till Kamppeter - Bug fixes, beta testing, evangelism. Kenshi Muto - Japanese localization, patches, and testing. + Tomohiro Kato - Japanese localization. Kiko - Bug fixes. Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester. Marek Laane - Estonian translation. @@ -36,7 +37,7 @@ like to thank the following individuals for their contributions: Opher Shachar - Hebrew localization. Stuart Stevens - HP JetDirect IPP information. Andrea Suatoni - IRIX desktop integration and testing. - Tomohiro Kato - Japanese localization. + Teppo Turlianen - Finnish localization. Tim Waugh - Lots of patches, testing, and Linux integration. Yugami - LDAP browsing support. diff --git a/INSTALL.txt b/INSTALL.txt index 5732830f3..24b3c3967 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,4 +1,4 @@ -INSTALL - CUPS v1.3.0 - 2007-08-13 +INSTALL - CUPS v1.3.1 - 2007-09-14 ---------------------------------- This file describes how to compile and install CUPS from source diff --git a/Makefile b/Makefile index 86d47a429..62cee85c0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 6945 2007-09-12 17:08:32Z mike $" # # Top-level Makefile for the Common UNIX Printing System (CUPS). # @@ -63,9 +63,8 @@ distclean: clean $(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man $(RM) man/cupsd.conf.man man/lpoptions.man $(RM) packaging/cups.list - $(RM) templates/edit-config.tmpl templates/header.tmpl + $(RM) templates/header.tmpl -$(RM) doc/*/index.html - -$(RM) templates/*/edit-config.tmpl -$(RM) templates/*/header.tmpl -$(RM) -r autom4te*.cache @@ -282,5 +281,5 @@ dist: all # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 6945 2007-09-12 17:08:32Z mike $". # diff --git a/README.txt b/README.txt index 48fee5a99..582250f03 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -README - CUPS v1.3.0 - 2007-08-13 +README - CUPS v1.3.1 - 2007-09-14 --------------------------------- Looking for compile instructions? Read the file "INSTALL.txt" diff --git a/backend/Makefile b/backend/Makefile index d6e9aee77..e02c27538 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $" +# "$Id: Makefile 6778 2007-08-08 19:27:51Z mike $" # # Backend makefile for the Common UNIX Printing System (CUPS). # @@ -219,5 +219,5 @@ include Dependencies # -# End of "$Id: Makefile 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: Makefile 6778 2007-08-08 19:27:51Z mike $". # diff --git a/backend/ipp.c b/backend/ipp.c index ed82f4d33..693a85bc8 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 6687 2007-07-18 19:49:45Z mike $" + * "$Id: ipp.c 6911 2007-09-04 20:35:08Z mike $" * * IPP backend for the Common UNIX Printing System (CUPS). * @@ -67,12 +67,12 @@ static void cancel_job(http_t *http, const char *uri, int id, const char *resource, const char *user, int version); static void check_printer_state(http_t *http, const char *uri, const char *resource, const char *user, - int version); + int version, int job_id); #ifdef HAVE_LIBZ static void compress_files(int num_files, char **files); #endif /* HAVE_LIBZ */ static const char *password_cb(const char *); -static int report_printer_state(ipp_t *ipp); +static int report_printer_state(ipp_t *ipp, int job_id); #ifdef __APPLE__ static int run_pictwps_filter(char **argv, const char *filename); @@ -102,9 +102,9 @@ main(int argc, /* I - Number of command-line args */ resource[1024], /* Resource info (printer name) */ addrname[256], /* Address name */ *optptr, /* Pointer to URI options */ - name[255], /* Name of option */ - value[255], /* Value of option */ - *ptr; /* Pointer into name or value */ + *name, /* Name of option */ + *value, /* Value of option */ + sep; /* Separator character */ int num_files; /* Number of files to print */ char **files, /* Files to print */ *filename; /* Pointer to single filename */ @@ -199,8 +199,9 @@ main(int argc, /* I - Number of command-line args */ } else if (argc < 6) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_STOP); } @@ -224,8 +225,9 @@ main(int argc, /* I - Number of command-line args */ hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_OK) { - fputs(_("ERROR: Missing device URI on command-line and no " - "DEVICE_URI environment variable!\n"), stderr); + _cupsLangPuts(stderr, + _("ERROR: Missing device URI on command-line and no " + "DEVICE_URI environment variable!\n")); return (CUPS_BACKEND_STOP); } @@ -263,29 +265,30 @@ main(int argc, /* I - Number of command-line args */ * Get the name... */ - for (ptr = name; *optptr && *optptr != '=';) - if (ptr < (name + sizeof(name) - 1)) - *ptr++ = *optptr++; - *ptr = '\0'; + name = optptr; - if (*optptr == '=') + while (*optptr && *optptr != '=' && *optptr != '+' && *optptr != '&') + optptr ++; + + if ((sep = *optptr) != '\0') + *optptr++ = '\0'; + + if (sep == '=') { /* * Get the value... */ - optptr ++; - - for (ptr = value; *optptr && *optptr != '+' && *optptr != '&';) - if (ptr < (value + sizeof(value) - 1)) - *ptr++ = *optptr++; - *ptr = '\0'; + value = optptr; - if (*optptr == '+' || *optptr == '&') + while (*optptr && *optptr != '+' && *optptr != '&') optptr ++; + + if (*optptr) + *optptr++ = '\0'; } else - value[0] = '\0'; + value = (char *)""; /* * Process the option... @@ -327,7 +330,7 @@ main(int argc, /* I - Number of command-line args */ cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED); else { - fprintf(stderr, + _cupsLangPrintf(stderr, _("ERROR: Unknown encryption option value \"%s\"!\n"), value); } @@ -340,7 +343,7 @@ main(int argc, /* I - Number of command-line args */ version = 1; else { - fprintf(stderr, + _cupsLangPrintf(stderr, _("ERROR: Unknown version option value \"%s\"!\n"), value); } @@ -369,8 +372,9 @@ main(int argc, /* I - Number of command-line args */ * Unknown option... */ - fprintf(stderr, _("ERROR: Unknown option \"%s\" with value \"%s\"!\n"), - name, value); + _cupsLangPrintf(stderr, + _("ERROR: Unknown option \"%s\" with value \"%s\"!\n"), + name, value); } } } @@ -470,7 +474,9 @@ main(int argc, /* I - Number of command-line args */ * Try loading authentication information from the environment. */ - if ((ptr = getenv("AUTH_USERNAME")) != NULL) + const char *ptr = getenv("AUTH_USERNAME"); + + if (ptr) cupsSetUser(ptr); password = getenv("AUTH_PASSWORD"); @@ -488,8 +494,8 @@ main(int argc, /* I - Number of command-line args */ do { - fprintf(stderr, _("INFO: Connecting to %s on port %d...\n"), - hostname, port); + _cupsLangPrintf(stderr, _("INFO: Connecting to %s on port %d...\n"), + hostname, port); if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL) { @@ -505,8 +511,9 @@ main(int argc, /* I - Number of command-line args */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); if (argc == 6 || strcmp(filename, argv[6])) unlink(filename); @@ -525,16 +532,16 @@ main(int argc, /* I - Number of command-line args */ { if (contimeout && (time(NULL) - start_time) > contimeout) { - fputs(_("ERROR: Printer not responding!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Printer not responding!\n")); return (CUPS_BACKEND_FAILED); } recoverable = 1; - fprintf(stderr, - _("WARNING: recoverable: Network host \'%s\' is busy; will " - "retry in %d seconds...\n"), - hostname, delay); + _cupsLangPrintf(stderr, + _("WARNING: recoverable: Network host \'%s\' is busy; " + "will retry in %d seconds...\n"), + hostname, delay); sleep(delay); @@ -543,8 +550,8 @@ main(int argc, /* I - Number of command-line args */ } else if (h_errno) { - fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), - hostname); + _cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), + hostname); return (CUPS_BACKEND_STOP); } else @@ -552,8 +559,9 @@ main(int argc, /* I - Number of command-line args */ recoverable = 1; fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno)); - fputs(_("ERROR: recoverable: Unable to connect to printer; will " - "retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("ERROR: recoverable: Unable to connect to printer; will " + "retry in 30 seconds...\n")); sleep(30); } @@ -572,7 +580,7 @@ main(int argc, /* I - Number of command-line args */ } fputs("STATE: -connecting-to-device\n", stderr); - fprintf(stderr, _("INFO: Connected to %s...\n"), hostname); + _cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname); #ifdef AF_INET6 if (http->hostaddr->addr.sa_family == AF_INET6) @@ -638,18 +646,18 @@ main(int argc, /* I - Number of command-line args */ { if (contimeout && (time(NULL) - start_time) > contimeout) { - fputs(_("ERROR: Printer not responding!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Printer not responding!\n")); return (CUPS_BACKEND_FAILED); } recoverable = 1; - fprintf(stderr, - _("WARNING: recoverable: Network host \'%s\' is busy; will " - "retry in %d seconds...\n"), - hostname, delay); + _cupsLangPrintf(stderr, + _("WARNING: recoverable: Network host \'%s\' is busy; " + "will retry in %d seconds...\n"), + hostname, delay); - report_printer_state(supported); + report_printer_state(supported, 0); sleep(delay); @@ -663,14 +671,15 @@ main(int argc, /* I - Number of command-line args */ * Switch to IPP/1.0... */ - fputs(_("INFO: Printer does not support IPP/1.1, trying IPP/1.0...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer does not support IPP/1.1, trying " + "IPP/1.0...\n")); version = 0; httpReconnect(http); } else if (ipp_status == IPP_NOT_FOUND) { - fputs(_("ERROR: Destination printer does not exist!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Destination printer does not exist!\n")); if (supported) ippDelete(supported); @@ -679,8 +688,9 @@ main(int argc, /* I - Number of command-line args */ } else { - fprintf(stderr, _("ERROR: Unable to get printer status (%s)!\n"), - cupsLastErrorString()); + _cupsLangPrintf(stderr, + _("ERROR: Unable to get printer status (%s)!\n"), + cupsLastErrorString()); sleep(10); } @@ -713,7 +723,7 @@ main(int argc, /* I - Number of command-line args */ format_sup->values[i].string.text); } - report_printer_state(supported); + report_printer_state(supported, 0); } while (ipp_status > IPP_OK_CONFLICT); @@ -742,8 +752,9 @@ main(int argc, /* I - Number of command-line args */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); ippDelete(supported); httpClose(http); @@ -944,7 +955,8 @@ main(int argc, /* I - Number of command-line args */ if (ipp_status == IPP_SERVICE_UNAVAILABLE || ipp_status == IPP_PRINTER_BUSY) { - fputs(_("INFO: Printer busy; will retry in 10 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 10 seconds...\n")); sleep(10); } else if ((ipp_status == IPP_BAD_REQUEST || @@ -954,25 +966,28 @@ main(int argc, /* I - Number of command-line args */ * Switch to IPP/1.0... */ - fputs(_("INFO: Printer does not support IPP/1.1, trying IPP/1.0...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer does not support IPP/1.1, trying " + "IPP/1.0...\n")); version = 0; httpReconnect(http); } else - fprintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"), - cupsLastErrorString()); + _cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"), + cupsLastErrorString()); } else if ((job_id_attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL) { - fputs(_("NOTICE: Print file accepted - job ID unknown.\n"), stderr); + _cupsLangPuts(stderr, + _("NOTICE: Print file accepted - job ID unknown.\n")); job_id = 0; } else { job_id = job_id_attr->values[0].integer; - fprintf(stderr, _("NOTICE: Print file accepted - job ID %d.\n"), job_id); + _cupsLangPrintf(stderr, _("NOTICE: Print file accepted - job ID %d.\n"), + job_id); } ippDelete(response); @@ -1010,8 +1025,9 @@ main(int argc, /* I - Number of command-line args */ { ipp_status = cupsLastError(); - fprintf(stderr, _("ERROR: Unable to add file %d to job: %s\n"), - job_id, cupsLastErrorString()); + _cupsLangPrintf(stderr, + _("ERROR: Unable to add file %d to job: %s\n"), + job_id, cupsLastErrorString()); break; } } @@ -1035,7 +1051,7 @@ main(int argc, /* I - Number of command-line args */ if (!job_id || !waitjob) continue; - fputs(_("INFO: Waiting for job to complete...\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Waiting for job to complete...\n")); for (; !job_cancelled;) { @@ -1089,8 +1105,9 @@ main(int argc, /* I - Number of command-line args */ { ippDelete(response); - fprintf(stderr, _("ERROR: Unable to get job %d attributes (%s)!\n"), - job_id, cupsLastErrorString()); + _cupsLangPrintf(stderr, + _("ERROR: Unable to get job %d attributes (%s)!\n"), + job_id, cupsLastErrorString()); break; } } @@ -1124,7 +1141,7 @@ main(int argc, /* I - Number of command-line args */ * Check the printer state and report it if necessary... */ - check_printer_state(http, uri, resource, argv[2], version); + check_printer_state(http, uri, resource, argv[2], version, job_id); /* * Wait 10 seconds before polling again... @@ -1145,7 +1162,7 @@ main(int argc, /* I - Number of command-line args */ * Check the printer state and report it if necessary... */ - check_printer_state(http, uri, resource, argv[2], version); + check_printer_state(http, uri, resource, argv[2], version, job_id); /* * Free memory... @@ -1211,7 +1228,7 @@ cancel_job(http_t *http, /* I - HTTP connection */ ipp_t *request; /* Cancel-Job request */ - fputs(_("INFO: Canceling print job...\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Canceling print job...\n")); request = ippNewRequest(IPP_CANCEL_JOB); request->request.op.version[1] = version; @@ -1231,8 +1248,8 @@ cancel_job(http_t *http, /* I - HTTP connection */ ippDelete(cupsDoRequest(http, request, resource)); if (cupsLastError() > IPP_OK_CONFLICT) - fprintf(stderr, _("ERROR: Unable to cancel job %d: %s\n"), id, - cupsLastErrorString()); + _cupsLangPrintf(stderr, _("ERROR: Unable to cancel job %d: %s\n"), id, + cupsLastErrorString()); } @@ -1246,7 +1263,8 @@ check_printer_state( const char *uri, /* I - Printer URI */ const char *resource, /* I - Resource path */ const char *user, /* I - Username, if any */ - int version) /* I - IPP version */ + int version, /* I - IPP version */ + int job_id) /* I - Current job ID */ { ipp_t *request, /* IPP request */ *response; /* IPP response */ @@ -1281,7 +1299,7 @@ check_printer_state( if ((response = cupsDoRequest(http, request, resource)) != NULL) { - report_printer_state(response); + report_printer_state(response, job_id); ippDelete(response); } } @@ -1312,25 +1330,25 @@ compress_files(int num_files, /* I - Number of files */ { if ((fd = cupsTempFd(filename, sizeof(filename))) < 0) { - fprintf(stderr, - _("ERROR: Unable to create temporary compressed print file: " - "%s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to create temporary compressed print " + "file: %s\n"), strerror(errno)); exit(CUPS_BACKEND_FAILED); } if ((out = cupsFileOpenFd(fd, "w9")) == NULL) { - fprintf(stderr, - _("ERROR: Unable to open temporary compressed print file: %s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open temporary compressed print " + "file: %s\n"), strerror(errno)); exit(CUPS_BACKEND_FAILED); } if ((in = cupsFileOpen(files[i], "r")) == NULL) { - fprintf(stderr, _("ERROR: Unable to open print file \"%s\": %s\n"), - files[i], strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open print file \"%s\": %s\n"), + files[i], strerror(errno)); cupsFileClose(out); exit(CUPS_BACKEND_FAILED); } @@ -1339,8 +1357,9 @@ compress_files(int num_files, /* I - Number of files */ while ((bytes = cupsFileRead(in, buffer, sizeof(buffer))) > 0) if (cupsFileWrite(out, buffer, bytes) < bytes) { - fprintf(stderr, _("ERROR: Unable to write %d bytes to \"%s\": %s\n"), - (int)bytes, filename, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to write %d bytes to \"%s\": %s\n"), + (int)bytes, filename, strerror(errno)); cupsFileClose(in); cupsFileClose(out); exit(CUPS_BACKEND_FAILED); @@ -1408,7 +1427,8 @@ password_cb(const char *prompt) /* I - Prompt (not used) */ */ static int /* O - Number of reasons shown */ -report_printer_state(ipp_t *ipp) /* I - IPP response */ +report_printer_state(ipp_t *ipp, /* I - IPP response */ + int job_id) /* I - Current job ID */ { int i; /* Looping var */ int count; /* Count of reasons shown... */ @@ -1419,6 +1439,7 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */ char unknown[1024]; /* Unknown message string */ const char *prefix; /* Prefix for STATE: line */ char state[1024]; /* State string */ + cups_lang_t *language; /* Current localization */ if ((psm = ippFindAttribute(ipp, "printer-state-message", @@ -1431,15 +1452,20 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */ state[0] = '\0'; prefix = "STATE: "; + language = cupsLangDefault(); for (i = 0, count = 0; i < reasons->num_values; i ++) { reason = reasons->values[i].string.text; - strlcat(state, prefix, sizeof(state)); - strlcat(state, reason, sizeof(state)); + if (job_id == 0 || strcmp(reason, "paused")) + { + strlcat(state, prefix, sizeof(state)); + strlcat(state, reason, sizeof(state)); + + prefix = ","; + } - prefix = ","; message = ""; if (!strncmp(reason, "media-needed", 12)) @@ -1504,11 +1530,11 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */ { count ++; if (strstr(reasons->values[i].string.text, "error")) - fprintf(stderr, "ERROR: %s\n", message); + fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message)); else if (strstr(reasons->values[i].string.text, "warning")) - fprintf(stderr, "WARNING: %s\n", message); + fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message)); else - fprintf(stderr, "INFO: %s\n", message); + fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message)); } } @@ -1550,15 +1576,16 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ printer = getenv("PRINTER"); if (!printer) { - fputs(_("ERROR: PRINTER environment variable not defined!\n"), stderr); + _cupsLangPuts(stderr, + _("ERROR: PRINTER environment variable not defined!\n")); return (-1); } if ((ppdfile = cupsGetPPD(printer)) == NULL) { - fprintf(stderr, - _("ERROR: Unable to get PPD file for printer \"%s\" - %s.\n"), - printer, cupsLastErrorString()); + _cupsLangPrintf(stderr, + _("ERROR: Unable to get PPD file for printer \"%s\" - " + "%s.\n"), printer, cupsLastErrorString()); } else { @@ -1572,8 +1599,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0) { - fprintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"), - strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"), + strerror(errno)); if (ppdfile) unlink(ppdfile); return (-1); @@ -1629,8 +1656,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ execlp("pictwpstops", printer, argv[1], argv[2], argv[3], argv[4], argv[5], filename, NULL); - fprintf(stderr, _("ERROR: Unable to exec pictwpstops: %s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to exec pictwpstops: %s\n"), + strerror(errno)); return (errno); } @@ -1642,8 +1669,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ * Error! */ - fprintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"), + strerror(errno)); unlink(filename); if (ppdfile) unlink(ppdfile); @@ -1656,8 +1683,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ if (wait(&status) < 0) { - fprintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"), + strerror(errno)); close(fd); unlink(filename); if (ppdfile) @@ -1673,11 +1700,11 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */ if (status) { if (status >= 256) - fprintf(stderr, _("ERROR: pictwpstops exited with status %d!\n"), - status / 256); + _cupsLangPrintf(stderr, _("ERROR: pictwpstops exited with status %d!\n"), + status / 256); else - fprintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"), - status); + _cupsLangPrintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"), + status); unlink(filename); return (status); @@ -1729,5 +1756,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 6687 2007-07-18 19:49:45Z mike $". + * End of "$Id: ipp.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/backend/lpd.c b/backend/lpd.c index 10f4b5c0b..322eebfad 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: lpd.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: lpd.c 6911 2007-09-04 20:35:08Z mike $" * * Line Printer Daemon backend for the Common UNIX Printing System (CUPS). * @@ -125,9 +125,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ username[255], /* Username info */ resource[1024], /* Resource info (printer name) */ *options, /* Pointer to options */ - name[255], /* Name of option */ - value[255], /* Value of option */ - *ptr, /* Pointer into name or value */ + *name, /* Name of option */ + *value, /* Value of option */ + sep, /* Separator character */ *filename, /* File to print */ title[256]; /* Title string */ int port; /* Port number */ @@ -186,8 +186,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -276,29 +277,30 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Get the name... */ - for (ptr = name; *options && *options != '=';) - if (ptr < (name + sizeof(name) - 1)) - *ptr++ = *options++; - *ptr = '\0'; + name = options; - if (*options == '=') + while (*options && *options != '=' && *options != '+' && *options != '&') + options ++; + + if ((sep = *options) != '\0') + *options++ = '\0'; + + if (sep == '=') { /* * Get the value... */ - options ++; + value = options; - for (ptr = value; *options && *options != '+' && *options != '&';) - if (ptr < (value + sizeof(value) - 1)) - *ptr++ = *options++; - *ptr = '\0'; - - if (*options == '+' || *options == '&') + while (*options && *options != '+' && *options != '&') options ++; + + if (*options) + *options++ = '\0'; } else - value[0] = '\0'; + value = (char *)""; /* * Process the option... @@ -322,8 +324,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (strchr("cdfglnoprtv", value[0])) format = value[0]; else - fprintf(stderr, _("ERROR: Unknown format character \"%c\"\n"), - value[0]); + _cupsLangPrintf(stderr, _("ERROR: Unknown format character \"%c\"\n"), + value[0]); } else if (!strcasecmp(name, "mode") && value[0]) { @@ -336,7 +338,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ else if (!strcasecmp(value, "stream")) mode = MODE_STREAM; else - fprintf(stderr, _("ERROR: Unknown print mode \"%s\"\n"), value); + _cupsLangPrintf(stderr, _("ERROR: Unknown print mode \"%s\"\n"), + value); } else if (!strcasecmp(name, "order") && value[0]) { @@ -349,7 +352,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ else if (!strcasecmp(value, "data,control")) order = ORDER_DATA_CONTROL; else - fprintf(stderr, _("ERROR: Unknown file order \"%s\"\n"), value); + _cupsLangPrintf(stderr, _("ERROR: Unknown file order \"%s\"\n"), + value); } else if (!strcasecmp(name, "reserve")) { @@ -457,8 +461,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (fd == -1) { - fprintf(stderr, _("ERROR: Unable to open print file %s: %s\n"), - filename, strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to open print file %s: %s\n"), + filename, strerror(errno)); return (CUPS_BACKEND_FAILED); } } @@ -476,6 +480,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * the remote end... */ + char *ptr; + for (ptr = title; *ptr; ptr ++) if (!isalnum(*ptr & 255) && !isspace(*ptr & 255)) *ptr = '_'; @@ -585,9 +591,9 @@ lpd_command(int fd, /* I - Socket connection to LPD host */ if (recv(fd, &status, 1, 0) < 1) { - fprintf(stderr, - _("WARNING: Remote host did not respond with command status " - "byte after %d seconds!\n"), timeout); + _cupsLangPrintf(stderr, + _("WARNING: Remote host did not respond with command " + "status byte after %d seconds!\n"), timeout); status = errno; } @@ -668,7 +674,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL) { - fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), hostname); + _cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), + hostname); return (CUPS_BACKEND_STOP); } @@ -690,9 +697,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ */ fputs("STATE: +connecting-to-device\n", stderr); - fprintf(stderr, - _("INFO: Attempting to connect to host %s for printer %s\n"), - hostname, printer); + _cupsLangPrintf(stderr, + _("INFO: Attempting to connect to host %s for printer %s\n"), + hostname, printer); for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist, delay = 5;; @@ -791,8 +798,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); httpAddrFreeList(addrlist); @@ -810,16 +818,15 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ { if (contimeout && (time(NULL) - start_time) > contimeout) { - fputs(_("ERROR: Printer not responding!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Printer not responding!\n")); return (CUPS_BACKEND_FAILED); } recoverable = 1; - fprintf(stderr, - _("WARNING: recoverable: Network host \'%s\' is busy; will " - "retry in %d seconds...\n"), - hostname, delay); + _cupsLangPrintf(stderr, + _("WARNING: recoverable: Network host \'%s\' is busy; " + "will retry in %d seconds...\n"), hostname, delay); sleep(delay); @@ -839,8 +846,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ recoverable = 1; fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno)); - fputs(_("ERROR: recoverable: Unable to connect to printer; will " - "retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("ERROR: recoverable: Unable to connect to printer; " + "will retry in 30 seconds...\n")); sleep(30); } } @@ -858,7 +866,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ } fputs("STATE: -connecting-to-device\n", stderr); - fprintf(stderr, _("INFO: Connected to %s...\n"), hostname); + _cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname); #ifdef AF_INET6 if (addr->addr.addr.sa_family == AF_INET6) @@ -964,8 +972,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_FAILED); } - fprintf(stderr, _("INFO: Sending control file (%u bytes)\n"), - (unsigned)strlen(control)); + _cupsLangPrintf(stderr, _("INFO: Sending control file (%u bytes)\n"), + (unsigned)strlen(control)); if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1)) { @@ -978,9 +986,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (read(fd, &status, 1) < 1) { - fprintf(stderr, - _("WARNING: Remote host did not respond with control " - "status byte after %d seconds!\n"), timeout); + _cupsLangPrintf(stderr, + _("WARNING: Remote host did not respond with control " + "status byte after %d seconds!\n"), timeout); status = errno; } @@ -988,11 +996,11 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ } if (status != 0) - fprintf(stderr, - _("ERROR: Remote host did not accept control file (%d)\n"), - status); + _cupsLangPrintf(stderr, + _("ERROR: Remote host did not accept control file " + "(%d)\n"), status); else - fputs(_("INFO: Control file sent successfully\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Control file sent successfully\n")); } else status = 0; @@ -1013,13 +1021,13 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_FAILED); } - fprintf(stderr, + _cupsLangPrintf(stderr, #ifdef HAVE_LONG_LONG - _("INFO: Sending data file (%lld bytes)\n"), + _("INFO: Sending data file (%lld bytes)\n"), #else - _("INFO: Sending data file (%ld bytes)\n"), + _("INFO: Sending data file (%ld bytes)\n"), #endif /* HAVE_LONG_LONG */ - CUPS_LLCAST filestats.st_size); + CUPS_LLCAST filestats.st_size); tbytes = 0; for (copy = 0; copy < manual_copies; copy ++) @@ -1028,8 +1036,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ while ((nbytes = read(print_fd, buffer, sizeof(buffer))) > 0) { - fprintf(stderr, _("INFO: Spooling LPR job, %.0f%% complete...\n"), - 100.0 * tbytes / filestats.st_size); + _cupsLangPrintf(stderr, + _("INFO: Spooling LPR job, %.0f%% complete...\n"), + 100.0 * tbytes / filestats.st_size); if (lpd_write(fd, buffer, nbytes) < nbytes) { @@ -1063,9 +1072,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (recv(fd, &status, 1, 0) < 1) { - fprintf(stderr, - _("WARNING: Remote host did not respond with data " - "status byte after %d seconds!\n"), timeout); + _cupsLangPrintf(stderr, + _("WARNING: Remote host did not respond with data " + "status byte after %d seconds!\n"), timeout); status = 0; } @@ -1076,10 +1085,11 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ status = 0; if (status != 0) - fprintf(stderr, _("ERROR: Remote host did not accept data file (%d)\n"), - status); + _cupsLangPrintf(stderr, + _("ERROR: Remote host did not accept data file (%d)\n"), + status); else - fputs(_("INFO: Data file sent successfully\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Data file sent successfully\n")); } if (status == 0 && order == ORDER_DATA_CONTROL) @@ -1093,8 +1103,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_FAILED); } - fprintf(stderr, _("INFO: Sending control file (%lu bytes)\n"), - (unsigned long)strlen(control)); + _cupsLangPrintf(stderr, _("INFO: Sending control file (%lu bytes)\n"), + (unsigned long)strlen(control)); if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1)) { @@ -1107,9 +1117,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (read(fd, &status, 1) < 1) { - fprintf(stderr, - _("WARNING: Remote host did not respond with control " - "status byte after %d seconds!\n"), timeout); + _cupsLangPrintf(stderr, + _("WARNING: Remote host did not respond with control " + "status byte after %d seconds!\n"), timeout); status = errno; } @@ -1117,11 +1127,11 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ } if (status != 0) - fprintf(stderr, - _("ERROR: Remote host did not accept control file (%d)\n"), - status); + _cupsLangPrintf(stderr, + _("ERROR: Remote host did not accept control file " + "(%d)\n"), status); else - fputs(_("INFO: Control file sent successfully\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Control file sent successfully\n")); } /* @@ -1305,5 +1315,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: lpd.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: lpd.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/backend/pap.c b/backend/pap.c index 79ce16058..7f04214fa 100644 --- a/backend/pap.c +++ b/backend/pap.c @@ -1,5 +1,5 @@ /* -* "$Id: pap.c 6559 2007-06-18 21:09:03Z mike $" +* "$Id: pap.c 6911 2007-09-04 20:35:08Z mike $" * * © Copyright 2004 Apple Computer, Inc. All rights reserved. * @@ -242,7 +242,9 @@ int main (int argc, const char * argv[]) /* Try to open the print file... */ if ((fp = fopen(argv[6], "rb")) == NULL) { - fprintf(stderr, "ERROR: unable to open print file \"%s\": %s\n", argv[6], strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open print file \"%s\": %s\n"), + argv[6], strerror(errno)); return (1); } @@ -1363,9 +1365,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone) *resourcePtr, *typePtr, *options, /* Pointer to options */ - optionName[255], /* Name of option */ - value[255], /* Value of option */ - *ptr; /* Pointer into name or value */ + *optionName, /* Name of option */ + *value, /* Value of option */ + sep; /* Separator character */ int port; /* Port number (not used) */ int statusInterval; /* */ @@ -1393,53 +1395,54 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone) while (*options != '\0') { - /* + /* * Get the name... */ - for (ptr = optionName; *options && *options != '=' && *options != '+'; ) - *ptr++ = *options++; - *ptr = '\0'; - value[0] = '\0'; + optionName = options; - if (*options == '=') - { - /* - * Get the value... - */ - + while (*options && *options != '=' && *options != '+' && *options != '&') options ++; - - for (ptr = value; *options && *options != '+';) - *ptr++ = *options++; - - *ptr = '\0'; - - if (*options == '+') - options ++; - } - else if (*options == '+') + + if ((sep = *options) != '\0') + *options++ = '\0'; + + if (sep == '=') { - options ++; + /* + * Get the value... + */ + + value = options; + + while (*options && *options != '+' && *options != '&') + options ++; + + if (*options) + *options++ = '\0'; } + else + value = (char *)""; - /* + /* * Process the option... */ - if (strcasecmp(optionName, "waiteof") == 0) + + if (!strcasecmp(optionName, "waiteof")) { - /* - * Set the banner... + /* + * Wait for the end of the print file? */ - if (strcasecmp(value, "on") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0) + + if (!strcasecmp(value, "on") || + !strcasecmp(value, "yes") || + !strcasecmp(value, "true")) { gWaitEOF = true; } - else if (strcasecmp(value, "off") == 0 || - strcasecmp(value, "no") == 0 || - strcasecmp(value, "false") == 0) + else if (!strcasecmp(value, "off") || + !strcasecmp(value, "no") || + !strcasecmp(value, "false")) { gWaitEOF = false; } @@ -1448,13 +1451,17 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone) fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value); } } - else if (strcasecmp(optionName, "status") == 0) + else if (!strcasecmp(optionName, "status")) { + /* + * Set status reporting interval... + */ + statusInterval = atoi(value); - if (value[0] < '0' || value[0] > '9' || - statusInterval < 0) + if (value[0] < '0' || value[0] > '9' || statusInterval < 0) { - fprintf(stderr, "WARNING: number expected for status option \"%s\"\n", value); + fprintf(stderr, "WARNING: number expected for status option \"%s\"\n", + value); } else { @@ -1469,20 +1476,24 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone) if (*resourcePtr == '/') resourcePtr++; - /* If the resource has a slash we assume the slash seperates the AppleTalk object - * name from the AppleTalk type. If the slash is not present we assume the AppleTalk - * type is LaserWriter. - */ - typePtr = strchr(resourcePtr, '/'); - if (typePtr != NULL) { - *typePtr++ = '\0'; - } else { - typePtr = "LaserWriter"; - } + /* If the resource has a slash we assume the slash seperates the AppleTalk object + * name from the AppleTalk type. If the slash is not present we assume the AppleTalk + * type is LaserWriter. + */ + + typePtr = strchr(resourcePtr, '/'); + if (typePtr != NULL) + { + *typePtr++ = '\0'; + } + else + { + typePtr = "LaserWriter"; + } - removePercentEscapes(hostname, zone, NBP_NVE_STR_SIZE + 1); - removePercentEscapes(resourcePtr, name, NBP_NVE_STR_SIZE + 1); - removePercentEscapes(typePtr, type, NBP_NVE_STR_SIZE + 1); + removePercentEscapes(hostname, zone, NBP_NVE_STR_SIZE + 1); + removePercentEscapes(resourcePtr, name, NBP_NVE_STR_SIZE + 1); + removePercentEscapes(typePtr, type, NBP_NVE_STR_SIZE + 1); return 0; } diff --git a/backend/parallel.c b/backend/parallel.c index febedf6f9..673e6a4c6 100644 --- a/backend/parallel.c +++ b/backend/parallel.c @@ -1,5 +1,5 @@ /* - * "$Id: parallel.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: parallel.c 6835 2007-08-22 18:34:34Z mike $" * * Parallel port backend for the Common UNIX Printing System (CUPS). * @@ -122,8 +122,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -213,8 +214,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); /* * Sleep 5 seconds to keep the job from requeuing too rapidly... @@ -227,19 +229,22 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (errno == EBUSY) { - fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 30 seconds...\n")); sleep(30); } else if (errno == ENXIO || errno == EIO || errno == ENOENT) { - fputs(_("INFO: Printer not connected; will retry in 30 seconds...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer not connected; will retry in 30 " + "seconds...\n")); sleep(30); } else { - fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"), - resource, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open device file \"%s\": %s\n"), + resource, strerror(errno)); return (CUPS_BACKEND_FAILED); } } @@ -279,13 +284,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb); if (print_fd != 0 && tbytes >= 0) - fprintf(stderr, + _cupsLangPrintf(stderr, #ifdef HAVE_LONG_LONG - _("INFO: Sent print file, %lld bytes...\n"), + _("INFO: Sent print file, %lld bytes...\n"), #else - _("INFO: Sent print file, %ld bytes...\n"), + _("INFO: Sent print file, %ld bytes...\n"), #endif /* HAVE_LONG_LONG */ - CUPS_LLCAST tbytes); + CUPS_LLCAST tbytes); } /* @@ -613,7 +618,7 @@ side_cb(int print_fd, /* I - Print file */ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) { - fputs(_("WARNING: Failed to read side-channel request!\n"), stderr); + _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n")); return; } @@ -662,5 +667,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: parallel.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: parallel.c 6835 2007-08-22 18:34:34Z mike $". */ diff --git a/backend/runloop.c b/backend/runloop.c index a3499e95f..0cd38bb61 100644 --- a/backend/runloop.c +++ b/backend/runloop.c @@ -1,5 +1,5 @@ /* - * "$Id: runloop.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: runloop.c 6835 2007-08-22 18:34:34Z mike $" * * Common run loop APIs for the Common UNIX Printing System (CUPS). * @@ -118,8 +118,8 @@ backendDrainOutput(int print_fd, /* I - Print file descriptor */ if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN && errno != EINTR && errno != ENOTTY) { - fprintf(stderr, _("ERROR: Unable to write print data: %s\n"), - strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to write print data: %s\n"), + strerror(errno)); return (-1); } } @@ -230,7 +230,7 @@ backendRunLoop( if (errno == ENXIO && offline != 1) { fputs("STATE: +offline-error\n", stderr); - fputs(_("INFO: Printer is currently off-line.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n")); offline = 1; } else if (errno == EINTR && total_bytes == 0) @@ -321,7 +321,7 @@ backendRunLoop( if (paperout != 1) { fputs("STATE: +media-empty-error\n", stderr); - fputs(_("ERROR: Out of paper!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Out of paper!\n")); paperout = 1; } } @@ -330,7 +330,7 @@ backendRunLoop( if (offline != 1) { fputs("STATE: +offline-error\n", stderr); - fputs(_("INFO: Printer is currently off-line.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n")); offline = 1; } } @@ -352,7 +352,7 @@ backendRunLoop( if (offline) { fputs("STATE: -offline-error\n", stderr); - fputs(_("INFO: Printer is now on-line.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n")); offline = 0; } @@ -374,5 +374,5 @@ backendRunLoop( /* - * End of "$Id: runloop.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: runloop.c 6835 2007-08-22 18:34:34Z mike $". */ diff --git a/backend/scsi-irix.c b/backend/scsi-irix.c index 3b3e43b0d..b3b267651 100644 --- a/backend/scsi-irix.c +++ b/backend/scsi-irix.c @@ -1,5 +1,5 @@ /* - * "$Id: scsi-irix.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: scsi-irix.c 6835 2007-08-22 18:34:34Z mike $" * * IRIX SCSI printer support for the Common UNIX Printing System (CUPS). * @@ -96,7 +96,8 @@ print_device(const char *resource, /* I - SCSI device */ if (strncmp(resource, "/dev/scsi/", 10) != 0) { - fprintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), resource); + _cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), + resource); return (CUPS_BACKEND_STOP); } @@ -119,8 +120,9 @@ print_device(const char *resource, /* I - SCSI device */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); /* * Sleep 5 seconds to keep the job from requeuing too rapidly... @@ -133,13 +135,15 @@ print_device(const char *resource, /* I - SCSI device */ if (errno != EAGAIN && errno != EBUSY) { - fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"), - resource, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open device file \"%s\": %s\n"), + resource, strerror(errno)); return (CUPS_BACKEND_FAILED); } else { - fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 30 seconds...\n")); sleep(30); } } @@ -201,9 +205,9 @@ print_device(const char *resource, /* I - SCSI device */ if (ioctl(scsi_fd, DS_ENTER, &scsi_req) < 0 || scsi_req.ds_status != 0) { - fprintf(stderr, - _("WARNING: SCSI command timed out (%d); retrying...\n"), - scsi_req.ds_status); + _cupsLangPrintf(stderr, + _("WARNING: SCSI command timed out (%d); " + "retrying...\n"), scsi_req.ds_status); sleep(try + 1); } else @@ -211,8 +215,8 @@ print_device(const char *resource, /* I - SCSI device */ if (try >= 10) { - fprintf(stderr, _("ERROR: Unable to send print data (%d)\n"), - scsi_req.ds_status); + _cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"), + scsi_req.ds_status); close(scsi_fd); return (CUPS_BACKEND_FAILED); } @@ -232,5 +236,5 @@ print_device(const char *resource, /* I - SCSI device */ /* - * End of "$Id: scsi-irix.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: scsi-irix.c 6835 2007-08-22 18:34:34Z mike $". */ diff --git a/backend/scsi-linux.c b/backend/scsi-linux.c index dbd1c7085..e7017e572 100644 --- a/backend/scsi-linux.c +++ b/backend/scsi-linux.c @@ -1,5 +1,5 @@ /* - * "$Id: scsi-linux.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: scsi-linux.c 6835 2007-08-22 18:34:34Z mike $" * * Linux SCSI printer support for the Common UNIX Printing System (CUPS). * @@ -110,7 +110,8 @@ print_device(const char *resource, /* I - SCSI device */ if (strncmp(resource, "/dev/sg", 7) != 0) { - fprintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), resource); + _cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), + resource); return (CUPS_BACKEND_STOP); } @@ -148,13 +149,15 @@ print_device(const char *resource, /* I - SCSI device */ if (errno != EAGAIN && errno != EBUSY) { - fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"), - resource, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open device file \"%s\": %s\n"), + resource, strerror(errno)); return (CUPS_BACKEND_FAILED); } else { - fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 30 seconds...\n")); sleep(30); } } @@ -220,9 +223,9 @@ print_device(const char *resource, /* I - SCSI device */ if (ioctl(scsi_fd, SG_IO, &scsi_req) < 0 || scsi_req.status != 0) { - fprintf(stderr, - _("WARNING: SCSI command timed out (%d); retrying...\n"), - scsi_req.status); + _cupsLangPrintf(stderr, + _("WARNING: SCSI command timed out (%d); " + "retrying...\n"), scsi_req.status); sleep(try + 1); } else @@ -230,8 +233,8 @@ print_device(const char *resource, /* I - SCSI device */ if (try >= 10) { - fprintf(stderr, _("ERROR: Unable to send print data (%d)\n"), - scsi_req.status); + _cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"), + scsi_req.status); close(scsi_fd); return (CUPS_BACKEND_FAILED); } @@ -252,5 +255,5 @@ print_device(const char *resource, /* I - SCSI device */ /* - * End of "$Id: scsi-linux.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: scsi-linux.c 6835 2007-08-22 18:34:34Z mike $". */ diff --git a/backend/scsi.c b/backend/scsi.c index df525618b..b08673167 100644 --- a/backend/scsi.c +++ b/backend/scsi.c @@ -1,5 +1,5 @@ /* - * "$Id: scsi.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: scsi.c 6835 2007-08-22 18:34:34Z mike $" * * SCSI printer backend for the Common UNIX Printing System (CUPS). * @@ -153,8 +153,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -224,5 +225,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* - * End of "$Id: scsi.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: scsi.c 6835 2007-08-22 18:34:34Z mike $". */ diff --git a/backend/serial.c b/backend/serial.c index 52ee566cd..864100149 100644 --- a/backend/serial.c +++ b/backend/serial.c @@ -1,5 +1,5 @@ /* - * "$Id: serial.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: serial.c 6911 2007-09-04 20:35:08Z mike $" * * Serial port backend for the Common UNIX Printing System (CUPS). * @@ -104,9 +104,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ username[255], /* Username info (not used) */ resource[1024], /* Resource info (device and options) */ *options, /* Pointer to options */ - name[255], /* Name of option */ - value[255], /* Value of option */ - *ptr; /* Pointer into name or value */ + *name, /* Name of option */ + *value, /* Value of option */ + sep; /* Option separator */ int port; /* Port number (not used) */ int copies; /* Number of copies to print */ int print_fd, /* Print file */ @@ -161,8 +161,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -234,8 +235,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); /* * Sleep 5 seconds to keep the job from requeuing too rapidly... @@ -248,13 +250,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (errno == EBUSY) { - fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 30 seconds...\n")); sleep(30); } else { - fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"), - resource, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open device file \"%s\": %s\n"), + resource, strerror(errno)); return (CUPS_BACKEND_FAILED); } } @@ -285,29 +289,30 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Get the name... */ - for (ptr = name; *options && *options != '=';) - if (ptr < (name + sizeof(name) - 1)) - *ptr++ = *options++; - *ptr = '\0'; + name = options; - if (*options == '=') + while (*options && *options != '=' && *options != '+' && *options != '&') + options ++; + + if ((sep = *options) != '\0') + *options++ = '\0'; + + if (sep == '=') { /* * Get the value... */ - options ++; - - for (ptr = value; *options && *options != '+' && *options != '&';) - if (ptr < (value + sizeof(value) - 1)) - *ptr++ = *options++; - *ptr = '\0'; + value = options; - if (*options == '+' || *options == '&') + while (*options && *options != '+' && *options != '&') options ++; + + if (*options) + *options++ = '\0'; } else - value[0] = '\0'; + value = (char *)""; /* * Process the option... @@ -370,8 +375,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ break; # endif /* B230400 */ default : - fprintf(stderr, _("WARNING: Unsupported baud rate %s!\n"), - value); + _cupsLangPrintf(stderr, _("WARNING: Unsupported baud rate %s!\n"), + value); break; } #endif /* B19200 == 19200 */ @@ -1247,7 +1252,8 @@ side_cb(int print_fd, /* I - Print file */ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) { - fputs(_("WARNING: Failed to read side-channel request!\n"), stderr); + _cupsLangPuts(stderr, + _("WARNING: Failed to read side-channel request!\n")); return; } @@ -1280,5 +1286,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: serial.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: serial.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/backend/socket.c b/backend/socket.c index 06790d96c..6efcbf2f2 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,5 +1,5 @@ /* - * "$Id: socket.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: socket.c 6911 2007-09-04 20:35:08Z mike $" * * AppSocket backend for the Common UNIX Printing System (CUPS). * @@ -68,9 +68,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ username[255], /* Username info (not used) */ resource[1024], /* Resource info (not used) */ *options, /* Pointer to options */ - name[255], /* Name of option */ - value[255], /* Value of option */ - *ptr; /* Pointer into name or value */ + *name, /* Name of option */ + *value, /* Value of option */ + sep; /* Option separator */ int print_fd; /* Print file */ int copies; /* Number of copies to print */ time_t start_time; /* Time of first connect */ @@ -83,7 +83,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ int device_fd; /* AppSocket */ int error; /* Error code (if any) */ http_addrlist_t *addrlist, /* Address list */ - *addr; /* Connected address */ + *addr; /* Connected address */ char addrname[256]; /* Address name */ ssize_t tbytes; /* Total number of bytes written */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) @@ -122,8 +122,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -190,29 +191,30 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Get the name... */ - for (ptr = name; *options && *options != '=';) - if (ptr < (name + sizeof(name) - 1)) - *ptr++ = *options++; - *ptr = '\0'; + name = options; - if (*options == '=') + while (*options && *options != '=' && *options != '+' && *options != '&') + options ++; + + if ((sep = *options) != '\0') + *options++ = '\0'; + + if (sep == '=') { /* * Get the value... */ - options ++; - - for (ptr = value; *options && *options != '+' && *options != '&';) - if (ptr < (value + sizeof(value) - 1)) - *ptr++ = *options++; - *ptr = '\0'; + value = options; - if (*options == '+' || *options == '&') + while (*options && *options != '+' && *options != '&') options ++; + + if (*options) + *options++ = '\0'; } else - value[0] = '\0'; + value = (char *)""; /* * Process the option... @@ -250,12 +252,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL) { - fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), hostname); + _cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), + hostname); return (CUPS_BACKEND_STOP); } - fprintf(stderr, _("INFO: Attempting to connect to host %s on port %d\n"), - hostname, port); + _cupsLangPrintf(stderr, + _("INFO: Attempting to connect to host %s on port %d\n"), + hostname, port); fputs("STATE: +connecting-to-device\n", stderr); @@ -275,8 +279,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); /* * Sleep 5 seconds to keep the job from requeuing too rapidly... @@ -292,16 +297,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ { if (contimeout && (time(NULL) - start_time) > contimeout) { - fputs(_("ERROR: Printer not responding!\n"), stderr); + _cupsLangPuts(stderr, _("ERROR: Printer not responding!\n")); return (CUPS_BACKEND_FAILED); } recoverable = 1; - fprintf(stderr, - _("WARNING: recoverable: Network host \'%s\' is busy; will " - "retry in %d seconds...\n"), - hostname, delay); + _cupsLangPrintf(stderr, + _("WARNING: recoverable: Network host \'%s\' is busy; " + "will retry in %d seconds...\n"), + hostname, delay); sleep(delay); @@ -312,9 +317,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ { recoverable = 1; - fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno)); - fputs(_("ERROR: recoverable: Unable to connect to printer; will " - "retry in 30 seconds...\n"), stderr); + _cupsLangPrintf(stderr, "DEBUG: Connection error: %s\n", + strerror(errno)); + _cupsLangPuts(stderr, + _("ERROR: recoverable: Unable to connect to printer; " + "will retry in 30 seconds...\n")); sleep(30); } } @@ -335,7 +342,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } fputs("STATE: -connecting-to-device\n", stderr); - fprintf(stderr, _("INFO: Connected to %s...\n"), hostname); + _cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname); #ifdef AF_INET6 if (addr->addr.addr.sa_family == AF_INET6) @@ -368,13 +375,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ tbytes = backendRunLoop(print_fd, device_fd, 1, side_cb); if (print_fd != 0 && tbytes >= 0) - fprintf(stderr, + _cupsLangPrintf(stderr, #ifdef HAVE_LONG_LONG - _("INFO: Sent print file, %lld bytes...\n"), + _("INFO: Sent print file, %lld bytes...\n"), #else - _("INFO: Sent print file, %ld bytes...\n"), + _("INFO: Sent print file, %ld bytes...\n"), #endif /* HAVE_LONG_LONG */ - CUPS_LLCAST tbytes); + CUPS_LLCAST tbytes); } /* @@ -389,8 +396,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Shutdown the socket and wait for the other end to finish... */ - fputs(_("INFO: Print file sent, waiting for printer to finish...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Print file sent, waiting for printer to finish...\n")); shutdown(device_fd, 1); @@ -413,7 +420,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ close(print_fd); if (tbytes >= 0) - fputs(_("INFO: Ready to print.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Ready to print.\n")); return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK); } @@ -439,7 +446,7 @@ side_cb(int print_fd, /* I - Print file */ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) { - fputs(_("WARNING: Failed to read side-channel request!\n"), stderr); + _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n")); return; } @@ -526,5 +533,5 @@ wait_bc(int device_fd, /* I - Socket */ /* - * End of "$Id: socket.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: socket.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index dc628fea3..efce4826d 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1,7 +1,7 @@ /* -* "$Id: usb-darwin.c 6680 2007-07-16 18:46:16Z mike $" +* "$Id: usb-darwin.c 6953 2007-09-13 22:41:21Z mike $" * -* Copyright © 2005-2007 Apple Inc. All rights reserved. +* Copyright � 2005-2007 Apple Inc. All rights reserved. * * IMPORTANT: This Apple software is supplied to you by Apple Computer, * Inc. ("Apple") in consideration of your agreement to the following @@ -267,7 +267,7 @@ static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, static void device_added(void *userdata, io_iterator_t iterator); static void get_device_id(cups_sc_status_t *status, char *data, int *datalen); static void iterate_printers(iterator_callback_t callBack, void *userdata); -static void parse_options(const char *options, char *serial, int serial_size, UInt32 *location, Boolean *wait_eof); +static void parse_options(char *options, char *serial, int serial_size, UInt32 *location, Boolean *wait_eof); static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial); static void setup_cfLanguage(void); static void soft_reset(); @@ -304,7 +304,7 @@ int /* O - Exit status */ print_device(const char *uri, /* I - Device URI */ const char *hostname, /* I - Hostname/manufacturer */ const char *resource, /* I - Resource/modelname */ - const char *options, /* I - Device options/serial number */ + char *options, /* I - Device options/serial number */ int print_fd, /* I - File descriptor to print */ int copies, /* I - Copies to print */ int argc, /* I - Number of command-line arguments (6 or 7) */ @@ -313,7 +313,8 @@ print_device(const char *uri, /* I - Device URI */ char serial[1024]; /* Serial number buffer */ OSStatus status; /* Function results */ pthread_t read_thread_id, /* Read thread */ - sidechannel_thread_id;/* Side channel thread */ + sidechannel_thread_id;/* Side-channel thread */ + int sidechannel_started = 0;/* Was the side-channel thread started? */ char print_buffer[8192], /* Print data buffer */ *print_ptr; /* Pointer into print data buffer */ UInt32 location; /* Unique location in bus topology */ @@ -327,6 +328,7 @@ print_device(const char *uri, /* I - Device URI */ stimeout; /* Timeout for select() */ struct timespec cond_timeout; /* pthread condition timeout */ + setup_cfLanguage(); parse_options(options, serial, sizeof(serial), &location, &g.wait_eof); @@ -387,7 +389,7 @@ print_device(const char *uri, /* I - Device URI */ strlcpy(print_buffer, "USB class driver", sizeof(print_buffer)); fputs("STATE: +apple-missing-usbclassdriver-error\n", stderr); - fprintf(stderr, _("FATAL: Could not load %s\n"), print_buffer); + _cupsLangPrintf(stderr, _("FATAL: Could not load %s\n"), print_buffer); if (driverBundlePath) CFRelease(driverBundlePath); @@ -404,7 +406,8 @@ print_device(const char *uri, /* I - Device URI */ countdown -= PRINTER_POLLING_INTERVAL; if (countdown <= 0) { - fprintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"), (int)status); + _cupsLangPrintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"), + (int)status); countdown = SUBSEQUENT_LOG_INTERVAL; /* subsequent log entries, every 15 seconds */ } } @@ -456,9 +459,11 @@ print_device(const char *uri, /* I - Device URI */ if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL)) { - fputs(_("WARNING: Couldn't create side channel\n"), stderr); + _cupsLangPuts(stderr, _("WARNING: Couldn't create side channel\n")); return CUPS_BACKEND_STOP; } + + sidechannel_started = 1; } /* @@ -473,7 +478,7 @@ print_device(const char *uri, /* I - Device URI */ if (pthread_create(&read_thread_id, NULL, read_thread, NULL)) { - fputs(_("WARNING: Couldn't create read channel\n"), stderr); + _cupsLangPuts(stderr, _("WARNING: Couldn't create read channel\n")); return CUPS_BACKEND_STOP; } @@ -488,7 +493,7 @@ print_device(const char *uri, /* I - Device URI */ while (status == noErr && copies-- > 0) { - fputs(_("INFO: Sending data\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Sending data\n")); if (print_fd != STDIN_FILENO) { @@ -556,7 +561,7 @@ print_device(const char *uri, /* I - Device URI */ } else if (errno != EAGAIN) { - fprintf(stderr, _("ERROR: select() returned %d\n"), (int)errno); + _cupsLangPrintf(stderr, _("ERROR: select() returned %d\n"), (int)errno); return CUPS_BACKEND_STOP; } } @@ -632,7 +637,8 @@ print_device(const char *uri, /* I - Device URI */ */ OSStatus err = (*g.classdriver)->Abort(g.classdriver); - fprintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"), (long)status, (long)err); + _cupsLangPrintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"), + (long)status, (long)err); status = CUPS_BACKEND_STOP; break; } @@ -656,27 +662,42 @@ print_device(const char *uri, /* I - Device URI */ * Wait for the side channel thread to exit... */ - close(CUPS_SC_FD); - pthread_mutex_lock(&g.readwrite_lock_mutex); - g.readwrite_lock = 0; - pthread_cond_signal(&g.readwrite_lock_cond); - pthread_mutex_unlock(&g.readwrite_lock_mutex); - - g.sidechannel_thread_stop = 1; - pthread_mutex_lock(&g.sidechannel_thread_mutex); - if (!g.sidechannel_thread_done) + if (sidechannel_started) { - cond_timeout.tv_sec = time(NULL) + WAIT_SIDE_DELAY; - cond_timeout.tv_nsec = 0; - pthread_cond_timedwait(&g.sidechannel_thread_cond, - &g.sidechannel_thread_mutex, &cond_timeout); - } - pthread_mutex_unlock(&g.sidechannel_thread_mutex); + close(CUPS_SC_FD); + pthread_mutex_lock(&g.readwrite_lock_mutex); + g.readwrite_lock = 0; + pthread_cond_signal(&g.readwrite_lock_cond); + pthread_mutex_unlock(&g.readwrite_lock_mutex); + + g.sidechannel_thread_stop = 1; + pthread_mutex_lock(&g.sidechannel_thread_mutex); + if (!g.sidechannel_thread_done) + { + /* + * Wait for the side-channel thread to exit... + */ - pthread_join(sidechannel_thread_id, NULL); + cond_timeout.tv_sec = time(NULL) + WAIT_SIDE_DELAY; + cond_timeout.tv_nsec = 0; + if (pthread_cond_timedwait(&g.sidechannel_thread_cond, + &g.sidechannel_thread_mutex, + &cond_timeout) != 0) + { + /* + * Force the side-channel thread to exit... + */ + + pthread_kill(sidechannel_thread_id, SIGTERM); + } + } + pthread_mutex_unlock(&g.sidechannel_thread_mutex); - pthread_cond_destroy(&g.sidechannel_thread_cond); - pthread_mutex_destroy(&g.sidechannel_thread_mutex); + pthread_join(sidechannel_thread_id, NULL); + + pthread_cond_destroy(&g.sidechannel_thread_cond); + pthread_mutex_destroy(&g.sidechannel_thread_mutex); + } pthread_cond_destroy(&g.readwrite_lock_cond); pthread_mutex_destroy(&g.readwrite_lock_mutex); @@ -689,9 +710,7 @@ print_device(const char *uri, /* I - Device URI */ /* * Give the read thread WAIT_EOF_DELAY seconds to complete all the data. If - * we are not signaled in that time then force the thread to exit by setting - * the waiteof to be false. Plese note that this relies on us using the timeout - * class driver. + * we are not signaled in that time then force the thread to exit. */ pthread_mutex_lock(&g.read_thread_mutex); @@ -703,7 +722,13 @@ print_device(const char *uri, /* I - Device URI */ if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex, &cond_timeout) != 0) - g.wait_eof = false; + { + /* + * Force the read thread to exit... + */ + + pthread_kill(read_thread_id, SIGTERM); + } } pthread_mutex_unlock(&g.read_thread_mutex); @@ -827,8 +852,16 @@ sidechannel_thread(void *reference) switch (command) { case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */ - soft_reset(); - cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0); + if ((*g.classdriver)->SoftReset != NULL) + { + soft_reset(); + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0); + } + else + { + cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED, + NULL, 0, 1.0); + } break; case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */ @@ -1091,7 +1124,7 @@ static Boolean find_device_cb(void *refcon, if (!keepLooking && g.status_timer != NULL) { fputs("STATE: -offline-error\n", stderr); - fputs(_("INFO: Printer is now on-line.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n")); CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode); CFRelease(g.status_timer); g.status_timer = NULL; @@ -1109,7 +1142,7 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info) { fputs("STATE: +offline-error\n", stderr); - fputs(_("INFO: Printer is currently off-line.\n"), stderr); + _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n")); } @@ -1541,18 +1574,19 @@ CFStringRef cfstr_create_trim(const char *cstr) #pragma mark - /* - * 'parse_options()' - Parse uri options. + * 'parse_options()' - Parse URI options. */ -static void parse_options(const char *options, +static void parse_options(char *options, char *serial, int serial_size, UInt32 *location, Boolean *wait_eof) { - char optionName[255], /* Name of option */ - value[255], /* Value of option */ - *ptr; /* Pointer into name or value */ + char sep, /* Separator character */ + *name, /* Name of option */ + *value; /* Value of option */ + if (serial) *serial = '\0'; @@ -1562,56 +1596,61 @@ static void parse_options(const char *options, if (!options) return; - while (*options != '\0') + while (*options) { - /* Get the name... */ - for (ptr = optionName; *options && *options != '=' && *options != '+';) - *ptr++ = *options++; + /* + * Get the name... + */ - *ptr = '\0'; - value[0] = '\0'; + name = options; - if (*options == '=') - { - /* Get the value... */ + while (*options && *options != '=' && *options != '+' && *options != '&') options ++; - for (ptr = value; *options && *options != '+';) - *ptr++ = *options++; + if ((sep = *options) != '\0') + *options++ = '\0'; - *ptr = '\0'; + if (sep == '=') + { + /* + * Get the value... + */ - if (*options == '+') + value = options; + + while (*options && *options != '+' && *options != '&') options ++; + + if (*options) + *options++ = '\0'; } - else if (*options == '+') - options ++; + else + value = (char *)""; - /* - * Process the option... - */ - if (strcasecmp(optionName, "waiteof") == 0) + /* + * Process the option... + */ + + if (!strcasecmp(name, "waiteof")) { - if (strcasecmp(value, "on") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0) + if (!strcasecmp(value, "on") || + !strcasecmp(value, "yes") || + !strcasecmp(value, "true")) *wait_eof = true; - else if (strcasecmp(value, "off") == 0 || - strcasecmp(value, "no") == 0 || - strcasecmp(value, "false") == 0) + else if (!strcasecmp(value, "off") || + !strcasecmp(value, "no") || + !strcasecmp(value, "false")) *wait_eof = false; else - fprintf(stderr, _("WARNING: Boolean expected for waiteof option \"%s\"\n"), value); + _cupsLangPrintf(stderr, + _("WARNING: Boolean expected for waiteof option " + "\"%s\"\n"), value); } - else if (strcasecmp(optionName, "serial") == 0) - { + else if (!strcasecmp(name, "serial")) strlcpy(serial, value, serial_size); - } - else if (strcasecmp(optionName, "location") == 0 && location) + else if (!strcasecmp(name, "location") && location) *location = strtol(value, NULL, 16); } - - return; } @@ -1885,7 +1924,7 @@ static void parse_pserror(char *sockBuffer, /* - * 'soft_reset' + * 'soft_reset()' - Send a soft reset to the device. */ static void soft_reset() @@ -1971,5 +2010,5 @@ static void get_device_id(cups_sc_status_t *status, /* - * End of "$Id: usb-darwin.c 6680 2007-07-16 18:46:16Z mike $". + * End of "$Id: usb-darwin.c 6953 2007-09-13 22:41:21Z mike $". */ diff --git a/backend/usb-unix.c b/backend/usb-unix.c index ff9e825a0..60f821d97 100644 --- a/backend/usb-unix.c +++ b/backend/usb-unix.c @@ -1,5 +1,5 @@ /* - * "$Id: usb-unix.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: usb-unix.c 6911 2007-09-04 20:35:08Z mike $" * * USB port backend for the Common UNIX Printing System (CUPS). * @@ -48,7 +48,7 @@ int /* O - Exit status */ print_device(const char *uri, /* I - Device URI */ const char *hostname, /* I - Hostname/manufacturer */ const char *resource, /* I - Resource/modelname */ - const char *options, /* I - Device options/serial number */ + char *options, /* I - Device options/serial number */ int print_fd, /* I - File descriptor to print */ int copies, /* I - Copies to print */ int argc, /* I - Number of command-line arguments (6 or 7) */ @@ -105,8 +105,9 @@ print_device(const char *uri, /* I - Device URI */ * available printer in the class. */ - fputs(_("INFO: Unable to contact printer, queuing on next " - "printer in class...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Unable to contact printer, queuing on next " + "printer in class...\n")); /* * Sleep 5 seconds to keep the job from requeuing too rapidly... @@ -119,20 +120,23 @@ print_device(const char *uri, /* I - Device URI */ if (errno == EBUSY) { - fputs(_("INFO: Printer busy; will retry in 10 seconds...\n"), stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 10 seconds...\n")); sleep(10); } else if (errno == ENXIO || errno == EIO || errno == ENOENT || errno == ENODEV) { - fputs(_("INFO: Printer not connected; will retry in 30 seconds...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer not connected; will retry in 30 " + "seconds...\n")); sleep(30); } else { - fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"), - resource, strerror(errno)); + _cupsLangPrintf(stderr, + _("ERROR: Unable to open device file \"%s\": %s\n"), + resource, strerror(errno)); return (CUPS_BACKEND_FAILED); } } @@ -172,13 +176,13 @@ print_device(const char *uri, /* I - Device URI */ tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb); if (print_fd != 0 && tbytes >= 0) - fprintf(stderr, + _cupsLangPrintf(stderr, #ifdef HAVE_LONG_LONG - _("INFO: Sent print file, %lld bytes...\n"), + _("INFO: Sent print file, %lld bytes...\n"), #else - _("INFO: Sent print file, %ld bytes...\n"), + _("INFO: Sent print file, %ld bytes...\n"), #endif /* HAVE_LONG_LONG */ - CUPS_LLCAST tbytes); + CUPS_LLCAST tbytes); } /* @@ -411,8 +415,8 @@ open_device(const char *uri, /* I - Device URI */ if (busy) { - fputs(_("INFO: Printer busy; will retry in 5 seconds...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 5 seconds...\n")); sleep(5); } } @@ -504,8 +508,8 @@ open_device(const char *uri, /* I - Device URI */ if (busy) { - fputs(_("INFO: Printer is busy; will retry in 5 seconds...\n"), - stderr); + _cupsLangPuts(stderr, + _("INFO: Printer is busy; will retry in 5 seconds...\n")); sleep(5); } } @@ -562,7 +566,7 @@ side_cb(int print_fd, /* I - Print file */ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) { - fputs(_("WARNING: Failed to read side-channel request!\n"), stderr); + _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n")); return; } @@ -611,5 +615,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: usb-unix.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: usb-unix.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/backend/usb.c b/backend/usb.c index 2abd4df47..689d39900 100644 --- a/backend/usb.c +++ b/backend/usb.c @@ -1,5 +1,5 @@ /* - * "$Id: usb.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: usb.c 6911 2007-09-04 20:35:08Z mike $" * * USB port backend for the Common UNIX Printing System (CUPS). * @@ -54,7 +54,7 @@ void list_devices(void); int print_device(const char *uri, const char *hostname, - const char *resource, const char *options, + const char *resource, char *options, int print_fd, int copies, int argc, char *argv[]); @@ -99,7 +99,7 @@ int /* O - Exit status */ print_device(const char *uri, /* I - Device URI */ const char *hostname, /* I - Hostname/manufacturer */ const char *resource, /* I - Resource/modelname */ - const char *options, /* I - Device options/serial number */ + char *options, /* I - Device options/serial number */ int print_fd, /* I - File descriptor to print */ int copies, /* I - Copies to print */ int argc, /* I - Number of command-line arguments (6 or 7) */ @@ -184,8 +184,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } else if (argc < 6 || argc > 7) { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); + _cupsLangPrintf(stderr, + _("Usage: %s job-id user title copies options [file]\n"), + argv[0]); return (CUPS_BACKEND_FAILED); } @@ -200,8 +201,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_OK) { - fputs(_("ERROR: No device URI found in argv[0] or in DEVICE_URI " - "environment variable!\n"), stderr); + _cupsLangPuts(stderr, + _("ERROR: No device URI found in argv[0] or in DEVICE_URI " + "environment variable!\n")); return (1); } @@ -237,8 +239,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if ((print_fd = open(argv[6], O_RDONLY)) < 0) { - fprintf(stderr, _("ERROR: Unable to open print file %s - %s\n"), - argv[6], strerror(errno)); + _cupsLangPrintf(stderr, _("ERROR: Unable to open print file %s - %s\n"), + argv[6], strerror(errno)); return (CUPS_BACKEND_FAILED); } @@ -264,5 +266,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* - * End of "$Id: usb.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: usb.c 6911 2007-09-04 20:35:08Z mike $". */ diff --git a/cgi-bin/help.c b/cgi-bin/help.c index 85a6a7cae..38fcec918 100644 --- a/cgi-bin/help.c +++ b/cgi-bin/help.c @@ -151,6 +151,7 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("HELPFILE", helpfile); cgiSetVariable("HELPTITLE", n->text); + cgiSetVariable("TOPIC", n->section); /* * Send a standard page header... diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 908db4b48..021de82f5 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -1,5 +1,5 @@ /* - * "$Id: template.c 6717 2007-07-24 23:47:12Z mike $" + * "$Id: template.c 6799 2007-08-15 19:33:36Z mike $" * * CGI template function. * @@ -85,9 +85,9 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */ void cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */ { - int i; /* Looping var */ char filename[1024], /* Filename */ - locale[16]; /* Locale name */ + locale[16], /* Locale name */ + *locptr; /* Pointer into locale name */ const char *directory, /* Directory for templates */ *lang; /* Language */ FILE *in; /* Input file */ @@ -100,22 +100,19 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */ * Convert the language to a locale name... */ + locale[0] = '\0'; + if ((lang = getenv("LANG")) != NULL) { - for (i = 0; lang[i] && i < 15; i ++) - if (isalnum(lang[i] & 255) || lang[i] == '_') - locale[i] = tolower(lang[i]); - else if (lang[i] == '-') - locale[i] = '_'; - else - break; + locale[0] = '/'; + strlcpy(locale + 1, lang, sizeof(locale) - 1); - locale[i] = '\0'; + if ((locptr = strchr(locale, '.')) != NULL) + *locptr = '\0'; /* Strip charset */ } - else - locale[0] = '\0'; - fprintf(stderr, "DEBUG2: locale=\"%s\"...\n", locale); + fprintf(stderr, "DEBUG: lang=\"%s\", locale=\"%s\"...\n", + lang ? lang : "(null)", locale); /* * See if we have a template file for this language... @@ -123,14 +120,17 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */ directory = cgiGetTemplateDir(); - snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl); - if (access(filename, 0)) + snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl); + if ((in = fopen(filename, "r")) == NULL) { - locale[2] = '\0'; + locale[3] = '\0'; - snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl); - if (access(filename, 0)) + snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl); + if ((in = fopen(filename, "r")) == NULL) + { snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl); + in = fopen(filename, "r"); + } } fprintf(stderr, "DEBUG2: Template file is \"%s\"...\n", filename); @@ -139,7 +139,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */ * Open the template file... */ - if ((in = fopen(filename, "r")) == NULL) + if (!in) { fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n", filename, strerror(errno)); @@ -663,5 +663,5 @@ cgi_puturi(const char *s, /* I - String to output */ /* - * End of "$Id: template.c 6717 2007-07-24 23:47:12Z mike $". + * End of "$Id: template.c 6799 2007-08-15 19:33:36Z mike $". */ diff --git a/conf/mime.convs.in b/conf/mime.convs.in index ad9ab9041..d6f4fb371 100644 --- a/conf/mime.convs.in +++ b/conf/mime.convs.in @@ -1,5 +1,5 @@ # -# "$Id: mime.convs.in 6649 2007-07-11 21:46:42Z mike $" +# "$Id: mime.convs.in 6761 2007-08-02 17:58:59Z mike $" # # DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW # VERSIONS OF CUPS. Instead, create a "local.convs" file that @@ -109,5 +109,5 @@ application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster @DEFAULT_RAW_PRINTING@application/octet-stream application/vnd.cups-raw 0 - # -# End of "$Id: mime.convs.in 6649 2007-07-11 21:46:42Z mike $". +# End of "$Id: mime.convs.in 6761 2007-08-02 17:58:59Z mike $". # diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 27835e87c..7bfe47c61 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 6749 2007-07-31 00:00:21Z mike $" +dnl "$Id: cups-common.m4 6946 2007-09-12 18:28:16Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -20,7 +20,7 @@ dnl Set the name of the config header file... AC_CONFIG_HEADER(config.h) dnl Versio number information... -CUPS_VERSION="1.3.0" +CUPS_VERSION="1.3.1" CUPS_REVISION="" #if test -z "$CUPS_REVISION" -a -d .svn; then # CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`" @@ -123,6 +123,7 @@ AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H)) AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H)) AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H)) AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H)) +AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H)) AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H)) AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H)) @@ -286,5 +287,5 @@ AC_SUBST(DEFAULT_IPP_PORT) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT) dnl -dnl End of "$Id: cups-common.m4 6749 2007-07-31 00:00:21Z mike $". +dnl End of "$Id: cups-common.m4 6946 2007-09-12 18:28:16Z mike $". dnl diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4 index c34dfd090..a0bdffcbe 100644 --- a/config-scripts/cups-directories.m4 +++ b/config-scripts/cups-directories.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-directories.m4 6649 2007-07-11 21:46:42Z mike $" +dnl "$Id: cups-directories.m4 6838 2007-08-22 20:00:19Z mike $" dnl dnl Directory stuff for the Common UNIX Printing System (CUPS). dnl @@ -292,20 +292,24 @@ AC_SUBST(CUPS_FONTPATH) AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH") # Locale data -case "$uname" in - Linux | GNU | *BSD* | Darwin*) - CUPS_LOCALEDIR="$datadir/locale" - ;; +if test "$localedir" = "\${datarootdir}/locale"; then + case "$uname" in + Linux | GNU | *BSD* | Darwin*) + CUPS_LOCALEDIR="$datarootdir/locale" + ;; - OSF1* | AIX*) - CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg" - ;; + OSF1* | AIX*) + CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg" + ;; - *) - # This is the standard System V location... - CUPS_LOCALEDIR="$exec_prefix/lib/locale" - ;; -esac + *) + # This is the standard System V location... + CUPS_LOCALEDIR="$exec_prefix/lib/locale" + ;; + esac +else + CUPS_LOCALEDIR="$localedir" +fi AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$CUPS_LOCALEDIR") AC_SUBST(CUPS_LOCALEDIR) @@ -356,5 +360,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups") AC_SUBST(CUPS_STATEDIR) dnl -dnl End of "$Id: cups-directories.m4 6649 2007-07-11 21:46:42Z mike $". +dnl End of "$Id: cups-directories.m4 6838 2007-08-22 20:00:19Z mike $". dnl diff --git a/config.h.in b/config.h.in index b59bfd0ab..4c4a21714 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,5 @@ /* - * "$Id: config.h.in 6755 2007-08-01 19:02:47Z mike $" + * "$Id: config.h.in 6878 2007-08-29 17:22:26Z mike $" * * Configuration file for the Common UNIX Printing System (CUPS). * @@ -523,6 +523,13 @@ #undef HAVE_DLFCN_H +/* + * Do we have ? + */ + +#undef HAVE_SYS_PARAM_H + + /* * Do we have ? */ @@ -540,5 +547,5 @@ #endif /* !_CUPS_CONFIG_H_ */ /* - * End of "$Id: config.h.in 6755 2007-08-01 19:02:47Z mike $". + * End of "$Id: config.h.in 6878 2007-08-29 17:22:26Z mike $". */ diff --git a/cups/auth.c b/cups/auth.c index ceb65ec2f..055977193 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -1,5 +1,5 @@ /* - * "$Id: auth.c 6722 2007-07-25 17:19:09Z mike $" + * "$Id: auth.c 6779 2007-08-08 19:49:48Z mike $" * * Authentication functions for the Common UNIX Printing System (CUPS). * @@ -654,5 +654,5 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */ /* - * End of "$Id: auth.c 6722 2007-07-25 17:19:09Z mike $". + * End of "$Id: auth.c 6779 2007-08-08 19:49:48Z mike $". */ diff --git a/cups/cups.h b/cups/cups.h index befa0a395..9cb3e2d15 100644 --- a/cups/cups.h +++ b/cups/cups.h @@ -1,5 +1,5 @@ /* - * "$Id: cups.h 6658 2007-07-13 01:13:26Z mike $" + * "$Id: cups.h 6946 2007-09-12 18:28:16Z mike $" * * API definitions for the Common UNIX Printing System (CUPS). * @@ -59,10 +59,10 @@ extern "C" { * Constants... */ -# define CUPS_VERSION 1.0300 +# define CUPS_VERSION 1.0301 # define CUPS_VERSION_MAJOR 1 # define CUPS_VERSION_MINOR 3 -# define CUPS_VERSION_PATCH 0 +# define CUPS_VERSION_PATCH 1 # define CUPS_DATE_ANY -1 @@ -256,5 +256,5 @@ extern void cupsSetDefaultDest(const char *name, #endif /* !_CUPS_CUPS_H_ */ /* - * End of "$Id: cups.h 6658 2007-07-13 01:13:26Z mike $". + * End of "$Id: cups.h 6946 2007-09-12 18:28:16Z mike $". */ diff --git a/cups/http-addr.c b/cups/http-addr.c index 14e6112de..58504ca1d 100644 --- a/cups/http-addr.c +++ b/cups/http-addr.c @@ -1,5 +1,5 @@ /* - * "$Id: http-addr.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: http-addr.c 6816 2007-08-20 20:16:00Z mike $" * * HTTP address routines for the Common UNIX Printing System (CUPS). * @@ -197,18 +197,17 @@ httpAddrLookup( #endif /* AF_LOCAL */ #ifdef HAVE_GETNAMEINFO { - if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen, - NULL, 0, 0)) - { - /* - * If we get an error back, then the address type is not supported - * and we should zero out the buffer... - */ - - name[0] = '\0'; + /* + * STR #2486: httpAddrLookup() fails when getnameinfo() returns EAI_AGAIN + * + * FWIW, I think this is really a bug in the implementation of + * getnameinfo(), but falling back on httpAddrString() is easy to + * do... + */ - return (NULL); - } + if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen, + NULL, 0, 0)) + return (httpAddrString(addr, name, namelen)); } #else { @@ -553,5 +552,5 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */ /* - * End of "$Id: http-addr.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: http-addr.c 6816 2007-08-20 20:16:00Z mike $". */ diff --git a/cups/http-private.h b/cups/http-private.h index cd46bb31f..c36eb8d01 100644 --- a/cups/http-private.h +++ b/cups/http-private.h @@ -1,5 +1,5 @@ /* - * "$Id: http-private.h 6649 2007-07-11 21:46:42Z mike $" + * "$Id: http-private.h 6934 2007-09-10 16:46:20Z mike $" * * Private HTTP definitions for the Common UNIX Printing System (CUPS). * @@ -62,6 +62,9 @@ # ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE # define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name # endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */ +# ifdef HAVE_KRB5_H +# include +# endif /* HAVE_KRB5_H */ # endif /* HAVE_GSSAPI */ # ifdef HAVE_AUTHORIZATION_H @@ -263,5 +266,5 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs); #endif /* !_CUPS_HTTP_PRIVATE_H_ */ /* - * End of "$Id: http-private.h 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: http-private.h 6934 2007-09-10 16:46:20Z mike $". */ diff --git a/cups/language.c b/cups/language.c index ac62feb27..a615eecba 100644 --- a/cups/language.c +++ b/cups/language.c @@ -1,5 +1,5 @@ /* - * "$Id: language.c 6649 2007-07-11 21:46:42Z mike $" + * "$Id: language.c 6917 2007-09-05 21:14:17Z mike $" * * I18N/language support for the Common UNIX Printing System (CUPS). * @@ -985,11 +985,12 @@ typedef struct static const _apple_name_locale_t apple_name_locale[] = { { "en" , "en_US" }, - { "no" , "nb" }, + { "nb" , "no" }, { "zh-Hans" , "zh_CN" }, { "zh-Hant" , "zh_TW" } }; + /* * 'appleLangDefault()' - Get the default locale string. */ @@ -998,6 +999,8 @@ static const char * /* O - Locale string */ appleLangDefault(void) { int i; /* Looping var */ + CFBundleRef bundle; /* Main bundle (if any) */ + CFArrayRef bundleList; /* List of localizations in bundle */ CFPropertyListRef localizationList; /* List of localization data */ CFStringRef languageName; /* Current name */ @@ -1014,63 +1017,77 @@ appleLangDefault(void) if (!cg->language[0]) { if ((lang = getenv("LANG"))) + { strlcpy(cg->language, lang, sizeof(cg->language)); - else + return (cg->language); + } + else if ((bundle = CFBundleGetMainBundle()) != NULL && + (bundleList = CFBundleCopyBundleLocalizations(bundle)) != NULL) { localizationList = - CFPreferencesCopyAppValue(CFSTR("AppleLanguages"), - kCFPreferencesCurrentApplication); + CFBundleCopyPreferredLocalizationsFromArray(bundleList); - if (localizationList != NULL) + CFRelease(bundleList); + } + else + localizationList = + CFPreferencesCopyAppValue(CFSTR("AppleLanguages"), + kCFPreferencesCurrentApplication); + + if (localizationList) + { + if (CFGetTypeID(localizationList) == CFArrayGetTypeID() && + CFArrayGetCount(localizationList) > 0) { - if (CFGetTypeID(localizationList) == CFArrayGetTypeID() && - CFArrayGetCount(localizationList) > 0) + languageName = CFArrayGetValueAtIndex(localizationList, 0); + + if (languageName && + CFGetTypeID(languageName) == CFStringGetTypeID()) { - languageName = CFArrayGetValueAtIndex(localizationList, 0); + localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString( + kCFAllocatorDefault, languageName); - if (languageName != NULL && - CFGetTypeID(languageName) == CFStringGetTypeID()) - { - localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString( - kCFAllocatorDefault, languageName); + if (localeName) + { + CFStringGetCString(localeName, cg->language, sizeof(cg->language), + kCFStringEncodingASCII); + CFRelease(localeName); - if (localeName != NULL) - { - CFStringGetCString(localeName, cg->language, sizeof(cg->language), - kCFStringEncodingASCII); - CFRelease(localeName); + DEBUG_printf(("appleLangDefault: cg->language=\"%s\"\n", + cg->language)); - /* - * Map new language identifiers to locales... - */ + /* + * Map new language identifiers to locales... + */ - for (i = 0; - i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]); - i++) + for (i = 0; + i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]); + i++) + { + if (!strcmp(cg->language, apple_name_locale[i].name)) { - if (!strcmp(cg->language, apple_name_locale[i].name)) - { - strlcpy(cg->language, apple_name_locale[i].locale, - sizeof(cg->language)); - break; - } + DEBUG_printf(("appleLangDefault: mapping \"%s\" to \"%s\"...\n", + cg->language, apple_name_locale[i].locale)); + strlcpy(cg->language, apple_name_locale[i].locale, + sizeof(cg->language)); + break; } + } - /* - * Convert language subtag into region subtag... - */ + /* + * Convert language subtag into region subtag... + */ - if (cg->language[2] == '-') - cg->language[2] = '_'; + if (cg->language[2] == '-') + cg->language[2] = '_'; - if (strchr(cg->language, '.') == NULL) - strlcat(cg->language, ".UTF-8", sizeof(cg->language)); - } - } + if (!strchr(cg->language, '.')) + strlcat(cg->language, ".UTF-8", sizeof(cg->language)); + } } - - CFRelease(localizationList); } + + CFRelease(localizationList); } /* @@ -1354,5 +1371,5 @@ cups_unquote(char *d, /* O - Unquoted string */ /* - * End of "$Id: language.c 6649 2007-07-11 21:46:42Z mike $". + * End of "$Id: language.c 6917 2007-09-05 21:14:17Z mike $". */ diff --git a/cups/localize.c b/cups/localize.c index 911d8ef35..347b9d97e 100644 --- a/cups/localize.c +++ b/cups/localize.c @@ -1,5 +1,5 @@ /* - * "$Id: localize.c 6686 2007-07-16 23:11:59Z mike $" + * "$Id: localize.c 6883 2007-08-29 21:05:17Z mike $" * * PPD custom option routines for the Common UNIX Printing System (CUPS). * @@ -44,7 +44,8 @@ * Local functions... */ -static void ppd_ll_CC(char *ll_CC, char *ll); +static void ppd_ll_CC(char *ll_CC, int ll_CC_size, + char *ll, int ll_size); static ppd_attr_t *ppd_localized_attr(ppd_file_t *ppd, const char *keyword, const char *spec, const char *ll_CC, @@ -90,7 +91,7 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */ * Get the default language... */ - ppd_ll_CC(ll_CC, ll); + ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll)); /* * Now lookup all of the groups, options, choices, etc. @@ -240,7 +241,7 @@ ppdLocalizeIPPReason( * Get the default language... */ - ppd_ll_CC(ll_CC, ll); + ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll)); /* * Find the localized attribute... @@ -391,8 +392,9 @@ ppdLocalizeIPPReason( static void ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */ - char *ll) /* O - Generic locale name */ - + int ll_CC_size, /* I - Size of country-specific name */ + char *ll, /* O - Generic locale name */ + int ll_size) /* I - Size of generic name */ { cups_lang_t *lang; /* Current language */ @@ -403,8 +405,8 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */ if ((lang = cupsLangDefault()) == NULL) { - strcpy(ll_CC, "en_US"); - strcpy(ll, "en"); + strlcpy(ll_CC, "en_US", ll_CC_size); + strlcpy(ll, "en", ll_size); return; } @@ -412,8 +414,10 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */ * Copy the locale name... */ - strlcpy(ll_CC, lang->language, sizeof(ll_CC)); - strlcpy(ll, lang->language, sizeof(ll)); + strlcpy(ll_CC, lang->language, ll_CC_size); + strlcpy(ll, lang->language, ll_size); + + DEBUG_printf(("ll_CC=\"%s\", ll=\"%s\"\n", ll_CC, ll)); if (strlen(ll_CC) == 2) { @@ -423,16 +427,16 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */ */ if (!strcmp(ll_CC, "cs")) - strcpy(ll_CC, "cs_CZ"); + strlcpy(ll_CC, "cs_CZ", ll_CC_size); else if (!strcmp(ll_CC, "en")) - strcpy(ll_CC, "en_US"); + strlcpy(ll_CC, "en_US", ll_CC_size); else if (!strcmp(ll_CC, "ja")) - strcpy(ll_CC, "ja_JP"); + strlcpy(ll_CC, "ja_JP", ll_CC_size); else if (!strcmp(ll_CC, "sv")) - strcpy(ll_CC, "sv_SE"); - else if (!strcmp(ll_CC, "zh")) - strcpy(ll_CC, "zh_CN"); /* Simplified Chinese */ - else + strlcpy(ll_CC, "sv_SE", ll_CC_size); + else if (!strcmp(ll_CC, "zh")) /* Simplified Chinese */ + strlcpy(ll_CC, "zh_CN", ll_CC_size); + else if (ll_CC_size >= 6) { ll_CC[2] = '_'; ll_CC[3] = toupper(ll_CC[0] & 255); @@ -475,17 +479,31 @@ ppd_localized_attr(ppd_file_t *ppd, /* I - PPD file */ snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll, keyword); attr = ppdFindAttr(ppd, lkeyword, spec); - if (!attr && !strcmp(ll, "ja")) + if (!attr) { - /* - * Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese - * PPD files were incorrectly assigned "jp" as the locale name - * instead of "ja". Support both the old (incorrect) and new - * locale names for Japanese... - */ + if (!strcmp(ll, "ja")) + { + /* + * Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese + * PPD files were incorrectly assigned "jp" as the locale name + * instead of "ja". Support both the old (incorrect) and new + * locale names for Japanese... + */ - snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword); - attr = ppdFindAttr(ppd, lkeyword, spec); + snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword); + attr = ppdFindAttr(ppd, lkeyword, spec); + } + else if (!strcmp(ll, "no")) + { + /* + * Norway has two languages, "Bokmal" (the primary one) + * and "Nynorsk" (new Norwegian); we map "no" to "nb" here as + * recommended by the locale folks... + */ + + snprintf(lkeyword, sizeof(lkeyword), "nb.%s", keyword); + attr = ppdFindAttr(ppd, lkeyword, spec); + } } } @@ -502,5 +520,5 @@ ppd_localized_attr(ppd_file_t *ppd, /* I - PPD file */ /* - * End of "$Id: localize.c 6686 2007-07-16 23:11:59Z mike $". + * End of "$Id: localize.c 6883 2007-08-29 21:05:17Z mike $". */ diff --git a/cups/mark.c b/cups/mark.c index 83298a226..98720bf01 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -1,5 +1,5 @@ /* - * "$Id: mark.c 6703 2007-07-20 21:28:10Z mike $" + * "$Id: mark.c 6942 2007-09-10 22:55:00Z mike $" * * Option marking routines for the Common UNIX Printing System (CUPS). * @@ -724,5 +724,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */ /* - * End of "$Id: mark.c 6703 2007-07-20 21:28:10Z mike $". + * End of "$Id: mark.c 6942 2007-09-10 22:55:00Z mike $". */ diff --git a/cups/ppd.c b/cups/ppd.c index bf4185db0..779722070 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -1,5 +1,5 @@ /* - * "$Id: ppd.c 6719 2007-07-25 00:08:49Z mike $" + * "$Id: ppd.c 6942 2007-09-10 22:55:00Z mike $" * * PPD file routines for the Common UNIX Printing System (CUPS). * @@ -3186,5 +3186,5 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ /* - * End of "$Id: ppd.c 6719 2007-07-25 00:08:49Z mike $". + * End of "$Id: ppd.c 6942 2007-09-10 22:55:00Z mike $". */ diff --git a/cups/test.ppd b/cups/test.ppd index 303b200a2..0add09e97 100644 --- a/cups/test.ppd +++ b/cups/test.ppd @@ -1,6 +1,6 @@ *PPD-Adobe: "4.3" *% -*% "$Id: test.ppd 6676 2007-07-16 17:09:09Z mike $" +*% "$Id: test.ppd 6799 2007-08-15 19:33:36Z mike $" *% *% Test PPD file for the Common UNIX Printing System (CUPS). *% @@ -149,6 +149,18 @@ http://foo/fr/bar.html help:anchor='foo'%20bookID=Vendor%20Help /help/fr/foo/bar.html" *End +*zh_TW.cupsIPPReason foo/Number 1 Foo Reason: "text:Number%201 +text:Foo%20Reason +http://foo/zh_TW/bar.html +help:anchor='foo'%20bookID=Vendor%20Help +/help/zh_TW/foo/bar.html" +*End +*zh.cupsIPPReason foo/Number 2 Foo Reason: "text:Number%202 +text:Foo%20Reason +http://foo/zh/bar.html +help:anchor='foo'%20bookID=Vendor%20Help +/help/zh/foo/bar.html" +*End *DefaultFont: Courier *Font AvantGarde-Book: Standard "(001.006S)" Standard ROM @@ -187,5 +199,5 @@ help:anchor='foo'%20bookID=Vendor%20Help *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: test.ppd 6676 2007-07-16 17:09:09Z mike $". +*% End of "$Id: test.ppd 6799 2007-08-15 19:33:36Z mike $". *% diff --git a/cups/testppd.c b/cups/testppd.c index 6fb4fb49c..afb252f48 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -1,5 +1,5 @@ /* - * "$Id: testppd.c 6676 2007-07-16 17:09:09Z mike $" + * "$Id: testppd.c 6799 2007-08-15 19:33:36Z mike $" * * PPD test program for the Common UNIX Printing System (CUPS). * @@ -224,6 +224,18 @@ main(int argc, /* I - Number of command-line arguments */ printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer); } + putenv("LANG=zh_TW"); + + fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout); + if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) && + !strcmp(buffer, "Number 1 Foo Reason")) + puts("PASS"); + else + { + status ++; + printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer); + } + ppdClose(ppd); } else @@ -360,5 +372,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: testppd.c 6676 2007-07-16 17:09:09Z mike $". + * End of "$Id: testppd.c 6799 2007-08-15 19:33:36Z mike $". */ diff --git a/doc/Makefile b/doc/Makefile index 2414de04f..9b7dd8812 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6733 2007-07-26 18:09:46Z mike $" +# "$Id: Makefile 6824 2007-08-20 22:21:15Z mike $" # # Documentation makefile for the Common UNIX Printing System (CUPS). # @@ -92,6 +92,8 @@ WEBIMAGES = \ images/printer-idle.gif \ images/printer-processing.gif \ images/printer-stopped.gif \ + images/raster.png \ + images/raster.svg \ images/smiley.jpg \ images/tab-left.gif \ images/tab-right.gif \ diff --git a/doc/cups-printable.css b/doc/cups-printable.css index 08457c05b..4b8bc87bd 100644 --- a/doc/cups-printable.css +++ b/doc/cups-printable.css @@ -110,14 +110,13 @@ SPAN.info { white-space: nowrap; } -H2 SPAN.info, H3 SPAN.info { +H2 SPAN.info, H3 SPAN.info, H4 SPAN.info { float: right; font-size: 100%; } H2.title, H3.title { border-bottom: solid 2pt #000000; - page-break-before: always; } DT { @@ -134,7 +133,7 @@ DL.category DT { } P.summary { - margin-left: 54pt; + margin-left: 36pt; font-family: monospace; } diff --git a/doc/cups.css b/doc/cups.css index 292e170f7..026042412 100644 --- a/doc/cups.css +++ b/doc/cups.css @@ -173,7 +173,7 @@ SPAN.info { white-space: nowrap; } -H2 SPAN.info, H3 SPAN.info { +H2 SPAN.info, H3 SPAN.info, H4 SPAN.info { float: right; font-size: 100%; } @@ -196,9 +196,10 @@ DIV.sidebar { background: #ddddaa; border: solid 2px #cccc99; float: right; + min-width: 25%; margin-left: 10pt; + max-width: 33%; padding: 5pt; - width: 25%; /* These are not implemented by all browsers, but that's OK */ border-radius: 10pt; -moz-border-radius: 10pt; @@ -254,7 +255,7 @@ DL.category DT { } P.summary { - margin-left: 54pt; + margin-left: 36pt; font-family: monospace; } diff --git a/doc/es/index.html.in b/doc/es/index.html.in index bca5a1cef..09c774949 100644 --- a/doc/es/index.html.in +++ b/doc/es/index.html.in @@ -62,7 +62,7 @@ BORDER="0" ALT="">

Estas páginas web permiten monitorizar sus impresoras y trabajos así como realizar tareas de administración del sistema. -Haga click en cualquiera de las pestañas de la parte superior o en los +Haga clic en cualquiera de las pestañas de la parte superior o en los botones de la parte inferior para realizar la tarea correspondiente.

@@ -88,7 +88,7 @@ STYLE="padding-right: 10px;" ALT="Ordenador feliz e impresora"> CUPS proporciona una capa de impresión portable para sistemas operativos basados en UNIX®. Está desarrollado y mantenido -por Apple Inc. para favorecer una solución de impresión +por Apple Inc. para favorecer una solución de impresión estandar. CUPS es el sistema de impresión estandar usado en MacOS® X y la mayoría de distribuciones Linux®.

diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html index b8f420dde..6dd4e91f9 100644 --- a/doc/help/spec-ppd.html +++ b/doc/help/spec-ppd.html @@ -4,31 +4,22 @@ CUPS PPD Extensions - +

Introduction

@@ -73,431 +64,401 @@ LINE-END = CR / LF / CR LF -

General Attributes

+

Auto-Configuration

-

APBookFile

+

CUPS supports several methods of auto-configuration via PPD attributes. +Currently these methods are only implemented on Mac OS X.

-

*APBookFile: "file URL"

+

Mac OS X 10.5APAutoSetupTool

-

This string attribute specifies the Apple help book file to use -for this printer driver.

+

*APAutoSetupTool: "/LibraryPrinters/vendor/filename"

-

Example:

+

This attribute defines a program that sets the default option choices. It +is run when a printer is added from the printer browser instead of the +normal PostScript query and SNMP OID attribute lookups.

+ +

The program is provided with two arguments: the printer's device URI and +the PPD file to be used for the printer. The program must write an updated +PPD file to stdout.

+ +

Examples:

-*APBookFile: "file:///Library/Printers/vendor/Help/filename"
+*% Use our setup tool when adding a printer
+*APAutoSetupTool: "/Library/Printers/vendor/Tools/autosetuptool"
 
-

APDuplexRequiresFlippedMargin

+

Mac OS X 10.2?MainKeyword

-

*APDuplexRequiresFlippedMargin: boolean

+

*?MainKeyword: "
+ PostScript query code that writes a message using the = operator...
+"
+*End

-

This boolean attribute notifies the RIP filters that the -destination printer does not require the top and bottom margins -of the ImageableArea swapped for the back page. The -default is true when cupsBackSide is Flipped -and false otherwise.

+

The ?MainKeyword attribute defines PostScript code that +determines the currently selected/enabled option keyword (choice) for the +main keyword (option). It is typically used when communicating with USB, +serial, Appletalk, and AppSocket (port 9100) printers.

+ +

The PostScript code typically sends its response back using the = +operator.

Example:

-*% Flip the back side images
-*cupsFlipDuplex: true
-
-*% Don't swap the top and bottom margins for the back side 
-*APDuplexRequiresFlippedMargin: false
+*OpenUI OptionDuplex/Duplexer Installed: Boolean
+*DuplexOptionDuplex: False
+*OptionDuplex False/Not Installed: ""
+*OptionDuplex True/Installed: ""
+
+*% Query the printer for the presence of the duplexer option...
+*?OptionDuplex: "
+  currentpagedevice /Duplex known
+  {(True)} {(False)} ifelse
+  = flush
+"
+*End
+*CloseUI: OptionDuplex
 
-

Also see the related cupsBackSide attribute.

+

Mac OS X 10.4OIDMainKeyword

-

APPrinterPreset

+

*?OIDMainKeyword: ".n.n.n..."
+*OIDMainKeyword OptionKeyword1: "value"
+...
+*OIDMainKeyword OptionKeywordN: "value"

-

*APPrinterPreset name/text: "*Option Choice ..."

- -

This attribute defines presets for multiple options that show up -in the print dialog on Mac OS X. Each preset maps to one or more -pairs of PPD options and choices.

+

The OIDMainKeyword attribute is used to define +SNMP OIDs that map to installable options. The first (query) line +defines the OID to lookup on the network device. The second and +subsequent attributes define a mapping from OID value to option +keyword. Since SNMP is an IP-based network protocol, this method +is typically only used to configure AppSocket, IPP, and LPD network +printers.

Examples:

-*APPrinterPreset Text/Text Printing on Plain Paper: "
-  *MediaType Plain
-  *ColorModel Gray
-  *Resolution 600dpi"
-*End
-
-*APPrinterPreset Photo/Photo Printing on Glossy Paper: "
-  *MediaType Glossy
-  *ColorModel RGB
-  *Resolution 300dpi"
-*End
+*% Get the installed memory on the printer...
+*?OIDInstalledMemory: ".1.3.6.1.2.1.25.2.2.0"
+*OIDInstalledMemory 16MB: "16384 KBytes"
+*OIDInstalledMemory 32MB: "32768 KBytes"
+*OIDInstalledMemory 48MB: "49152 KBytes"
+*OIDInstalledMemory 72MB: "73728 KBytes"
 
-

APRemoteQueueID

-

*APRemoteQueueID: "string"

- -

This string attribute notifies the scheduler that this PPD is for a remote CUPS printer, typically shared via Bonjour.

+

Color Profiles

-

Example:

+

CUPS supports three types of color profiles. The first type is +based on sRGB and is used by the standard CUPS raster filters and +ESP Ghostscript. The second type is based on ICC profiles and is +used by the Quartz-based filters on MacOS X. The final type is +based on well-known colorspaces such as sRGB and Adobe RGB.

-
-*APRemoteQueueID: "myprinter"
-
+
Note: -

CUPS 1.3cupsBackSide

+

At this time, none of the CUPS raster +filters support ICC profiles. This will be addressed as time +and resources permit.

-

*cupsBackSide: keyword

+
-

This attribute requests special handling of the back side of pages -when doing duplexed (2-sided) output. Table 1 -shows the supported keyword values for this attribute and their affect -on the raster data sent to your driver. The default value is -Normal.

+

cupsColorProfile

-
Note: cupsBackSide replaces the older -cupsFlipDuplex attribute - if cupsBackSide is -specified, cupsFlipDuplex will be ignored.
+

*cupsColorProfile Resolution/MediaType: "density +gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Table 1: Back Side Raster Coordinate System
cupsBackSideTumble ValueImage Presentation
NormalfalseLeft-to-right, top-to-bottom
NormaltrueLeft-to-right, top-to-bottom
ManualTumblefalseLeft-to-right, top-to-bottom
ManualTumbletrueRight-to-left, bottom-to-top
RotatedfalseRight-to-left, bottom-to-top
RotatedtrueRight-to-left, top-to-bottom
Flipped *falseLeft-to-right, bottom-to-top
Flipped *trueRight-to-left, top-to-bottom
-
+

This string attribute specifies an sRGB-based color profile +consisting of gamma and density controls and a 3x3 CMY color +transform matrix.

-

* - Not supported in Mac OS X 10.5.x and earlier

+

The Resolution and MediaType values may be "-" +to act as a wildcard. Otherwise they must match one of the +Resolution or MediaType attributes defined in +the PPD file.

-

Examples:

+

The density and gamma values define gamma and +density adjustment function such that:

-*% Flip the page image for the back side of duplexed output 
-*cupsBackSide: Flipped
-
-*% Rotate the page image for the back side of duplexed output 
-*cupsBackSide: Rotated
+f(x) = density * x gamma
 
-

Also see the related APDuplexRequiresFlippedMargin -attribute.

+

The m00 through m22 values define a 3x3 +transformation matrix for the CMY color values. The density +function is applied after the CMY transformation:

-

cupsEvenDuplex

+
+| m00 m01 m02 |
+| m10 m11 m12 |
+| m20 m21 m22 |
+
-

*cupsEvenDuplex: boolean

+

Examples:

-

This boolean attribute notifies the RIP filters that the -destination printer requires an even number of pages when 2-sided -printing is selected. The default value is false.

+
+*% Specify a profile for printing at 360dpi on all media types 
+*cupsColorProfile 360dpi/-: "1.0 1.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"
 
-

Example:

+*% Specify a profile for printing at 720dpi on Glossy media +*cupsColorProfile 720dpi/Glossy: "1.0 2.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0" -
-*% Always send an even number of pages when duplexing 
-*cupsEvenDuplex: true
+*% Specify a default profile for printing at all other resolutions and media types 
+*cupsColorProfile -/-: "0.9 2.0 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"
 
-

cupsFax

+

Mac OS X 10.3/CUPS 1.2cupsICCProfile

-

*cupsFax: boolean

+

*cupsICCProfile +ColorModel.MediaType.Resolution/Description: "filename"

-

This boolean attribute specifies whether the PPD defines a facsimile device. The default is false.

+

This attribute specifies an ICC color profile that is +used to convert the document colors to the device +colorspace. The ColorModel, MediaType, and +Resolution keywords specify a selector for color +profiles. If omitted, the color profile will match any option +keyword for the corresponding main keyword.

+ +

The Description specifies human-readable text that +is associated with the color profile. The filename +portion specifies the ICC color profile to use; if the filename +is not absolute, it is loaded relative to the +/usr/share/cups/profiles directory.

Examples:

-*cupsFax: true
-
+*% Specify a profile for CMYK printing at 360dpi on all media types +*cupsICCProfile CMYK..360dpi/360dpi CMYK: "/Library/Printers/vendor/Profiles/foo-360-cmyk.icc" -

cupsFilter

+*% Specify a profile for RGB printing at 720dpi on Glossy media +*cupsColorProfile RGB.Glossy.720dpi/720dpi Glossy: "/Library/Printers/vendor/Profiles/foo-720-glossy-rgb.icc" -

*cupsFilter: "source/type cost program"

+*% Specify a default profile for printing at all other resolutions and media types +*cupsICCProfile ../Default: "/Library/Printers/vendor/Profiles/foo-default.icc" +
-

This string attribute provides a conversion rule from the -given source type to the printer's native format using the -filter "program". If a printer supports the source type directly, -the special filter program "-" may be specified.

+

Customizing the Profile Selection Keywords

-

Examples:

+

The MediaType and Resolution keywords can be +reassigned to different main keywords, allowing drivers to do +color profile selection based on different parameters. The +cupsICCQualifier2 and cupsICCQualifier3 +attributes define the mapping from selector to main keyword:

-*% Standard raster printer driver filter 
-*cupsFilter: "application/vnd.cups-raster 100 rastertofoo"
+*cupsICCQualifier2: MainKeyword2
+*cupsICCQualifier3: MainKeyword3
+
-*% Plain text filter -*cupsFilter: "text/plain 10 texttofoo" +

The default mapping is as follows:

-*% Pass-through filter for PostScript printers -*cupsFilter: "application/vnd.cups-postscript 0 -" +
+*cupsICCQualifier2: MediaType
+*cupsICCQualifier3: Resolution
 
-

DeprecatedcupsFlipDuplex

+

Mac OS X 10.4Custom Color Matching Support

-

*cupsFlipDuplex: boolean

+

*APSupportsCustomColorMatching: true
+*APCustomColorMatchingName name/text: ""
+*APCustomColorMatchingProfile: profile
+*APDefaultCustomColorMatchingProfile: profile

-

Due to implementation differences between Mac OS X and Ghostscript, -the cupsFlipDuplex attribute is deprecated. Instead, use -the cupsBackSide attribute to specify the coordinate -system (pixel layout) of the page data on the back side of duplex -pages.

+

These attributes tell the Mac OS X raster filters that the printer +driver provides its own custom color matching and that generic color +profiles should be used when generating 1-, 3-, and 4-component raster +data as requested by the driver. The APCustomColorMatchingProfile +and APDefaultColorMatchingProfile attributes specify alternate +color profiles (sRGB or AdobeRGB) to use for 3-color (RGB) raster data.

-

The value true maps to a cupsBackSide value -of Rotated on Mac OS X and Flipped with -Ghostscript.

+

Mac OS X 10.5APCustomColorMatchingName

-

The default value is false.

+

*APCustomColorMatchingName name/text: ""

-
Note: Mac OS X drivers that previously used -cupsFlipDuplex may wish to provide both the old and -new attributes for maximum compatibility, for example: +

This attribute defines an alternate name for the color matching +provided by a driver in the Color Matching print panel. +The default is to use the name "Vendor Matching" or its localized +equivalent.

+ +

Examples:

-*cupsBackSide: Rotated
-*cupsFlipDuplex: true
+*% Define the names for our color matching...
+*APCustomColorMatchingName name/AcmeColor(tm): ""
+*fr.APCustomColorMatchingName name/La AcmeColor(tm): ""
 
-Similarly, drivers written for other operating systems using -Ghostscript can use: +

Mac OS X 10.5APCustomColorMatchingProfile

-
-*cupsBackSide: Flipped
-*cupsFlipDuplex: true
-
+

*APCustomColorMatchingProfile: name

-

cupsIPPFinishings

+

This attribute defines a supported RGB color profile that can be used +when doing custom color matching. Currently only sRGB and +AdobeRGB are supported. If not specified, RGB data will use the +Generic RGB colorspace.

-

*cupsIPPFinishings number/text: "*Option Choice ..."

+
Note: -

This attribute defines a mapping from IPP finishings -values to PPD options and choices.

+

If you provide multiple APCustomColorMatchingProfile attributes, +you are responsible for providing the necessary user interface controls to +select the profile in a print dialog pane. +Add the named profile to the print settings using the key +kPMCustomColorMatchingProfileKey.

+ +

Examples:

-*cupsIPPFinishings 4/staple: "*StapleLocation SinglePortrait"
-*cupsIPPFinishings 5/punch: "*PunchMedia Yes *PunchLocation LeftSide"
-*cupsIPPFinishings 20/staple-top-left: "*StapleLocation SinglePortrait"
-*cupsIPPFinishings 21/staple-bottom-left: "*StapleLocation SingleLandscape"
+*% Use sRGB for RGB color by default, but support both sRGB and AdobeRGB
+*APSupportsCustomColorMatching: true
+*APDefaultCustomColorMatchingProfile: sRGB
+*APCustomColorMatchingProfile: sRGB
+*APCustomColorMatchingProfile: AdobeRGB
 
-

cupsIPPReason

- -

*cupsIPPReason reason/Reason Text: "optional URIs"

+

Mac OS X 10.5APDefaultCustomColorMatchingProfile

-

This optional attribute maps custom -printer-state-reasons keywords that are generated by -the driver to human readable text. The optional URIs string -contains zero or more URIs separated by a newline. Each URI can -be a CUPS server absolute path to a help file under the -scheduler's DocumentRoot directory, a full HTTP URL -("http://www.domain.com/path/to/help/page.html"), or any other -valid URI which directs the user at additional information -concerning the condition that is being reported.

+

*APDefaultCustomColorMatchingProfile: name

-

Since the reason text is limited to 80 characters by the PPD specification, -longer text strings can be included by URI-encoding the text with the "text" -scheme, for example "text:some%20text". Multiple text URIs are -combined (with spaces between each URI) by the ppdLocalizeIPPReason -into a single string that can be displayed to the user.

+

This attribute defines the default RGB color profile that will be used +when doing custom color matching. Currently only sRGB and +AdobeRGB are supported.

Examples:

-*% Map com.vendor-error to text but no page
-*cupsIPPReason com.vendor-error/A serious error occurred: ""
-
-*% Map com.vendor-error to more than 80 characters of text but no page
-*cupsIPPReason com.vendor-error/A serious error occurred: "text:Now%20is%20the%20time
-text:for%20all%20good%20men%20to%20come%20to%20the%20aid%20of%20their%20country."
-
-*% Map com.vendor-error to text and a local page
-*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html"
-
-*% Map com.vendor-error to text and a remote page
-*cupsIPPReason com.vendor-error/A serious error occurred: "http://www.vendor.com/help"
-
-*% Map com.vendor-error to text and a local, Apple help book, and remote page
-*APHelpBook: "file:///Library/Printers/vendor/Help/filename"
-*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html
-help:anchor='com.vendor-error'%20bookID=Vendor%20Help
-http://www.vendor.com/help"
-*End
+*% Use sRGB for RGB color by default
+*APSupportsCustomColorMatching: true
+*APDefaultCustomColorMatchingProfile: sRGB
 
-

cupsLanguages

+

Mac OS X 10.4APSupportsCustomColorMatching

-

*cupsLanguages: "locale list"

+

*APSupportsCustomColorMatching: boolean

-

This attribute describes which language localizations are -included in the PPD. The "locale list" string is a space-delimited -list of locale names ("en", "en_US", "fr_CA", etc.)

+

This attribute specifies that the driver provides its own custom color +matching. When true, the default hand-off colorspace will be +Generic Gray, Generic RGB, or Generic CMYK depending on the number of +components the driver requests. The APDefaultCustomColorMatchingProfile +attribute can be used to override the default 3-component (RGB) colorspace.

-

Example:

+

The default for APSupportsCustomColorMatching is false.

+ +

Examples:

-*% Specify Canadian, UK, and US English, and Candian and French French 
-*cupsLanguages: "en_CA en_UK en_US fr_CA fr_CA"
+*APSupportsCustomColorMatching: true
+*APDefaultCustomColorMatchingProfile: sRGB
 
-

cupsManualCopies

-

*cupsManualCopies: boolean

+

Globalized PPD Support

-

This boolean attribute notifies the RIP filters that the -destination printer does not support copy generation in -hardware. The default value is false.

- -

Example:

- -
-*% Tell the RIP filters to generate the copies for us 
-*cupsManualCopies: true
-
+

CUPS 1.2 and higher adds support for PPD files containing multiple +languages by following the following additional rules:

-

cupsModelNumber

+
    -

    *cupsModelNumber: number

    +
  1. The LanguageVersion MUST be English
  2. -

    This integer attribute specifies a printer-specific model -number. This number can be used by a filter program to adjust -the output for a specific model of printer.

    +
  3. The LanguageEncoding MUST be ISOLatin1
  4. -

    Example:

    +
  5. The cupsLanguages attribute MUST be provided and + list each of the supported locales in the PPD file
  6. -
    -*% Specify an integer for a driver-specific model number 
    -*cupsModelNumber: 1234
    -
    +
  7. Main and option keywords MUST NOT exceed 34 (instead of 40) + characters to allow room for the locale prefixes in translation + attributes
  8. +
  9. The main keyword "Translation" MUST NOT be used
  10. -

    cupsPJLCharset

    +
  11. Translation strings included with the main and option + keywords MUST NOT contain characters outside the ASCII + subset of ISOLatin1 and UTF-8; developers wishing to use + characters outside ASCII MUST provide a separate set of + English localization attributes for the affected keywords.
  12. -

    *cupsPJLCharset: "ISO character set name"

    +
  13. Localizations are specified using a locale prefix of + the form "ll" or "ll_CC." where "ll" is the 2-letter ISO + language code and "CC" is the 2-letter ISO country + code
      +
    • A generic language translation ("ll") SHOULD be provided with country-specific differences ("ll_CC") provided only as needed
    • +
    • For historical reasons, the "zh" and "zh_CN" locales map to Simplified Chinese while the "zh_TW" locale maps to Traditional Chinese
    • +
  14. -

    This string attribute specifies the character set that is used -for strings in PJL commands. If not specified, US-ASCII is -assumed.

    +
  15. Locale-specific translation strings MUST be encoded + using UTF-8.
  16. -

    Example:

    +
  17. Main keywords MUST be localized using one of the + following forms: +

    *ll.Translation MainKeyword/translation + text: ""
    + *ll_CC.Translation MainKeyword/translation + text: ""

  18. -
    -*% Specify UTF-8 is used in PJL strings
    -*cupsPJLCharset: "UTF-8"
    -
    +
  19. Option keywords MUST be localized using one of the + following forms: +

    *ll.MainKeyword OptionKeyword/translation + text: ""
    + *ll_CC.MainKeyword OptionKeyword/translation + text: ""

  20. +
  21. Localization attributes MAY appear anywhere after the + first line of the PPD file
  22. -

    cupsPortMonitor

    +
-

*cupsPortMonitor urischeme/Descriptive Text: "port monitor"

+
Note: -

This string attribute specifies printer-specific "port -monitor" filters that may be used with the printer. The CUPS -scheduler also looks for the Protocols attribute to see -if the BCP or TBCP protocols are supported. If -so, the corresponding port monitor ("bcp" and "tbcp", -respectively) is listed in the printer's -port-monitor-supported attribute.

+

We use a LanguageEncoding value of ISOLatin1 +and limit the allowed base translation strings to ASCII to avoid +character coding issues that would otherwise occur. In addition, +requiring the base translation strings to be in English allows +for easier fallback translation when no localization is provided +in the PPD file for a given locale.

-

The "urischeme" portion of the attribute specifies the URI scheme -that this port monitor should be used for. Typically this is used to -pre-select a particular port monitor for each type of connection that -is supported by the printer. The "port monitor" string can be "none" -to disable the port monitor for the given URI scheme.

+

Examples:

-*% Specify a PostScript printer that supports the TBCP protocol
-*Protocols: TBCP PJL
-
-*% Specify that TBCP should be used for socket connections but not USB
-*cupsPortMonitor socket/AppSocket Printing: "tbcp"
-*cupsPortMonitor usb/USB Printing: "none"
-
-*% Specify a printer-specific port monitor for an Epson USB printer 
-*cupsPortMonitor usb/USB Status Monitor: "epson-usb"
-
- -

cupsPreFilter

- -

*cupsPreFilter: "source/type cost program"

+*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*cupsLanguages: "de fr_CA" +*ModelName: "Foobar Laser 9999" -

This string attribute provides a pre-filter rule. The pre-filter -program will be inserted in the conversion chain immediately -before the filter that accepts the given MIME type.

+*% Localize ModelName for French and German +*fr_CA.Translation ModelName/La Foobar Laser 9999: "" +*de.Translation ModelName/Foobar LaserDrucken 9999: "" -

Examples:

+*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html" +*% Localize printer-state-reason for French and German +*fr_CA.cupsIPPReason com.vendor-error/Une erreur sèrieuse s'est produite: "/help/com.vendor/error.html" +*de.cupsIPPReason com.vendor-error/Eine ernste Störung trat: "/help/com.vendor/error.html" -
-*% PDF pre-filter
-*cupsPreFilter: "application/pdf 100 mypdfprefilter"
+...
 
-*% PNG pre-filter
-*cupsPreFilter: "image/png 0 mypngprefilter"
+*OpenUI *InputSlot/Paper Source: PickOne
+*OrderDependency: 10 AnySetup *InputSlot
+*DefaultInputSlot: Auto
+*% Localize InputSlot for French and German
+*fr_CA.Translation InputSlot/Papier source: ""
+*de.Translation InputSlot/Papiereinzug: ""
+*InputSlot Auto/Default: "<</ManualFeed false>>setpagedevice"
+*% Localize InputSlot=Auto for French and German
+*fr_CA.InputSlot Auto/Par Defaut: ""
+*de.InputSlot Auto/Standard: ""
+*InputSlot Manual/Manual Feed: "<</ManualFeed true>>setpagedevice"
+*% Localize InputSlot=Manual for French and German
+*fr_CA.InputSlot Manual/Manuel mecanisme de alimentation: ""
+*de.InputSlot Manual/Manueller Einzug: ""
+*CloseUI: *InputSlot
 
-

cupsVersion

- -

*cupsVersion: major.minor

- -

This required attribute describes which version of the CUPS -PPD file extensions was used. Currently it must be the string -"1.0", "1.1", or "1.2".

- -

Example:

- -
-*% Specify a CUPS 1.2 driver 
-*cupsVersion: "1.2"
-

Custom Options

@@ -566,6 +527,15 @@ option value is "2.0" then CUPS will output the string +
Note: + +

Custom options are not directly supported by the Mac OS X Print Dialog +nor by the CUPS web interface at this time. Vendors that use custom +options on Mac OS X must provide their own user interface via the +APDialogExtension attribute.

+ +
+

Examples:

@@ -613,285 +583,86 @@ option value is "2.0" then CUPS will output the string
 
-

Color Profiles

- -

CUPS supports two types of color profiles. The first type is -based on sRGB and is used by the standard CUPS raster filters and -ESP Ghostscript. The second type is based on ICC profiles and is -used by the Core Graphics-based filters on MacOS X.

- -
Note: At this time, none of the CUPS raster -filters support ICC profiles. This will be addressed as time -and resources permit.
+

Writing PostScript Option Commands for Raster Drivers

-

cupsColorProfile

+

PPD files are used for both PostScript and non-PostScript printers. For CUPS raster drivers, you use a subset of the PostScript language to set page device attributes such as page size, resolution, and so forth. For example, the following code sets the page size to A4 size:

-

*cupsColorProfile Resolution/MediaType: "density -gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"

+
+*PageSize A4: "<</PageSize[595 842]>>setpagedevice"
+
-

This string attribute specifies an sRGB-based color profile -consisting of gamma and density controls and a 3x3 CMY color -transform matrix.

+

Custom options typically use other operators to organize the values into a key/value dictionary for setpagedevice. For example, our previous CustomWatermarkText option code uses the roll operator to move the custom string value into the dictionary for setpagedevice:

-

The Resolution and MediaType values may be "-" -to act as a wildcard. Otherwise they must match one of the -Resolution or MediaType attributes defined in -the PPD file.

+
+*CustomWatermarkText True: "<</cupsString1 3 -1 roll>>setpagedevice"
+
-

The density and gamma values define gamma and -density adjustment function such that:

+

For a custom string value of "My Watermark", CUPS will produce the following PostScript code for the option:

-f(x) = density * x gamma
+(My Watermark)
+<</cupsString1 3 -1 roll>>setpagedevice
 
-

The m00 through m22 values define a 3x3 -transformation matrix for the CMY color values. The density -function is applied after the CMY transformation:

+

The code moves the string value ("My Watermark") from the bottom of the stack to the top, creating a dictionary that looks like:

-| m00 m01 m02 |
-| m10 m11 m12 |
-| m20 m21 m22 |
+<</cupsString1(My Watermark)>>setpagedevice
 
-

Examples:

+

The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.

-
-*% Specify a profile for printing at 360dpi on all media types 
-*cupsColorProfile 360dpi/-: "1.0 1.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"
+

Custom Page Size Code

-*% Specify a profile for printing at 720dpi on Glossy media -*cupsColorProfile 720dpi/Glossy: "1.0 2.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0" +

There are many possible implementations of the CustomPageSize code. For CUPS raster drivers, the following code is recommended:

-*% Specify a default profile for printing at all other resolutions and media types -*cupsColorProfile -/-: "0.9 2.0 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0" +
+*ParamCustomPageSize Width:        1 points min-width max-width
+*ParamCustomPageSize Height:       2 points min-height max-height
+*ParamCustomPageSize WidthOffset:  3 points 0 0
+*ParamCustomPageSize HeightOffset: 4 points 0 0
+*ParamCustomPageSize Orientation:  5 int 0 0
+*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
 
-

cupsICCProfile

+

Supported PostScript Operators

-

*cupsICCProfile -ColorModel.MediaType.Resolution/Description: "filename"

+

CUPS supports the following PostScript operators in addition to the usual PostScript number, string (literal and hex-encoded), boolean, null, and name values:

-

This attribute specifies an ICC color profile that is -used to convert the document colors to the device -colorspace. The ColorModel, MediaType, and -Resolution keywords specify a selector for color -profiles. If omitted, the color profile will match any option -keyword for the corresponding main keyword.

+
    -

    The Description specifies human-readable text that -is associated with the color profile. The filename -portion specifies the ICC color profile to use; if the filename -is not absolute, it is loaded relative to the -/usr/share/cups/profiles directory.

    +
  • << - Start a dictionary.
  • -

    Examples:

    +
  • >> - End a dictionary.
  • -
    -*% Specify a profile for CMYK printing at 360dpi on all media types 
    -*cupsICCProfile CMYK..360dpi/360dpi CMYK: "vendor/foo-360-cmyk.icc"
    +	
  • [ - Start an array.
  • -*% Specify a profile for RGB printing at 720dpi on Glossy media -*cupsColorProfile RGB.Glossy.720dpi/720dpi Glossy: "vendor/foo-720-glossy-rgb.icc" +
  • ] - End an array.
  • -*% Specify a default profile for printing at all other resolutions and media types -*cupsICCProfile ../Default: "vendor/foo-default.icc" -
    +
  • copy - Copy the top N objects on the stack.
  • -

    Customizing the Profile Selection Keywords

    +
  • dup - Copy the top object on the stack.
  • -

    The MediaType and Resolution keywords can be -reassigned to different main keywords, allowing drivers to do -color profile selection based on different parameters. The -cupsICCQualifier2 and cupsICCQualifier3 -attributes define the mapping from selector to main keyword:

    +
  • index - Copy the Nth from the top object on the stack.
  • -
    -*cupsICCQualifier2: MainKeyword2
    -*cupsICCQualifier3: MainKeyword3
    -
    +
  • pop - Pop the top object on the stack.
  • -

    The default mapping is as follows:

    +
  • roll - Shift the top N objects on the stack.
  • -
    -*cupsICCQualifier2: MediaType
    -*cupsICCQualifier3: Resolution
    -
    +
  • setpagedevice - Set the page header values according to the key/value dictionary on the stack.
  • +
-

Globalized PPD Support

+
Note: -

CUPS 1.2 and higher adds support for PPD files containing multiple -languages by following the following additional rules:

- -
    - -
  1. The LanguageVersion MUST be English
  2. - -
  3. The LanguageEncoding MUST be ISOLatin1
  4. - -
  5. The cupsLanguages attribute MUST be provided and - list each of the supported locales in the PPD file
  6. - -
  7. Main and option keywords MUST NOT exceed 34 (instead of 40) - characters to allow room for the locale prefixes in translation - attributes
  8. - -
  9. The main keyword "Translation" MUST NOT be used
  10. - -
  11. Translation strings included with the main and option - keywords MUST NOT contain characters outside the ASCII - subset of ISOLatin1 and UTF-8; developers wishing to use - characters outside ASCII MUST provide a separate set of - English localization attributes for the affected keywords.
  12. - -
  13. Localizations are specified using a locale prefix of - the form "ll" or "ll_CC." where "ll" is the 2-letter ISO - language code and "CC" is the 2-letter ISO country - code
      -
    • A generic language translation ("ll") SHOULD be provided with country-specific differences ("ll_CC") provided only as needed
    • -
    • For historical reasons, the "zh" and "zh_CN" locales map to Simplified Chinese while the "zh_TW" locale maps to Traditional Chinese
    • -
  14. - -
  15. Locale-specific translation strings MUST be encoded - using UTF-8.
  16. - -
  17. Main keywords MUST be localized using one of the - following forms: -

    *ll.Translation MainKeyword/translation - text: ""
    - *ll_CC.Translation MainKeyword/translation - text: ""

  18. - -
  19. Option keywords MUST be localized using one of the - following forms: -

    *ll.MainKeyword OptionKeyword/translation - text: ""
    - *ll_CC.MainKeyword OptionKeyword/translation - text: ""

  20. - -
  21. Localization attributes MAY appear anywhere after the - first line of the PPD file
  22. - -
- -
Note: -We use a LanguageEncoding value of ISOLatin1 -and limit the allowed base translation strings to ASCII to avoid -character coding issues that would otherwise occur. In addition, -requiring the base translation strings to be in English allows -for easier fallback translation when no localization is provided -in the PPD file for a given locale.
- -

Examples:

- -
-*LanguageVersion: English
-*LanguageEncoding: ISOLatin1
-*cupsLanguages: "de fr_CA"
-*ModelName: "Foobar Laser 9999"
-
-*% Localize ModelName for French and German
-*fr_CA.Translation ModelName/La Foobar Laser 9999: ""
-*de.Translation ModelName/Foobar LaserDrucken 9999: ""
-
-*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html"
-*% Localize printer-state-reason for French and German
-*fr_CA.cupsIPPReason com.vendor-error/Une erreur sèrieuse s'est produite: "/help/com.vendor/error.html"
-*de.cupsIPPReason com.vendor-error/Eine ernste Störung trat: "/help/com.vendor/error.html"
-
-...
-
-*OpenUI *InputSlot/Paper Source: PickOne
-*OrderDependency: 10 AnySetup *InputSlot
-*DefaultInputSlot: Auto
-*% Localize InputSlot for French and German
-*fr_CA.Translation InputSlot/Papier source: ""
-*de.Translation InputSlot/Papiereinzug: ""
-*InputSlot Auto/Default: "<</ManualFeed false>>setpagedevice"
-*% Localize InputSlot=Auto for French and German
-*fr_CA.InputSlot Auto/Par Defaut: ""
-*de.InputSlot Auto/Standard: ""
-*InputSlot Manual/Manual Feed: "<</ManualFeed true>>setpagedevice"
-*% Localize InputSlot=Manual for French and German
-*fr_CA.InputSlot Manual/Manuel mecanisme de alimentation: ""
-*de.InputSlot Manual/Manueller Einzug: ""
-*CloseUI: *InputSlot
-
- - -

Writing PostScript Option Commands for Raster Drivers

- -

PPD files are used for both PostScript and non-PostScript printers. For CUPS raster drivers, you use a subset of the PostScript language to set page device attributes such as page size, resolution, and so forth. For example, the following code sets the page size to A4 size:

- -
-*PageSize A4: "<</PageSize[595 842]>>setpagedevice"
-
- -

Custom options typically use other operators to organize the values into a key/value dictionary for setpagedevice. For example, our previous CustomWatermarkText option code uses the roll operator to move the custom string value into the dictionary for setpagedevice:

- -
-*CustomWatermarkText True: "<</cupsString1 3 -1 roll>>setpagedevice"
-
- -

For a custom string value of "My Watermark", CUPS will produce the following PostScript code for the option:

- -
-(My Watermark)
-<</cupsString1 3 -1 roll>>setpagedevice
-
- -

The code moves the string value ("My Watermark") from the bottom of the stack to the top, creating a dictionary that looks like:

- -
-<</cupsString1(My Watermark)>>setpagedevice
-
- -

The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.

- -

Custom Page Size Code

- -

There are many possible implementations of the CustomPageSize code. For CUPS raster drivers, the following code is recommended:

- -
-*ParamCustomPageSize Width:        1 points min-width max-width
-*ParamCustomPageSize Height:       2 points min-height max-height
-*ParamCustomPageSize WidthOffset:  3 points 0 0
-*ParamCustomPageSize HeightOffset: 4 points 0 0
-*ParamCustomPageSize Orientation:  5 int 0 0
-*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
-
- -

Supported PostScript Operators

- -

CUPS supports the following PostScript operators in addition to the usual PostScript number, string (literal and hex-encoded), boolean, null, and name values:

- -
    - -
  • << - Start a dictionary.
  • - -
  • >> - End a dictionary.
  • - -
  • [ - Start an array.
  • - -
  • ] - End an array.
  • - -
  • copy - Copy the top N objects on the stack.
  • - -
  • dup - Copy the top object on the stack.
  • - -
  • index - Copy the Nth from the top object on the stack.
  • - -
  • pop - Pop the top object on the stack.
  • - -
  • roll - Shift the top N objects on the stack.
  • - -
  • setpagedevice - Set the page header values according to the key/value dictionary on the stack.
  • - -
- -
Note: Never use the unsupported dict or put operators in your option code. These operators are typically used in option code dating back to Level 1 PostScript printers, which did not support the simpler << or >> operators. If you have old option code using dict or put, you can rewrite it very easily to use the newer << and >> operators instead. For example, the following code to set the page size: +

Never use the unsupported dict or put +operators in your option code. These operators are typically used in +option code dating back to Level 1 PostScript printers, which did not +support the simpler << or >> operators. +If you have old option code using dict or put, you can +rewrite it very easily to use the newer << and +>> operators instead. For example, the following code +to set the page size: