From 09a101d671d39312a756c325d8463a1a02f582a6 Mon Sep 17 00:00:00 2001 From: jlovell Date: Sat, 23 Jun 2007 05:26:17 +0000 Subject: [PATCH] Load cups into easysw/current. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@334 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.2.txt | 14 + CHANGES.txt | 7 +- Makedefs.in | 22 +- Makefile | 6 +- backend/Makefile | 16 +- backend/backend-private.h | 5 +- backend/ipp.c | 63 +- backend/pap.c | 117 +- backend/parallel.c | 8 +- backend/runloop.c | 117 +- backend/serial.c | 8 +- backend/socket.c | 10 +- backend/usb-darwin.c | 1684 +++++++++++++++------------- backend/usb-unix.c | 8 +- berkeley/Makefile | 10 +- cgi-bin/Makefile | 10 +- conf/{mime.convs => mime.convs.in} | 6 +- conf/mime.types | 20 +- config-scripts/cups-common.m4 | 18 +- config-scripts/cups-compiler.m4 | 13 +- config-scripts/cups-defaults.m4 | 26 +- config-scripts/cups-dnssd.m4 | 6 +- config-scripts/cups-gssapi.m4 | 18 +- config.h.in | 5 +- configure.in | 6 +- cups/Makefile | 26 +- cups/adminutil.c | 21 +- cups/cups.h | 5 +- cups/libcups.exp | 296 +++++ cups/libcups.order | 1 + cups/localize.c | 20 +- cups/mark.c | 8 +- cups/options.c | 140 ++- cups/ppd.c | 18 +- cups/tempfile.c | 26 +- cups/testcups.c | 183 +++ cups/testppd.c | 6 +- cups/transcode.c | 14 +- doc/Makefile | 3 +- doc/help/accounting.html | 59 + doc/help/spec-ipp.html | 24 +- doc/help/spec-ppd.html | 131 ++- driver/testdriver.c | 18 +- filter/Makefile | 10 +- filter/imagetops.c | 16 +- filter/imagetoraster.c | 16 +- filter/interpret.c | 16 +- filter/pstops.c | 17 +- filter/raster.c | 45 +- init/org.cups.cups-lpd.plist | 2 + init/org.cups.cupsd.plist | 6 +- monitor/Makefile | 10 +- notifier/Makefile | 10 +- notifier/rss.c | 6 +- packaging/cups.list.in | 7 +- packaging/cups.spec.in | 5 +- ppd/deskjet.ppd | 12 +- ppd/deskjet2.ppd | 12 +- ppd/dymo.ppd | 12 +- ppd/epson24.ppd | 12 +- ppd/epson9.ppd | 12 +- ppd/intelbar.ppd | 10 +- ppd/laserjet.ppd | 12 +- ppd/okidat24.ppd | 12 +- ppd/okidata9.ppd | 12 +- ppd/sample.drv | 996 ++++++++++++++++ ppd/stcolor.ppd | 16 +- ppd/stcolor2.ppd | 16 +- ppd/stphoto.ppd | 16 +- ppd/stphoto2.ppd | 16 +- ppd/zebra.ppd | 16 +- ppd/zebracpl.ppd | 10 +- ppd/zebraep1.ppd | 10 +- ppd/zebraep2.ppd | 10 +- scheduler/Makefile | 22 +- scheduler/auth.c | 6 +- scheduler/client.c | 8 +- scheduler/client.h | 5 +- scheduler/conf.c | 10 +- scheduler/cups-driverd.c | 7 +- scheduler/cupsd.order | 93 ++ scheduler/dirsvc.c | 23 +- scheduler/ipp.c | 251 +++-- scheduler/job.c | 365 +++--- scheduler/job.h | 12 +- scheduler/main.c | 12 +- scheduler/printers.c | 99 +- scheduler/printers.h | 7 +- scripting/php/Makefile | 8 +- systemv/Makefile | 14 +- systemv/cupstestppd.c | 73 +- systemv/lpstat.c | 26 +- templates/printers.tmpl | 2 +- test/create-job-timeout.test | 7 +- test/create-job.test | 6 +- test/get-jobs.test | 2 +- 96 files changed, 4201 insertions(+), 1457 deletions(-) rename conf/{mime.convs => mime.convs.in} (95%) create mode 100644 cups/libcups.exp create mode 100755 cups/libcups.order create mode 100644 cups/testcups.c create mode 100644 doc/help/accounting.html create mode 100644 ppd/sample.drv create mode 100644 scheduler/cupsd.order diff --git a/CHANGES-1.2.txt b/CHANGES-1.2.txt index de8bf7524..0ae2d9ba1 100644 --- a/CHANGES-1.2.txt +++ b/CHANGES-1.2.txt @@ -1,6 +1,20 @@ CHANGES-1.2.txt --------------- +CHANGES IN CUPS V1.2.12 + + - The web admin interface incorrectly handled the "share + printers" and "show remote printers" settings (STR + #2393) + - The scheduler's log messages about AuthClass and + AuthGroupName advised using a replacement directive but + had the wrong syntax (STR #2400) + - Updated the PostScript/PJL and HP-GL/2 MIME rules to + look in the first 4k of the file, not just the first 1k + (STR #2386) + - Updated the Italian localization (STR #2382) + + CHANGES IN CUPS V1.2.11 - Fixed the "relaying from" log message (STR #2376) diff --git a/CHANGES.txt b/CHANGES.txt index 942cd4d30..e73cbd134 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,10 +1,13 @@ -CHANGES.txt - 2007-05-03 +CHANGES.txt - 2007-06-21 ------------------------ CHANGES IN CUPS V1.3 - Documentation updates (STR #1775, STR #2130, STR #2131, - STR #2263, STR #2356) + STR #2263, STR #2356, STR #2397) + - The scheduler did not add a trailing banner page if a + client did not specify the last document in a job (STR + #1711) - The scheduler did not report Bonjour shared printers as remote printers (STR #2384) - Added new -R and -W options to the cupstestppd program diff --git a/Makedefs.in b/Makedefs.in index 9e49bdb31..2474705d8 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -1,5 +1,5 @@ # -# "$Id: Makedefs.in 6332 2007-03-12 16:08:51Z mike $" +# "$Id: Makedefs.in 6564 2007-06-18 23:40:38Z mike $" # # Common makefile definitions for the Common UNIX Printing System (CUPS). # @@ -106,8 +106,7 @@ INSTALLSTATIC = @INSTALLSTATIC@ # # Program options... # -# ARCHFLAGS Defines the default architecture build options, used -# when compiling separate 32/64-bit libraries. +# ARCHFLAGS Defines the default architecture build options. # ARCH32FLAGS Defines the 32-bit architecture build options, used # when compiling separate 32/64-bit libraries. # ARCH64FLAGS Defines the 64-bit architecture build options, used @@ -118,10 +117,12 @@ INSTALLSTATIC = @INSTALLSTATIC@ # for extra debug info) # +ALL_CFLAGS = $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \ + $(OPTIONS) $(CFLAGS) ARCHFLAGS = @ARCHFLAGS@ ARFLAGS = @ARFLAGS@ BACKLIBS = @BACKLIBS@ -CFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \ +CFLAGS = -I.. @CPPFLAGS@ @CFLAGS@ \ @LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS) COMMONLIBS = @LIBS@ CUPSDLIBS = @CUPSDLIBS@ @@ -131,11 +132,14 @@ CXXLIBS = @CXXLIBS@ DSOFLAGS = @DSOFLAGS@ DSOLIBS = @DSOLIBS@ $(COMMONLIBS) DNSSDLIBS = @DNSSDLIBS@ +FONTS = @FONTS@ IMGLIBS = @IMGLIBS@ IMGFILTERS = @IMGFILTERS@ LAUNCHDLIBS = @LAUNCHDLIBS@ -LDFLAGS = -L../cups -L../filter $(ARCHFLAGS) \ +LDFLAGS = -L../cups -L../filter @LDARCHFLAGS@ \ @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) +LEGACY_BACKENDS = @LEGACY_BACKENDS@ +LIBCUPSORDER = @LIBCUPSORDER@ LINKCUPS = @LINKCUPS@ $(SSLLIBS) LINKCUPSIMAGE = @LINKCUPSIMAGE@ LIBS = $(LINKCUPS) $(COMMONLIBS) @@ -250,15 +254,15 @@ DBUSDIR = @DBUSDIR@ .c.o: echo Compiling $<... - $(CC) $(ARCHFLAGS) $(OPTIM) $(CFLAGS) -c $< + $(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c $< .c.32.o: echo Compiling 32-bit $<... - $(CC) $(ARCH32FLAGS) $(OPTIM) $(CFLAGS) -c -o $@ $< + $(CC) $(ARCH32FLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $< .c.64.o: echo Compiling 64-bit $<... - $(CC) $(ARCH64FLAGS) $(OPTIM) $(CFLAGS) -c -o $@ $< + $(CC) $(ARCH64FLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $< .cxx.o: echo Compiling $<... @@ -276,5 +280,5 @@ DBUSDIR = @DBUSDIR@ # -# End of "$Id: Makedefs.in 6332 2007-03-12 16:08:51Z mike $" +# End of "$Id: Makedefs.in 6564 2007-06-18 23:40:38Z mike $" # diff --git a/Makefile b/Makefile index 1edbe7939..393e09571 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6513 2007-05-06 23:50:25Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # Top-level Makefile for the Common UNIX Printing System (CUPS). # @@ -31,7 +31,7 @@ include Makedefs DIRS = cups backend berkeley cgi-bin filter locale man monitor \ notifier $(PDFTOPS) scheduler systemv test \ $(PHPDIR) \ - conf data doc fonts ppd templates + conf data doc $(FONTS) ppd templates # @@ -291,5 +291,5 @@ dist: all # -# End of "$Id: Makefile 6513 2007-05-06 23:50:25Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/backend/Makefile b/backend/Makefile index 37031b34c..28337a0bc 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,9 +1,9 @@ # -# "$Id: Makefile 6414 2007-03-30 13:40:57Z mike $" +# "$Id: Makefile 6576 2007-06-20 00:23:32Z mike $" # # Backend makefile for the Common UNIX Printing System (CUPS). # -# Copyright 1997-2006 by Easy Software Products, all rights reserved. +# Copyright 1997-2007 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the # property of Easy Software Products and are protected by Federal @@ -26,8 +26,8 @@ include ../Makedefs -RBACKENDS = ipp lpd -UBACKENDS = $(PAP) parallel scsi serial snmp socket usb +RBACKENDS = lpd +UBACKENDS = ipp $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb TARGETS = betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS) LIBOBJS = ieee1284.o runloop.o OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \ @@ -71,6 +71,12 @@ install: all done $(RM) $(SERVERBIN)/backend/http $(LN) ipp $(SERVERBIN)/backend/http + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -222,5 +228,5 @@ include Dependencies # -# End of "$Id: Makefile 6414 2007-03-30 13:40:57Z mike $". +# End of "$Id: Makefile 6576 2007-06-20 00:23:32Z mike $". # diff --git a/backend/backend-private.h b/backend/backend-private.h index 2aa96e47e..59de3696a 100644 --- a/backend/backend-private.h +++ b/backend/backend-private.h @@ -1,5 +1,5 @@ /* - * "$Id: backend-private.h 6402 2007-03-27 07:54:14Z mike $" + * "$Id: backend-private.h 6591 2007-06-21 20:35:28Z mike $" * * Backend support definitions for the Common UNIX Printing System (CUPS). * @@ -56,6 +56,7 @@ extern "C" { * Prototypes... */ +extern int backendDrainOutput(int print_fd, int device_fd); extern int backendGetDeviceID(int fd, char *device_id, int device_id_size, char *make_model, int make_model_size, const char *scheme, char *uri, int uri_size); @@ -73,5 +74,5 @@ extern ssize_t backendRunLoop(int print_fd, int device_fd, int use_bc, /* - * End of "$Id: backend-private.h 6402 2007-03-27 07:54:14Z mike $". + * End of "$Id: backend-private.h 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/ipp.c b/backend/ipp.c index 2ff1fb823..43cca4975 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 6482 2007-04-30 17:05:59Z mike $" + * "$Id: ipp.c 6582 2007-06-20 22:07:38Z mike $" * * IPP backend for the Common UNIX Printing System (CUPS). * @@ -475,60 +475,13 @@ main(int argc, /* I - Number of command-line args */ else if (!getuid()) { /* - * Try loading authentication information from the a##### file. + * Try loading authentication information from the environment. */ - const char *request_root; /* CUPS_REQUESTROOT env var */ - char afilename[1024], /* a##### filename */ - aline[2048]; /* Line from file */ - FILE *fp; /* File pointer */ + if ((ptr = getenv("AUTH_USERNAME")) != NULL) + cupsSetUser(ptr); - - if ((request_root = getenv("CUPS_REQUESTROOT")) != NULL) - { - /* - * Try opening authentication cache file... - */ - - snprintf(afilename, sizeof(afilename), "%s/a%05d", request_root, - atoi(argv[1])); - if ((fp = fopen(afilename, "r")) != NULL) - { - /* - * Read username... - */ - - if (fgets(aline, sizeof(aline), fp)) - { - /* - * Decode username... - */ - - i = sizeof(username); - httpDecode64_2(username, &i, aline); - - /* - * Read password... - */ - - if (fgets(aline, sizeof(aline), fp)) - { - /* - * Decode password... - */ - - i = sizeof(password); - httpDecode64_2(password, &i, aline); - } - } - - /* - * Close the file... - */ - - fclose(fp); - } - } + password = getenv("AUTH_PASSWORD"); } /* @@ -945,8 +898,8 @@ main(int argc, /* I - Number of command-line args */ break; if (i < format_sup->num_values) - num_options = cupsAddOption("document-format", content_type, - num_options, &options); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, + "document-format", NULL, content_type); } if (copies_sup && version > 0 && send_options) @@ -1767,5 +1720,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 6482 2007-04-30 17:05:59Z mike $". + * End of "$Id: ipp.c 6582 2007-06-20 22:07:38Z mike $". */ diff --git a/backend/pap.c b/backend/pap.c index b24ed3617..79ce16058 100644 --- a/backend/pap.c +++ b/backend/pap.c @@ -1,5 +1,5 @@ /* -* "$Id: pap.c 6087 2006-11-14 15:48:34Z mike $" +* "$Id: pap.c 6559 2007-06-18 21:09:03Z mike $" * * © Copyright 2004 Apple Computer, Inc. All rights reserved. * @@ -49,24 +49,25 @@ * * Contents: * -* main() - Send a file to the specified Appletalk printer. -* listDevices() - List all LaserWriter printers in the local zone. -* printFile() - Print file. -* papOpen() - Open a pap session to a printer. -* papClose() - Close a pap session. -* papWrite() - Write bytes to a printer. -* papCloseResp() - Send a pap close response. -* papSendRequest() - Fomrat and send a pap packet. -* papCancelRequest() - Cancel a pending pap request. -* statusUpdate() - Print printer status to stderr. -* parseUri() - Extract the print name and zone from a uri. -* addPercentEscapes() - Encode a string with percent escapes. -* removePercentEscapes - Remove percent escape sequences from a string. -* nbptuple_compare() - Compare routine for qsort. -* okayToUseAppleTalk() - Returns true if AppleTalk is available and enabled. -* packet_name() - Returns packet name string. -* connectTimeout() - Returns the connect timeout preference value. -* signalHandler() - handle SIGINT to close the session before quiting. +* main() - Send a file to the specified Appletalk printer. +* listDevices() - List all LaserWriter printers in the local zone. +* printFile() - Print file. +* papOpen() - Open a pap session to a printer. +* papClose() - Close a pap session. +* papWrite() - Write bytes to a printer. +* papCloseResp() - Send a pap close response. +* papSendRequest() - Fomrat and send a pap packet. +* papCancelRequest() - Cancel a pending pap request. +* sidechannel_request() - Handle side-channel requests. +* statusUpdate() - Print printer status to stderr. +* parseUri() - Extract the print name and zone from a uri. +* addPercentEscapes() - Encode a string with percent escapes. +* removePercentEscapes - Remove percent escape sequences from a string. +* nbptuple_compare() - Compare routine for qsort. +* okayToUseAppleTalk() - Returns true if AppleTalk is available and enabled. +* packet_name() - Returns packet name string. +* connectTimeout() - Returns the connect timeout preference value. +* signalHandler() - handle SIGINT to close the session before quiting. */ #include @@ -92,6 +93,8 @@ #include #include +#include +#include #include @@ -167,6 +170,7 @@ static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid, static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int function, u_char bitmap, int xo, int seqno); static int papCancelRequest(int sockfd, u_short tid); +static void sidechannel_request(); static void statusUpdate(char* status, u_char statusLen); static int parseUri(const char* argv0, char* name, char* type, char* zone); static int addPercentEscapes(const char* src, char* dst, int dstMax); @@ -392,6 +396,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in char sockBuffer[4096 + 1]; /* Socket buffer with room for nul */ char atpReqBuf[AT_PAP_DATA_SIZE]; fd_set readSet; + int use_sidechannel; /* Use side channel? */ at_nbptuple_t tuple; at_inet_t sendDataAddr; @@ -418,6 +423,22 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ + /* + * Test the side channel descriptor before calling papOpen() since it may open + * an unused fd 4 (a.k.a. CUPS_SC_FD)... + */ + + FD_ZERO(&readSet); + FD_SET(CUPS_SC_FD, &readSet); + + timeout.tv_sec = 0; + timeout.tv_usec = 0; + + if ((select(CUPS_SC_FD+1, &readSet, NULL, NULL, &timeout)) >= 0) + use_sidechannel = 1; + else + use_sidechannel = 0; + /* try to find our printer */ if ((err = nbp_make_entity(&entity, name, type, zone)) != noErr) { @@ -559,8 +580,12 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in fileBufferNbytes = 0; fileTbytes = 0; fileEOFRead = fileEOFSent = false; + maxfdp1 = MAX(fdin, gSockfd) + 1; + if (use_sidechannel && CUPS_SC_FD >= maxfdp1) + maxfdp1 = CUPS_SC_FD + 1; + if (gStatusInterval != 0) { timeout.tv_usec = 0; @@ -580,6 +605,9 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in if (fileBufferNbytes == 0 && fileEOFRead == false) FD_SET(fdin, &readSet); + if (use_sidechannel) + FD_SET(CUPS_SC_FD, &readSet); + /* Set the select timeout value based on the next status interval */ if (gStatusInterval != 0) { @@ -604,6 +632,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in nextStatusTime = time(NULL) + gStatusInterval; } + /* + * Check if we have a side-channel request ready... + */ + + if (use_sidechannel && FD_ISSET(CUPS_SC_FD, &readSet)) + sidechannel_request(); + /* Was there an event on the input stream? */ if (FD_ISSET(fdin, &readSet)) { @@ -1229,6 +1264,50 @@ int papCancelRequest(int sockfd, u_short tid) } +/* + * 'sidechannel_request()' - Handle side-channel requests. + */ + +static void +sidechannel_request() +{ + cups_sc_command_t command; /* Request command */ + cups_sc_status_t status; /* Request/response status */ + char data[2048]; /* Request/response data */ + int datalen; /* Request/response data size */ + + datalen = sizeof(data); + + if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) + { + fputs(_("WARNING: Failed to read side-channel request!\n"), stderr); + return; + } + + switch (command) + { + case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */ + data[0] = 1; + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0); + break; + + case CUPS_SC_CMD_GET_STATE: /* Return device state */ + data[0] = CUPS_SC_STATE_ONLINE; + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0); + break; + + case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */ + case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */ + case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */ + default: + cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED, + NULL, 0, 1.0); + break; + } + return; +} + + #pragma mark - /*! * @function statusUpdate diff --git a/backend/parallel.c b/backend/parallel.c index 79b1f2b82..a52d44f8b 100644 --- a/backend/parallel.c +++ b/backend/parallel.c @@ -1,5 +1,5 @@ /* - * "$Id: parallel.c 6403 2007-03-27 16:00:56Z mike $" + * "$Id: parallel.c 6591 2007-06-21 20:35:28Z mike $" * * Parallel port backend for the Common UNIX Printing System (CUPS). * @@ -629,7 +629,9 @@ side_cb(int print_fd, /* I - Print file */ switch (command) { case CUPS_SC_CMD_DRAIN_OUTPUT : - if (tcdrain(device_fd)) + if (backendDrainOutput(print_fd, device_fd)) + status = CUPS_SC_STATUS_IO_ERROR; + else if (tcdrain(device_fd)) status = CUPS_SC_STATUS_IO_ERROR; else status = CUPS_SC_STATUS_OK; @@ -669,5 +671,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: parallel.c 6403 2007-03-27 16:00:56Z mike $". + * End of "$Id: parallel.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/runloop.c b/backend/runloop.c index fd0bb8f04..647c79488 100644 --- a/backend/runloop.c +++ b/backend/runloop.c @@ -1,7 +1,7 @@ /* - * "$Id: runloop.c 6498 2007-04-30 21:40:33Z mike $" + * "$Id: runloop.c 6591 2007-06-21 20:35:28Z mike $" * - * Common run loop API for the Common UNIX Printing System (CUPS). + * Common run loop APIs for the Common UNIX Printing System (CUPS). * * Copyright 2006-2007 by Easy Software Products, all rights reserved. * @@ -25,7 +25,8 @@ * * Contents: * - * backendRunLoop() - Read and write print and back-channel data. + * backendDrainOutput() - Drain pending print data to the device. + * backendRunLoop() - Read and write print and back-channel data. */ /* @@ -40,6 +41,109 @@ #endif /* __hpux */ +/* + * 'backendDrainOutput()' - Drain pending print data to the device. + */ + +int /* O - 0 on success, -1 on error */ +backendDrainOutput(int print_fd, /* I - Print file descriptor */ + int device_fd) /* I - Device file descriptor */ +{ + int nfds; /* Maximum file descriptor value + 1 */ + fd_set input; /* Input set for reading */ + ssize_t print_bytes, /* Print bytes read */ + bytes; /* Bytes written */ + char print_buffer[8192], /* Print data buffer */ + *print_ptr; /* Pointer into print data buffer */ + struct timeval timeout; /* Timeout for read... */ + + + fprintf(stderr, "DEBUG: backendDrainOutput(print_fd=%d, device_fd=%d)\n", + print_fd, device_fd); + + /* + * Figure out the maximum file descriptor value to use with select()... + */ + + nfds = (print_fd > device_fd ? print_fd : device_fd) + 1; + + /* + * Now loop until we are out of data from print_fd... + */ + + for (;;) + { + /* + * Use select() to determine whether we have data to copy around... + */ + + FD_ZERO(&input); + FD_SET(print_fd, &input); + + timeout.tv_sec = 0; + timeout.tv_usec = 0; + + if (select(nfds, &input, NULL, NULL, &timeout) < 0) + return (-1); + + if (!FD_ISSET(print_fd, &input)) + return (0); + + if ((print_bytes = read(print_fd, print_buffer, + sizeof(print_buffer))) < 0) + { + /* + * Read error - bail if we don't see EAGAIN or EINTR... + */ + + if (errno != EAGAIN || errno != EINTR) + { + perror("ERROR: Unable to read print data"); + return (-1); + } + + print_bytes = 0; + } + else if (print_bytes == 0) + { + /* + * End of file, return... + */ + + return (0); + } + + fprintf(stderr, "DEBUG: Read %d bytes of print data...\n", + (int)print_bytes); + + for (print_ptr = print_buffer; print_bytes > 0;) + { + if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0) + { + /* + * Write error - bail if we don't see an error we can retry... + */ + + if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN && + errno != EINTR && errno != ENOTTY) + { + fprintf(stderr, _("ERROR: Unable to write print data: %s\n"), + strerror(errno)); + return (-1); + } + } + else + { + fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes); + + print_bytes -= bytes; + print_ptr += bytes; + } + } + } +} + + /* * 'backendRunLoop()' - Read and write print and back-channel data. */ @@ -69,8 +173,9 @@ backendRunLoop( fprintf(stderr, - "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n", - print_fd, device_fd, use_bc); + "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d, " + "side_cb=%p)\n", + print_fd, device_fd, use_bc, side_cb); /* * If we are printing data from a print driver on stdin, ignore SIGTERM @@ -278,5 +383,5 @@ backendRunLoop( /* - * End of "$Id: runloop.c 6498 2007-04-30 21:40:33Z mike $". + * End of "$Id: runloop.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/serial.c b/backend/serial.c index 901df2659..0aa11e90e 100644 --- a/backend/serial.c +++ b/backend/serial.c @@ -1,5 +1,5 @@ /* - * "$Id: serial.c 6403 2007-03-27 16:00:56Z mike $" + * "$Id: serial.c 6591 2007-06-21 20:35:28Z mike $" * * Serial port backend for the Common UNIX Printing System (CUPS). * @@ -1263,7 +1263,9 @@ side_cb(int print_fd, /* I - Print file */ switch (command) { case CUPS_SC_CMD_DRAIN_OUTPUT : - if (tcdrain(device_fd)) + if (backendDrainOutput(print_fd, device_fd)) + status = CUPS_SC_STATUS_IO_ERROR; + else if (tcdrain(device_fd)) status = CUPS_SC_STATUS_IO_ERROR; else status = CUPS_SC_STATUS_OK; @@ -1287,5 +1289,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: serial.c 6403 2007-03-27 16:00:56Z mike $". + * End of "$Id: serial.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/socket.c b/backend/socket.c index 19994f042..0cb2629aa 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,5 +1,5 @@ /* - * "$Id: socket.c 6438 2007-04-03 17:52:41Z mike $" + * "$Id: socket.c 6591 2007-06-21 20:35:28Z mike $" * * AppSocket backend for the Common UNIX Printing System (CUPS). * @@ -458,7 +458,11 @@ side_cb(int print_fd, /* I - Print file */ * Our sockets disable the Nagle algorithm and data is sent immediately. */ - status = CUPS_SC_STATUS_OK; + if (backendDrainOutput(print_fd, device_fd)) + status = CUPS_SC_STATUS_IO_ERROR; + else + status = CUPS_SC_STATUS_OK; + datalen = 0; break; @@ -522,5 +526,5 @@ wait_bc(int device_fd, /* I - Socket */ /* - * End of "$Id: socket.c 6438 2007-04-03 17:52:41Z mike $". + * End of "$Id: socket.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 4cde9129c..e78b15ed5 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1,50 +1,81 @@ /* - * "$Id: usb-darwin.c 6491 2007-04-30 18:21:52Z mike $" - * - * 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 - * terms, and your use, installation, modification or redistribution of - * this Apple software constitutes acceptance of these terms. If you do - * not agree with these terms, please do not use, install, modify or - * redistribute this Apple software. - * - * In consideration of your agreement to abide by the following terms, and - * subject to these terms, Apple grants you a personal, non-exclusive - * license, under Apple's copyrights in this original Apple software (the - * "Apple Software"), to use, reproduce, modify and redistribute the Apple - * Software, with or without modifications, in source and/or binary forms; - * provided that if you redistribute the Apple Software in its entirety and - * without modifications, you must retain this notice and the following - * text and disclaimers in all such redistributions of the Apple Software. - * Neither the name, trademarks, service marks or logos of Apple Computer, - * Inc. may be used to endorse or promote products derived from the Apple - * Software without specific prior written permission from Apple. Except - * as expressly stated in this notice, no other rights or licenses, express - * or implied, are granted by Apple herein, including but not limited to - * any patent rights that may be infringed by your derivative works or by - * other works in which the Apple Software may be incorporated. - * - * The Apple Software is provided by Apple on an "AS IS" basis. APPLE - * MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION - * THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND - * OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - * - * IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, - * MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED - * AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), - * STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +* "$Id: usb-darwin.c 6591 2007-06-21 20:35:28Z mike $" +* +* 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 +* terms, and your use, installation, modification or redistribution of +* this Apple software constitutes acceptance of these terms. If you do +* not agree with these terms, please do not use, install, modify or +* redistribute this Apple software. +* +* In consideration of your agreement to abide by the following terms, and +* subject to these terms, Apple grants you a personal, non-exclusive +* license, under Apple's copyrights in this original Apple software (the +* "Apple Software"), to use, reproduce, modify and redistribute the Apple +* Software, with or without modifications, in source and/or binary forms; +* provided that if you redistribute the Apple Software in its entirety and +* without modifications, you must retain this notice and the following +* text and disclaimers in all such redistributions of the Apple Software. +* Neither the name, trademarks, service marks or logos of Apple Computer, +* Inc. may be used to endorse or promote products derived from the Apple +* Software without specific prior written permission from Apple. Except +* as expressly stated in this notice, no other rights or licenses, express +* or implied, are granted by Apple herein, including but not limited to +* any patent rights that may be infringed by your derivative works or by +* other works in which the Apple Software may be incorporated. +* +* The Apple Software is provided by Apple on an "AS IS" basis. APPLE +* MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION +* THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND +* OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. +* +* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL +* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, +* MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED +* AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), +* STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Contents: +* +* list_devices() - List all USB devices. +* print_device() - Print a file to a USB device. +* sidechannel_thread() - Thread to handle side-channel requests. +* read_thread() - Thread to read the backchannel data on. +* list_device_cb() - list_device iterator callback. +* find_device_cb() - print_device iterator callback. +* status_timer_cb() - Status timer callback. +* iterate_printers() - Iterate over all the printers. +* device_added() - Device added notifier. +* copy_deviceinfo() - Copy strings from the 1284 device ID. +* release_deviceinfo() - Release deviceinfo strings. +* load_classdriver() - Load a classdriver. +* unload_classdriver() - Unload a classdriver. +* load_printerdriver() - Load vendor's classdriver. +* registry_open() - Open a connection to the printer. +* registry_close() - Close the connection to the printer. +* copy_deviceid() - Copy the 1284 device id string. +* copy_devicestring() - Copy the 1284 device id string. +* copy_value_for_key() - Copy value string associated with a key. +* cfstr_create_trim() - Create CFString and trim whitespace characters. +* parse_options() - Parse uri options. +* setup_cfLanguage() - Create AppleLanguages array from LANG environment var. +* run_ppc_backend() - Re-exec i386 backend as ppc. +* sigterm_handler() - SIGTERM handler. +* next_line() - Find the next line in a buffer. +* parse_pserror() - Scan the backchannel data for postscript errors. +* get_device_id() - Return IEEE-1284 device ID. +*/ /* - * USB port on Darwin backend for the Common UNIX Printing System (CUPS). + * Include necessary headers. */ + #include #include #include @@ -54,7 +85,7 @@ #include #include #include -#include +#include #include #include #include @@ -68,31 +99,29 @@ #include -/* - * WAITEOF_DELAY is number of seconds we'll wait for responses from - * the printer after we've finished sending all the data +/* + * WAIT_EOF_DELAY is number of seconds we'll wait for responses from + * the printer after we've finished sending all the data */ -#define WAITEOF_DELAY 7 +#define WAIT_EOF_DELAY 7 #define DEFAULT_TIMEOUT 60L #define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID190) #define kUSBLanguageEnglish 0x409 -#define PRINTER_POLLING_INTERVAL 5 /* seconds */ -#define INITIAL_LOG_INTERVAL (PRINTER_POLLING_INTERVAL) -#define SUBSEQUENT_LOG_INTERVAL (3*INITIAL_LOG_INTERVAL) +#define PRINTER_POLLING_INTERVAL 5 /* seconds */ +#define INITIAL_LOG_INTERVAL PRINTER_POLLING_INTERVAL +#define SUBSEQUENT_LOG_INTERVAL 3 * INITIAL_LOG_INTERVAL -#define kUSBPrinterClassTypeID (CFUUIDGetConstantUUIDWithBytes(NULL, 0x06, 0x04, 0x7D, 0x16, 0x53, 0xA2, 0x11, 0xD6, 0x92, 0x06, 0x00, 0x30, 0x65, 0x52, 0x45, 0x92)) -#define kUSBPrinterClassInterfaceID (CFUUIDGetConstantUUIDWithBytes(NULL, 0x03, 0x34, 0x6D, 0x74, 0x53, 0xA3, 0x11, 0xD6, 0x9E, 0xA1, 0x76, 0x30, 0x65, 0x52, 0x45, 0x92)) +#define kUSBPrinterClassTypeID CFUUIDGetConstantUUIDWithBytes(NULL, 0x06, 0x04, 0x7D, 0x16, 0x53, 0xA2, 0x11, 0xD6, 0x92, 0x06, 0x00, 0x30, 0x65, 0x52, 0x45, 0x92) +#define kUSBPrinterClassInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, 0x03, 0x34, 0x6D, 0x74, 0x53, 0xA3, 0x11, 0xD6, 0x9E, 0xA1, 0x76, 0x30, 0x65, 0x52, 0x45, 0x92) #define kUSBClassDriverProperty CFSTR("USB Printing Class") #define kUSBGenericTOPrinterClassDriver CFSTR("/System/Library/Printers/Libraries/USBGenericTOPrintingClass.plugin") #define kUSBPrinterClassDeviceNotOpen -9664 /*kPMInvalidIOMContext*/ -#define kWriteBufferSize 2048 -#pragma mark - /* * Section 5.3 USB Printing Class spec */ @@ -103,19 +132,21 @@ typedef IOUSBInterfaceInterface190 **printer_interface_t; -typedef struct iodevice_request_s /**** Device request ****/ +typedef struct iodevice_request_s /**** Device request ****/ { - UInt8 requestType; + UInt8 requestType; UInt8 request; UInt16 value; UInt16 index; UInt16 length; - void *buffer; + void *buffer; } iodevice_request_t; -typedef union { /**** Centronics status byte ****/ +typedef union /**** Centronics status byte ****/ +{ char b; - struct { + struct + { unsigned reserved0:2; unsigned paperError:1; unsigned select:1; @@ -124,7 +155,7 @@ typedef union { /**** Centronics status byte ****/ } status; } centronics_status_t; -typedef struct classdriver_context_s /**** Classdriver context ****/ +typedef struct classdriver_s /**** g.classdriver context ****/ { IUNKNOWN_C_GUTS; CFPlugInRef plugin; /* release plugin */ @@ -139,100 +170,101 @@ typedef struct classdriver_context_s /**** Classdriver context ****/ UInt8 inpipe; /* optional bulkIn pipe */ /* general class requests */ - kern_return_t (*DeviceRequest)( struct classdriver_context_s **printer, iodevice_request_t *iorequest, UInt16 timeout ); - kern_return_t (*GetString)( struct classdriver_context_s **printer, UInt8 whichString, UInt16 language, UInt16 timeout, CFStringRef *result ); + kern_return_t (*DeviceRequest)(struct classdriver_s **printer, iodevice_request_t *iorequest, UInt16 timeout); + kern_return_t (*GetString)(struct classdriver_s **printer, UInt8 whichString, UInt16 language, UInt16 timeout, CFStringRef *result); /* standard printer class requests */ - kern_return_t (*SoftReset)( struct classdriver_context_s **printer, UInt16 timeout ); - kern_return_t (*GetCentronicsStatus)( struct classdriver_context_s **printer, centronics_status_t *result, UInt16 timeout ); - kern_return_t (*GetDeviceID)( struct classdriver_context_s **printer, CFStringRef *devid, UInt16 timeout ); + kern_return_t (*SoftReset)(struct classdriver_s **printer, UInt16 timeout); + kern_return_t (*GetCentronicsStatus)(struct classdriver_s **printer, centronics_status_t *result, UInt16 timeout); + kern_return_t (*GetDeviceID)(struct classdriver_s **printer, CFStringRef *devid, UInt16 timeout); /* standard bulk device requests */ - kern_return_t (*ReadPipe)( struct classdriver_context_s **printer, UInt8 *buffer, UInt32 *count ); - kern_return_t (*WritePipe)( struct classdriver_context_s **printer, UInt8 *buffer, UInt32 *count, Boolean eoj ); + kern_return_t (*ReadPipe)(struct classdriver_s **printer, UInt8 *buffer, UInt32 *count); + kern_return_t (*WritePipe)(struct classdriver_s **printer, UInt8 *buffer, UInt32 *count, Boolean eoj); /* interface requests */ - kern_return_t (*Open)( struct classdriver_context_s **printer, UInt32 location, UInt8 protocol ); - kern_return_t (*Abort)( struct classdriver_context_s **printer ); - kern_return_t (*Close)( struct classdriver_context_s **printer ); + kern_return_t (*Open)(struct classdriver_s **printer, UInt32 location, UInt8 protocol); + kern_return_t (*Abort)(struct classdriver_s **printer); + kern_return_t (*Close)(struct classdriver_s **printer); /* initialize and terminate */ - kern_return_t (*Initialize)( struct classdriver_context_s **printer, struct classdriver_context_s **baseclass ); - kern_return_t (*Terminate)( struct classdriver_context_s **printer ); - -} classdriver_context_t; + kern_return_t (*Initialize)(struct classdriver_s **printer, struct classdriver_s **baseclass); + kern_return_t (*Terminate)(struct classdriver_s **printer); +} classdriver_t; typedef Boolean (*iterator_callback_t)(void *refcon, io_service_t obj); -typedef struct iterator_reference_s { /**** Iterator reference data */ +typedef struct iterator_reference_s /**** Iterator reference data */ +{ iterator_callback_t callback; void *userdata; Boolean keepRunning; } iterator_reference_t; -typedef struct printer_data_s { /**** Printer context data ****/ - io_service_t printerObj; - classdriver_context_t **printerDriver; +typedef struct globals_s +{ + io_service_t printer_obj; + classdriver_t **classdriver; + + pthread_mutex_t read_thread_mutex; + pthread_cond_t read_thread_cond; + int read_thread_stop; + int read_thread_done; - pthread_cond_t readCompleteCondition; - pthread_mutex_t readMutex; - int done; + pthread_mutex_t readwrite_lock_mutex; + pthread_cond_t readwrite_lock_cond; + int readwrite_lock; - const char *uri; CFStringRef make; CFStringRef model; CFStringRef serial; - UInt32 location; - Boolean waitEOF; - - CFRunLoopTimerRef statusTimer; - - pthread_cond_t reqWaitCompCond; - pthread_mutex_t reqWaitMutex; - pthread_mutex_t waitCloseMutex; - pthread_mutex_t writeCompMutex; - int writeDone; - int reqWaitDone; - int reqWqitFlag; - int directionalFlag; /* 0=uni, 1=bidi */ - ssize_t dataSize; - ssize_t dataOffset; - char dataBuffer[kWriteBufferSize]; -} printer_data_t; + + CFRunLoopTimerRef status_timer; + + int print_fd; /* File descriptor to print */ + ssize_t print_bytes; /* Print bytes read */ + + Boolean wait_eof; + int drain_output; /* Drain all pending output */ + int bidi_flag; /* 0=unidirectional, 1=bidirectional */ +} globals_t; + + +/* + * Globals... + */ + +globals_t g = { 0 }; /* Globals */ /* * Local functions... */ -static Boolean list_device_callback(void *refcon, io_service_t obj); -static Boolean find_device_callback(void *refcon, io_service_t obj); -static void statusTimerCallback(CFRunLoopTimerRef timer, void *info); -static void iterate_printers(iterator_callback_t callBack, void *userdata); -static void device_added(void *userdata, io_iterator_t iterator); +static Boolean find_device_cb(void *refcon, io_service_t obj); +static Boolean list_device_cb(void *refcon, io_service_t obj); +static CFStringRef cfstr_create_trim(const char *cstr); +static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys); +static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_t ***printerDriver); +static kern_return_t load_printerdriver(CFStringRef *driverBundlePath); +static kern_return_t registry_close(); +static kern_return_t registry_open(CFStringRef *driverBundlePath); +static kern_return_t unload_classdriver(); +static OSStatus copy_deviceid(classdriver_t **printer, CFStringRef *deviceID); +static void *read_thread(void *reference); +static void *sidechannel_thread(void *reference); static void copy_deviceinfo(CFStringRef deviceIDString, CFStringRef *make, CFStringRef *model, CFStringRef *serial); -static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial); -static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_context_t ***driver); -static kern_return_t unload_classdriver(classdriver_context_t ***classDriver); -static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath); -static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath); -static kern_return_t registry_close(printer_data_t *printer); -static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *deviceID); static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, UInt32 *deviceLocation); -static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys); -static CFStringRef cfstr_create_and_trim(const char *cstr); -static void parse_options(const char *options, char *serial, UInt32 *location, Boolean *waitEOF); +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, UInt32 *location, Boolean *wait_eof); +static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial); static void setup_cfLanguage(void); -static void *read_thread(void *reference); -static void *reqestWait_thread(void *reference); -static void usbSoftReset(printer_data_t *userData, cups_sc_status_t *status); -static void usbDrainOutput(printer_data_t *userData, cups_sc_status_t *status); -static void usbGetBidirectional(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen); -static void usbGetDeviceID(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen); -static void usbGetDevState(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen); - +static void soft_reset(); +static void status_timer_cb(CFRunLoopTimerRef timer, void *info); #if defined(__i386__) static pid_t child_pid; /* Child PID */ @@ -253,7 +285,7 @@ static void parse_pserror (char *sockBuffer, int len); void list_devices() { - iterate_printers(list_device_callback, NULL); + iterate_printers(list_device_cb, NULL); } @@ -266,78 +298,89 @@ 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 */ - int fd, /* I - File descriptor to print */ + 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) */ char *argv[]) /* I - Command-line arguments */ { - printer_data_t printer_data = { 0x0 }; /* Printer context */ - char serial[1024]; /* Serial number buffer */ - OSStatus status = noErr; /* Function results */ - pthread_t thr; /* Read thread */ - char buffer[2048]; /* Write buffer */ - int thread_created = 0; /* Thread created? */ - int countdown = INITIAL_LOG_INTERVAL; /* Logging interval */ - pthread_cond_t *readCompleteConditionPtr = NULL; /* Read complete condition */ - pthread_mutex_t *readMutexPtr = NULL; /* Read mutex */ - CFStringRef driverBundlePath; /* Class driver path */ - int reqWait_create = 0; /* RequestWait thread created? */ - pthread_t reqWaitThread; /* RequestWait thread */ - pthread_cond_t *reqWaitCompCondPtr = NULL; /* RequestWait complete condition */ - pthread_mutex_t *reqWaitMutexPtr = NULL; /* RequestWait mutex */ - pthread_mutex_t *waitCloseMutexPtr = NULL; /* wait close mutex */ - pthread_mutex_t *writeCompMutexPtr = NULL; /* write complete mutex */ + char serial[1024]; /* Serial number buffer */ + OSStatus status; /* Function results */ + pthread_t read_thread_id, /* Read thread */ + sidechannel_thread_id;/* Side channel thread */ + char print_buffer[8192], /* Print data buffer */ + *print_ptr; /* Pointer into print data buffer */ + UInt32 location; /* Unique location in bus topology */ + fd_set input_set; /* Input set for select() */ + CFStringRef driverBundlePath; /* Class driver path */ + int countdown, /* Logging interval */ + nfds; /* Number of file descriptors */ + ssize_t total_bytes; /* Total bytes written */ + UInt32 bytes; /* Bytes written */ + struct timeval *timeout, /* Timeout pointer */ + stimeout; /* Timeout for select() */ + struct timespec cond_timeout; /* pthread condition timeout */ setup_cfLanguage(); - parse_options(options, serial, &printer_data.location, &printer_data.waitEOF); + + parse_options(options, serial, &location, &g.wait_eof); if (resource[0] == '/') resource++; - printer_data.uri = uri; - - printer_data.make = cfstr_create_and_trim(hostname); - printer_data.model = cfstr_create_and_trim(resource); - printer_data.serial = cfstr_create_and_trim(serial); + g.print_fd = print_fd; + g.make = cfstr_create_trim(hostname); + g.model = cfstr_create_trim(resource); + g.serial = cfstr_create_trim(serial); + g.location = location; fputs("STATE: +connecting-to-device\n", stderr); - do { - if (printer_data.printerObj != 0x0) { - IOObjectRelease(printer_data.printerObj); - unload_classdriver(&printer_data.printerDriver); - printer_data.printerObj = 0x0; - printer_data.printerDriver = 0x0; + countdown = INITIAL_LOG_INTERVAL; + + do + { + if (g.printer_obj) + { + IOObjectRelease(g.printer_obj); + unload_classdriver(&g.classdriver); + g.printer_obj = 0x0; + g.classdriver = 0x0; } fprintf(stderr, "DEBUG: Looking for '%s %s'\n", hostname, resource); - iterate_printers(find_device_callback, &printer_data); + + iterate_printers(find_device_cb, NULL); fputs("DEBUG: Opening connection\n", stderr); driverBundlePath = NULL; - status = registry_open(&printer_data, &driverBundlePath); + + status = registry_open(&driverBundlePath); + #if defined(__i386__) /* * If we were unable to load the class drivers for this printer it's probably because they're ppc-only. * In this case try to fork & exec this backend as a ppc executable so we can use them... */ - if (status == -2 /* kPMInvalidIOMContext */) { - run_ppc_backend(argc, argv, fd); + if (status == -2) + { + run_ppc_backend(argc, argv, print_fd); /* Never returns here */ } #endif /* __i386__ */ - if (status == -2) { + + if (status == -2) + { /* * If we still were unable to load the class drivers for this printer log * the error and stop the queue... */ - if (driverBundlePath == NULL || !CFStringGetCString(driverBundlePath, buffer, sizeof(buffer), kCFStringEncodingUTF8)) - strlcpy(buffer, "USB class driver", sizeof(buffer)); + if (driverBundlePath == NULL || !CFStringGetCString(driverBundlePath, print_buffer, sizeof(print_buffer), kCFStringEncodingUTF8)) + 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"), buffer); + fprintf(stderr, _("FATAL: Could not load %s\n"), print_buffer); if (driverBundlePath) CFRelease(driverBundlePath); @@ -348,10 +391,12 @@ print_device(const char *uri, /* I - Device URI */ if (driverBundlePath) CFRelease(driverBundlePath); - if (status != noErr) { - sleep( PRINTER_POLLING_INTERVAL ); + if (status != noErr) + { + sleep(PRINTER_POLLING_INTERVAL); countdown -= PRINTER_POLLING_INTERVAL; - if ( countdown <= 0 ) { + if (countdown <= 0) + { fprintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"), (int)status); countdown = SUBSEQUENT_LOG_INTERVAL; /* subsequent log entries, every 15 seconds */ } @@ -367,7 +412,8 @@ print_device(const char *uri, /* I - Device URI */ * stdin (otherwise you can't cancel raw jobs...) */ - if (!fd) { + if (!print_fd) + { #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ sigset(SIGTERM, SIG_IGN); #elif defined(HAVE_SIGACTION) @@ -381,200 +427,506 @@ print_device(const char *uri, /* I - Device URI */ #endif /* HAVE_SIGSET */ } - if (status == noErr) { - if (pthread_cond_init(&printer_data.readCompleteCondition, NULL) == 0) - readCompleteConditionPtr = &printer_data.readCompleteCondition; - - if (pthread_mutex_init(&printer_data.readMutex, NULL) == 0) - readMutexPtr = &printer_data.readMutex; + /* + * Start the side channel thread only if the descriptor is valid + * (i.e. it's not when the backend is used for auto-setup)... + */ - printer_data.done = 0; + pthread_mutex_init(&g.readwrite_lock_mutex, NULL); + pthread_cond_init(&g.readwrite_lock_cond, NULL); + g.readwrite_lock = 1; - if (pthread_create(&thr, NULL, read_thread, &printer_data) == 0) - thread_created = 1; + FD_ZERO(&input_set); + FD_SET(CUPS_SC_FD, &input_set); - if (thread_created == 0) - fputs(_("WARNING: Couldn't create read channel\n"), stderr); + stimeout.tv_sec = 0; + stimeout.tv_usec = 0; - if (pthread_cond_init(&printer_data.reqWaitCompCond, NULL) == 0) - reqWaitCompCondPtr = &printer_data.reqWaitCompCond; - - if (pthread_mutex_init(&printer_data.reqWaitMutex, NULL) == 0) - reqWaitMutexPtr = &printer_data.reqWaitMutex; - - printer_data.reqWaitDone = 0; - printer_data.reqWqitFlag = 0; + if ((select(CUPS_SC_FD+1, &input_set, NULL, NULL, &stimeout)) >= 0) + { + if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL)) + { + fputs(_("WARNING: Couldn't create side channel\n"), stderr); + return CUPS_BACKEND_STOP; + } + } - if (pthread_create(&reqWaitThread, NULL, reqestWait_thread, &printer_data) == 0) - reqWait_create = 1; + /* + * Get the read thread going... + */ - if (reqWait_create == 0) - fputs(_("WARNING: Couldn't create sidechannel thread!\n"), stderr); + g.read_thread_stop = 0; + g.read_thread_done = 0; - if (pthread_mutex_init(&printer_data.waitCloseMutex, NULL) == 0) - waitCloseMutexPtr = &printer_data.waitCloseMutex; + pthread_cond_init(&g.read_thread_cond, NULL); + pthread_mutex_init(&g.read_thread_mutex, NULL); - if (pthread_mutex_init(&printer_data.writeCompMutex, NULL) == 0) - writeCompMutexPtr = &printer_data.writeCompMutex; + if (pthread_create(&read_thread_id, NULL, read_thread, NULL)) + { + fputs(_("WARNING: Couldn't create read channel\n"), stderr); + return CUPS_BACKEND_STOP; } - /* - * The main thread sends the print file... - */ - - printer_data.writeDone = 0; - printer_data.dataSize = 0; - printer_data.dataOffset = 0; - pthread_mutex_lock(writeCompMutexPtr); + /* + * The main thread sends the print file... + */ - while (status == noErr && copies-- > 0) { - UInt32 wbytes; /* Number of bytes written */ - ssize_t nbytes; /* Number of bytes read */ - off_t tbytes = 0; /* Total number of bytes written */ + g.drain_output = 0; + g.print_bytes = 0; + total_bytes = 0; + print_ptr = print_buffer; + while (status == noErr && copies-- > 0) + { fputs(_("INFO: Sending data\n"), stderr); - if (STDIN_FILENO != fd) { + if (print_fd != STDIN_FILENO) + { fputs("PAGE: 1 1", stderr); - lseek( fd, 0, SEEK_SET ); + lseek(print_fd, 0, SEEK_SET); } - while (status == noErr && (nbytes = read(fd, buffer, sizeof(buffer))) > 0) { - char *bufptr = buffer; - tbytes += nbytes; + while (status == noErr) + { + FD_ZERO(&input_set); - while (nbytes > 0 && status == noErr) { - if (printer_data.writeDone) { - printer_data.dataSize = nbytes; - printer_data.dataOffset = bufptr - buffer; - memcpy(printer_data.dataBuffer, buffer, nbytes); + if (!g.print_bytes) + FD_SET(print_fd, &input_set); - status = -1; - break; + /* + * Calculate select timeout... + * If we have data waiting to send timeout is 100ms. + * else if we're draining print_fd timeout is 0. + * else we're waiting forever... + */ + + if (g.print_bytes) + { + stimeout.tv_sec = 0; + stimeout.tv_usec = 100000; /* 100ms */ + timeout = &stimeout; + } + else if (g.drain_output) + { + stimeout.tv_sec = 0; + stimeout.tv_usec = 0; + timeout = &stimeout; + } + else + timeout = NULL; + + /* + * I/O is unlocked around select... + */ + + 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); + + nfds = select(print_fd + 1, &input_set, NULL, NULL, timeout); + + /* + * Reacquire the lock... + */ + + pthread_mutex_lock(&g.readwrite_lock_mutex); + while (g.readwrite_lock) + pthread_cond_wait(&g.readwrite_lock_cond, &g.readwrite_lock_mutex); + g.readwrite_lock = 1; + pthread_mutex_unlock(&g.readwrite_lock_mutex); + + if (nfds < 0) + { + if (errno == EINTR && total_bytes == 0) + { + fputs("DEBUG: Received an interrupt before any bytes were " + "written, aborting!\n", stderr); + return (0); + } + else if (errno != EAGAIN) + { + fprintf(stderr, _("ERROR: select() returned %d\n"), (int)errno); + return CUPS_BACKEND_STOP; + } + } + + /* + * If drain output has finished send a response... + */ + + if (g.drain_output && !nfds && !g.print_bytes) + { + /* Send a response... */ + cupsSideChannelWrite(CUPS_SC_CMD_DRAIN_OUTPUT, CUPS_SC_STATUS_OK, NULL, 0, 1.0); + g.drain_output = 0; + } + + /* + * Check if we have print data ready... + */ + + if (FD_ISSET(print_fd, &input_set)) + { + g.print_bytes = read(print_fd, print_buffer, sizeof(print_buffer)); + + if (g.print_bytes < 0) + { + /* + * Read error - bail if we don't see EAGAIN or EINTR... + */ + + if (errno != EAGAIN || errno != EINTR) + { + perror("ERROR: Unable to read print data"); + return CUPS_BACKEND_STOP; + } + + g.print_bytes = 0; } + else if (g.print_bytes == 0) + { + /* + * End of file, break out of the loop... + */ - wbytes = nbytes; - status = (*(printer_data.printerDriver))->WritePipe( printer_data.printerDriver, (UInt8*)bufptr, &wbytes, 0 /* nbytes > wbytes? 0: feof(fp) */ ); - if (wbytes < 0 || noErr != status) { - OSStatus err = (*(printer_data.printerDriver))->Abort(printer_data.printerDriver); - fprintf(stderr, _("ERROR: %ld: Unable to send print file to printer (canceled:%ld)\n"), status, err); break; } - nbytes -= wbytes; - bufptr += wbytes; + print_ptr = print_buffer; + + fprintf(stderr, "DEBUG: Read %d bytes of print data...\n", + (int)g.print_bytes); } - if (fd != 0 && status == noErr) - fprintf(stderr, "DEBUG: Sending print file, %lld bytes...\n", (off_t)tbytes); - } - } + if (g.print_bytes) + { + bytes = g.print_bytes; - printer_data.writeDone = 1; - pthread_mutex_unlock(writeCompMutexPtr); + status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0); - if (thread_created) { - /* Signal the read thread that we are done... */ - printer_data.done = 1; + /* + * Ignore timeout errors... + */ - /* Give the read thread WAITEOF_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. - */ - struct timespec sleepUntil = { time(NULL) + WAITEOF_DELAY, 0 }; - pthread_mutex_lock(&printer_data.readMutex); - if (pthread_cond_timedwait(&printer_data.readCompleteCondition, &printer_data.readMutex, (const struct timespec *)&sleepUntil) != 0) - printer_data.waitEOF = false; - pthread_mutex_unlock(&printer_data.readMutex); - pthread_join( thr,NULL); /* wait for the child thread to return */ - } + if (status == kIOUSBTransactionTimeout) + { + status = 0; + bytes = 0; + } - if (reqWait_create) { - /* Signal the cupsSideChannelDoRequest wait thread that we are done... */ - printer_data.reqWaitDone = 1; + if (status || bytes < 0) + { + /* + * Write error - bail if we don't see an error we can retry... + */ - /* - * Give the cupsSideChannelDoRequest wait thread WAITEOF_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. - */ - struct timespec reqWaitSleepUntil = { time(NULL) + WAITEOF_DELAY, 0 }; - pthread_mutex_lock(&printer_data.reqWaitMutex); - - while (!printer_data.reqWqitFlag) { - if (pthread_cond_timedwait(&printer_data.reqWaitCompCond, - &printer_data.reqWaitMutex, - (const struct timespec *)&reqWaitSleepUntil) != 0) { - printer_data.waitEOF = false; - printer_data.reqWqitFlag = 1; + OSStatus err = (*g.classdriver)->Abort(g.classdriver); + fprintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"), (long)status, (long)err); + return CUPS_BACKEND_STOP; + } + + fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes); + + g.print_bytes -= bytes; + print_ptr += bytes; + total_bytes += bytes; } + + if (print_fd != 0 && status == noErr) + fprintf(stderr, "DEBUG: Sending print file, %lld bytes...\n", + (off_t)total_bytes); } - pthread_mutex_unlock(&printer_data.reqWaitMutex); - pthread_join(reqWaitThread,NULL); /* wait for the child thread to return */ } - /* interface close wait mutex(for softreset) */ - pthread_mutex_lock(waitCloseMutexPtr); - pthread_mutex_unlock(waitCloseMutexPtr); + fprintf(stderr, "DEBUG: Sent %lld bytes...\n", (off_t)total_bytes); - /* - * Close the connection and input file and general clean up... - */ - registry_close(&printer_data); + /* + * 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); + + pthread_join(sidechannel_thread_id, NULL); + + pthread_cond_destroy(&g.readwrite_lock_cond); + pthread_mutex_destroy(&g.readwrite_lock_mutex); + + /* + * Signal the read thread to stop... + */ + + g.read_thread_stop = 1; + + /* + * 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. + */ + + pthread_mutex_lock(&g.read_thread_mutex); - if (STDIN_FILENO != fd) - close(fd); + if (!g.read_thread_done) + { + cond_timeout.tv_sec = time(NULL) + WAIT_EOF_DELAY; + cond_timeout.tv_nsec = 0; - if (readCompleteConditionPtr != NULL) - pthread_cond_destroy(&printer_data.readCompleteCondition); + if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex, &cond_timeout) != 0) + g.wait_eof = false; + } + pthread_mutex_unlock(&g.read_thread_mutex); - if (readMutexPtr != NULL) - pthread_mutex_destroy(&printer_data.readMutex); + pthread_join(read_thread_id, NULL); /* wait for the read thread to return */ - if (waitCloseMutexPtr != NULL) - pthread_mutex_destroy(&printer_data.waitCloseMutex); + pthread_cond_destroy(&g.read_thread_cond); + pthread_mutex_destroy(&g.read_thread_mutex); - if (writeCompMutexPtr != NULL) - pthread_mutex_destroy(&printer_data.writeCompMutex); + /* + * Close the connection and input file and general clean up... + */ - if (reqWaitCompCondPtr != NULL) - pthread_cond_destroy(&printer_data.reqWaitCompCond); + registry_close(); - if (reqWaitMutexPtr != NULL) - pthread_mutex_destroy(&printer_data.reqWaitMutex); + if (print_fd != STDIN_FILENO) + close(print_fd); - if (printer_data.make != NULL) - CFRelease(printer_data.make); + if (g.make != NULL) + CFRelease(g.make); - if (printer_data.model != NULL) - CFRelease(printer_data.model); + if (g.model != NULL) + CFRelease(g.model); - if (printer_data.serial != NULL) - CFRelease(printer_data.serial); + if (g.serial != NULL) + CFRelease(g.serial); - if (printer_data.printerObj != 0x0) - IOObjectRelease(printer_data.printerObj); + if (g.printer_obj != 0x0) + IOObjectRelease(g.printer_obj); return status; } + +/* + * 'read_thread()' - Thread to read the backchannel data on. + */ + +static void *read_thread(void *reference) +{ + UInt8 readbuffer[512]; + UInt32 rbytes; + kern_return_t readstatus; + struct mach_timebase_info timeBaseInfo; + uint64_t start, + delay; + + /* Calculate what 250 milliSeconds are in mach absolute time... + */ + mach_timebase_info(&timeBaseInfo); + delay = ((uint64_t)250000000 * (uint64_t)timeBaseInfo.denom) / (uint64_t)timeBaseInfo.numer; + + do + { + /* + * Remember when we started so we can throttle the loop after the read call... + */ + + start = mach_absolute_time(); + + rbytes = sizeof(readbuffer); + readstatus = (*g.classdriver)->ReadPipe(g.classdriver, readbuffer, &rbytes); + if (readstatus == kIOReturnSuccess && rbytes > 0) + { + cupsBackChannelWrite((char*)readbuffer, rbytes, 1.0); + + /* cntrl-d is echoed by the printer. + * NOTES: + * Xerox Phaser 6250D doesn't echo the cntrl-d. + * Xerox Phaser 6250D doesn't always send the product query. + */ + if (g.wait_eof && readbuffer[rbytes-1] == 0x4) + break; + +#ifdef PARSE_PS_ERRORS + parse_pserror(readbuffer, rbytes); +#endif + } + + /* + * Make sure this loop executes no more than once every 250 miliseconds... + */ + + if ((readstatus != kIOReturnSuccess || rbytes == 0) && (g.wait_eof || !g.read_thread_stop)) + mach_wait_until(start + delay); + + } while (g.wait_eof || !g.read_thread_stop); /* Abort from main thread tests error here */ + + /* + * Let the main thread know that we have completed the read thread... + */ + + pthread_mutex_lock(&g.read_thread_mutex); + g.read_thread_done = 1; + pthread_cond_signal(&g.read_thread_cond); + pthread_mutex_unlock(&g.read_thread_mutex); + + return NULL; +} + + +/* + * 'sidechannel_thread()' - Handle side-channel requests. + */ + +static void* +sidechannel_thread(void *reference) +{ + cups_sc_command_t command; /* Request command */ + cups_sc_status_t status; /* Request/response status */ + char data[2048]; /* Request/response data */ + int datalen; /* Request/response data size */ + + for (;;) + { + datalen = sizeof(data); + + if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) + break; + + switch (command) + { + case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */ + soft_reset(); + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0); + break; + + case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */ + g.drain_output = 1; + break; + + case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */ + data[0] = g.bidi_flag; + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0); + break; + + case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */ + datalen = sizeof(data); + get_device_id(&status, data, &datalen); + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, datalen, 1.0); + break; + + case CUPS_SC_CMD_GET_STATE: /* Return device state */ + data[0] = CUPS_SC_STATE_ONLINE; + cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0); + break; + + default: + cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED, + NULL, 0, 1.0); + break; + } + } + return NULL; +} + + #pragma mark - /* - * 'list_device_callback()' - list_device iterator callback. + * 'iterate_printers()' - Iterate over all the printers. + */ + +static void iterate_printers(iterator_callback_t callBack, + void *userdata) +{ + mach_port_t masterPort = 0x0; + kern_return_t kr = IOMasterPort (bootstrap_port, &masterPort); + + if (kr == kIOReturnSuccess && masterPort != 0x0) + { + io_iterator_t addIterator = 0x0; + + iterator_reference_t reference = { callBack, userdata, true }; + IONotificationPortRef addNotification = IONotificationPortCreate(masterPort); + + int klass = kUSBPrintingClass; + int subklass = kUSBPrintingSubclass; + + CFNumberRef usb_klass = CFNumberCreate(NULL, kCFNumberIntType, &klass); + CFNumberRef usb_subklass = CFNumberCreate(NULL, kCFNumberIntType, &subklass); + CFMutableDictionaryRef usbPrinterMatchDictionary = IOServiceMatching(kIOUSBInterfaceClassName); + + CFDictionaryAddValue(usbPrinterMatchDictionary, CFSTR("bInterfaceClass"), usb_klass); + CFDictionaryAddValue(usbPrinterMatchDictionary, CFSTR("bInterfaceSubClass"), usb_subklass); + + CFRelease(usb_klass); + CFRelease(usb_subklass); + + kr = IOServiceAddMatchingNotification(addNotification, kIOMatchedNotification, usbPrinterMatchDictionary, &device_added, &reference, &addIterator); + if (addIterator != 0x0) + { + device_added (&reference, addIterator); + + if (reference.keepRunning) + { + CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(addNotification), kCFRunLoopDefaultMode); + CFRunLoopRun(); + } + IOObjectRelease(addIterator); + } + mach_port_deallocate(mach_task_self(), masterPort); + } +} + + +/* + * 'device_added()' - Device added notifier. */ -static Boolean list_device_callback(void *refcon, io_service_t obj) +static void device_added(void *userdata, + io_iterator_t iterator) +{ + iterator_reference_t *reference = userdata; + + io_service_t obj; + while (reference->keepRunning && (obj = IOIteratorNext(iterator)) != 0x0) + { + if (reference->callback != NULL) + reference->keepRunning = reference->callback(reference->userdata, obj); + + IOObjectRelease(obj); + } + + /* One last call to the call back now that we are not longer have printers left to iterate... + */ + if (reference->keepRunning) + reference->keepRunning = reference->callback(reference->userdata, 0x0); + + if (!reference->keepRunning) + CFRunLoopStop(CFRunLoopGetCurrent()); +} + + +/* + * 'list_device_cb()' - list_device iterator callback. + */ + +static Boolean list_device_cb(void *refcon, + io_service_t obj) { Boolean keepRunning = (obj != 0x0); - if (keepRunning) { + if (keepRunning) + { CFStringRef deviceIDString = NULL; UInt32 deviceLocation = 0; copy_devicestring(obj, &deviceIDString, &deviceLocation); - if (deviceIDString != NULL) { + if (deviceIDString != NULL) + { CFStringRef make = NULL, model = NULL, serial = NULL; char uristr[1024], makestr[1024], modelstr[1024], serialstr[1024]; char optionsstr[1024], idstr[1024]; @@ -605,9 +957,7 @@ static Boolean list_device_callback(void *refcon, io_service_t obj) snprintf(optionsstr, sizeof(optionsstr), "?serial=%s", serialstr); } else if (deviceLocation != 0) - { - snprintf(optionsstr, sizeof(optionsstr), "?location=%lx", deviceLocation); - } + snprintf(optionsstr, sizeof(optionsstr), "?location=%x", (unsigned)deviceLocation); httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr); strncat(uristr, optionsstr, sizeof(uristr)); @@ -635,42 +985,48 @@ static Boolean list_device_callback(void *refcon, io_service_t obj) /* - * 'find_device_callback()' - print_device iterator callback. + * 'find_device_cb()' - print_device iterator callback. */ -static Boolean find_device_callback(void *refcon, io_service_t obj) +static Boolean find_device_cb(void *refcon, + io_service_t obj) { Boolean keepLooking = true; - printer_data_t *userData = (printer_data_t *)refcon; - if (obj != 0x0) { + if (obj != 0x0) + { CFStringRef idString = NULL; UInt32 location = -1; copy_devicestring(obj, &idString, &location); - if (idString != NULL) { + if (idString != NULL) + { CFStringRef make = NULL, model = NULL, serial = NULL; copy_deviceinfo(idString, &make, &model, &serial); - if (CFStringCompare(make, userData->make, kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - if (CFStringCompare(model, userData->model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - if (userData->serial != NULL && CFStringGetLength(userData->serial) > 0 ) { - if (serial != NULL && CFStringCompare(serial, userData->serial, kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + if (CFStringCompare(make, g.make, kCFCompareCaseInsensitive) == kCFCompareEqualTo) + { + if (CFStringCompare(model, g.model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) + { + if (g.serial != NULL && CFStringGetLength(g.serial) > 0) + { + if (serial != NULL && CFStringCompare(serial, g.serial, kCFCompareCaseInsensitive) == kCFCompareEqualTo) + { IOObjectRetain(obj); - userData->printerObj = obj; + g.printer_obj = obj; keepLooking = false; } } - else { - if (userData->printerObj != 0) { - IOObjectRetain(userData->printerObj); - } - userData->printerObj = obj; + else + { + if (g.printer_obj != 0) + IOObjectRelease(g.printer_obj); + + g.printer_obj = obj; IOObjectRetain(obj); - if (userData->location == 0 || userData->location == location) { + if (g.location == 0 || g.location == location) keepLooking = false; - } } } } @@ -679,103 +1035,43 @@ static Boolean find_device_callback(void *refcon, io_service_t obj) CFRelease(idString); } } - else { - keepLooking = (userData->printerObj == 0); - if (obj == 0x0 && keepLooking) { - CFRunLoopTimerContext context = { 0, userData, NULL, NULL, NULL }; - CFRunLoopTimerRef timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + 1.0, 10, 0x0, 0x0, statusTimerCallback, &context); - if (timer != NULL) { + else + { + keepLooking = (g.printer_obj == 0); + if (obj == 0x0 && keepLooking) + { + CFRunLoopTimerContext context = { 0, refcon, NULL, NULL, NULL }; + CFRunLoopTimerRef timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + 1.0, 10, 0x0, 0x0, status_timer_cb, &context); + if (timer != NULL) + { CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode); - userData->statusTimer = timer; + g.status_timer = timer; } } } - - if (!keepLooking && userData->statusTimer != NULL) { + + if (!keepLooking && g.status_timer != NULL) + { fputs("STATE: -offline-error\n", stderr); fputs(_("INFO: Printer is now on-line.\n"), stderr); - CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), userData->statusTimer, kCFRunLoopDefaultMode); - CFRelease(userData->statusTimer); - userData->statusTimer = NULL; + CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode); + CFRelease(g.status_timer); + g.status_timer = NULL; } return keepLooking; } -static void statusTimerCallback (CFRunLoopTimerRef timer, void *info) -{ - fputs("STATE: +offline-error\n", stderr); - fputs(_("INFO: Printer is currently off-line.\n"), stderr); -} -#pragma mark - /* - * 'iterate_printers()' - iterate over all the printers. + * 'status_timer_cb()' - Status timer callback. */ -static void iterate_printers(iterator_callback_t callBack, void *userdata) +static void status_timer_cb(CFRunLoopTimerRef timer, + void *info) { - mach_port_t masterPort = 0x0; - kern_return_t kr = IOMasterPort (bootstrap_port, &masterPort); - - if (kr == kIOReturnSuccess && masterPort != 0x0) { - io_iterator_t addIterator = 0x0; - - iterator_reference_t reference = { callBack, userdata, true }; - IONotificationPortRef addNotification = IONotificationPortCreate(masterPort); - - int klass = kUSBPrintingClass; - int subklass = kUSBPrintingSubclass; - - CFNumberRef usb_klass = CFNumberCreate(NULL, kCFNumberIntType, &klass); - CFNumberRef usb_subklass = CFNumberCreate(NULL, kCFNumberIntType, &subklass); - CFMutableDictionaryRef usbPrinterMatchDictionary = IOServiceMatching(kIOUSBInterfaceClassName); - - CFDictionaryAddValue(usbPrinterMatchDictionary, CFSTR("bInterfaceClass"), usb_klass); - CFDictionaryAddValue(usbPrinterMatchDictionary, CFSTR("bInterfaceSubClass"), usb_subklass); - - CFRelease(usb_klass); - CFRelease(usb_subklass); - - kr = IOServiceAddMatchingNotification(addNotification, kIOMatchedNotification, usbPrinterMatchDictionary, &device_added, &reference, &addIterator); - if (addIterator != 0x0) { - device_added (&reference, addIterator); - - if (reference.keepRunning) { - CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(addNotification), kCFRunLoopDefaultMode); - CFRunLoopRun(); - } - IOObjectRelease(addIterator); - } - mach_port_deallocate(mach_task_self(), masterPort); - } -} - - -/* - * 'device_added()' - device added notifier. - */ - -static void device_added(void *userdata, io_iterator_t iterator) -{ - iterator_reference_t *reference = userdata; - - io_service_t obj; - while (reference->keepRunning && (obj = IOIteratorNext(iterator)) != 0x0) { - if (reference->callback != NULL) { - reference->keepRunning = reference->callback(reference->userdata, obj); - } - IOObjectRelease(obj); - } - - /* One last call to the call back now that we are not longer have printers left to iterate... - */ - if (reference->keepRunning) - reference->keepRunning = reference->callback(reference->userdata, 0x0); - - if (!reference->keepRunning) { - CFRunLoopStop(CFRunLoopGetCurrent()); - } + fputs("STATE: +offline-error\n", stderr); + fputs(_("INFO: Printer is currently off-line.\n"), stderr); } @@ -784,8 +1080,11 @@ static void device_added(void *userdata, io_iterator_t iterator) * 'copy_deviceinfo()' - Copy strings from the 1284 device ID. */ -static void copy_deviceinfo(CFStringRef deviceIDString, CFStringRef *make, CFStringRef *model, CFStringRef *serial) -{ +static void copy_deviceinfo(CFStringRef deviceIDString, + CFStringRef *make, + CFStringRef *model, + CFStringRef *serial) +{ CFStringRef modelKeys[] = { CFSTR("MDL:"), CFSTR("MODEL:"), NULL }; CFStringRef makeKeys[] = { CFSTR("MFG:"), CFSTR("MANUFACTURER:"), NULL }; CFStringRef serialKeys[] = { CFSTR("SN:"), CFSTR("SERN:"), NULL }; @@ -803,19 +1102,24 @@ static void copy_deviceinfo(CFStringRef deviceIDString, CFStringRef *make, CFStr * 'release_deviceinfo()' - Release deviceinfo strings. */ -static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial) +static void release_deviceinfo(CFStringRef *make, + CFStringRef *model, + CFStringRef *serial) { - if (make != NULL && *make != NULL) { + if (make != NULL && *make != NULL) + { CFRelease(*make); *make = NULL; } - if (model != NULL && *model != NULL) { + if (model != NULL && *model != NULL) + { CFRelease(*model); *model = NULL; } - if (serial != NULL && *serial != NULL) { + if (serial != NULL && *serial != NULL) + { CFRelease(*serial); *serial = NULL; } @@ -827,33 +1131,40 @@ static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRe * 'load_classdriver()' - Load a classdriver. */ -static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_context_t ***printerDriver) +static kern_return_t load_classdriver(CFStringRef driverPath, + printer_interface_t intf, + classdriver_t ***printerDriver) { kern_return_t kr = kUSBPrinterClassDeviceNotOpen; - classdriver_context_t **driver = NULL; + classdriver_t **driver = NULL; CFStringRef bundle = (driverPath == NULL ? kUSBGenericTOPrinterClassDriver : driverPath); - if ( NULL != bundle ) { + if (bundle != NULL) + { CFURLRef url = CFURLCreateWithFileSystemPath(NULL, bundle, kCFURLPOSIXPathStyle, true); CFPlugInRef plugin = (url != NULL ? CFPlugInCreate(NULL, url) : NULL); - if (url != NULL) + if (url != NULL) CFRelease(url); - if (plugin != NULL) { + if (plugin != NULL) + { CFArrayRef factories = CFPlugInFindFactoriesForPlugInTypeInPlugIn(kUSBPrinterClassTypeID, plugin); - if (factories != NULL && CFArrayGetCount(factories) > 0) { + if (factories != NULL && CFArrayGetCount(factories) > 0) + { CFUUIDRef factoryID = CFArrayGetValueAtIndex(factories, 0); IUnknownVTbl **iunknown = CFPlugInInstanceCreate(NULL, factoryID, kUSBPrinterClassTypeID); - if (NULL != iunknown) { + if (iunknown != NULL) + { kr = (*iunknown)->QueryInterface(iunknown, CFUUIDGetUUIDBytes(kUSBPrinterClassInterfaceID), (LPVOID *)&driver); - if (kr == kIOReturnSuccess && driver != NULL) { - classdriver_context_t **genericDriver = NULL; - if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo) { + if (kr == kIOReturnSuccess && driver != NULL) + { + classdriver_t **genericDriver = NULL; + if (driverPath != NULL && CFStringCompare(driverPath, kUSBGenericTOPrinterClassDriver, 0) != kCFCompareEqualTo) kr = load_classdriver(NULL, intf, &genericDriver); - } - if (kr == kIOReturnSuccess) { + if (kr == kIOReturnSuccess) + { (*driver)->interface = intf; (*driver)->Initialize(driver, genericDriver); @@ -883,11 +1194,12 @@ static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_ * 'unload_classdriver()' - Unload a classdriver. */ -static kern_return_t unload_classdriver(classdriver_context_t ***classDriver) +static kern_return_t unload_classdriver(classdriver_t ***classdriver) { - if (*classDriver != NULL) { - (**classDriver)->Release(*classDriver); - *classDriver = NULL; + if (*classdriver != NULL) + { + (**classdriver)->Release(*classdriver); + *classdriver = NULL; } return kIOReturnSuccess; @@ -895,12 +1207,12 @@ static kern_return_t unload_classdriver(classdriver_context_t ***classDriver) /* - * 'load_printerdriver()' - Load a vendor's (or generic) classdriver. + * 'load_printerdriver()' - Load vendor's classdriver. * * If driverBundlePath is not NULL on return it is the callers responsbility to release it! */ -static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath) +static kern_return_t load_printerdriver(CFStringRef *driverBundlePath) { IOCFPlugInInterface **iodev = NULL; SInt32 score; @@ -908,14 +1220,14 @@ static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *dr printer_interface_t intf; HRESULT res; - kr = IOCreatePlugInInterfaceForService(printer->printerObj, kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &iodev, &score); + kr = IOCreatePlugInInterfaceForService(g.printer_obj, kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &iodev, &score); if (kr == kIOReturnSuccess) { if ((res = (*iodev)->QueryInterface(iodev, USB_INTERFACE_KIND, (LPVOID *) &intf)) == noErr) { - *driverBundlePath = IORegistryEntryCreateCFProperty(printer->printerObj, kUSBClassDriverProperty, NULL, kNilOptions); + *driverBundlePath = IORegistryEntryCreateCFProperty(g.printer_obj, kUSBClassDriverProperty, NULL, kNilOptions); - kr = load_classdriver(*driverBundlePath, intf, &printer->printerDriver); + kr = load_classdriver(*driverBundlePath, intf, &g.classdriver); if (kr != kIOReturnSuccess) (*intf)->Release(intf); @@ -930,33 +1242,35 @@ static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *dr * 'registry_open()' - Open a connection to the printer. */ -static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath) +static kern_return_t registry_open(CFStringRef *driverBundlePath) { - printer->directionalFlag = 0; + g.bidi_flag = 0; /* 0=unidirectional */ - kern_return_t kr = load_printerdriver(printer, driverBundlePath); - if (kr != kIOReturnSuccess) { + kern_return_t kr = load_printerdriver(driverBundlePath); + if (kr != kIOReturnSuccess) kr = -2; - } - if (printer->printerDriver != NULL) { - kr = (*(printer->printerDriver))->Open(printer->printerDriver, printer->location, kUSBPrintingProtocolBidirectional); - if (kr != kIOReturnSuccess || (*(printer->printerDriver))->interface == NULL) { - kr = (*(printer->printerDriver))->Open(printer->printerDriver, printer->location, kUSBPrintingProtocolUnidirectional); - if (kr == kIOReturnSuccess) { - if ((*(printer->printerDriver))->interface == NULL) { - (*(printer->printerDriver))->Close(printer->printerDriver); + if (g.classdriver != NULL) + { + kr = (*g.classdriver)->Open(g.classdriver, g.location, kUSBPrintingProtocolBidirectional); + if (kr != kIOReturnSuccess || (*g.classdriver)->interface == NULL) + { + kr = (*g.classdriver)->Open(g.classdriver, g.location, kUSBPrintingProtocolUnidirectional); + if (kr == kIOReturnSuccess) + { + if ((*g.classdriver)->interface == NULL) + { + (*g.classdriver)->Close(g.classdriver); kr = -1; } } - } else { - printer->directionalFlag = 1; } + else + g.bidi_flag = 1; /* 1=bidirectional */ } - if (kr != kIOReturnSuccess) { - unload_classdriver(&printer->printerDriver); - } + if (kr != kIOReturnSuccess) + unload_classdriver(&g.classdriver); return kr; } @@ -966,12 +1280,12 @@ static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverB * 'registry_close()' - Close the connection to the printer. */ -static kern_return_t registry_close(printer_data_t *printer) +static kern_return_t registry_close() { - if (printer->printerDriver != NULL) { - (*(printer->printerDriver))->Close(printer->printerDriver); - } - unload_classdriver(&printer->printerDriver); + if (g.classdriver != NULL) + (*g.classdriver)->Close(g.classdriver); + + unload_classdriver(&g.classdriver); return kIOReturnSuccess; } @@ -980,7 +1294,8 @@ static kern_return_t registry_close(printer_data_t *printer) * 'copy_deviceid()' - Copy the 1284 device id string. */ -static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *deviceID) +static OSStatus copy_deviceid(classdriver_t **classdriver, + CFStringRef *deviceID) { CFStringRef devID = NULL, @@ -988,52 +1303,61 @@ static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *devi deviceModel = NULL, deviceSerial = NULL; - OSStatus err = (*printer)->GetDeviceID(printer, &devID, DEFAULT_TIMEOUT); + OSStatus err = (*classdriver)->GetDeviceID(classdriver, &devID, DEFAULT_TIMEOUT); copy_deviceinfo(devID, &deviceMake, &deviceModel, &deviceSerial); - if (deviceMake == NULL || deviceModel == NULL || deviceSerial == NULL) { + if (deviceMake == NULL || deviceModel == NULL || deviceSerial == NULL) + { IOUSBDeviceDescriptor desc; iodevice_request_t request; - request.requestType = USBmakebmRequestType( kUSBIn, kUSBStandard, kUSBDevice ); + request.requestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice); request.request = kUSBRqGetDescriptor; request.value = (kUSBDeviceDesc << 8) | 0; request.index = 0; request.length = sizeof(desc); request.buffer = &desc; - err = (*printer)->DeviceRequest(printer, &request, DEFAULT_TIMEOUT); - if (err == kIOReturnSuccess) { + err = (*classdriver)->DeviceRequest(classdriver, &request, DEFAULT_TIMEOUT); + if (err == kIOReturnSuccess) + { CFMutableStringRef newDevID = CFStringCreateMutable(NULL, 0); - if (deviceMake == NULL) { + if (deviceMake == NULL) + { CFStringRef data = NULL; - err = (*printer)->GetString(printer, desc.iManufacturer, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); - if (data != NULL) { + err = (*classdriver)->GetString(classdriver, desc.iManufacturer, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); + if (data != NULL) + { CFStringAppendFormat(newDevID, NULL, CFSTR("MFG:%@;"), data); CFRelease(data); } } - if (deviceModel == NULL) { + if (deviceModel == NULL) + { CFStringRef data = NULL; - err = (*printer)->GetString(printer, desc.iProduct, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); - if (data != NULL) { + err = (*classdriver)->GetString(classdriver, desc.iProduct, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); + if (data != NULL) + { CFStringAppendFormat(newDevID, NULL, CFSTR("MDL:%@;"), data); CFRelease(data); } } - if (deviceSerial == NULL && desc.iSerialNumber != 0) { + if (deviceSerial == NULL && desc.iSerialNumber != 0) + { CFStringRef data = NULL; - err = (*printer)->GetString(printer, desc.iSerialNumber, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); - if (data != NULL) { + err = (*classdriver)->GetString(classdriver, desc.iSerialNumber, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data); + if (data != NULL) + { CFStringAppendFormat(newDevID, NULL, CFSTR("SERN:%@;"), data); CFRelease(data); } } - if (devID != NULL) { + if (devID != NULL) + { CFStringAppend(newDevID, devID); CFRelease(devID); } @@ -1041,7 +1365,8 @@ static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *devi *deviceID = newDevID; } } - else { + else + { *deviceID = devID; } release_deviceinfo(&deviceMake, &deviceModel, &deviceSerial); @@ -1054,34 +1379,39 @@ static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *devi * 'copy_devicestring()' - Copy the 1284 device id string. */ -static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, UInt32 *deviceLocation) +static void copy_devicestring(io_service_t usbInterface, + CFStringRef *deviceID, + UInt32 *deviceLocation) { IOCFPlugInInterface **iodev = NULL; SInt32 score; kern_return_t kr; printer_interface_t intf; HRESULT res; - classdriver_context_t **klassDriver = NULL; + classdriver_t **klassDriver = NULL; CFStringRef driverBundlePath; - kr = IOCreatePlugInInterfaceForService(usbInterface, kIOUSBInterfaceUserClientTypeID, - kIOCFPlugInInterfaceID, &iodev, &score); - if (kr == kIOReturnSuccess) + if ((kr = IOCreatePlugInInterfaceForService(usbInterface, + kIOUSBInterfaceUserClientTypeID, + kIOCFPlugInInterfaceID, + &iodev, &score)) == kIOReturnSuccess) { - if ((res = (*iodev)->QueryInterface(iodev, USB_INTERFACE_KIND, (LPVOID *) &intf)) == noErr) + if ((res = (*iodev)->QueryInterface(iodev, USB_INTERFACE_KIND, (LPVOID *) + &intf)) == noErr) { - /* ignore the result for location id... */ - (void)(*intf)->GetLocationID(intf, deviceLocation); + (*intf)->GetLocationID(intf, deviceLocation); - driverBundlePath = IORegistryEntryCreateCFProperty( usbInterface, kUSBClassDriverProperty, NULL, kNilOptions ); + driverBundlePath = IORegistryEntryCreateCFProperty(usbInterface, + kUSBClassDriverProperty, + NULL, kNilOptions); kr = load_classdriver(driverBundlePath, intf, &klassDriver); if (kr != kIOReturnSuccess && driverBundlePath != NULL) kr = load_classdriver(NULL, intf, &klassDriver); - if (kr == kIOReturnSuccess && klassDriver != NULL) - kr = copy_deviceid(klassDriver, deviceID); + if (kr == kIOReturnSuccess && klassDriver != NULL) + kr = copy_deviceid(klassDriver, deviceID); unload_classdriver(&klassDriver); @@ -1089,7 +1419,7 @@ static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, CFRelease(driverBundlePath); /* (*intf)->Release(intf); */ - } + } IODestroyPlugInInterface(iodev); } } @@ -1100,29 +1430,35 @@ static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, * 'copy_value_for_key()' - Copy value string associated with a key. */ -static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys) +static CFStringRef copy_value_for_key(CFStringRef deviceID, + CFStringRef *keys) { CFStringRef value = NULL; CFArrayRef kvPairs = deviceID != NULL ? CFStringCreateArrayBySeparatingStrings(NULL, deviceID, CFSTR(";")) : NULL; CFIndex max = kvPairs != NULL ? CFArrayGetCount(kvPairs) : 0; CFIndex idx = 0; - while (idx < max && value == NULL) { + while (idx < max && value == NULL) + { CFStringRef kvpair = CFArrayGetValueAtIndex(kvPairs, idx); CFIndex idxx = 0; - while (keys[idxx] != NULL && value == NULL) { + while (keys[idxx] != NULL && value == NULL) + { CFRange range = CFStringFind(kvpair, keys[idxx], kCFCompareCaseInsensitive); - if (range.length != -1) { - if (range.location != 0) { + if (range.length != -1) + { + if (range.location != 0) + { CFMutableStringRef theString = CFStringCreateMutableCopy(NULL, 0, kvpair); CFStringTrimWhitespace(theString); range = CFStringFind(theString, keys[idxx], kCFCompareCaseInsensitive); - if (range.location == 0) { + if (range.location == 0) value = CFStringCreateWithSubstring(NULL, theString, CFRangeMake(range.length, CFStringGetLength(theString) - range.length)); - } + CFRelease(theString); } - else { + else + { CFStringRef theString = CFStringCreateWithSubstring(NULL, kvpair, CFRangeMake(range.length, CFStringGetLength(kvpair) - range.length)); CFMutableStringRef theString2 = CFStringCreateMutableCopy(NULL, 0, theString); CFRelease(theString); @@ -1137,21 +1473,20 @@ static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys) } if (kvPairs != NULL) - CFRelease(kvPairs); + CFRelease(kvPairs); return value; } /* - * 'cfstr_create_and_trim()' - Create a CFString from a c-string and - * trim it's whitespace characters. + * 'cfstr_create_trim()' - Create CFString and trim whitespace characters. */ -CFStringRef cfstr_create_and_trim(const char *cstr) +CFStringRef cfstr_create_trim(const char *cstr) { CFStringRef cfstr; CFMutableStringRef cfmutablestr = NULL; - + if ((cfstr = CFStringCreateWithCString(NULL, cstr, kCFStringEncodingUTF8)) != NULL) { if ((cfmutablestr = CFStringCreateMutableCopy(NULL, 1024, cfstr)) != NULL) @@ -1168,7 +1503,10 @@ CFStringRef cfstr_create_and_trim(const char *cstr) * 'parse_options()' - Parse uri options. */ -static void parse_options(const char *options, char *serial, UInt32 *location, Boolean *waitEOF) +static void parse_options(const char *options, + char *serial, + UInt32 *location, + Boolean *wait_eof) { char *serialnumber; /* ?serial= or ?location= */ char optionName[255], /* Name of option */ @@ -1185,15 +1523,17 @@ static void parse_options(const char *options, char *serial, UInt32 *location, B serialnumber = NULL; - while (*options != '\0') { + while (*options != '\0') + { /* Get the name... */ - for (ptr = optionName; *options && *options != '=' && *options != '+'; ) + for (ptr = optionName; *options && *options != '=' && *options != '+';) *ptr++ = *options++; *ptr = '\0'; value[0] = '\0'; - if (*options == '=') { + if (*options == '=') + { /* Get the value... */ options ++; @@ -1205,35 +1545,32 @@ static void parse_options(const char *options, char *serial, UInt32 *location, B if (*options == '+') options ++; } - else if (*options == '+') { + else if (*options == '+') options ++; - } /* * Process the option... */ - if (strcasecmp(optionName, "waiteof") == 0) { + if (strcasecmp(optionName, "waiteof") == 0) + { if (strcasecmp(value, "on") == 0 || strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0) { - *waitEOF = true; - } + strcasecmp(value, "true") == 0) + *wait_eof = true; else if (strcasecmp(value, "off") == 0 || strcasecmp(value, "no") == 0 || - strcasecmp(value, "false") == 0) { - *waitEOF = false; - } - else { + strcasecmp(value, "false") == 0) + *wait_eof = false; + else fprintf(stderr, _("WARNING: Boolean expected for waiteof option \"%s\"\n"), value); - } } - else if (strcasecmp(optionName, "serial") == 0) { + else if (strcasecmp(optionName, "serial") == 0) + { strcpy(serial, value); serialnumber = serial; } - else if (strcasecmp(optionName, "location") == 0 && location) { + else if (strcasecmp(optionName, "location") == 0 && location) *location = strtol(value, NULL, 16); - } } return; @@ -1259,7 +1596,8 @@ static void setup_cfLanguage(void) const char *requestedLang = NULL; requestedLang = getenv("LANG"); - if (requestedLang != NULL) { + if (requestedLang != NULL) + { lang[0] = CFStringCreateWithCString(kCFAllocatorDefault, requestedLang, kCFStringEncodingUTF8); langArray = CFArrayCreate(kCFAllocatorDefault, (const void **)lang, sizeof(lang) / sizeof(lang[0]), &kCFTypeArrayCallBacks); @@ -1268,9 +1606,9 @@ static void setup_cfLanguage(void) CFRelease(lang[0]); CFRelease(langArray); - } else { - fputs("DEBUG: usb: LANG environment variable missing.\n", stderr); } + else + fputs("DEBUG: usb: LANG environment variable missing.\n", stderr); } #pragma mark - @@ -1282,9 +1620,11 @@ static void setup_cfLanguage(void) * * @result Never returns; always calls exit(). * - * @discussion + * @discussion */ -static void run_ppc_backend(int argc, char *argv[], int fd) +static void run_ppc_backend(int argc, + char *argv[], + int fd) { int i; int exitstatus = 0; @@ -1301,12 +1641,14 @@ static void run_ppc_backend(int argc, char *argv[], int fd) */ usb_ppc_status = getenv("USB_PPC_STATUS"); - if (usb_ppc_status == NULL) { + if (usb_ppc_status == NULL) + { /* Catch SIGTERM if we are _not_ printing data from * stdin (otherwise you can't cancel raw jobs...) */ - if (fd != 0) { + if (fd != 0) + { #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ sigset(SIGTERM, sigterm_handler); #elif defined(HAVE_SIGACTION) @@ -1320,7 +1662,8 @@ static void run_ppc_backend(int argc, char *argv[], int fd) #endif /* HAVE_SIGSET */ } - if ((child_pid = fork()) == 0) { + if ((child_pid = fork()) == 0) + { /* Child comes here. */ setenv("USB_PPC_STATUS", "1", false); @@ -1340,8 +1683,9 @@ static void run_ppc_backend(int argc, char *argv[], int fd) fprintf(stderr, "DEBUG: execv: %s\n", strerror(errno)); exitstatus = errno; } - else if (child_pid > 0) { - /* Parent comes here. + else if (child_pid > 0) + { + /* Parent comes here. * * Close the fds we won't be using then wait for the child backend to exit. */ @@ -1353,24 +1697,28 @@ static void run_ppc_backend(int argc, char *argv[], int fd) while ((waitpid_status = waitpid(child_pid, &childstatus, 0)) == (pid_t)-1 && errno == EINTR) usleep(1000); - if (WIFSIGNALED(childstatus)) { + if (WIFSIGNALED(childstatus)) + { exitstatus = WTERMSIG(childstatus); fprintf(stderr, "DEBUG: usb(ppc) backend %d crashed on signal %d!\n", child_pid, exitstatus); } - else { + else + { if ((exitstatus = WEXITSTATUS(childstatus)) != 0) fprintf(stderr, "DEBUG: usb(ppc) backend %d stopped with status %d!\n", child_pid, exitstatus); else fprintf(stderr, "DEBUG: PID %d exited with no errors\n", child_pid); } } - else { + else + { /* fork() error */ fprintf(stderr, "DEBUG: fork: %s\n", strerror(errno)); exitstatus = errno; } } - else { + else + { fputs("DEBUG: usb child running i386 again\n", stderr); exitstatus = ENOENT; } @@ -1415,7 +1763,8 @@ static const char *next_line (const char *buffer) * 'parse_pserror()' - Scan the backchannel data for postscript errors. */ -static void parse_pserror (char *sockBuffer, int len) +static void parse_pserror(char *sockBuffer, + int len) { static char gErrorBuffer[1024] = ""; static char *gErrorBufferPtr = gErrorBuffer; @@ -1435,14 +1784,15 @@ static void parse_pserror (char *sockBuffer, int len) gErrorBufferPtr += len; *(gErrorBufferPtr + 1) = '\0'; - pLineEnd = (char *)next_line((const char *)gErrorBuffer); - while (pLineEnd != NULL) { + while (pLineEnd != NULL) + { *pLineEnd++ = '\0'; pCommentBegin = strstr(gErrorBuffer,"%%["); pCommentEnd = strstr(gErrorBuffer, "]%%"); - if (pCommentBegin != gErrorBuffer && pCommentEnd != NULL) { + if (pCommentBegin != gErrorBuffer && pCommentEnd != NULL) + { pCommentEnd += 3; /* Skip past "]%%" */ *pCommentEnd = '\0'; /* There's always room for the nul */ @@ -1453,7 +1803,8 @@ static void parse_pserror (char *sockBuffer, int len) else logLevel = "INFO"; - if ((logstrlen = snprintf(logstr, sizeof(logstr), "%s: %s\n", logLevel, pCommentBegin)) >= sizeof(logstr)) { + if ((logstrlen = snprintf(logstr, sizeof(logstr), "%s: %s\n", logLevel, pCommentBegin)) >= sizeof(logstr)) + { /* If the string was trucnated make sure it has a linefeed before the nul */ logstrlen = sizeof(logstr) - 1; logstr[logstrlen - 1] = '\n'; @@ -1471,263 +1822,90 @@ static void parse_pserror (char *sockBuffer, int len) /* - * 'read_thread()' - A thread to read the backchannel data. + * 'soft_reset' */ -static void *read_thread(void *reference) +static void soft_reset() { - /* post a read to the device and write results to stdout - * the final pending read will be Aborted in the main thread - */ - UInt8 readbuffer[512]; - UInt32 rbytes; - kern_return_t readstatus; - printer_data_t *userData = (printer_data_t *)reference; - classdriver_context_t **classdriver = userData->printerDriver; - struct mach_timebase_info timeBaseInfo; - uint64_t start, - delay; - - /* Calculate what 250 milliSeconds are in mach absolute time... - */ - mach_timebase_info(&timeBaseInfo); - delay = ((uint64_t)250000000 * (uint64_t)timeBaseInfo.denom) / (uint64_t)timeBaseInfo.numer; + fd_set input_set; /* Input set for select() */ + struct timeval stimeout; /* Timeout for select() */ + char buffer[2048]; /* Buffer */ + struct timespec cond_timeout; /* pthread condition timeout */ - do { - /* Remember when we started so we can throttle the loop after the read call... - */ - start = mach_absolute_time(); - - rbytes = sizeof(readbuffer); - readstatus = (*classdriver)->ReadPipe( classdriver, readbuffer, &rbytes ); - if ( kIOReturnSuccess == readstatus && rbytes > 0 ) { + /* + * Send an abort once a second until the I/O lock is released by the main thread... + */ - cupsBackChannelWrite((char*)readbuffer, rbytes, 1.0); - - /* cntrl-d is echoed by the printer. - * NOTES: - * Xerox Phaser 6250D doesn't echo the cntrl-d. - * Xerox Phaser 6250D doesn't always send the product query. - */ - if (userData->waitEOF && readbuffer[rbytes-1] == 0x4) - break; -#ifdef PARSE_PS_ERRORS - parse_pserror(readbuffer, rbytes); -#endif - } - - /* Make sure this loop executes no more than once every 250 miliseconds... - */ - if ((readstatus != kIOReturnSuccess || rbytes == 0) && (userData->waitEOF || !userData->done)) - mach_wait_until(start + delay); - - } while ( userData->waitEOF || !userData->done ); /* Abort from main thread tests error here */ + pthread_mutex_lock(&g.readwrite_lock_mutex); + while (g.readwrite_lock) + { + (*g.classdriver)->Abort(g.classdriver); - /* Let the other thread (main thread) know that we have completed the read thread... - */ - pthread_mutex_lock(&userData->readMutex); - pthread_cond_signal(&userData->readCompleteCondition); - pthread_mutex_unlock(&userData->readMutex); + cond_timeout.tv_sec = time(NULL) + 1; + cond_timeout.tv_nsec = 0; - return NULL; -} - -/* - * 'reqestWait_thread()' - A thread cupsSideChannelDoRequest wait. - */ -static void *reqestWait_thread(void *reference) { - printer_data_t *userData = (printer_data_t *)reference; - int datalen; - cups_sc_command_t command; - cups_sc_status_t status; - uint64_t start, delay; - struct mach_timebase_info timeBaseInfo; - char data[2048]; + pthread_cond_timedwait(&g.readwrite_lock_cond, &g.readwrite_lock_mutex, &cond_timeout); + } - /* - * Calculate what 100 milliSeconds are in mach absolute time... - */ - mach_timebase_info(&timeBaseInfo); - delay = ((uint64_t)100000000 * (uint64_t)timeBaseInfo.denom) / (uint64_t)timeBaseInfo.numer; + g.readwrite_lock = 1; + pthread_mutex_unlock(&g.readwrite_lock_mutex); - /* interface close wait mutex lock. */ - pthread_mutex_lock(&(userData->waitCloseMutex)); + /* + * Flush bytes waiting on print_fd... + */ - do { - /* - * Remember when we started so we can throttle the loop after the cupsSideChannelDoRequest call... - */ - start = mach_absolute_time(); + g.print_bytes = 0; - /* Poll for a command... */ - command=0; - datalen = sizeof(data); - bzero(data, sizeof(data)); - - if (!cupsSideChannelRead(&command, &status, data, &datalen, 0.0)) { - datalen = sizeof(data); - - switch (command) { - case CUPS_SC_CMD_SOFT_RESET: - /* do a soft reset */ - usbSoftReset(userData, &status); - datalen = 0; - userData->reqWaitDone = 1; - break; - case CUPS_SC_CMD_DRAIN_OUTPUT: - /* drain all pending output */ - usbDrainOutput(userData, &status); - datalen = 0; - break; - case CUPS_SC_CMD_GET_BIDI: - /* return whether the connection is bidirectional */ - usbGetBidirectional(userData, &status, data, &datalen); - break; - case CUPS_SC_CMD_GET_DEVICE_ID: - /* return the IEEE-1284 device ID */ - usbGetDeviceID(userData, &status, data, &datalen); - break; - case CUPS_SC_CMD_GET_STATE: - /* return the device state */ - usbGetDevState(userData, &status, data, &datalen); - break; - default: - status = CUPS_SC_STATUS_NOT_IMPLEMENTED; - datalen = 0; - break; - } + FD_ZERO(&input_set); + FD_SET(g.print_fd, &input_set); - if (userData->writeDone) { - status = CUPS_SC_STATUS_NONE; - } + stimeout.tv_sec = 0; + stimeout.tv_usec = 0; - /* Send a response... */ - cupsSideChannelWrite(command, status, data, datalen, 1.0); - } + while (select(g.print_fd+1, &input_set, NULL, NULL, &stimeout) > 0) + if (read(g.print_fd, buffer, sizeof(buffer)) <= 0) + break; - /* - * Make sure this loop executes no more than once every 500 miliseconds... - */ - if ((userData->waitEOF) || (!userData->reqWaitDone)) { - mach_wait_until(start + delay); - } - } while(!userData->reqWaitDone); + /* + * Send the reset... + */ - sleep(1); - pthread_mutex_lock(&userData->reqWaitMutex); - userData->reqWqitFlag = 1; - pthread_cond_signal(&userData->reqWaitCompCond); - pthread_mutex_unlock(&userData->reqWaitMutex); + (*g.classdriver)->SoftReset(g.classdriver, 0); - /* interface close wait mutex unlock. */ - pthread_mutex_unlock(&(userData->waitCloseMutex)); + /* + * Release the I/O lock... + */ - return NULL; + 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); } -#pragma mark - -/* - * 'usbSoftReset' - */ -static void usbSoftReset(printer_data_t *userData, cups_sc_status_t *status) { - OSStatus err; - - /* write stop. */ - userData->writeDone = 1; - - /* Abort (print_device()-WritePipe kIOReturnAborted return) */ - if (userData->printerDriver != NULL) - err = (*(userData->printerDriver))->Abort(userData->printerDriver); - - /* print_device() WritePipe_Loop break wait. */ - pthread_mutex_lock(&(userData->writeCompMutex)); - pthread_mutex_unlock(&(userData->writeCompMutex)); - - /* SoftReset */ - if (userData->printerDriver != NULL) - (*(userData->printerDriver))->SoftReset(userData->printerDriver, 0); - - if (status != NULL) - *status = CUPS_SC_STATUS_OK; -} /* - * 'usbDrainOutput' + * 'get_device_id()' - Return IEEE-1284 device ID. */ -static void usbDrainOutput(printer_data_t *userData, cups_sc_status_t *status) { - OSStatus osSts = noErr; /* Function results */ - OSStatus err = noErr; - UInt32 wbytes; /* Number of bytes written */ - ssize_t nbytes; /* Number of bytes read */ - char *bufptr; - - bufptr = userData->dataBuffer+userData->dataOffset; - nbytes = userData->dataSize; - - while((nbytes > 0) && (osSts == noErr)) { - wbytes = nbytes; - osSts = (*(userData->printerDriver))->WritePipe(userData->printerDriver, (UInt8*)bufptr, &wbytes, 0); - - if (wbytes < 0 || noErr != osSts) { - if (osSts != kIOReturnAborted) { - err = (*(userData->printerDriver))->Abort(userData->printerDriver); - break; - } - } - nbytes -= wbytes; - bufptr += wbytes; - } - - if (status != NULL) { - if ((osSts != noErr) || (err != noErr)) { - *status = CUPS_SC_STATUS_IO_ERROR; - } else { - *status = CUPS_SC_STATUS_OK; - } - } -} - -/* - * 'usbGetBidirectional' - */ -static void usbGetBidirectional(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen) { - *data = userData->directionalFlag; - *datalen = 1; - - if (status != NULL) - *status = CUPS_SC_STATUS_OK; -} - -/* - * 'usbGetDeviceID' - */ -static void usbGetDeviceID(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen) { +static void get_device_id(cups_sc_status_t *status, + char *data, + int *datalen) +{ UInt32 deviceLocation = 0; CFStringRef deviceIDString = NULL; /* GetDeviceID */ - copy_devicestring(userData->printerObj, &deviceIDString, &deviceLocation); - CFStringGetCString(deviceIDString, data, *datalen, kCFStringEncodingUTF8); - *datalen = strlen(data); - - if (status != NULL) { - *status = CUPS_SC_STATUS_OK; + copy_devicestring(g.printer_obj, &deviceIDString, &deviceLocation); + if (deviceIDString) + { + CFStringGetCString(deviceIDString, data, *datalen, kCFStringEncodingUTF8); + *datalen = strlen(data); + CFRelease(deviceIDString); } + *status = CUPS_SC_STATUS_OK; } -/* - * 'usbGetDevState' - */ -static void usbGetDevState(printer_data_t *userData, cups_sc_status_t *status, char *data, int *datalen) { - *data = CUPS_SC_STATE_ONLINE; - *datalen = 1; - - if (status != NULL) { - *status = CUPS_SC_STATUS_OK; - } -} /* - * End of "$Id: usb-darwin.c 6491 2007-04-30 18:21:52Z mike $". + * End of "$Id: usb-darwin.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/backend/usb-unix.c b/backend/usb-unix.c index 477fee2f6..c034a416f 100644 --- a/backend/usb-unix.c +++ b/backend/usb-unix.c @@ -1,5 +1,5 @@ /* - * "$Id: usb-unix.c 6510 2007-05-04 13:08:05Z mike $" + * "$Id: usb-unix.c 6591 2007-06-21 20:35:28Z mike $" * * USB port backend for the Common UNIX Printing System (CUPS). * @@ -578,7 +578,9 @@ side_cb(int print_fd, /* I - Print file */ switch (command) { case CUPS_SC_CMD_DRAIN_OUTPUT : - if (tcdrain(device_fd)) + if (backendDrainOutput(print_fd, device_fd)) + status = CUPS_SC_STATUS_IO_ERROR; + else if (tcdrain(device_fd)) status = CUPS_SC_STATUS_IO_ERROR; else status = CUPS_SC_STATUS_OK; @@ -618,5 +620,5 @@ side_cb(int print_fd, /* I - Print file */ /* - * End of "$Id: usb-unix.c 6510 2007-05-04 13:08:05Z mike $". + * End of "$Id: usb-unix.c 6591 2007-06-21 20:35:28Z mike $". */ diff --git a/berkeley/Makefile b/berkeley/Makefile index eb16d025c..762605e56 100644 --- a/berkeley/Makefile +++ b/berkeley/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # Berkeley commands makefile for the Common UNIX Printing System (CUPS). # @@ -62,6 +62,12 @@ install: all $(INSTALL_BIN) lprm $(BINDIR) $(INSTALL_DIR) -m 755 $(SBINDIR) $(INSTALL_BIN) lpc $(SBINDIR) + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -121,5 +127,5 @@ include Dependencies # -# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/cgi-bin/Makefile b/cgi-bin/Makefile index bf884689c..5826668fc 100644 --- a/cgi-bin/Makefile +++ b/cgi-bin/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6055 2006-10-23 00:11:55Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # CGI makefile for the Common UNIX Printing System (CUPS). # @@ -63,6 +63,12 @@ install: all for file in $(CGIS); do \ $(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \ done + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -170,5 +176,5 @@ include Dependencies # -# End of "$Id: Makefile 6055 2006-10-23 00:11:55Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/conf/mime.convs b/conf/mime.convs.in similarity index 95% rename from conf/mime.convs rename to conf/mime.convs.in index 97463d335..ec3291871 100644 --- a/conf/mime.convs +++ b/conf/mime.convs.in @@ -1,5 +1,5 @@ # -# "$Id: mime.convs 6405 2007-03-27 16:09:02Z mike $" +# "$Id: mime.convs.in 6566 2007-06-18 23:56:23Z mike $" # # DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW # VERSIONS OF CUPS. Instead, create a "local.convs" file that @@ -115,8 +115,8 @@ image/x-sun-raster application/vnd.cups-raster 100 imagetoraster # without the -oraw option. # -#application/octet-stream application/vnd.cups-raw 0 - +@DEFAULT_RAW_PRINTING@application/octet-stream application/vnd.cups-raw 0 - # -# End of "$Id: mime.convs 6405 2007-03-27 16:09:02Z mike $". +# End of "$Id: mime.convs.in 6566 2007-06-18 23:56:23Z mike $". # diff --git a/conf/mime.types b/conf/mime.types index a0d33ed08..ed53e7947 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -1,5 +1,5 @@ # -# "$Id: mime.types 6405 2007-03-27 16:09:02Z mike $" +# "$Id: mime.types 6545 2007-06-04 14:24:01Z mike $" # # MIME types file for the Common UNIX Printing System (CUPS). # @@ -78,20 +78,20 @@ application/pdf pdf string(0,%PDF) application/postscript ai eps ps string(0,%!) string(0,<04>%!) \ contains(0,128,<1B>%-12345X) + \ - (contains(0,1024,"LANGUAGE=POSTSCRIPT") \ - contains(0,1024,"LANGUAGE = Postscript") \ - contains(0,1024,"LANGUAGE = PostScript") \ - contains(0,1024,"LANGUAGE = POSTSCRIPT") \ - (contains(0,1024,<0a>%!) + \ - !contains(0,1024,"ENTER LANGUAGE"))) + (contains(0,4096,"LANGUAGE=POSTSCRIPT") \ + contains(0,4096,"LANGUAGE = Postscript") \ + contains(0,4096,"LANGUAGE = PostScript") \ + contains(0,4096,"LANGUAGE = POSTSCRIPT") \ + (contains(0,4096,<0a>%!) + \ + !contains(0,4096,"ENTER LANGUAGE"))) application/vnd.hp-HPGL hpgl string(0,<1B>&)\ string(0,<1B>E<1B>%0B) \ string(0,<1B>%-1B) string(0,<201B>)\ string(0,BP;) string(0,IN;) string(0,DF;) \ string(0,BPINPS;) \ (contains(0,128,<1B>%-12345X) + \ - (contains(0,1024,"LANGUAGE=HPGL") \ - contains(0,1024,"LANGUAGE = HPGL"))) + (contains(0,4096,"LANGUAGE=HPGL") \ + contains(0,4096,"LANGUAGE = HPGL"))) ######################################################################## # @@ -180,5 +180,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \ application/octet-stream # -# End of "$Id: mime.types 6405 2007-03-27 16:09:02Z mike $". +# End of "$Id: mime.types 6545 2007-06-04 14:24:01Z mike $". # diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 765c5109d..2b84c2bfb 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 6370 2007-03-20 14:36:12Z mike $" +dnl "$Id: cups-common.m4 6564 2007-06-18 23:40:38Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -196,10 +196,22 @@ CUPS_SYSTEM_AUTHKEY="" AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto]) +AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order], + LIBCUPSORDER="$withval", + LIBCUPSORDER="libcups.order") +AC_SUBST(LIBCUPSORDER) + +FONTS="fonts" +AC_SUBST(FONTS) +LEGACY_BACKENDS="parallel scsi" +AC_SUBST(LEGACY_BACKENDS) + case $uname in Darwin*) + FONTS="" + LEGACY_BACKENDS="" BACKLIBS="-framework IOKit" - CUPSDLIBS="-framework IOKit -framework SystemConfiguration" + CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration" LIBS="-framework CoreFoundation $LIBS" dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString... @@ -281,5 +293,5 @@ AC_SUBST(DEFAULT_IPP_PORT) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT) dnl -dnl End of "$Id: cups-common.m4 6370 2007-03-20 14:36:12Z mike $". +dnl End of "$Id: cups-common.m4 6564 2007-06-18 23:40:38Z mike $". dnl diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index e2e0585e4..e0426aa5b 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-compiler.m4 6447 2007-04-10 18:02:00Z mike $" +dnl "$Id: cups-compiler.m4 6562 2007-06-18 21:51:10Z mike $" dnl dnl Compiler stuff for the Common UNIX Printing System (CUPS). dnl @@ -39,11 +39,20 @@ AC_ARG_WITH(archflags, [ --with-archflags="flags" if test -z "$with_archflags"; then ARCHFLAGS="" + LDARCHFLAGS="" else ARCHFLAGS="$with_archflags" + if test "$uname" = Darwin; then + # Only link 32-bit programs - 64-bit is for the shared + # libraries... + LDARCHFLAGS="`echo $ARCHFLAGS | sed -e '1,$s/-arch x86_64//' -e '1,$s/-arch ppc64//'`" + else + LDARCHFLAGS="$ARCHFLAGS" + fi fi AC_SUBST(ARCHFLAGS) +AC_SUBST(LDARCHFLAGS) dnl Setup support for separate 32/64-bit library generation... AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags" @@ -449,5 +458,5 @@ case $uname in esac dnl -dnl End of "$Id: cups-compiler.m4 6447 2007-04-10 18:02:00Z mike $". +dnl End of "$Id: cups-compiler.m4 6562 2007-06-18 21:51:10Z mike $". dnl diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index 5edcbb433..06393e115 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-defaults.m4 6529 2007-05-08 19:48:20Z mike $" +dnl "$Id: cups-defaults.m4 6568 2007-06-18 23:58:08Z mike $" dnl dnl Default cupsd configuration settings for the Common UNIX Printing System dnl (CUPS). @@ -142,11 +142,11 @@ fi AC_SUBST(CUPS_IMPLICIT_CLASSES) dnl Default UseNetworkDefault -AC_ARG_ENABLE(network_default, [ --enable-use-network-default +AC_ARG_ENABLE(use_network_default, [ --enable-use-network-default enable UseNetworkDefault by default, default=auto]) -if test "x$enable_network_default" != xno; then +if test "x$enable_use_network_default" != xno; then AC_MSG_CHECKING(whether to use network default printers) - if test "x$enable_network_default" = xyes -o $uname != Darwin; then + if test "x$enable_use_network_default" = xyes -o $uname != Darwin; then CUPS_USE_NETWORK_DEFAULT="Yes" AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1) AC_MSG_RESULT(yes) @@ -293,6 +293,22 @@ AC_ARG_WITH(max-copies, [ --with-max-copies set max copies value, default AC_SUBST(CUPS_MAX_COPIES) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_MAX_COPIES, $CUPS_MAX_COPIES) +dnl Default raw printing state +AC_ARG_ENABLE(raw_printing, [ --enable-raw-printing enable raw printing by default, default=auto]) +if test "x$enable_raw_printing" != xno; then + AC_MSG_CHECKING(whether to enable raw printing) + if test "x$enable_raw_printing" = xyes -o $uname = Darwin; then + DEFAULT_RAW_PRINTING="" + AC_MSG_RESULT(yes) + else + DEFAULT_RAW_PRINTING="#" + AC_MSG_RESULT(no) + fi +else + DEFAULT_RAW_PRINTING="#" +fi +AC_SUBST(DEFAULT_RAW_PRINTING) + dnl -dnl End of "$Id: cups-defaults.m4 6529 2007-05-08 19:48:20Z mike $". +dnl End of "$Id: cups-defaults.m4 6568 2007-06-18 23:58:08Z mike $". dnl diff --git a/config-scripts/cups-dnssd.m4 b/config-scripts/cups-dnssd.m4 index 360910a0d..acdc98a02 100644 --- a/config-scripts/cups-dnssd.m4 +++ b/config-scripts/cups-dnssd.m4 @@ -11,11 +11,11 @@ dnl Copyright ... dnl dnl -AC_ARG_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes]) -AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library], +AC_ARG_ENABLE(dnssd, [ --enable-dnssd turn on DNS Service Discovery support, default=yes]) +AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library], LDFLAGS="-L$withval $LDFLAGS" DSOFLAGS="-L$withval $DSOFLAGS",) -AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes], +AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Service Discovery includes], CFLAGS="-I$withval $CFLAGS" CXXFLAGS="-I$withval $CXXFLAGS" CPPFLAGS="-I$withval $CPPFLAGS",) diff --git a/config-scripts/cups-gssapi.m4 b/config-scripts/cups-gssapi.m4 index e9b138081..c1394afcd 100644 --- a/config-scripts/cups-gssapi.m4 +++ b/config-scripts/cups-gssapi.m4 @@ -42,10 +42,19 @@ if test x$enable_gssapi != xno; then fi AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) else - # Solaris provides its own GSSAPI implementation... - AC_CHECK_LIB(gss, gss_display_status, - AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) - LIBGSSAPI="-lgss") + # Check for vendor-specific implementations... + case "$uname" in + HP-UX*) + AC_CHECK_LIB(gss, gss_display_status, + AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) + LIBGSSAPI="-lgss -lgssapi_krb5") + ;; + SunOS*) + AC_CHECK_LIB(gss, gss_display_status, + AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) + LIBGSSAPI="-lgss") + ;; + esac fi if test "x$LIBGSSAPI" != x; then @@ -60,6 +69,7 @@ if test x$enable_gssapi != xno; then AC_CHECK_FUNC(gsskrb5_register_acceptor_identity, AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY)) + AC_CHECK_FUNC(krb5_cc_resolve, AC_DEFINE(KRB5_CC_RESOLVE)) AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE) if test $ac_cv_header_gssapi_gssapi_h = yes; then diff --git a/config.h.in b/config.h.in index 20fe8ce70..9bbbab61c 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,5 @@ /* - * "$Id: config.h.in 6370 2007-03-20 14:36:12Z mike $" + * "$Id: config.h.in 6569 2007-06-19 00:16:59Z mike $" * * Configuration file for the Common UNIX Printing System (CUPS). * @@ -503,6 +503,7 @@ #undef HAVE_GSSAPI_GSSAPI_KRB5_H #undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE +#undef HAVE_KRB5_CC_RESOLVE #undef HAVE_KRB5_H #undef HAVE_HEIMDAL @@ -533,5 +534,5 @@ #endif /* !_CUPS_CONFIG_H_ */ /* - * End of "$Id: config.h.in 6370 2007-03-20 14:36:12Z mike $". + * End of "$Id: config.h.in 6569 2007-06-19 00:16:59Z mike $". */ diff --git a/configure.in b/configure.in index 0850d8d23..bfbe2cd8d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl -dnl "$Id: configure.in 6488 2007-04-30 17:45:57Z mike $" +dnl "$Id: configure.in 6566 2007-06-18 23:56:23Z mike $" dnl dnl Configuration script for the Common UNIX Printing System (CUPS). dnl @@ -76,7 +76,7 @@ AC_SUBST(INSTALL_LANGUAGES) AC_SUBST(UNINSTALL_LANGUAGES) AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config - conf/cupsd.conf conf/pam.std doc/index.html + conf/cupsd.conf conf/mime.convs conf/pam.std doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html man/client.conf.man man/cups-deviced.man man/cups-driverd.man man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man @@ -87,5 +87,5 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config chmod +x cups-config dnl -dnl End of "$Id: configure.in 6488 2007-04-30 17:45:57Z mike $". +dnl End of "$Id: configure.in 6566 2007-06-18 23:56:23Z mike $". dnl diff --git a/cups/Makefile b/cups/Makefile index 36c170baa..c78edbffb 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6304 2007-02-22 22:06:23Z mike $" +# "$Id: Makefile 6603 2007-06-22 22:23:21Z mike $" # # API library Makefile for the Common UNIX Printing System (CUPS). # @@ -78,6 +78,7 @@ OBJS = \ $(LIB64OBJS) \ testadmin.o \ testarray.o \ + testcups.o \ testfile.o \ testhttp.o \ testi18n.o \ @@ -118,6 +119,7 @@ TARGETS = \ libcups.a \ testadmin \ testarray \ + testcups \ testfile \ testhttp \ testi18n \ @@ -173,6 +175,12 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64) $(RM) $(LIBDIR)/libcups.dylib; \ $(LN) $(LIBCUPS) $(LIBDIR)/libcups.dylib; \ fi + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi installstatic: $(INSTALL_DIR) -m 755 $(LIBDIR) @@ -265,12 +273,14 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS) # libcups.2.dylib # -libcups.2.dylib: $(LIBOBJS) +libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER) echo Linking $@... $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \ -install_name $(libdir)/$@ \ -current_version 2.8.0 \ -compatibility_version 2.0.0 \ + -exported_symbols_list libcups.exp \ + -sectorder __TEXT __text $(LIBCUPSORDER) \ $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) $(RM) libcups.dylib $(LN) $@ libcups.dylib @@ -352,6 +362,16 @@ testarray: testarray.o libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) +# +# testcups (dependency on static CUPS library is intentional) +# + +testcups: testcups.o libcups.a + echo Linking $@... + $(CC) $(LDFLAGS) -o $@ testcups.o libcups.a \ + $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) + + # # testfile (dependency on static CUPS library is intentional) # @@ -451,5 +471,5 @@ include Dependencies # -# End of "$Id: Makefile 6304 2007-02-22 22:06:23Z mike $". +# End of "$Id: Makefile 6603 2007-06-22 22:23:21Z mike $". # diff --git a/cups/adminutil.c b/cups/adminutil.c index a58f57906..57a656d94 100644 --- a/cups/adminutil.c +++ b/cups/adminutil.c @@ -1,5 +1,5 @@ /* - * "$Id: adminutil.c 6435 2007-04-02 22:43:39Z mike $" + * "$Id: adminutil.c 6549 2007-06-04 15:32:58Z mike $" * * Administration utility API definitions for the Common UNIX Printing * System (CUPS). @@ -1335,14 +1335,21 @@ _cupsAdminSetServerSettings( { if (!wrote_browsing) { + int new_remote_printers = (remote_printers > 0 || + (remote_printers == -1 && + old_remote_printers > 0)); + int new_share_printers = (share_printers > 0 || + (share_printers == -1 && + old_share_printers > 0)); + wrote_browsing = 1; - if (remote_printers > 0 || share_printers > 0) + if (new_remote_printers || new_share_printers) { - if (remote_printers > 0 && share_printers > 0) + if (new_remote_printers && new_share_printers) cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n"); - else if (remote_printers > 0) + else if (new_remote_printers) cupsFilePuts(temp, "# Show shared printers on the local network.\n"); else @@ -1352,10 +1359,10 @@ _cupsAdminSetServerSettings( cupsFilePuts(temp, "Browsing On\n"); cupsFilePuts(temp, "BrowseOrder allow,deny\n"); - if (remote_printers > 0) + if (new_remote_printers) cupsFilePuts(temp, "BrowseAllow all\n"); - if (share_printers > 0) + if (new_share_printers) cupsFilePuts(temp, "BrowseAddress @LOCAL\n"); } else @@ -2209,5 +2216,5 @@ write_option(cups_file_t *dstfp, /* I - PPD file */ /* - * End of "$Id: adminutil.c 6435 2007-04-02 22:43:39Z mike $". + * End of "$Id: adminutil.c 6549 2007-06-04 15:32:58Z mike $". */ diff --git a/cups/cups.h b/cups/cups.h index 88b4d50de..1e446cf05 100644 --- a/cups/cups.h +++ b/cups/cups.h @@ -1,5 +1,5 @@ /* - * "$Id: cups.h 6506 2007-05-03 18:12:35Z mike $" + * "$Id: cups.h 6590 2007-06-21 18:22:22Z mike $" * * API definitions for the Common UNIX Printing System (CUPS). * @@ -107,6 +107,7 @@ enum cups_ptype_e /* Not a typedef'd enum so we can OR */ CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */ CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */ CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */ + CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3@ */ CUPS_PRINTER_OPTIONS = 0xe6fffc /* ~(CLASS | REMOTE | IMPLICIT) */ }; @@ -264,5 +265,5 @@ extern void cupsSetDefaultDest(const char *name, #endif /* !_CUPS_CUPS_H_ */ /* - * End of "$Id: cups.h 6506 2007-05-03 18:12:35Z mike $". + * End of "$Id: cups.h 6590 2007-06-21 18:22:22Z mike $". */ diff --git a/cups/libcups.exp b/cups/libcups.exp new file mode 100644 index 000000000..ed3332bca --- /dev/null +++ b/cups/libcups.exp @@ -0,0 +1,296 @@ +__cups_strcpy +__cupsAdminGetServerSettings +__cupsAdminSetServerSettings +__cupsCharmapFlush +__cupsCharmapFree +__cupsCharmapGet +__cupsEncodingName +__cupsGetPassword +__cupsGlobals +__cupsLangPrintf +__cupsLangPuts +__cupsLangString +__cupsMD5Append +__cupsMD5Finish +__cupsMD5Init +__cupsMessageFree +__cupsMessageLoad +__cupsMessageLookup +__cupsSetError +__cupsSetLocale +__cupsStrAlloc +__cupsStrFlush +__cupsStrFormatd +__cupsStrFree +__cupsStrScand +__cupsStrStatistics +__httpReadCDSA +__httpWriteCDSA +__ippAddAttr +__ippFindOption +__ippFreeAttr +__ppdGetEncoding +_cupsAddDest +_cupsAddOption +_cupsAdminCreateWindowsPPD +_cupsAdminExportSamba +_cupsAdminGetServerSettings +_cupsAdminSetServerSettings +_cupsArrayAdd +_cupsArrayClear +_cupsArrayCount +_cupsArrayCurrent +_cupsArrayDelete +_cupsArrayDup +_cupsArrayFind +_cupsArrayFirst +_cupsArrayGetIndex +_cupsArrayGetInsert +_cupsArrayIndex +_cupsArrayInsert +_cupsArrayLast +_cupsArrayNew +_cupsArrayNew2 +_cupsArrayNext +_cupsArrayPrev +_cupsArrayRemove +_cupsArrayRestore +_cupsArraySave +_cupsArrayUserData +_cupsBackChannelRead +_cupsBackChannelWrite +_cupsBackendDeviceURI +_cupsCancelJob +_cupsCharsetToUTF8 +_cupsDirClose +_cupsDirOpen +_cupsDirRead +_cupsDirRewind +_cupsDoAuthentication +_cupsDoFileRequest +_cupsDoIORequest +_cupsDoRequest +_cupsEncodeOptions +_cupsEncodeOptions2 +_cupsEncryption +_cupsFileClose +_cupsFileCompression +_cupsFileEOF +_cupsFileFind +_cupsFileFlush +_cupsFileGetChar +_cupsFileGetConf +_cupsFileGetLine +_cupsFileGets +_cupsFileLock +_cupsFileNumber +_cupsFileOpen +_cupsFileOpenFd +_cupsFilePeekChar +_cupsFilePrintf +_cupsFilePutChar +_cupsFilePuts +_cupsFileRead +_cupsFileRewind +_cupsFileSeek +_cupsFileStderr +_cupsFileStdin +_cupsFileStdout +_cupsFileTell +_cupsFileUnlock +_cupsFileWrite +_cupsFreeDests +_cupsFreeJobs +_cupsFreeOptions +_cupsGetClasses +_cupsGetDefault +_cupsGetDefault2 +_cupsGetDest +_cupsGetDests +_cupsGetDests2 +_cupsGetFd +_cupsGetFile +_cupsGetJobs +_cupsGetJobs2 +_cupsGetOption +_cupsGetPassword +_cupsGetPPD +_cupsGetPPD2 +_cupsGetPrinters +_cupsGetServerPPD +_cupsLangDefault +_cupsLangEncoding +_cupsLangFlush +_cupsLangFree +_cupsLangGet +_cupsLastError +_cupsLastErrorString +_cupsMarkOptions +_cupsNotifySubject +_cupsNotifyText +_cupsParseOptions +_cupsPrintFile +_cupsPrintFile2 +_cupsPrintFiles +_cupsPrintFiles2 +_cupsPutFd +_cupsPutFile +_cupsRemoveDest +_cupsRemoveOption +_cupsServer +_cupsSetDefaultDest +_cupsSetDests +_cupsSetDests2 +_cupsSetEncryption +_cupsSetPasswordCB +_cupsSetServer +_cupsSetUser +_cupsSideChannelDoRequest +_cupsSideChannelRead +_cupsSideChannelWrite +_cupsTempFd +_cupsTempFile +_cupsTempFile2 +_cupsUser +_cupsUTF32ToUTF8 +_cupsUTF8ToCharset +_cupsUTF8ToUTF32 +_httpAddrAny +_httpAddrConnect +_httpAddrEqual +_httpAddrFreeList +_httpAddrGetList +_httpAddrLength +_httpAddrLocalhost +_httpAddrLookup +_httpAddrString +_httpAssembleURI +_httpAssembleURIf +_httpBlocking +_httpCheck +_httpClearCookie +_httpClearFields +_httpClose +_httpConnect +_httpConnectEncrypt +_httpDecode64 +_httpDecode64_2 +_httpDelete +_httpEncode64 +_httpEncode64_2 +_httpEncryption +_httpError +_httpFlush +_httpFlushWrite +_httpGet +_httpGetBlocking +_httpGetCookie +_httpGetDateString +_httpGetDateString2 +_httpGetDateTime +_httpGetFd +_httpGetField +_httpGetHostByName +_httpGetHostname +_httpGetLength +_httpGetLength2 +_httpGets +_httpGetStatus +_httpGetSubField +_httpGetSubField2 +_httpHead +_httpInitialize +_httpMD5 +_httpMD5Final +_httpMD5String +_httpOptions +_httpPost +_httpPrintf +_httpPut +_httpRead +_httpRead2 +_httpReconnect +_httpSeparate +_httpSeparate2 +_httpSeparateURI +_httpSetCookie +_httpSetExpect +_httpSetField +_httpSetLength +_httpStatus +_httpTrace +_httpUpdate +_httpWait +_httpWrite +_httpWrite2 +_ippAddBoolean +_ippAddBooleans +_ippAddCollection +_ippAddCollections +_ippAddDate +_ippAddInteger +_ippAddIntegers +_ippAddOctetString +_ippAddRange +_ippAddRanges +_ippAddResolution +_ippAddResolutions +_ippAddSeparator +_ippAddString +_ippAddStrings +_ippDateToTime +_ippDelete +_ippDeleteAttribute +_ippErrorString +_ippErrorValue +_ippFindAttribute +_ippFindNextAttribute +_ippLength +_ippNew +_ippNewRequest +_ippOpString +_ippOpValue +_ippPort +_ippRead +_ippReadFile +_ippReadIO +_ippSetPort +_ippTimeToDate +_ippWrite +_ippWriteFile +_ippWriteIO +_ppdClose +_ppdCollect +_ppdCollect2 +_ppdConflicts +_ppdEmit +_ppdEmitAfterOrder +_ppdEmitFd +_ppdEmitJCL +_ppdEmitJCLEnd +_ppdEmitString +_ppdErrorString +_ppdFindAttr +_ppdFindChoice +_ppdFindCustomOption +_ppdFindCustomParam +_ppdFindMarkedChoice +_ppdFindNextAttr +_ppdFindOption +_ppdFirstCustomParam +_ppdFirstOption +_ppdIsMarked +_ppdLastError +_ppdLocalize +_ppdMarkDefaults +_ppdMarkOption +_ppdNextCustomParam +_ppdNextOption +_ppdOpen +_ppdOpen2 +_ppdOpenFd +_ppdOpenFile +_ppdPageLength +_ppdPageSize +_ppdPageWidth +_ppdSetConformance diff --git a/cups/libcups.order b/cups/libcups.order new file mode 100755 index 000000000..92820f7c2 --- /dev/null +++ b/cups/libcups.order @@ -0,0 +1 @@ +single module:dyld_stub_binding_helper diff --git a/cups/localize.c b/cups/localize.c index bf3a5303b..0482588ce 100644 --- a/cups/localize.c +++ b/cups/localize.c @@ -1,5 +1,5 @@ /* - * "$Id: localize.c 6457 2007-04-17 18:40:55Z mike $" + * "$Id: localize.c 6602 2007-06-22 22:13:13Z mike $" * * PPD custom option routines for the Common UNIX Printing System (CUPS). * @@ -201,6 +201,22 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */ cupsArrayRestore(ppd->sorted_attrs); } + /* + * Translate printer presets... + */ + + for (attr = ppdFindAttr(ppd, "APPrinterPreset", NULL); + attr; + attr = ppdFindNextAttr(ppd, "APPrinterPreset", NULL)) + { + cupsArraySave(ppd->sorted_attrs); + + if ((text = ppd_text(ppd, "APPrinterPreset", attr->spec, ll_CC, ll)) != NULL) + strlcpy(attr->text, text, sizeof(attr->text)); + + cupsArrayRestore(ppd->sorted_attrs); + } + return (0); } @@ -265,5 +281,5 @@ ppd_text(ppd_file_t *ppd, /* I - PPD file */ /* - * End of "$Id: localize.c 6457 2007-04-17 18:40:55Z mike $". + * End of "$Id: localize.c 6602 2007-06-22 22:13:13Z mike $". */ diff --git a/cups/mark.c b/cups/mark.c index 6f68d6b00..052136e68 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -1,5 +1,5 @@ /* - * "$Id: mark.c 6477 2007-04-25 19:55:45Z mike $" + * "$Id: mark.c 6558 2007-06-18 18:11:49Z mike $" * * Option marking routines for the Common UNIX Printing System (CUPS). * @@ -112,7 +112,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */ key.option = o1; if ((c1 = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key)) != NULL && - !c1->marked) + (!c1->marked || strcmp(c->choice1, c1->choice))) c1 = NULL; } else if (!c1) @@ -150,7 +150,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */ key.option = o2; if ((c2 = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key)) != NULL && - !c2->marked) + (!c2->marked || strcmp(c->choice2, c2->choice))) c2 = NULL; } else if (!c2) @@ -730,5 +730,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */ /* - * End of "$Id: mark.c 6477 2007-04-25 19:55:45Z mike $". + * End of "$Id: mark.c 6558 2007-06-18 18:11:49Z mike $". */ diff --git a/cups/options.c b/cups/options.c index 12305b1b6..e4b7bbb88 100644 --- a/cups/options.c +++ b/cups/options.c @@ -1,5 +1,5 @@ /* - * "$Id: options.c 6310 2007-02-27 14:20:39Z mike $" + * "$Id: options.c 6601 2007-06-22 21:27:22Z mike $" * * Option routines for the Common UNIX Printing System (CUPS). * @@ -31,6 +31,7 @@ * cupsMarkOptions() - Mark command-line options in a PPD file. * cupsParseOptions() - Parse options from a command-line argument. * cupsRemoveOptions() - Remove an option from an option array. + * ppd_mark_choices() - Mark one or more option choices from a string. */ /* @@ -44,6 +45,13 @@ #include "debug.h" +/* + * Local functions... + */ + +static int ppd_mark_choices(ppd_file_t *ppd, const char *options); + + /* * 'cupsAddOption()' - Add an option to an option array. */ @@ -171,6 +179,7 @@ cupsMarkOptions( const char *page_size; /* PageSize option */ cups_option_t *optptr; /* Current option */ ppd_option_t *option; /* PPD option */ + ppd_attr_t *attr; /* PPD attribute */ static const char * const duplex_options[] = { /* Duplex option names */ "Duplex", /* Adobe */ @@ -387,6 +396,51 @@ cupsMarkOptions( } } } + else if (!strcasecmp(optptr->name, "finishings")) + { + /* + * Lookup cupsIPPFinishings attributes for each value... + */ + + for (ptr = optptr->value; *ptr;) + { + /* + * Get the next finishings number... + */ + + if (!isdigit(*ptr & 255)) + break; + + if ((j = strtol(ptr, &ptr, 10)) < 3) + break; + + /* + * Skip separator as needed... + */ + + if (*ptr == ',') + ptr ++; + + /* + * Look it up in the PPD file... + */ + + sprintf(s, "%d", j); + + if ((attr = ppdFindAttr(ppd, "cupsIPPFinishings", s)) == NULL) + continue; + + /* + * Apply "*Option Choice" settings from the attribute value... + */ + + if (ppd_mark_choices(ppd, attr->value)) + conflict = 1; + } + } + else if (!strcasecmp(optptr->name, "mirror") && + ppdMarkOption(ppd, "MirrorPrint", optptr->value)) + conflict = 1; else if (ppdMarkOption(ppd, optptr->name, optptr->value)) conflict = 1; @@ -651,5 +705,87 @@ cupsRemoveOption( /* - * End of "$Id: options.c 6310 2007-02-27 14:20:39Z mike $". + * 'ppd_mark_choices()' - Mark one or more option choices from a string. + */ + +static int /* O - 1 if there are conflicts, 0 otherwise */ +ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */ + const char *options) /* I - "*Option Choice ..." string */ +{ + char option[PPD_MAX_NAME], /* Current option */ + choice[PPD_MAX_NAME], /* Current choice */ + *ptr; /* Pointer into option or choice */ + int conflict = 0; /* Do we have a conflict? */ + + + if (!options) + return (0); + + /* + * Read all of the "*Option Choice" pairs from the string, marking PPD + * options as we go... + */ + + while (*options) + { + /* + * Skip leading whitespace... + */ + + while (isspace(*options & 255)) + options ++; + + if (*options != '*') + break; + + /* + * Get the option name... + */ + + options ++; + ptr = option; + while (*options && !isspace(*options & 255) && + ptr < (option + sizeof(option) - 1)) + *ptr++ = *options++; + + if (ptr == option) + break; + + *ptr = '\0'; + + /* + * Get the choice... + */ + + while (isspace(*options & 255)) + options ++; + + if (!*options) + break; + + ptr = choice; + while (*options && !isspace(*options & 255) && + ptr < (choice + sizeof(choice) - 1)) + *ptr++ = *options++; + + *ptr = '\0'; + + /* + * Mark the option... + */ + + if (ppdMarkOption(ppd, option, choice)) + conflict = 1; + } + + /* + * Return whether we had any conflicts... + */ + + return (conflict); +} + + +/* + * End of "$Id: options.c 6601 2007-06-22 21:27:22Z mike $". */ diff --git a/cups/ppd.c b/cups/ppd.c index d68a1209c..884244878 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -1,5 +1,5 @@ /* - * "$Id: ppd.c 6479 2007-04-27 11:44:10Z mike $" + * "$Id: ppd.c 6586 2007-06-21 17:44:22Z mike $" * * PPD file routines for the Common UNIX Printing System (CUPS). * @@ -1022,11 +1022,15 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ if ((option = ppdFindOption(ppd, keyword + 6)) == NULL) { + int groupidx = -1; /* Index for current group */ ppd_group_t *gtemp; /* Temporary group */ DEBUG_printf(("%s option not found for %s...\n", keyword + 6, keyword)); + if (group) + groupidx = group - ppd->groups; /* Save index for current group */ + if ((gtemp = ppd_get_group(ppd, "General", _("General"), cg, encoding)) == NULL) { @@ -1035,6 +1039,9 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ goto error; } + if (group) + group = ppd->groups + groupidx; /* Restore group pointer */ + if ((option = ppd_get_option(gtemp, keyword + 6)) == NULL) { DEBUG_printf(("Unable to get %s option!\n", keyword + 6)); @@ -1088,8 +1095,12 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ if ((option = ppdFindOption(ppd, "PageRegion")) == NULL) { + int groupidx = -1; /* Index to current group */ ppd_group_t *gtemp; /* Temporary group */ + if (group) + groupidx = group - ppd->groups; /* Save index for current group */ + if ((gtemp = ppd_get_group(ppd, "General", _("General"), cg, encoding)) == NULL) { @@ -1098,6 +1109,9 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ goto error; } + if (group) + group = ppd->groups + groupidx; /* Restore group pointer */ + option = ppd_get_option(gtemp, "PageRegion"); } @@ -3179,5 +3193,5 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ /* - * End of "$Id: ppd.c 6479 2007-04-27 11:44:10Z mike $". + * End of "$Id: ppd.c 6586 2007-06-21 17:44:22Z mike $". */ diff --git a/cups/tempfile.c b/cups/tempfile.c index f7fd876dc..9375edc46 100644 --- a/cups/tempfile.c +++ b/cups/tempfile.c @@ -1,5 +1,5 @@ /* - * "$Id: tempfile.c 6039 2006-10-17 02:24:34Z mike $" + * "$Id: tempfile.c 6599 2007-06-22 18:11:12Z mike $" * * Temp file utilities for the Common UNIX Printing System (CUPS). * @@ -80,17 +80,19 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */ tmpdir = tmppath; } #else - if ((tmpdir = getenv("TMPDIR")) == NULL) - { - /* - * Put root temp files in restricted temp directory... - */ + /* + * Previously we put root temporary files in the default CUPS temporary + * directory under /var/spool/cups. However, since the scheduler cleans + * out temporary files there and runs independently of the user apps, we + * don't want to use it unless specifically told to by cupsd. + */ - if (getuid() == 0) - tmpdir = CUPS_REQUESTS "/tmp"; - else - tmpdir = "/tmp"; - } + if ((tmpdir = getenv("TMPDIR")) == NULL) +# ifdef __APPLE__ + tmpdir = "/private/tmp"; /* /tmp is a symlink to /private/tmp */ +# else + tmpdir = "/tmp"; +# endif /* __APPLE__ */ #endif /* WIN32 */ /* @@ -238,5 +240,5 @@ cupsTempFile2(char *filename, /* I - Pointer to buffer */ /* - * End of "$Id: tempfile.c 6039 2006-10-17 02:24:34Z mike $". + * End of "$Id: tempfile.c 6599 2007-06-22 18:11:12Z mike $". */ diff --git a/cups/testcups.c b/cups/testcups.c new file mode 100644 index 000000000..d9f391f0e --- /dev/null +++ b/cups/testcups.c @@ -0,0 +1,183 @@ +/* + * "$Id$" + * + * CUPS API test program for the Common UNIX Printing System (CUPS). + * + * Copyright 2007 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products and are protected by Federal + * copyright law. Distribution and use rights are outlined in the file + * "LICENSE.txt" which should have been included with this file. If this + * file is missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * main() - Main entry. + */ + +/* + * Include necessary headers... + */ + +#include +#include +#include "cups.h" + + +/* + * 'main()' - Main entry. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ +{ + int status = 0, /* Exit status */ + num_dests; /* Number of destinations */ + cups_dest_t *dests, /* Destinations */ + *dest; /* Current destination */ + const char *ppdfile; /* PPD file */ + ppd_file_t *ppd; /* PPD file data */ + int num_jobs; /* Number of jobs for queue */ + cups_job_t *jobs; /* Jobs for queue */ + + + /* + * cupsGetDests() + */ + + fputs("cupsGetDests: ", stdout); + fflush(stdout); + + num_dests = cupsGetDests(&dests); + + if (num_dests == 0) + { + puts("FAIL"); + return (1); + } + else + puts("PASS"); + + /* + * cupsGetDest(printer) + */ + + printf("cupsGetDest(\"%s\"): ", dests[num_dests / 2].name); + fflush(stdout); + + if ((dest = cupsGetDest(dests[num_dests / 2].name, NULL, num_dests, + dests)) == NULL) + { + status = 1; + puts("FAIL"); + } + else + puts("PASS"); + + /* + * cupsGetDest(NULL) + */ + + fputs("cupsGetDest(NULL): ", stdout); + fflush(stdout); + + if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) == NULL) + { + status = 1; + puts("FAIL"); + } + else + puts("PASS"); + + /* + * cupsPrintFile() + */ + + fputs("cupsPrintFile: ", stdout); + fflush(stdout); + + if (cupsPrintFile(dest->name, "../data/testprint.ps", "Test Page", + dest->num_options, dest->options) <= 0) + { + status = 1; + puts("FAIL"); + } + else + puts("PASS"); + + /* + * cupsGetPPD(printer) + */ + + fputs("cupsGetPPD(): ", stdout); + fflush(stdout); + + if ((ppdfile = cupsGetPPD(dest->name)) == NULL) + { + status = 1; + puts("FAIL"); + } + else + { + puts("PASS"); + + /* + * ppdOpenFile() + */ + + fputs("ppdOpenFile(): ", stdout); + fflush(stdout); + + if ((ppd = ppdOpenFile(ppdfile)) == NULL) + { + puts("FAIL"); + return (1); + } + else + puts("PASS"); + + ppdClose(ppd); + unlink(ppdfile); + } + + /* + * cupsGetJobs() + */ + + fputs("cupsGetJobs: ", stdout); + fflush(stdout); + + num_jobs = cupsGetJobs(&jobs, NULL, 0, -1); + + if (num_jobs == 0) + { + puts("FAIL"); + return (1); + } + else + puts("PASS"); + + cupsFreeJobs(num_jobs, jobs); + cupsFreeDests(num_dests, dests); + + return (status); +} + + +/* + * End of "$Id: testfile.c 6192 2007-01-10 19:26:48Z mike $". + */ diff --git a/cups/testppd.c b/cups/testppd.c index 3315d94c1..e06b90e92 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -1,5 +1,5 @@ /* - * "$Id: testppd.c 6159 2006-12-19 20:08:42Z mike $" + * "$Id: testppd.c 6580 2007-06-20 21:11:43Z mike $" * * PPD test program for the Common UNIX Printing System (CUPS). * @@ -300,6 +300,8 @@ main(int argc, /* I - Number of command-line arguments */ attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec, attr->text, attr->value ? attr->value : ""); + + ppdClose(ppd); } } @@ -308,5 +310,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: testppd.c 6159 2006-12-19 20:08:42Z mike $". + * End of "$Id: testppd.c 6580 2007-06-20 21:11:43Z mike $". */ diff --git a/cups/transcode.c b/cups/transcode.c index 70bf40f1d..92a7bfb97 100644 --- a/cups/transcode.c +++ b/cups/transcode.c @@ -1,5 +1,5 @@ /* - * "$Id: transcode.c 6187 2007-01-10 16:20:42Z mike $" + * "$Id: transcode.c 6592 2007-06-21 21:04:40Z mike $" * * Transcoding support for the Common UNIX Printing System (CUPS). * @@ -1435,7 +1435,7 @@ get_vbcs_charmap( char *s; /* Line parsing pointer */ char line[256]; /* Line from charset map file */ int i; /* Loop variable */ - int wide; /* 32-bit legacy char */ + int legacy; /* 32-bit legacy char */ DEBUG_printf(("get_vbcs_charmap(encoding=%d, filename=\"%s\")\n", @@ -1504,8 +1504,8 @@ get_vbcs_charmap( cupsFileRewind(fp); - i = 0; - wide = 0; + i = 0; + legacy = 0; while (cupsFileGets(fp, line, sizeof(line))) { @@ -1575,9 +1575,9 @@ get_vbcs_charmap( * Save VBCS 32-bit to Unicode mapping in sorted list table... */ - if (!wide) + if (!legacy) { - wide = 1; + legacy = 1; vmap->widecount = (mapcount - i + 1); wide2uni = (_cups_wide2uni_t *)calloc(vmap->widecount, sizeof(_cups_wide2uni_t)); @@ -1655,5 +1655,5 @@ get_vbcs_charmap( /* - * End of "$Id: transcode.c 6187 2007-01-10 16:20:42Z mike $" + * End of "$Id: transcode.c 6592 2007-06-21 21:04:40Z mike $" */ diff --git a/doc/Makefile b/doc/Makefile index ee2d33973..540791a93 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6519 2007-05-08 01:55:27Z mike $" +# "$Id: Makefile 6594 2007-06-21 21:51:15Z mike $" # # Documentation makefile for the Common UNIX Printing System (CUPS). # @@ -114,6 +114,7 @@ WEBIMAGES = \ images/web-set-printer-options.gif \ images/web-test-page.gif HELPFILES = \ + help/accounting.html \ help/api-array.html \ help/api-cups.html \ help/api-filedir.html \ diff --git a/doc/help/accounting.html b/doc/help/accounting.html new file mode 100644 index 000000000..5860fe223 --- /dev/null +++ b/doc/help/accounting.html @@ -0,0 +1,59 @@ + + + + Printer Accounting Basics + + + +

CUPS supports a variety of printer accounting schemes. Aside from the +built-in quota and page logging +support, there are several third-party solutions that can be found on +www.cups.org.

+ + +

Quota Support

+ +

CUPS supports page and size-based quotas for each printer. +The quotas are tracked individually for each user, but a single set of +limits applies to all users for a partiuclar printer. For example, you +can limit every user to 5 pages per day on an expensive printer, but +you cannot limit every user except Johnny.

+ +

The job-k-limit, job-page-limit, and job-quota-peiod +options determine whether and how quotas are enforced for a printer. +The job-quota-period option determines the time interval for +quota tracking. The interval is expressed in seconds, so a day is +86,400, a week is 604,800 and a month is 2,592,000 seconds. The +job-k-limit option specifies the job size limit in killobytes. The +job-page-limit option specifies the number of pages limit.

+ +

For quotas to be enforced, the period and at least one of the limits +must be set to a non-zero value. The following options will enable +weekly quotas with the given size and page count limits:

+ +
+/usr/sbin/lpadmin -p printer -o job-quota-period=604800 \
+    -o job-k-limit=1024 ENTER
+/usr/sbin/lpadmin -p printer -o job-quota-period=604800 \
+    -o job-page-limit=100 ENTER
+
+ +

Or, you can combine all three options on the same line.

+ +

While there is no way to query the current quota state for a particular +user, any application can request a list of jobs for a user and printer that +can be used to easily determine that information.

+ + +

Page Logging

+ +

CUPS logs every page that is printed on a system to the +page_log file. Page logging +is only available for drivers that provide page accounting information, +typically all PostScript and CUPS raster devices. Raw queues and queues +using third-party solutions such as Foomatic generally do not have +useful page accounting information available.

+ + + + diff --git a/doc/help/spec-ipp.html b/doc/help/spec-ipp.html index 998699174..6d9247f55 100644 --- a/doc/help/spec-ipp.html +++ b/doc/help/spec-ipp.html @@ -915,6 +915,11 @@ CUPS-Add-Modify-Printer request:
The client OPTIONALLY supplies a device URI for the specified printer. +
"port-monitor" (name(127)): + +
The client OPTIONALLY supplies a port monitor name for the + specified printer. +
"ppd-name" (name(127)):
The client OPTIONALLY supplies a PPD name for the specified @@ -2232,11 +2237,20 @@ calculations, in seconds. The default value of 0 specifies that the limits apply to all jobs that have been printed by a user that are still known to the system. -

job-sheets-supported (1setof type3 keyword | name(MAX))CUPS 1.1

+

job-sheets-supported (1setof type3 keyword | name(MAX))CUPS 1.1

The job-sheets-supported attribute specifies the available banner files. There will always be at least one banner file available called "none". +

port-monitor" (name(127))

+ +

The port-monitor attribute specifies the port monitor to use when printing +to this printer. The default port monitor is "none". + +

port-monitor-supported" (1setOf name(127))

+ +

The port-monitor-supported attribute specifies the available port monitors. +

printer-type (type2 enum)

The printer-type attribute specifies printer type and @@ -2345,6 +2359,14 @@ summary='Printer Type Bits'> 0x00400000 Queue requires authentication. + + 0x00800000 + Queue supports CUPS command files. + + + 0x01000000 + Queue was automatically discovered and added. + diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html index 46ef77506..fc448e0ab 100644 --- a/doc/help/spec-ppd.html +++ b/doc/help/spec-ppd.html @@ -8,7 +8,7 @@ + +

+1 dict dup /PageSize [612 792] put setpagedevice
+
+ +

can be rewritten as:

+ +
+<< /PageSize [612 792] >> setpagedevice
+
+ + +

Supported Page Device Attributes

-

Table 1 shows the supported page device attributes along with PostScript code examples.

+

Table 2 shows the supported page device attributes along with PostScript code examples.

- + @@ -1000,7 +1115,9 @@ in the PPD file for a given locale.
    -
  • Added cupsPreFilter attribute.
  • +
  • Added APPrinterPreset, cupsIPPFinishings, and cupsPreFilter attributes.
  • + +
  • Added discussion of custom option code, sample CustomPageSize code, and "do not use dict and put" note.
diff --git a/driver/testdriver.c b/driver/testdriver.c index eab00dffc..a28cb0147 100644 --- a/driver/testdriver.c +++ b/driver/testdriver.c @@ -1,5 +1,5 @@ /* - * "$Id: testdriver.c 5390 2006-04-10 19:29:44Z mike $" + * "$Id: testdriver.c 6555 2007-06-07 01:33:44Z mike $" * * Sample/test driver interface program for the Common UNIX Printing * System (CUPS). @@ -39,6 +39,7 @@ #include #include +#include /* @@ -88,16 +89,23 @@ static int /* O - Exit status */ cat_ppd(const char *uri) /* I - PPD URI */ { int i; /* Looping var */ + char scheme[255], /* URI scheme */ + userpass[255], /* Username/password (unused) */ + hostname[255], /* Hostname (unused) */ + resource[1024]; /* Resource name */ + int port; /* Port (unused) */ const char *name; /* Pointer to name in URI */ - if ((name = strchr(uri, ':')) == NULL) + if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), + userpass, sizeof(userpass), hostname, sizeof(hostname), + &port, resource, sizeof(resource)) < HTTP_URI_OK) { fprintf(stderr, "ERROR: Bad URI \"%s\"!\n", uri); return (1); } - name ++; + name = resource + 1; for (i = 0 ; i < (int)(sizeof(models) / sizeof(models[0])); i ++) if (!strcmp(name, models[i][0])) @@ -167,7 +175,7 @@ list_ppds(const char *name) /* I - Program name */ base = name; for (i = 0; i < (int)(sizeof(models) / sizeof(models[0])); i ++) - printf("\"%s:%s\" en \"Test\" \"Test %s\" \"1284 device id\"\n", + printf("\"%s:///%s\" en \"Test\" \"Test %s\" \"1284 device id\"\n", base, models[i][0], models[i][1]); return (0); @@ -175,5 +183,5 @@ list_ppds(const char *name) /* I - Program name */ /* - * End of "$Id: testdriver.c 5390 2006-04-10 19:29:44Z mike $". + * End of "$Id: testdriver.c 6555 2007-06-07 01:33:44Z mike $". */ diff --git a/filter/Makefile b/filter/Makefile index f657bd185..fd7e15735 100644 --- a/filter/Makefile +++ b/filter/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6315 2007-03-03 00:12:26Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # Filter makefile for the Common UNIX Printing System (CUPS). # @@ -106,6 +106,12 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64) $(RM) $(LIBDIR)/libcupsimage.dylib; \ $(LN) $(LIBCUPSIMAGE) $(LIBDIR)/libcupsimage.dylib; \ fi + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi installstatic: $(INSTALL_DIR) -m 755 $(LIBDIR) @@ -389,5 +395,5 @@ include Dependencies # -# End of "$Id: Makefile 6315 2007-03-03 00:12:26Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/filter/imagetops.c b/filter/imagetops.c index 55a19f260..485ec41a3 100644 --- a/filter/imagetops.c +++ b/filter/imagetops.c @@ -1,5 +1,5 @@ /* - * "$Id: imagetops.c 6420 2007-03-30 20:00:59Z mike $" + * "$Id: imagetops.c 6578 2007-06-20 17:46:04Z mike $" * * Image file to PostScript filter for the Common UNIX Printing System (CUPS). * @@ -283,8 +283,16 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("hue", num_options, options)) != NULL) hue = atoi(val); - if ((val = cupsGetOption("mirror", num_options, options)) != NULL && - strcasecmp(val, "True") == 0) + if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL) + { + val = choice->choice; + choice->marked = 0; + } + else + val = cupsGetOption("mirror", num_options, options); + + if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || + !strcasecmp(val, "yes"))) Flip = 1; if ((val = cupsGetOption("emit-jcl", num_options, options)) != NULL && @@ -1062,5 +1070,5 @@ ps_ascii85(cups_ib_t *data, /* I - Data to print */ /* - * End of "$Id: imagetops.c 6420 2007-03-30 20:00:59Z mike $". + * End of "$Id: imagetops.c 6578 2007-06-20 17:46:04Z mike $". */ diff --git a/filter/imagetoraster.c b/filter/imagetoraster.c index 32aa209bf..66653d3ff 100644 --- a/filter/imagetoraster.c +++ b/filter/imagetoraster.c @@ -1,5 +1,5 @@ /* - * "$Id: imagetoraster.c 6420 2007-03-30 20:00:59Z mike $" + * "$Id: imagetoraster.c 6578 2007-06-20 17:46:04Z mike $" * * Image file to raster filter for the Common UNIX Printing System (CUPS). * @@ -445,8 +445,16 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("hue", num_options, options)) != NULL) hue = atoi(val); - if ((val = cupsGetOption("mirror", num_options, options)) != NULL && - strcasecmp(val, "True") == 0) + if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL) + { + val = choice->choice; + choice->marked = 0; + } + else + val = cupsGetOption("mirror", num_options, options); + + if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || + !strcasecmp(val, "yes"))) Flip = 1; /* @@ -4313,5 +4321,5 @@ raster_cb( /* - * End of "$Id: imagetoraster.c 6420 2007-03-30 20:00:59Z mike $". + * End of "$Id: imagetoraster.c 6578 2007-06-20 17:46:04Z mike $". */ diff --git a/filter/interpret.c b/filter/interpret.c index 266c171c4..dedc86d2f 100644 --- a/filter/interpret.c +++ b/filter/interpret.c @@ -1,5 +1,5 @@ /* - * "$Id: interpret.c 6371 2007-03-20 23:18:01Z mike $" + * "$Id: interpret.c 6575 2007-06-19 23:56:24Z mike $" * * PPD command interpreter for the Common UNIX Printing System (CUPS). * @@ -1415,9 +1415,19 @@ setpagedevice( h->LeadingEdge = (unsigned)obj->value.number; else if (!strcmp(name, "ManualFeed") && obj->type == CUPS_PS_BOOLEAN) h->ManualFeed = (unsigned)obj->value.boolean; - else if ((!strcmp(name, "cupsMediaPosition") || /* Compatibility */ + else if ((!strcmp(name, "cupsMediaPosition") || !strcmp(name, "MediaPosition")) && obj->type == CUPS_PS_NUMBER) + { + /* + * cupsMediaPosition is supported for backwards compatibility only. + * We added it back in the Ghostscript 5.50 days to work around a + * bug in Ghostscript WRT handling of MediaPosition and setpagedevice. + * + * All new development should set MediaPosition... + */ + h->MediaPosition = (unsigned)obj->value.number; + } else if (!strcmp(name, "MediaWeight") && obj->type == CUPS_PS_NUMBER) h->MediaWeight = (unsigned)obj->value.number; else if (!strcmp(name, "MirrorPrint") && obj->type == CUPS_PS_BOOLEAN) @@ -1640,5 +1650,5 @@ DEBUG_stack(_cups_ps_stack_t *st) /* I - Stack */ /* - * End of "$Id: interpret.c 6371 2007-03-20 23:18:01Z mike $". + * End of "$Id: interpret.c 6575 2007-06-19 23:56:24Z mike $". */ diff --git a/filter/pstops.c b/filter/pstops.c index c74dbd3d0..1a91a0402 100644 --- a/filter/pstops.c +++ b/filter/pstops.c @@ -1,5 +1,5 @@ /* - * "$Id: pstops.c 6420 2007-03-30 20:00:59Z mike $" + * "$Id: pstops.c 6578 2007-06-20 17:46:04Z mike $" * * PostScript filter for the Common UNIX Printing System (CUPS). * @@ -2422,9 +2422,16 @@ set_pstops_options( if ((choice = ppdFindMarkedChoice(ppd, "ManualFeed")) != NULL) doc->manual_feed = choice->choice; - if ((val = cupsGetOption("mirror", num_options, options)) != NULL && - (!strcasecmp(val, "true") || !strcasecmp(val, "on") || - !strcasecmp(val, "yes"))) + if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL) + { + val = choice->choice; + choice->marked = 0; + } + else + val = cupsGetOption("mirror", num_options, options); + + if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || + !strcasecmp(val, "yes"))) doc->mirror = 1; /* @@ -3298,5 +3305,5 @@ write_labels(pstops_doc_t *doc, /* I - Document information */ /* - * End of "$Id: pstops.c 6420 2007-03-30 20:00:59Z mike $". + * End of "$Id: pstops.c 6578 2007-06-20 17:46:04Z mike $". */ diff --git a/filter/raster.c b/filter/raster.c index 32155073b..25ad6506f 100644 --- a/filter/raster.c +++ b/filter/raster.c @@ -1,5 +1,5 @@ /* - * "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $" + * "$Id: raster.c 6584 2007-06-21 17:22:26Z mike $" * * Raster file routines for the Common UNIX Printing System (CUPS). * @@ -182,6 +182,8 @@ cupsRasterOpen(int fd, /* I - File descriptor */ r->sync == CUPS_RASTER_REVSYNCv1 || r->sync == CUPS_RASTER_REVSYNCv2) r->swapped = 1; + + DEBUG_printf(("r->swapped=%d, r->sync=%08x\n", r->swapped, r->sync)); } else { @@ -547,10 +549,8 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */ unsigned remaining; /* Bytes remaining */ -#ifdef DEBUG - fprintf(stderr, "cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n", - r, p, len, r->remaining); -#endif /* DEBUG */ + DEBUG_printf(("cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n", + r, p, len, r->remaining)); if (r == NULL || r->mode != CUPS_RASTER_WRITE || r->remaining == 0) return (0); @@ -673,12 +673,7 @@ static unsigned /* O - 1 on success, 0 on fail */ cups_raster_read_header( cups_raster_t *r) /* I - Raster stream */ { - int len; /* Number of words to swap */ - union swap_s /* Swapping structure */ - { - unsigned char b[4]; - unsigned v; - } *s; + int len; /* Length for read/swap */ if (r == NULL || r->mode != CUPS_RASTER_READ) @@ -707,10 +702,28 @@ cups_raster_read_header( */ if (r->swapped) - for (len = 81, s = (union swap_s *)&(r->header.AdvanceDistance); + { + unsigned *s, /* Current word */ + temp; /* Temporary copy */ + + + DEBUG_puts("Swapping header bytes..."); + + for (len = 81, s = &(r->header.AdvanceDistance); len > 0; len --, s ++) - s->v = (((((s->b[3] << 8) | s->b[2]) << 8) | s->b[1]) << 8) | s->b[0]; + { + DEBUG_printf(("%08x =>", *s)); + + temp = *s; + *s = ((temp & 0xff) << 24) | + ((temp & 0xff00) << 8) | + ((temp & 0xff0000) >> 8) | + ((temp & 0xff000000) >> 24); + + DEBUG_printf((" %08x\n", *s)); + } + } /* * Update the header and row count... @@ -981,9 +994,7 @@ cups_raster_write( maxrun; /* Maximum run of 128 * bpp */ -#ifdef DEBUG - fprintf(stderr, "cups_raster_write(r=%p, pixels=%p)\n", r, pixels); -#endif /* DEBUG */ + DEBUG_printf(("cups_raster_write(r=%p, pixels=%p)\n", r, pixels)); /* * Allocate a write buffer as needed... @@ -1165,5 +1176,5 @@ cups_write(int fd, /* I - File descriptor */ /* - * End of "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $". + * End of "$Id: raster.c 6584 2007-06-21 17:22:26Z mike $". */ diff --git a/init/org.cups.cups-lpd.plist b/init/org.cups.cups-lpd.plist index f768e3338..9020d067e 100644 --- a/init/org.cups.cups-lpd.plist +++ b/init/org.cups.cups-lpd.plist @@ -12,6 +12,8 @@ -o document-format=application/octet-stream + SHAuthorizationRight + system.preferences Sockets Listeners diff --git a/init/org.cups.cupsd.plist b/init/org.cups.cupsd.plist index 89bcab309..74bcce6c3 100644 --- a/init/org.cups.cupsd.plist +++ b/init/org.cups.cupsd.plist @@ -4,8 +4,6 @@ Label org.cups.cupsd - OnDemand - KeepAlive PathState @@ -14,8 +12,6 @@ - RunAtLoad - ProgramArguments /usr/sbin/cupsd @@ -23,6 +19,8 @@ ServiceIPC + SHAuthorizationRight + system.preferences Sockets Listeners diff --git a/monitor/Makefile b/monitor/Makefile index e7ae20c7a..085e9d889 100644 --- a/monitor/Makefile +++ b/monitor/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # Port monitor makefile for the Common UNIX Printing System (CUPS). # @@ -63,6 +63,12 @@ install: all for file in $(TARGETS); do \ $(INSTALL_BIN) $$file $(SERVERBIN)/monitor; \ done + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -103,5 +109,5 @@ include Dependencies # -# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/notifier/Makefile b/notifier/Makefile index f2b221605..fc355bf32 100644 --- a/notifier/Makefile +++ b/notifier/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6304 2007-02-22 22:06:23Z mike $" +# "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $" # # Notifier makefile for the Common UNIX Printing System (CUPS). # @@ -55,6 +55,12 @@ install: all done $(INSTALL_DIR) -m 755 $(CACHEDIR)/rss -chgrp $(CUPS_GROUP) $(CACHEDIR)/rss + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -111,5 +117,5 @@ include Dependencies # -# End of "$Id: Makefile 6304 2007-02-22 22:06:23Z mike $". +# End of "$Id: Makefile 6563 2007-06-18 22:18:46Z mike $". # diff --git a/notifier/rss.c b/notifier/rss.c index e9abfa3d3..f82a78cae 100644 --- a/notifier/rss.c +++ b/notifier/rss.c @@ -1,5 +1,5 @@ /* - * "$Id: rss.c 6326 2007-03-11 17:50:18Z mike $" + * "$Id: rss.c 6596 2007-06-21 22:42:25Z mike $" * * RSS notifier for the Common UNIX Printing System (CUPS). * @@ -602,7 +602,7 @@ save_rss(cups_array_t *rss, /* I - RSS messages */ fputs(" \n", fp); fputs(" CUPS RSS Feed\n", fp); fprintf(fp, " %s\n", baseurl); - fputs(" CUPS RSS Feed\n", fp); + fputs(" CUPS RSS Feed\n", fp); fputs(" " CUPS_SVERSION "\n", fp); fputs(" 1\n", fp); @@ -701,5 +701,5 @@ xml_escape(const char *s) /* I - String to escape */ /* - * End of "$Id: rss.c 6326 2007-03-11 17:50:18Z mike $". + * End of "$Id: rss.c 6596 2007-06-21 22:42:25Z mike $". */ diff --git a/packaging/cups.list.in b/packaging/cups.list.in index b926dfa2f..aa2c8aa40 100644 --- a/packaging/cups.list.in +++ b/packaging/cups.list.in @@ -1,5 +1,5 @@ # -# "$Id: cups.list.in 6529 2007-05-08 19:48:20Z mike $" +# "$Id: cups.list.in 6597 2007-06-22 16:41:58Z mike $" # # ESP Package Manager (EPM) file list for the Common UNIX Printing # System (CUPS). @@ -226,8 +226,10 @@ d 0755 root sys $SERVERBIN/backend - f 0700 root sys $SERVERBIN/backend/ipp backend/ipp l 0700 root sys $SERVERBIN/backend/http ipp f 0700 root sys $SERVERBIN/backend/lpd backend/lpd +%system !darwin f 0755 root sys $SERVERBIN/backend/parallel backend/parallel f 0755 root sys $SERVERBIN/backend/scsi backend/scsi +%system all f 0755 root sys $SERVERBIN/backend/serial backend/serial f 0755 root sys $SERVERBIN/backend/snmp backend/snmp f 0755 root sys $SERVERBIN/backend/socket backend/socket @@ -522,6 +524,7 @@ d 0755 root sys $DOCDIR - f 0644 root sys $DOCDIR doc/*.css f 0644 root sys $DOCDIR doc/*.html d 0755 root sys $DOCDIR/help - +f 0644 root sys $DOCDIR/help/accounting.html doc/help/accounting.html f 0644 root sys $DOCDIR/help/cgi.html doc/help/cgi.html f 0644 root sys $DOCDIR/help/glossary.html doc/help/glossary.html f 0644 root sys $DOCDIR/help/license.html doc/help/license.html @@ -683,5 +686,5 @@ f 0644 root sys $XINETD/cups-lpd init/cups-lpd %subpackage # -# End of "$Id: cups.list.in 6529 2007-05-08 19:48:20Z mike $". +# End of "$Id: cups.list.in 6597 2007-06-22 16:41:58Z mike $". # diff --git a/packaging/cups.spec.in b/packaging/cups.spec.in index df14b7a35..4438bab65 100644 --- a/packaging/cups.spec.in +++ b/packaging/cups.spec.in @@ -1,5 +1,5 @@ # -# "$Id: cups.spec.in 6529 2007-05-08 19:48:20Z mike $" +# "$Id: cups.spec.in 6597 2007-06-22 16:41:58Z mike $" # # RPM "spec" file for the Common UNIX Printing System (CUPS). # @@ -339,6 +339,7 @@ rm -rf $RPM_BUILD_ROOT %dir /usr/share/doc/cups /usr/share/doc/cups/*.* %dir /usr/share/doc/cups/help +/usr/share/doc/cups/help/accounting.html /usr/share/doc/cups/help/cgi.html /usr/share/doc/cups/help/glossary.html /usr/share/doc/cups/help/license.html @@ -537,5 +538,5 @@ rm -rf $RPM_BUILD_ROOT # -# End of "$Id: cups.spec.in 6529 2007-05-08 19:48:20Z mike $". +# End of "$Id: cups.spec.in 6597 2007-06-22 16:41:58Z mike $". # diff --git a/ppd/deskjet.ppd b/ppd/deskjet.ppd index 4752f013a..4cbf27c83 100644 --- a/ppd/deskjet.ppd +++ b/ppd/deskjet.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: deskjet.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: deskjet.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample HP DeskJet driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "DESKJET.PPD" *Manufacturer: "HP" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsFilter: "application/vnd.cups-raster 0 rastertohp" *cupsModelNumber: 1 *ModelName: "HP DeskJet Series" *ShortNickName: "HP DeskJet Series" -*NickName: "HP DeskJet Series CUPS v1.2" +*NickName: "HP DeskJet Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -195,5 +195,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: deskjet.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: deskjet.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/deskjet2.ppd b/ppd/deskjet2.ppd index f583b08d6..161dd03d0 100644 --- a/ppd/deskjet2.ppd +++ b/ppd/deskjet2.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: deskjet2.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: deskjet2.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Second sample HP DeskJet driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "DESKJET2.PPD" *Manufacturer: "HP" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsFilter: "application/vnd.cups-raster 0 rastertohp" *cupsModelNumber: 2 @@ -40,7 +40,7 @@ *ModelName: "HP New DeskJet Series" *ShortNickName: "HP New DeskJet Series" -*NickName: "HP New DeskJet Series CUPS v1.2" +*NickName: "HP New DeskJet Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -214,5 +214,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: deskjet2.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: deskjet2.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/dymo.ppd b/ppd/dymo.ppd index 69426a938..c436246ec 100644 --- a/ppd/dymo.ppd +++ b/ppd/dymo.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: dymo.ppd 5130 2006-02-17 20:25:33Z mike $" +*% "$Id: dymo.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample DYMO label printer driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 2001-2005 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "DYMO.PPD" *Manufacturer: "Dymo" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *cupsModelNumber: 0 *ModelName: "DYMO Label Printer" *ShortNickName: "DYMO Label Printer" -*NickName: "DYMO Label Printer CUPS v1.2" +*NickName: "DYMO Label Printer CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -152,5 +152,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: dymo.ppd 5130 2006-02-17 20:25:33Z mike $". +*% End of "$Id: dymo.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/epson24.ppd b/ppd/epson24.ppd index 689c2c368..2db156d87 100644 --- a/ppd/epson24.ppd +++ b/ppd/epson24.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: epson24.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: epson24.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON 24-Pin driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "EPSON24.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 1 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" *ModelName: "EPSON 24-Pin Series" *ShortNickName: "EPSON 24-Pin Series" -*NickName: "EPSON 24-Pin Series CUPS v1.2" +*NickName: "EPSON 24-Pin Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -135,5 +135,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: epson24.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: epson24.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/epson9.ppd b/ppd/epson9.ppd index 97470aa00..d0c79c782 100644 --- a/ppd/epson9.ppd +++ b/ppd/epson9.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: epson9.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: epson9.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON 9-Pin driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "EPSON9.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 0 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" *ModelName: "EPSON 9-Pin Series" *ShortNickName: "EPSON 9-Pin Series" -*NickName: "EPSON 9-Pin Series CUPS v1.2" +*NickName: "EPSON 9-Pin Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -133,5 +133,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: epson9.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: epson9.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/intelbar.ppd b/ppd/intelbar.ppd index cc2ea6db3..c9ede6a31 100644 --- a/ppd/intelbar.ppd +++ b/ppd/intelbar.ppd @@ -5,7 +5,7 @@ *% Sample IntelliBar label printer driver PPD file for the Common UNIX *% Printing System (CUPS). *% -*% Copyright 2001-2006 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "INTELBAR.PPD" *Manufacturer: "Intellitech" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *cupsModelNumber: 32 *ModelName: "Intellitech IntelliBar Series Label Printer" *ShortNickName: "Intellitech IntelliBar Series" -*NickName: "Intellitech IntelliBar Series Label Printer v1.2" +*NickName: "Intellitech IntelliBar Series Label Printer v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -85,7 +85,7 @@ *OpenUI *inPrintDensity/Print Density: PickOne *OrderDependency: 20 DocumentSetup *inPrintDensity *DefaultinPrintDensity: Default -*inPrintDensity Default/PrinterDefault: "<>setpagedevice" +*inPrintDensity Default/PrinterDefault: "<>setpagedevice" *inPrintDensity -15: "<>setpagedevice" *inPrintDensity -14: "<>setpagedevice" *inPrintDensity -13: "<>setpagedevice" diff --git a/ppd/laserjet.ppd b/ppd/laserjet.ppd index 5c02dcecb..696cf860a 100644 --- a/ppd/laserjet.ppd +++ b/ppd/laserjet.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: laserjet.ppd 4905 2006-01-10 20:07:15Z mike $" +*% "$Id: laserjet.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample HP LaserJet driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2006 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "LASERJET.PPD" *Manufacturer: "HP" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertohp" *cupsModelNumber: 0 *ModelName: "HP LaserJet Series PCL 4/5" *ShortNickName: "HP LaserJet Series PCL 4/5" -*NickName: "HP LaserJet Series PCL 4/5 CUPS v1.2" +*NickName: "HP LaserJet Series PCL 4/5 CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -197,5 +197,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: laserjet.ppd 4905 2006-01-10 20:07:15Z mike $". +*% End of "$Id: laserjet.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/okidat24.ppd b/ppd/okidat24.ppd index b60f0634d..1f7480d4b 100644 --- a/ppd/okidat24.ppd +++ b/ppd/okidat24.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: okidat24.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: okidat24.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample OKIDATA 24-Pin driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.1" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "OKIDAT24.PPD" *Manufacturer: "Oki" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 1 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" *ModelName: "OKIDATA 24-Pin Series" *ShortNickName: "OKIDATA 24-Pin Series" -*NickName: "OKIDATA 24-Pin Series CUPS v1.2" +*NickName: "OKIDATA 24-Pin Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -125,5 +125,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: okidat24.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: okidat24.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/okidata9.ppd b/ppd/okidata9.ppd index 189c8db6d..825ee9431 100644 --- a/ppd/okidata9.ppd +++ b/ppd/okidata9.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: okidata9.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: okidata9.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample OKIDATA 9-Pin driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,20 +24,20 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "OKIDATA9.PPD" *Manufacturer: "Oki" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 0 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" *ModelName: "OKIDATA 9-Pin Series" *ShortNickName: "OKIDATA 9-Pin Series" -*NickName: "OKIDATA 9-Pin Series CUPS v1.2" +*NickName: "OKIDATA 9-Pin Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -123,5 +123,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: okidata9.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: okidata9.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/sample.drv b/ppd/sample.drv new file mode 100644 index 000000000..7dd037011 --- /dev/null +++ b/ppd/sample.drv @@ -0,0 +1,996 @@ +// CUPS PPD Compiler v1.1.1 + +// Include necessary files... +#include +#include +#include +#include +#include + +// Media sizes used by label drivers... +*#media "w81h252/Address - 1 1/8 x 3 1/2\"" 81 252 +#media "w101h252/Large Address - 1 4/10 x 3 1/2\"" 101 252 +#media "w54h144/Return Address - 3/4 x 2\"" 54 144 +#media "w167h288/Shipping Address - 2 5/16 x 4\"" 167 288 +#media "w162h540/Internet Postage 2-Part - 2 1/4 x 7 1/2\"" 162 540 +#media "w162h504/Internet Postage 3-Part - 2 1/4 x 7\"" 162 504 +#media "w41h248/File Folder - 9/16 x 3 7/16\"" 41 248 +#media "w41h144/Hanging Folder - 9/16 x 2\"" 41 144 +#media "w153h198/3.5\" Disk - 2 1/8 x 2 3/4\"" 153 198 +#media "w90h18/1.25x0.25\"" 90 18 +#media "w90h162/1.25x2.25\"" 90 162 +#media "w108h18/1.50x0.25\"" 108 18 +#media "w108h36/1.50x0.50\"" 108 36 +#media "w108h72/1.50x1.00\"" 108 72 +#media "w108h144/1.50x2.00\"" 108 144 +#media "w144h26/2.00x0.37\"" 144 26 +#media "w144h36/2.00x0.50\"" 144 36 +#media "w144h72/2.00x1.00\"" 144 72 +#media "w144h90/2.00x1.25\"" 144 90 +#media "w144h288/2.00x4.00\"" 144 288 +#media "w144h396/2.00x5.50\"" 144 396 +#media "w162h36/2.25x0.50\"" 162 36 +#media "w162h90/2.25x1.25\"" 162 90 +#media "w162h288/2.25x4.00\"" 162 288 +#media "w162h396/2.25x5.50\"" 162 396 +#media "w171h396/2.38x5.50\"" 171 396 +#media "w180h72/2.50x1.00\"" 180 72 +#media "w180h144/2.50x2.00\"" 180 144 +#media "w198h90/2.75x1.25\"" 198 90 +#media "w216h72/3.00x1.00\"" 216 72 +#media "w216h90/3.00x1.25\"" 216 90 +#media "w216h144/3.00x2.00\"" 216 144 +#media "w216h216/3.00x3.00\"" 216 216 +#media "w216h360/3.00x5.00\"" 216 360 +#media "w234h144/3.25x2.00\"" 234 144 +#media "w234h360/3.25x5.00\"" 234 360 +#media "w234h396/3.25x5.50\"" 234 396 +#media "w234h419/3.25x5.83\"" 234 419 +#media "w234h563/3.25x7.83\"" 234 563 +#media "w252h72/3.50x1.00\"" 252 72 +#media "w288h72/4.00x1.00\"" 288 72 +#media "w288h144/4.00x2.00\"" 288 144 +#media "w288h180/4.00x2.50\"" 288 180 +#media "w288h216/4.00x3.00\"" 288 216 +#media "w288h288/4.00x4.00\"" 288 288 +#media "w288h360/4.00x5.00\"" 288 360 +#media "w288h432/4.00x6.00\"" 288 432 +#media "w288h468/4.00x6.50\"" 288 468 +#media "w288h936/4.00x13.00\"" 288 936 + +// Common stuff for all drivers... +Attribute "cupsVersion" "" "1.3" +Attribute "FileSystem" "" "False" +Attribute "LandscapeOrientation" "" "Plus90" +Attribute "LanguageLevel" "" "3" +Attribute "Product" "" "(GNU Ghostscript)" +Attribute "Product" "" "(ESP Ghostscript)" +Attribute "PSVersion" "" "(3010.000) 81501" +Attribute "TTRasterizer" "" "Type42" + +Copyright "Copyright 1997-2007 by Easy Software Products." +Copyright "" +Copyright "These coded instructions, statements, and computer programs are the" +Copyright "property of Easy Software Products and are protected by Federal" +Copyright "copyright law. Distribution and use rights are outlined in the file" +Copyright "\"LICENSE.txt\" which should have been included with this file. If this" +Copyright "file is missing or damaged please contact Easy Software Products" +Copyright "at:" +Copyright "" +Copyright "Attn: CUPS Licensing Information" +Copyright "Easy Software Products" +Copyright "44141 Airport View Drive, Suite 204" +Copyright "Hollywood, Maryland 20636 USA" +Copyright "" +Copyright "Voice: (301) 373-9600" +Copyright "EMail: cups-info@cups.org" +Copyright "WWW: http://www.cups.org" + +Font * + +Version "1.3" + +// HP +{ + Manufacturer "HP" + DriverType hp + + // HP DeskJet Series + { + ModelName "DeskJet Series" + PCFileName "DESKJET.PPD" + ModelNumber $HP_DESKJET + ManualCopies Yes + ColorDevice Yes + Throughput 1 + + UIConstraints "*PageSize A3 *InputSlot Envelope" + UIConstraints "*PageSize A4 *InputSlot Envelope" + UIConstraints "*PageSize A5 *InputSlot Envelope" + UIConstraints "*PageSize B5 *InputSlot Envelope" + UIConstraints "*PageSize Executive *InputSlot Envelope" + UIConstraints "*PageSize Legal *InputSlot Envelope" + UIConstraints "*PageSize Letter *InputSlot Envelope" + UIConstraints "*PageSize Tabloid *InputSlot Envelope" + UIConstraints "*Resolution 600dpi *ColorModel CMYK" + + HWMargins 18 36 18 36 + *Media Letter + Media Legal + Media Executive + Media Tabloid + Media A3 + Media A4 + Media A5 + Media B5 + Media EnvISOB5 + Media Env10 + Media EnvC5 + Media EnvDL + Media EnvMonarch + + ColorModel Gray/Grayscale k chunky 2 + ColorModel RGB/Color cmy banded 2 + *ColorModel CMYK kcmy banded 2 + + Resolution - 1 0 0 0 150dpi + *Resolution - 1 0 0 0 300dpi + Resolution k 1 0 0 0 "600dpi/600 DPI Grayscale" + + *InputSlot 1 Tray + InputSlot 2 "Manual/Manual Feed" + InputSlot 3 "Envelope/Envelope Feed" + + *MediaType 0 "Plain/Plain Paper" + MediaType 1 "Bond/Bond Paper" + MediaType 2 "Special/Special Paper" + MediaType 3 Transparency + MediaType 4 "Glossy/Glossy Paper" + } + + // HP New DeskJet Series + { + ModelName "New DeskJet Series" + PCFileName "DESKJET2.PPD" + ModelNumber $HP_DESKJET2 + ManualCopies Yes + ColorDevice Yes + Throughput 1 + + UIConstraints "*Duplex *Option1 False" + UIConstraints "*PageSize A3 *InputSlot Envelope" + UIConstraints "*PageSize A4 *InputSlot Envelope" + UIConstraints "*PageSize A5 *InputSlot Envelope" + UIConstraints "*PageSize B5 *InputSlot Envelope" + UIConstraints "*PageSize Executive *InputSlot Envelope" + UIConstraints "*PageSize Legal *InputSlot Envelope" + UIConstraints "*PageSize Letter *InputSlot Envelope" + UIConstraints "*PageSize Tabloid *InputSlot Envelope" + + HWMargins 18 36 18 36 + *Media Letter + Media Legal + Media Executive + Media Tabloid + Media A3 + Media A4 + Media A5 + Media B5 + Media EnvISOB5 + Media Env10 + Media EnvC5 + Media EnvDL + Media EnvMonarch + + ColorModel Gray/Grayscale k chunky 2 + ColorModel RGB/Color cmy banded 2 + *ColorModel CMYK kcmy banded 2 + + *Resolution - 1 0 0 0 300dpi + Resolution - 1 0 0 0 600x300dpi + Resolution - 1 0 0 0 600dpi + + *InputSlot 1 Tray + InputSlot 2 "Manual/Manual Feed" + InputSlot 3 "Envelope/Envelope Feed" + + *MediaType 0 "Plain/Plain Paper" + MediaType 1 "Bond/Bond Paper" + MediaType 2 "Special/Special Paper" + MediaType 3 Transparency + MediaType 4 "Glossy/Glossy Paper" + + Duplex flip + Installable "Option1/Duplexer" + } + + // HP LaserJet Series PCL 4/5 + { + ModelName "LaserJet Series PCL 4/5" + PCFileName "LASERJET.PPD" + Throughput 8 + ModelNumber $HP_LASERJET + ColorDevice No + + UIConstraints "*Duplex *Option1 False" + UIConstraints "*PageSize A3 *InputSlot Envelope" + UIConstraints "*PageSize A4 *InputSlot Envelope" + UIConstraints "*PageSize A5 *InputSlot Envelope" + UIConstraints "*PageSize B5 *InputSlot Envelope" + UIConstraints "*PageSize Executive *InputSlot Envelope" + UIConstraints "*PageSize Legal *InputSlot Envelope" + UIConstraints "*PageSize Letter *InputSlot Envelope" + UIConstraints "*PageSize Tabloid *InputSlot Envelope" + + HWMargins 18 36 18 36 + *Media Letter + Media Legal + Media Executive + Media Tabloid + Media A3 + Media A4 + Media A5 + Media B5 + Media EnvISOB5 + Media Env10 + Media EnvC5 + Media EnvDL + Media EnvMonarch + + Resolution k 1 0 0 0 150dpi + *Resolution k 1 0 0 0 300dpi + Resolution k 1 0 0 0 600dpi + + *InputSlot 0 Default + InputSlot 8 "Tray1/Tray 1" + InputSlot 1 "Tray2/Tray 2" + InputSlot 4 "Tray3/Tray 3" + InputSlot 5 "Tray4/Tray 4" + InputSlot 2 "Manual/Manual Feed" + InputSlot 3 "Envelope/Envelope Feed" + + Duplex Yes + Installable "Option1/Duplexer" + } +} + +// Dymo Label Printer +{ + Manufacturer "Dymo" + ModelName "Label Printer" + PCFileName "DYMO.PPD" + DriverType label + ModelNumber $DYMO_3x0 + Throughput 8 + ManualCopies No + ColorDevice No + + HWMargins 2 14.9 2 14.9 + + *Media w81h252 + Media w101h252 + Media w54h144 + Media w167h288 + Media w162h540 + Media w162h504 + Media w41h248 + Media w41h144 + Media w153h198 + + Resolution k 1 0 0 0 136dpi + Resolution k 1 0 0 0 203dpi + *Resolution k 1 0 0 0 300dpi + + Darkness 0 Light + Darkness 1 Medium + *Darkness 2 Normal + Darkness 3 Dark +} + +// Epson +{ + Manufacturer "Epson" + DriverType epson + ManualCopies Yes + ColorDevice No + Throughput 1 + + HWMargins 18 18 18 18 + *Media Letter + Media Legal + Media A4 + Media FanFoldUS + + HWMargins 0 0 0 0 + VariablePaperSizes Yes + MinSize 36 36 + MaxSize 1080 86400 + + // Epson 24-Pin Series + { + ModelName "24-Pin Series" + PCFileName "EPSON24.PPD" + ModelNumber $EPSON_24PIN + + Resolution k 1 8 0 0 60dpi + *Resolution k 1 8 0 0 120x60dpi + Resolution k 1 24 0 0 180dpi + Resolution k 1 24 0 0 360x180dpi + Resolution k 1 48 0 0 360x180dpi + } + + // Epson 9-Pin Series + { + ModelName "9-Pin Series" + PCFileName "EPSON9.PPD" + ModelNumber $EPSON_9PIN + ColorDevice No + + Resolution k 1 8 0 0 60x720dpi + *Resolution k 1 8 0 0 120x72dpi + Resolution k 1 8 0 0 240x72dpi + } + + // Epson Stylus Color Series + { + ModelName "Stylus Color Series" + PCFileName "STCOLOR.PPD" + ModelNumber $EPSON_COLOR + ColorDevice Yes + + HWMargins 8.6 39.6 8.6 25.51 + *Media Letter + Media Legal + Media A4 + + Resolution - 1 0 0 0 180dpi + *Resolution - 1 0 0 0 360dpi + Resolution - 1 0 0 0 720dpi + + *ColorModel CMYK cmyk banded 1 + ColorModel Gray/Grayscale k chunky 1 + } + + // Epson New Stylus Color Series + { + ModelName "New Stylus Color Series" + PCFileName "STCOLOR2.PPD" + ModelNumber $EPSON_ICOLOR + ColorDevice Yes + + HWMargins 8.6 39.6 8.6 25.51 + *Media Letter + Media Legal + Media A4 + + Resolution - 1 0 0 0 180dpi + *Resolution - 1 0 0 0 360dpi + Resolution - 1 0 0 0 720dpi + + *ColorModel CMYK cmyk banded 1 + ColorModel Gray/Grayscale k chunky 1 + } + + // Epson Stylus Color Series + { + ModelName "Stylus Photo Series" + PCFileName "STPHOTO.PPD" + ModelNumber $EPSON_PHOTO + ColorDevice Yes + + HWMargins 8.6 39.6 8.6 25.51 + *Media Letter + Media Legal + Media A4 + + Resolution - 1 0 0 0 180dpi + *Resolution - 1 0 0 0 360dpi + Resolution - 1 0 0 0 720dpi + + *ColorModel CMYK cmykcm banded 1 + ColorModel Gray/Grayscale k chunky 1 + } + + // Epson New Stylus Color Series + { + ModelName "New Stylus Photo Series" + PCFileName "STPHOTO2.PPD" + ModelNumber $EPSON_IPHOTO + ColorDevice Yes + + HWMargins 8.6 39.6 8.6 25.51 + *Media Letter + Media Legal + Media A4 + + Resolution - 1 0 0 0 180dpi + *Resolution - 1 0 0 0 360dpi + Resolution - 1 0 0 0 720dpi + + *ColorModel CMYK cmykcm banded 1 + ColorModel Gray/Grayscale k chunky 1 + } +} + +// Intellitech IntelliBar Series Label Printer +{ + Manufacturer "Intellitech" + ModelName "IntelliBar Series Label Printer" + PCFileName "INTELBAR.PPD" + DriverType label + ModelNumber $INTELLITECH_PCL + Throughput 8 + ColorDevice No + + HWMargins 0 5.76 0 5.76 + VariablePaperSize Yes + MinSize 36 36 + MaxSize 630 7128 + + UIConstraints "*inPrintMode Standard *inCutInterval " + UIConstraints "*inPrintMode Standard *inTearInterval " + UIConstraints "*inPrintMode Tear *inCutInterval " + UIConstraints "*inTearInterval *inPrintMode Cut" + UIConstraints "*inTearInterval *inPrintMode Standard" + + *Media w288h432 + + *Resolution k 1 0 0 0 300dpi + + Group "PrinterSettings/Printer Settings" + Option "inPrintDensity/Print Density" PickOne DocumentSetup 20.0 + *Choice "Default/PrinterDefault" "<>setpagedevice" + Choice "-15/-15" "<>setpagedevice" + Choice "-14/-14" "<>setpagedevice" + Choice "-13/-13" "<>setpagedevice" + Choice "-12/-12" "<>setpagedevice" + Choice "-11/-11" "<>setpagedevice" + Choice "-10/-10" "<>setpagedevice" + Choice "-9/-9" "<>setpagedevice" + Choice "-8/-8" "<>setpagedevice" + Choice "-7/-7" "<>setpagedevice" + Choice "-6/-6" "<>setpagedevice" + Choice "-5/-5" "<>setpagedevice" + Choice "-4/-4" "<>setpagedevice" + Choice "-3/-3" "<>setpagedevice" + Choice "-2/-2" "<>setpagedevice" + Choice "-1/-1" "<>setpagedevice" + Choice "0/0" "<>setpagedevice" + Choice "1/1" "<>setpagedevice" + Choice "2/2" "<>setpagedevice" + Choice "3/3" "<>setpagedevice" + Choice "4/4" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "6/6" "<>setpagedevice" + Choice "7/7" "<>setpagedevice" + Choice "8/8" "<>setpagedevice" + Choice "9/9" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "11/11" "<>setpagedevice" + Choice "12/12" "<>setpagedevice" + Choice "13/13" "<>setpagedevice" + Choice "14/14" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Option "inPrintRate/Print Speed" PickOne DocumentSetup 20.0 + *Choice "Default/PrinterDefault" "<>setpagedevice" + Choice "15/15 mm/sec." "<>setpagedevice" + Choice "20/20 mm/sec." "<>setpagedevice" + Choice "30/30 mm/sec." "<>setpagedevice" + Choice "40/40 mm/sec." "<>setpagedevice" + Choice "60/60 mm/sec." "<>setpagedevice" + Choice "80/80 mm/sec." "<>setpagedevice" + Choice "100/100 mm/sec." "<>setpagedevice" + Choice "120/120 mm/sec." "<>setpagedevice" + Choice "150/150 mm/sec." "<>setpagedevice" + Choice "200/200 mm/sec." "<>setpagedevice" + Choice "250/250 mm/sec." "<>setpagedevice" + Choice "300/300 mm/sec." "<>setpagedevice" + Option "inPrintMode/Print Mode" PickOne DocumentSetup 20.0 + *Choice "Standard/Standard" "" + Choice "Tear/Tear" "" + Choice "Cut/Cut" "" + Option "inTearInterval/Print and Tear" PickOne DocumentSetup 20.0 + *Choice "None/Disabled" "<>setpagedevice" + Choice "1/Every Label" "<>setpagedevice" + Choice "2/Every 2 Labels" "<>setpagedevice" + Choice "3/Every 3 Labels" "<>setpagedevice" + Choice "4/Every 4 Labels" "<>setpagedevice" + Choice "5/Every 5 Labels" "<>setpagedevice" + Choice "6/Every 6 Labels" "<>setpagedevice" + Choice "7/Every 7 Labels" "<>setpagedevice" + Choice "8/Every 8 Labels" "<>setpagedevice" + Choice "9/Every 9 Labels" "<>setpagedevice" + Choice "10/Every 10 Labels" "<>setpagedevice" + Attribute CustominTearInterval True "<>setpagedevice" + Attribute ParamCustominTearInterval Interval "1 int 1 99" + Option "inCutInterval/Print and Cut" PickOne DocumentSetup 20.0 + *Choice "None/Disabled" "<>setpagedevice" + Choice "1/Every Label" "<>setpagedevice" + Choice "2/Every 2 Labels" "<>setpagedevice" + Choice "3/Every 3 Labels" "<>setpagedevice" + Choice "4/Every 4 Labels" "<>setpagedevice" + Choice "5/Every 5 Labels" "<>setpagedevice" + Choice "6/Every 6 Labels" "<>setpagedevice" + Choice "7/Every 7 Labels" "<>setpagedevice" + Choice "8/Every 8 Labels" "<>setpagedevice" + Choice "9/Every 9 Labels" "<>setpagedevice" + Choice "10/Every 10 Labels" "<>setpagedevice" + Attribute CustominCutInterval True "<>setpagedevice" + Attribute ParamCustominCutInterval Interval "1 int 1 99" +} + +// Oki +{ + Manufacturer "Oki" + DriverType epson + ManualCopies Yes + ColorDevice No + Throughput 1 + + HWMargins 18 18 18 18 + *Media Letter + Media Legal + Media A4 + Media FanFoldUS + + HWMargins 0 0 0 0 + VariablePaperSizes Yes + MinSize 36 36 + MaxSize 1080 86400 + + // Oki 24-Pin Series + { + ModelName "24-Pin Series" + PCFileName "OKIDAT24.PPD" + ModelNumber $EPSON_24PIN + + Resolution k 1 8 0 0 60dpi + *Resolution k 1 8 0 0 120x60dpi + Resolution k 1 24 0 0 180dpi + Resolution k 1 24 0 0 360x180dpi + Resolution k 1 48 0 0 360dpi + } + + // Oki 9-Pin Series + { + ModelName "9-Pin Series" + PCFileName "OKIDATA9.PPD" + ModelNumber $EPSON_9PIN + ColorDevice No + + Resolution k 1 8 0 0 60x720dpi + *Resolution k 1 8 0 0 120x72dpi + Resolution k 1 8 0 0 240x72dpi + } +} + + +// Zebra +{ + Manufacturer "Zebra" + DriverType label + Throughput 8 + ColorDevice False + + // Zebra ZPL Label Printer + { + ModelName "ZPL Label Printer" + PCFileName "ZEBRA.PPD" + ModelNumber $ZEBRA_ZPL + + HWMargins 0 0 0 0 + VariablePaperSize Yes + MinSize 36 36 + MaxSize 288 3600 + + Media w90h18 + Media w90h162 + Media w108h18 + Media w108h36 + Media w108h72 + Media w108h144 + Media w144h26 + Media w144h36 + Media w144h72 + Media w144h90 + Media w144h288 + Media w144h396 + Media w162h36 + Media w162h90 + Media w162h288 + Media w162h396 + Media w171h396 + Media w180h72 + Media w180h144 + Media w198h90 + Media w216h72 + Media w216h90 + Media w216h144 + Media w216h216 + Media w216h360 + Media w234h144 + Media w234h360 + Media w234h396 + Media w234h419 + Media w234h563 + Media w252h72 + Media w288h72 + Media w288h144 + Media w288h180 + Media w288h216 + Media w288h288 + *Media w288h360 + Media w288h432 + Media w288h468 + Media w288h936 + + *Resolution k 1 0 0 0 203dpi + Resolution k 1 0 0 0 300dpi + Resolution k 1 0 0 0 600dpi + + Group "General/General" + Option "zeMediaTracking/Media Tracking" PickOne AnySetup 20.0 + Choice "Continuous/Continuous" "" + *Choice "Web/Non-continuous (Web sensing)" "" + Choice "Mark/Non-continuous (Mark sensing)" "" + Option "MediaType/Media Type" PickOne AnySetup 20.0 + *Choice "Saved/PrinterDefault" "" + Choice "Thermal/Thermal Transfer Media" "<>setpagedevice" + Choice "Direct/Direct Thermal Media" "<>setpagedevice" + Group "PrinterSettings/Printer Settings" + Option "Darkness/Media Darkness" PickOne AnySetup 20.0 + *Choice "-1/PrinterDefault" "<>setpagedevice" + Choice "1/1" "<>setpagedevice" + Choice "2/2" "<>setpagedevice" + Choice "3/3" "<>setpagedevice" + Choice "4/4" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "6/6" "<>setpagedevice" + Choice "7/7" "<>setpagedevice" + Choice "8/8" "<>setpagedevice" + Choice "9/9" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "11/11" "<>setpagedevice" + Choice "12/12" "<>setpagedevice" + Choice "13/13" "<>setpagedevice" + Choice "14/14" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Choice "16/16" "<>setpagedevice" + Choice "17/17" "<>setpagedevice" + Choice "18/18" "<>setpagedevice" + Choice "19/19" "<>setpagedevice" + Choice "20/20" "<>setpagedevice" + Choice "21/21" "<>setpagedevice" + Choice "22/22" "<>setpagedevice" + Choice "23/23" "<>setpagedevice" + Choice "24/24" "<>setpagedevice" + Choice "25/25" "<>setpagedevice" + Choice "26/26" "<>setpagedevice" + Choice "27/27" "<>setpagedevice" + Choice "28/28" "<>setpagedevice" + Choice "29/29" "<>setpagedevice" + Choice "30/30" "<>setpagedevice" + Option "zePrintRate/Print Rate" PickOne AnySetup 20.0 + *Choice "Default/PrinterDefault" "" + Choice "1/1 inch/sec." "" + Choice "2/2 inches/sec." "" + Choice "3/3 inches/sec." "" + Choice "4/4 inches/sec." "" + Choice "5/5 inches/sec." "" + Choice "6/6 inches/sec." "" + Choice "7/7 inches/sec." "" + Choice "8/8 inches/sec." "" + Choice "9/9 inches/sec." "" + Choice "10/10 inches/sec." "" + Choice "11/11 inches/sec." "" + Choice "12/12 inches/sec." "" + Option "zeLabelTop/Label Top" PickOne AnySetup 20.0 + *Choice "200/PrinterDefault" "<>setpagedevice" + Choice "-120/-120" "<>setpagedevice" + Choice "-115/-115" "<>setpagedevice" + Choice "-110/-110" "<>setpagedevice" + Choice "-105/-105" "<>setpagedevice" + Choice "-100/-100" "<>setpagedevice" + Choice "-95/-95" "<>setpagedevice" + Choice "-90/-90" "<>setpagedevice" + Choice "-85/-85" "<>setpagedevice" + Choice "-80/-80" "<>setpagedevice" + Choice "-75/-75" "<>setpagedevice" + Choice "-70/-70" "<>setpagedevice" + Choice "-65/-65" "<>setpagedevice" + Choice "-60/-60" "<>setpagedevice" + Choice "-55/-55" "<>setpagedevice" + Choice "-50/-50" "<>setpagedevice" + Choice "-45/-45" "<>setpagedevice" + Choice "-40/-40" "<>setpagedevice" + Choice "-35/-35" "<>setpagedevice" + Choice "-30/-30" "<>setpagedevice" + Choice "-25/-25" "<>setpagedevice" + Choice "-20/-20" "<>setpagedevice" + Choice "-15/-15" "<>setpagedevice" + Choice "-10/-10" "<>setpagedevice" + Choice "-5/-5" "<>setpagedevice" + Choice "0/0" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Choice "20/20" "<>setpagedevice" + Choice "25/25" "<>setpagedevice" + Choice "30/30" "<>setpagedevice" + Choice "35/35" "<>setpagedevice" + Choice "40/40" "<>setpagedevice" + Choice "45/45" "<>setpagedevice" + Choice "50/50" "<>setpagedevice" + Choice "55/55" "<>setpagedevice" + Choice "60/60" "<>setpagedevice" + Choice "65/65" "<>setpagedevice" + Choice "70/70" "<>setpagedevice" + Choice "75/75" "<>setpagedevice" + Choice "80/80" "<>setpagedevice" + Choice "85/85" "<>setpagedevice" + Choice "90/90" "<>setpagedevice" + Choice "95/95" "<>setpagedevice" + Choice "100/100" "<>setpagedevice" + Choice "105/105" "<>setpagedevice" + Choice "110/110" "<>setpagedevice" + Choice "115/115" "<>setpagedevice" + Choice "120/120" "<>setpagedevice" + Option "zePrintMode/Print Mode" PickOne AnySetup 20.0 + *Choice "Saved/PrinterDefault" "" + Choice "Tear/Tear-off" "" + Choice "Peel/Peel-Off" "" + Choice "Rewind/Rewind" "" + Choice "Applicator/Applicator" "" + Choice "Cutter/Cutter" "" + Option "zeTearOffPosition/Tear-off Adjust Position" PickOne AnySetup 20.0 + *Choice "1000/PrinterDefault" "<>setpagedevice" + Choice "-120/-120" "<>setpagedevice" + Choice "-115/-115" "<>setpagedevice" + Choice "-110/-110" "<>setpagedevice" + Choice "-105/-105" "<>setpagedevice" + Choice "-100/-100" "<>setpagedevice" + Choice "-95/-95" "<>setpagedevice" + Choice "-90/-90" "<>setpagedevice" + Choice "-85/-85" "<>setpagedevice" + Choice "-80/-80" "<>setpagedevice" + Choice "-75/-75" "<>setpagedevice" + Choice "-70/-70" "<>setpagedevice" + Choice "-65/-65" "<>setpagedevice" + Choice "-60/-60" "<>setpagedevice" + Choice "-55/-55" "<>setpagedevice" + Choice "-50/-50" "<>setpagedevice" + Choice "-45/-45" "<>setpagedevice" + Choice "-40/-40" "<>setpagedevice" + Choice "-35/-35" "<>setpagedevice" + Choice "-30/-30" "<>setpagedevice" + Choice "-25/-25" "<>setpagedevice" + Choice "-20/-20" "<>setpagedevice" + Choice "-15/-15" "<>setpagedevice" + Choice "-10/-10" "<>setpagedevice" + Choice "-5/-5" "<>setpagedevice" + Choice "0/0" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Choice "20/20" "<>setpagedevice" + Choice "25/25" "<>setpagedevice" + Choice "30/30" "<>setpagedevice" + Choice "35/35" "<>setpagedevice" + Choice "40/40" "<>setpagedevice" + Choice "45/45" "<>setpagedevice" + Choice "50/50" "<>setpagedevice" + Choice "55/55" "<>setpagedevice" + Choice "60/60" "<>setpagedevice" + Choice "65/65" "<>setpagedevice" + Choice "70/70" "<>setpagedevice" + Choice "75/75" "<>setpagedevice" + Choice "80/80" "<>setpagedevice" + Choice "85/85" "<>setpagedevice" + Choice "90/90" "<>setpagedevice" + Choice "95/95" "<>setpagedevice" + Choice "100/100" "<>setpagedevice" + Choice "105/105" "<>setpagedevice" + Choice "110/110" "<>setpagedevice" + Choice "115/115" "<>setpagedevice" + Choice "120/120" "<>setpagedevice" + Option "zeErrorReprint/Reprint After Error" PickOne AnySetup 20.0 + *Choice "Saved/PrinterDefault" "" + Choice "Always/Always" "" + Choice "Never/Never" "" + } + +// Zebra CPCL Label Printer +{ + Copyright "" + Copyright "Sample Zebra label printer driver PPD file for the Common UNIX Printing" + Copyright "System (CUPS)." + Copyright "" + Copyright "Copyright 2001-2007 by Easy Software Products." + Copyright "" + Copyright "These coded instructions, statements, and computer programs are the" + Copyright "property of Easy Software Products and are protected by Federal" + Copyright "copyright law. Distribution and use rights are outlined in the file" + Copyright "\"LICENSE.txt\" which should have been included with this file. If this" + Copyright "file is missing or damaged please contact Easy Software Products" + Copyright "at:" + Copyright "" + Copyright "Attn: CUPS Licensing Information" + Copyright "Easy Software Products" + Copyright "44141 Airport View Drive, Suite 204" + Copyright "Hollywood, Maryland 20636 USA" + Copyright "" + Copyright "Voice: (301) 373-9600" + Copyright "EMail: cups-info@cups.org" + Copyright "WWW: http://www.cups.org" + Copyright "" + Manufacturer "Zebra" + ModelName "CPCL Label Printer" + PCFileName "ZEBRACPL.PPD" + Version "1.3" + DriverType ps + ModelNumber 19 + Throughput 8 + Attribute "Product" "" "(GNU Ghostscript)" + Attribute "Product" "" "(ESP Ghostscript)" + Attribute "cupsVersion" "" "1.3" + Attribute "cupsManualCopies" "" "False" + Attribute "cupsModelNumber" "" "19" + Attribute "PSVersion" "" "(3010.000) 81501" + Attribute "LanguageLevel" "" "3" + Attribute "DefaultColorSpace" "" "Gray" + Attribute "FileSystem" "" "False" + Attribute "LandscapeOrientation" "" "Plus90" + Attribute "TTRasterizer" "" "Type42" + Attribute "HWMargins" "" "0 0 1 0" + Attribute "ParamCustomPageSize" "Width" "1 points 36 288" + Attribute "ParamCustomPageSize" "Height" "2 points 36 3600" + Attribute "ParamCustomPageSize" "WidthOffset" "3 points 0 0" + Attribute "ParamCustomPageSize" "HeightOffset" "4 points 0 0" + Attribute "ParamCustomPageSize" "Orientation" "5 int 0 0" + Font "AvantGarde-Book" "Standard" "(001.006S)" "Standard" ROM + Font "AvantGarde-BookOblique" "Standard" "(001.006S)" "Standard" ROM + Font "AvantGarde-Demi" "Standard" "(001.007S)" "Standard" ROM + Font "AvantGarde-DemiOblique" "Standard" "(001.007S)" "Standard" ROM + Font "Bookman-Demi" "Standard" "(001.004S)" "Standard" ROM + Font "Bookman-DemiItalic" "Standard" "(001.004S)" "Standard" ROM + Font "Bookman-Light" "Standard" "(001.004S)" "Standard" ROM + Font "Bookman-LightItalic" "Standard" "(001.004S)" "Standard" ROM + Font "Courier" "Standard" "(002.004S)" "Standard" ROM + Font "Courier-Bold" "Standard" "(002.004S)" "Standard" ROM + Font "Courier-BoldOblique" "Standard" "(002.004S)" "Standard" ROM + Font "Courier-Oblique" "Standard" "(002.004S)" "Standard" ROM + Font "Helvetica" "Standard" "(001.006S)" "Standard" ROM + Font "Helvetica-Bold" "Standard" "(001.007S)" "Standard" ROM + Font "Helvetica-BoldOblique" "Standard" "(001.007S)" "Standard" ROM + Font "Helvetica-Narrow" "Standard" "(001.006S)" "Standard" ROM + Font "Helvetica-Narrow-Bold" "Standard" "(001.007S)" "Standard" ROM + Font "Helvetica-Narrow-BoldOblique" "Standard" "(001.007S)" "Standard" ROM + Font "Helvetica-Narrow-Oblique" "Standard" "(001.006S)" "Standard" ROM + Font "Helvetica-Oblique" "Standard" "(001.006S)" "Standard" ROM + Font "NewCenturySchlbk-Bold" "Standard" "(001.009S)" "Standard" ROM + Font "NewCenturySchlbk-BoldItalic" "Standard" "(001.007S)" "Standard" ROM + Font "NewCenturySchlbk-Italic" "Standard" "(001.006S)" "Standard" ROM + Font "NewCenturySchlbk-Roman" "Standard" "(001.007S)" "Standard" ROM + Font "Palatino-Bold" "Standard" "(001.005S)" "Standard" ROM + Font "Palatino-BoldItalic" "Standard" "(001.005S)" "Standard" ROM + Font "Palatino-Italic" "Standard" "(001.005S)" "Standard" ROM + Font "Palatino-Roman" "Standard" "(001.005S)" "Standard" ROM + Font "Symbol" "Special" "(001.007S)" "Special" ROM + Font "Times-Bold" "Standard" "(001.007S)" "Standard" ROM + Font "Times-BoldItalic" "Standard" "(001.009S)" "Standard" ROM + Font "Times-Italic" "Standard" "(001.007S)" "Standard" ROM + Font "Times-Roman" "Standard" "(001.007S)" "Standard" ROM + Font "ZapfChancery-MediumItalic" "Standard" "(001.007S)" "Standard" ROM + Font "ZapfDingbats" "Special" "(001.004S)" "Standard" ROM + Group "General/General" + Option "Resolution/Output Resolution" PickOne AnySetup 20.0 + *Choice "203dpi/203 DPI" "<>setpagedevice" + Option "zeMediaTracking/Media Tracking" PickOne AnySetup 20.0 + Choice "Continuous/Continuous" "" + *Choice "Web/Non-continuous (Web sensing)" "" + Choice "Mark/Non-continuous (Mark sensing)" "" + Group "PrinterSettings/Printer Settings" + Option "Darkness/Media Darkness" PickOne AnySetup 20.0 + *Choice "-1/PrinterDefault" "<>setpagedevice" + Choice "1/1" "<>setpagedevice" + Choice "2/2" "<>setpagedevice" + Choice "3/3" "<>setpagedevice" + Choice "4/4" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "6/6" "<>setpagedevice" + Choice "7/7" "<>setpagedevice" + Choice "8/8" "<>setpagedevice" + Choice "9/9" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "11/11" "<>setpagedevice" + Choice "12/12" "<>setpagedevice" + Choice "13/13" "<>setpagedevice" + Choice "14/14" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Choice "16/16" "<>setpagedevice" + Choice "17/17" "<>setpagedevice" + Choice "18/18" "<>setpagedevice" + Choice "19/19" "<>setpagedevice" + Choice "20/20" "<>setpagedevice" + Choice "21/21" "<>setpagedevice" + Choice "22/22" "<>setpagedevice" + Choice "23/23" "<>setpagedevice" + Choice "24/24" "<>setpagedevice" + Choice "25/25" "<>setpagedevice" + Choice "26/26" "<>setpagedevice" + Choice "27/27" "<>setpagedevice" + Choice "28/28" "<>setpagedevice" + Choice "29/29" "<>setpagedevice" + Choice "30/30" "<>setpagedevice" + Option "zePrintRate/Print Rate" PickOne AnySetup 20.0 + *Choice "Default/PrinterDefault" "" + Choice "1/1 inch/sec." "" + Choice "2/2 inches/sec." "" + Choice "3/3 inches/sec." "" + Choice "4/4 inches/sec." "" + Option "zeTearOffPosition/Tear-off Adjust Position" PickOne AnySetup 20.0 + *Choice "1000/PrinterDefault" "<>setpagedevice" + Choice "-120/-120" "<>setpagedevice" + Choice "-115/-115" "<>setpagedevice" + Choice "-110/-110" "<>setpagedevice" + Choice "-105/-105" "<>setpagedevice" + Choice "-100/-100" "<>setpagedevice" + Choice "-95/-95" "<>setpagedevice" + Choice "-90/-90" "<>setpagedevice" + Choice "-85/-85" "<>setpagedevice" + Choice "-80/-80" "<>setpagedevice" + Choice "-75/-75" "<>setpagedevice" + Choice "-70/-70" "<>setpagedevice" + Choice "-65/-65" "<>setpagedevice" + Choice "-60/-60" "<>setpagedevice" + Choice "-55/-55" "<>setpagedevice" + Choice "-50/-50" "<>setpagedevice" + Choice "-45/-45" "<>setpagedevice" + Choice "-40/-40" "<>setpagedevice" + Choice "-35/-35" "<>setpagedevice" + Choice "-30/-30" "<>setpagedevice" + Choice "-25/-25" "<>setpagedevice" + Choice "-20/-20" "<>setpagedevice" + Choice "-15/-15" "<>setpagedevice" + Choice "-10/-10" "<>setpagedevice" + Choice "-5/-5" "<>setpagedevice" + Choice "0/0" "<>setpagedevice" + Choice "5/5" "<>setpagedevice" + Choice "10/10" "<>setpagedevice" + Choice "15/15" "<>setpagedevice" + Choice "20/20" "<>setpagedevice" + Choice "25/25" "<>setpagedevice" + Choice "30/30" "<>setpagedevice" + Choice "35/35" "<>setpagedevice" + Choice "40/40" "<>setpagedevice" + Choice "45/45" "<>setpagedevice" + Choice "50/50" "<>setpagedevice" + Choice "55/55" "<>setpagedevice" + Choice "60/60" "<>setpagedevice" + Choice "65/65" "<>setpagedevice" + Choice "70/70" "<>setpagedevice" + Choice "75/75" "<>setpagedevice" + Choice "80/80" "<>setpagedevice" + Choice "85/85" "<>setpagedevice" + Choice "90/90" "<>setpagedevice" + Choice "95/95" "<>setpagedevice" + Choice "100/100" "<>setpagedevice" + Choice "105/105" "<>setpagedevice" + Choice "110/110" "<>setpagedevice" + Choice "115/115" "<>setpagedevice" + Choice "120/120" "<>setpagedevice" + Option "zeErrorReprint/Reprint After Error" PickOne AnySetup 20.0 + *Choice "Saved/PrinterDefault" "" + Choice "Always/Always" "" + Choice "Never/Never" "" + CustomMedia "w144h72/Label - 2 x 1\"" 144.00 72.00 0.00 0.00 0.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w144h90/Label - 2 x 1.25\"" 144.00 90.00 0.00 0.00 0.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w144h144/Label - 2 x 2\"" 144.00 144.00 0.00 0.00 0.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w144h216/Label - 2 x 3\"" 144.00 216.00 0.00 0.00 0.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w209h72/Label - 2.9 x 1\"" 209.00 72.00 0.00 0.00 0.00 0.00 "<>setpagedevice>>" "<>setpagedevice>>" + CustomMedia "w288h144/Label - 4 x 2\"" 288.00 144.00 0.00 0.00 1.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w288h216/Label - 4 x 3\"" 288.00 216.00 0.00 0.00 1.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w288h288/Label - 4 x 4\"" 288.00 288.00 0.00 0.00 1.00 0.00 "<>setpagedevice" "<>setpagedevice" + *CustomMedia "w288h360/Label - 4 x 5\"" 288.00 360.00 0.00 0.00 1.00 0.00 "<>setpagedevice" "<>setpagedevice" + CustomMedia "w288h432/Label - 4 x 6\"" 288.00 432.00 0.00 0.00 1.00 0.00 "<>setpagedevice" "<>setpagedevice" +} diff --git a/ppd/stcolor.ppd b/ppd/stcolor.ppd index aba03926b..66ea0374c 100644 --- a/ppd/stcolor.ppd +++ b/ppd/stcolor.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: stcolor.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: stcolor.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON Stylus Color driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "STCOLOR.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 2 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" @@ -40,7 +40,7 @@ *cupsColorProfile 720dpi/-: "1.0 2.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0" *ModelName: "EPSON Stylus Color Series" *ShortNickName: "EPSON Stylus Color Series" -*NickName: "EPSON Stylus Color Series CUPS v1.2" +*NickName: "EPSON Stylus Color Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -81,8 +81,8 @@ *OrderDependency: 20 AnySetup *Resolution *DefaultResolution: 360dpi *Resolution 180dpi/180 DPI: "<>setpagedevice" -*Resolution 360dpi/360 DPI: "<>setpagedevice{0.6666 exp}bind settransfer" -*Resolution 720dpi/720 DPI: "<>setpagedevice{0.4 exp}bind settransfer" +*Resolution 360dpi/360 DPI: "<>setpagedevice" +*Resolution 720dpi/720 DPI: "<>setpagedevice" *CloseUI: *Resolution *OpenUI *ColorModel/Output Mode: PickOne @@ -129,5 +129,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: stcolor.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: stcolor.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/stcolor2.ppd b/ppd/stcolor2.ppd index f66142b47..639ad3bba 100644 --- a/ppd/stcolor2.ppd +++ b/ppd/stcolor2.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: stcolor2.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: stcolor2.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON Stylus Color driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "STCOLOR2.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 4 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" @@ -40,7 +40,7 @@ *cupsColorProfile 720dpi/-: "1.0 2.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0" *ModelName: "EPSON New Stylus Color Series" *ShortNickName: "EPSON New Stylus Color Series" -*NickName: "EPSON New Stylus Color Series CUPS v1.2" +*NickName: "EPSON New Stylus Color Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -81,8 +81,8 @@ *OrderDependency: 20 AnySetup *Resolution *DefaultResolution: 360dpi *Resolution 180dpi/180 DPI: "<>setpagedevice" -*Resolution 360dpi/360 DPI: "<>setpagedevice{0.6666 exp}bind settransfer" -*Resolution 720dpi/720 DPI: "<>setpagedevice{0.4 exp}bind settransfer" +*Resolution 360dpi/360 DPI: "<>setpagedevice" +*Resolution 720dpi/720 DPI: "<>setpagedevice" *CloseUI: *Resolution *OpenUI *ColorModel/Output Mode: PickOne @@ -129,5 +129,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: stcolor2.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: stcolor2.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/stphoto.ppd b/ppd/stphoto.ppd index ce01eba5f..994358c97 100644 --- a/ppd/stphoto.ppd +++ b/ppd/stphoto.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: stphoto.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: stphoto.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON Stylus Photo driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "STPHOTO.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 3 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" @@ -40,7 +40,7 @@ *cupsColorProfile 720dpi/-: "1.0 2.5 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" *ModelName: "EPSON Stylus Photo Series" *ShortNickName: "EPSON Stylus Photo Series" -*NickName: "EPSON Stylus Photo Series CUPS v1.2" +*NickName: "EPSON Stylus Photo Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -81,8 +81,8 @@ *OrderDependency: 20 AnySetup *Resolution *DefaultResolution: 360dpi *Resolution 180dpi/180 DPI: "<>setpagedevice" -*Resolution 360dpi/360 DPI: "<>setpagedevice{0.6666 exp}bind settransfer" -*Resolution 720dpi/720 DPI: "<>setpagedevice{0.4 exp}bind settransfer" +*Resolution 360dpi/360 DPI: "<>setpagedevice" +*Resolution 720dpi/720 DPI: "<>setpagedevice" *CloseUI: *Resolution *OpenUI *ColorModel/Output Mode: PickOne @@ -129,5 +129,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: stphoto.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: stphoto.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/stphoto2.ppd b/ppd/stphoto2.ppd index f093582da..8e1874d94 100644 --- a/ppd/stphoto2.ppd +++ b/ppd/stphoto2.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: stphoto2.ppd 4880 2005-12-15 16:19:46Z mike $" +*% "$Id: stphoto2.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample EPSON Stylus Photo driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 1997-2005 by Easy Software Products. +*% Copyright 1997-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "STPHOTO2.PPD" *Manufacturer: "Epson" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: True *cupsModelNumber: 5 *cupsFilter: "application/vnd.cups-raster 0 rastertoepson" @@ -40,7 +40,7 @@ *cupsColorProfile 720dpi/-: "1.0 2.5 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0" *ModelName: "EPSON New Stylus Photo Series" *ShortNickName: "EPSON New Stylus Photo Series" -*NickName: "EPSON New Stylus Photo Series CUPS v1.2" +*NickName: "EPSON New Stylus Photo Series CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: True @@ -81,8 +81,8 @@ *OrderDependency: 20 AnySetup *Resolution *DefaultResolution: 360dpi *Resolution 180dpi/180 DPI: "<>setpagedevice" -*Resolution 360dpi/360 DPI: "<>setpagedevice{0.6666 exp}bind settransfer" -*Resolution 720dpi/720 DPI: "<>setpagedevice{0.4 exp}bind settransfer" +*Resolution 360dpi/360 DPI: "<>setpagedevice" +*Resolution 720dpi/720 DPI: "<>setpagedevice" *CloseUI: *Resolution *OpenUI *ColorModel/Output Mode: PickOne @@ -129,5 +129,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: stphoto2.ppd 4880 2005-12-15 16:19:46Z mike $". +*% End of "$Id: stphoto2.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/zebra.ppd b/ppd/zebra.ppd index c478eda0f..413aa8e06 100644 --- a/ppd/zebra.ppd +++ b/ppd/zebra.ppd @@ -1,11 +1,11 @@ *PPD-Adobe: "4.3" *% -*% "$Id: zebra.ppd 5510 2006-05-11 17:41:54Z mike $" +*% "$Id: zebra.ppd 6557 2007-06-18 17:41:11Z mike $" *% *% Sample Zebra label printer driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 2001-2006 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "ZEBRA.PPD" *Manufacturer: "Zebra" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *% cupsModelNumber is 16 for EPL1 line mode, 17 for EPL2 page mode, @@ -39,7 +39,7 @@ *cupsModelNumber: 18 *ModelName: "Zebra ZPL Label Printer" *ShortNickName: "Zebra ZPL Label Printer" -*NickName: "Zebra ZPL Label Printer CUPS v1.2" +*NickName: "Zebra ZPL Label Printer CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -261,7 +261,7 @@ *OpenUI *Darkness/Media Darkness: PickOne *OrderDependency: 20 AnySetup *Darkness *DefaultDarkness: -1 -*Darkness -1/PrinterDefault: "<>setpagedevice" +*Darkness -1/PrinterDefault: "<>setpagedevice" *Darkness 1: "<>setpagedevice" *Darkness 2: "<>setpagedevice" *Darkness 3: "<>setpagedevice" @@ -297,7 +297,7 @@ *OpenUI *zePrintRate/Print Rate: PickOne *OrderDependency: 20 AnySetup *zePrintRate *DefaultzePrintRate: Default -*zePrintRate Default/PrinterDefault: Default +*zePrintRate Default/PrinterDefault: "" *zePrintRate 1/1 inch/sec.: "" *zePrintRate 2/2 inches/sec.: "" *zePrintRate 3/3 inches/sec.: "" @@ -479,5 +479,5 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM *% -*% End of "$Id: zebra.ppd 5510 2006-05-11 17:41:54Z mike $". +*% End of "$Id: zebra.ppd 6557 2007-06-18 17:41:11Z mike $". *% diff --git a/ppd/zebracpl.ppd b/ppd/zebracpl.ppd index e5bd41241..11d63a545 100644 --- a/ppd/zebracpl.ppd +++ b/ppd/zebracpl.ppd @@ -5,7 +5,7 @@ *% Sample Zebra label printer driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 2001-2006 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "ZEBRACPL.PPD" *Manufacturer: "Zebra" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *% cupsModelNumber is 16 for EPL1 line mode, 17 for EPL2 page mode, @@ -39,7 +39,7 @@ *cupsModelNumber: 19 *ModelName: "Zebra CPCL Label Printer" *ShortNickName: "Zebra CPCL Label Printer" -*NickName: "Zebra CPCL Label Printer CUPS v1.2" +*NickName: "Zebra CPCL Label Printer CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -132,7 +132,7 @@ *OpenUI *Darkness/Media Darkness: PickOne *OrderDependency: 20 AnySetup *Darkness *DefaultDarkness: -1 -*Darkness -1/PrinterDefault: "<>setpagedevice" +*Darkness -1/PrinterDefault: "<>setpagedevice" *Darkness 1: "<>setpagedevice" *Darkness 2: "<>setpagedevice" *Darkness 3: "<>setpagedevice" diff --git a/ppd/zebraep1.ppd b/ppd/zebraep1.ppd index 1e157654b..b47b1ce37 100644 --- a/ppd/zebraep1.ppd +++ b/ppd/zebraep1.ppd @@ -5,7 +5,7 @@ *% Sample Zebra label printer driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 2001-2006 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "ZEBRA.PPD" *Manufacturer: "Zebra" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *% cupsModelNumber is 16 for EPL1 line mode, 17 for EPL2 page mode, @@ -39,7 +39,7 @@ *cupsModelNumber: 16 *ModelName: "Zebra EPL1 Label Printer" *ShortNickName: "Zebra EPL1 Label Printer" -*NickName: "Zebra EPL1 Label Printer CUPS v1.2" +*NickName: "Zebra EPL1 Label Printer CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -245,7 +245,7 @@ *OpenUI *Darkness/Media Darkness: PickOne *OrderDependency: 20 AnySetup *Darkness *DefaultDarkness: -1 -*Darkness -1/PrinterDefault: "<>setpagedevice" +*Darkness -1/PrinterDefault: "<>setpagedevice" *Darkness 1: "<>setpagedevice" *Darkness 2: "<>setpagedevice" *Darkness 3: "<>setpagedevice" diff --git a/ppd/zebraep2.ppd b/ppd/zebraep2.ppd index 6bd774713..5fffdba3f 100644 --- a/ppd/zebraep2.ppd +++ b/ppd/zebraep2.ppd @@ -5,7 +5,7 @@ *% Sample Zebra label printer driver PPD file for the Common UNIX Printing *% System (CUPS). *% -*% Copyright 2001-2006 by Easy Software Products. +*% Copyright 2001-2007 by Easy Software Products. *% *% These coded instructions, statements, and computer programs are the *% property of Easy Software Products and are protected by Federal @@ -24,14 +24,14 @@ *% WWW: http://www.cups.org *% *FormatVersion: "4.3" -*FileVersion: "1.2" +*FileVersion: "1.3" *LanguageVersion: English *LanguageEncoding: ISOLatin1 *PCFileName: "ZEBRA.PPD" *Manufacturer: "Zebra" *Product: "(GNU Ghostscript)" *Product: "(ESP Ghostscript)" -*cupsVersion: 1.2 +*cupsVersion: 1.3 *cupsManualCopies: False *cupsFilter: "application/vnd.cups-raster 0 rastertolabel" *% cupsModelNumber is 16 for EPL1 line mode, 17 for EPL2 page mode, @@ -39,7 +39,7 @@ *cupsModelNumber: 17 *ModelName: "Zebra EPL2 Label Printer" *ShortNickName: "Zebra EPL2 Label Printer" -*NickName: "Zebra EPL2 Label Printer CUPS v1.2" +*NickName: "Zebra EPL2 Label Printer CUPS v1.3" *PSVersion: "(3010.000) 81501" *LanguageLevel: "3" *ColorDevice: False @@ -253,7 +253,7 @@ *OpenUI *Darkness/Media Darkness: PickOne *OrderDependency: 20 AnySetup *Darkness *DefaultDarkness: -1 -*Darkness -1/PrinterDefault: "<>setpagedevice" +*Darkness -1/PrinterDefault: "<>setpagedevice" *Darkness 1: "<>setpagedevice" *Darkness 2: "<>setpagedevice" *Darkness 3: "<>setpagedevice" diff --git a/scheduler/Makefile b/scheduler/Makefile index c76690e06..a5a8653a8 100644 --- a/scheduler/Makefile +++ b/scheduler/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 6291 2007-02-19 21:54:27Z mike $" +# "$Id: Makefile 6565 2007-06-18 23:50:16Z mike $" # # Scheduler Makefile for the Common UNIX Printing System (CUPS). # @@ -135,11 +135,13 @@ install: all echo Creating $(SERVERROOT)/ssl... $(INSTALL_DIR) -m 700 $(SERVERROOT)/ssl -chgrp $(CUPS_GROUP) $(SERVERROOT)/ssl - echo Creating $(STATEDIR)... - $(INSTALL_DIR) -m 755 $(STATEDIR) - echo Creating $(STATEDIR)/certs... - $(INSTALL_DIR) -m 511 $(STATEDIR)/certs - -chgrp $(CUPS_PRIMARY_SYSTEM_GROUP) $(STATEDIR)/certs + -if test "x`uname`" != xDarwin; then \ + echo Creating $(STATEDIR)...; \ + $(INSTALL_DIR) -m 755 $(STATEDIR); \ + echo Creating $(STATEDIR)/certs...; \ + $(INSTALL_DIR) -m 511 $(STATEDIR)/certs; \ + chgrp $(CUPS_PRIMARY_SYSTEM_GROUP) $(STATEDIR)/certs; \ + fi echo Creating $(LOGDIR)... $(INSTALL_DIR) -m 755 $(LOGDIR) echo Creating $(REQUESTS)... @@ -154,6 +156,12 @@ install: all # echo Creating $(CACHEDIR)/ppd... # $(INSTALL_DIR) -m 755 $(CACHEDIR)/ppd # -chgrp $(CUPS_GROUP) $(CACHEDIR)/ppd + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -304,5 +312,5 @@ include Dependencies # -# End of "$Id: Makefile 6291 2007-02-19 21:54:27Z mike $". +# End of "$Id: Makefile 6565 2007-06-18 23:50:16Z mike $". # diff --git a/scheduler/auth.c b/scheduler/auth.c index d0cee777f..a4bfa09b1 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -1,5 +1,5 @@ /* - * "$Id: auth.c 6397 2007-03-25 23:33:32Z mike $" + * "$Id: auth.c 6570 2007-06-19 18:10:48Z mike $" * * Authorization routines for the Common UNIX Printing System (CUPS). * @@ -956,6 +956,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ gss_release_buffer(&minor_status, &output_token); gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER); + + con->gss_have_creds = 1; } else gss_release_name(&minor_status, &client_name); @@ -2537,5 +2539,5 @@ to64(char *s, /* O - Output string */ /* - * End of "$Id: auth.c 6397 2007-03-25 23:33:32Z mike $". + * End of "$Id: auth.c 6570 2007-06-19 18:10:48Z mike $". */ diff --git a/scheduler/client.c b/scheduler/client.c index 68439f30e..55eb41164 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,5 +1,5 @@ /* - * "$Id: client.c 6504 2007-05-02 00:14:56Z mike $" + * "$Id: client.c 6570 2007-06-19 18:10:48Z mike $" * * Client routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -834,6 +834,10 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ con->language = NULL; } +#ifdef HAVE_GSSAPI + con->gss_have_creds = 0; +#endif /* HAVE_GSSAPI */ + /* * Grab the request line... */ @@ -4562,5 +4566,5 @@ write_pipe(cupsd_client_t *con) /* I - Client connection */ /* - * End of "$Id: client.c 6504 2007-05-02 00:14:56Z mike $". + * End of "$Id: client.c 6570 2007-06-19 18:10:48Z mike $". */ diff --git a/scheduler/client.h b/scheduler/client.h index 82061b7bb..cfdf6e37c 100644 --- a/scheduler/client.h +++ b/scheduler/client.h @@ -1,5 +1,5 @@ /* - * "$Id: client.h 6503 2007-05-01 23:06:44Z mike $" + * "$Id: client.h 6570 2007-06-19 18:10:48Z mike $" * * Client definitions for the Common UNIX Printing System (CUPS) scheduler. * @@ -61,6 +61,7 @@ struct cupsd_client_s char servername[256];/* Server name for connection */ int serverport; /* Server port for connection */ #ifdef HAVE_GSSAPI + int gss_have_creds; /* Have authenticated credentials */ int no_negotiate; /* Don't offer WWW-Authenticate: Negotiate */ gss_buffer_desc gss_output_token; /* Output token for Negotiate header */ @@ -138,5 +139,5 @@ extern void cupsdWriteClient(cupsd_client_t *con); /* - * End of "$Id: client.h 6503 2007-05-01 23:06:44Z mike $". + * End of "$Id: client.h 6570 2007-06-19 18:10:48Z mike $". */ diff --git a/scheduler/conf.c b/scheduler/conf.c index e45da7378..fe4dffe9a 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -1,5 +1,5 @@ /* - * "$Id: conf.c 6518 2007-05-07 22:17:53Z mike $" + * "$Id: conf.c 6547 2007-06-04 14:38:43Z mike $" * * Configuration routines for the Common UNIX Printing System (CUPS). * @@ -1797,7 +1797,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ cupsdLogMessage(CUPSD_LOG_WARN, "\"AuthClass %s\" is deprecated; consider using " - "\"Require @groupname\" on line %d.", + "\"Require user @groupname\" on line %d.", value, linenum); } else if (!strcasecmp(value, "system")) @@ -1808,7 +1808,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ cupsdLogMessage(CUPSD_LOG_WARN, "\"AuthClass %s\" is deprecated; consider using " - "\"Require @SYSTEM\" on line %d.", + "\"Require user @SYSTEM\" on line %d.", value, linenum); } else @@ -1825,7 +1825,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ cupsdLogMessage(CUPSD_LOG_WARN, "\"AuthGroupName %s\" directive is deprecated; consider " - "using \"Require @%s\" on line %d.", + "using \"Require user @%s\" on line %d.", value, value, linenum); } else if (!strcasecmp(line, "Require")) @@ -3373,5 +3373,5 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ /* - * End of "$Id: conf.c 6518 2007-05-07 22:17:53Z mike $". + * End of "$Id: conf.c 6547 2007-06-04 14:38:43Z mike $". */ diff --git a/scheduler/cups-driverd.c b/scheduler/cups-driverd.c index bd632c738..f8dc349e7 100644 --- a/scheduler/cups-driverd.c +++ b/scheduler/cups-driverd.c @@ -1,5 +1,5 @@ /* - * "$Id: cups-driverd.c 6540 2007-05-23 15:25:48Z mike $" + * "$Id: cups-driverd.c 6551 2007-06-05 13:32:22Z mike $" * * PPD/driver support for the Common UNIX Printing System (CUPS). * @@ -299,7 +299,8 @@ cat_ppd(const char *name, /* I - PPD name */ else scheme[0] = '\0'; - puts("Content-Type: application/ipp\n"); + if (request_id > 0) + puts("Content-Type: application/ipp\n"); if (scheme[0]) { @@ -1707,5 +1708,5 @@ load_drivers(void) /* - * End of "$Id: cups-driverd.c 6540 2007-05-23 15:25:48Z mike $". + * End of "$Id: cups-driverd.c 6551 2007-06-05 13:32:22Z mike $". */ diff --git a/scheduler/cupsd.order b/scheduler/cupsd.order new file mode 100644 index 000000000..adf0c5bc5 --- /dev/null +++ b/scheduler/cupsd.order @@ -0,0 +1,93 @@ +506502610382 _dyld_func_lookup +506502685257 main +506502715804 cupsdSetString +506506372025 cupsdFindLocation +506506395599 cupsdAddLocation +506506422618 compare_locations +506506442028 cupsdAllowIP +506506459141 add_allow +506506478809 read_location +506506500685 parse_aaa +506506520354 cupsdAllowHost +506506554362 cupsdAddName +506506578477 read_policy +506506595949 cupsdAddPolicy +506506651840 cupsdAddPolicyOp +506506850180 cupsdCheckPermissions +506507063184 cupsdInitEnv +506507083008 clear_env +506507102454 cupsdSetEnv +506507138155 cupsdSetEnvf +506507189792 cupsdFindPolicy +506507227839 cupsdDeleteAllSubscriptions +506507248359 cupsdFreeAllJobs +506507267439 cupsdDeleteAllClasses +506507286520 cupsdDeleteAllPrinters +506507307556 mimeLoad +506507324314 mimeMerge +506507355197 mimeNew +506507441845 load_types +506507518598 mimeAddType +506507536778 mimeType +506507556897 mimeAddTypeRule +506507593083 compare_types +506508272080 load_convs +506508326621 add_fcache +506508359303 mimeAddFilter +506508378534 mimeFilterLookup +506508403668 compare_fcache +506508429895 compare_filters +506509114255 delete_fcache +506509154834 mimeNumFilters +506509172690 mimeNumTypes +506509206171 mimeFirstType +506509228911 mimeNextType +506509325837 cupsdLoadBanners +506509344611 free_banners +506509424863 add_banner +506509442851 mimeFileType +506509475474 checkrules +506509509518 patmatch +506509582672 compare_banners +506509797932 cupsdLoadAllPrinters +506509854963 cupsdAddPrinter +506509925950 cupsdSetPrinterAttrs +506509947124 cupsdCreateCommonData +506510213823 delete_printer_filters +506510235340 mimeFirstFilter +506510252530 mimeNextFilter +506510273476 cupsdFindBest +506510293397 cupsdFindPolicyOp +506510353536 cupsdSanitizeURI +506511563302 add_printer_filter +506511697758 add_printer_formats +506511719725 mimeFilter +506511737533 compare_srcs +506511764984 find_filters +506512606253 add_printer_defaults +506512654206 cupsdRegisterPrinter +506512674342 cupsdAddPrinterHistory +506512737170 compare_printers +506524108560 cupsdLoadAllClasses +506524143324 cupsdLoadRemoteCache +506524177711 cupsdWritePrintcap +506524527469 cupsdLoadAllJobs +506524564508 load_job_cache +506524756314 compare_jobs +506524815667 cupsdLoadJob +506524968952 cupsdLoadAllSubscriptions +506525011690 launchd_checkin +506503187119 cupsdStartSelect +506503230913 cupsdReadConfiguration +506503252142 cupsdDeleteAllLocations +506503274576 cupsdDeleteAllListeners +506503310703 cupsdSetStringf +506503363312 cupsdClearString +506505395867 parse_protocols +506505440694 cupsdDeleteAllPolicies +506505501913 read_configuration +506505561788 parse_groups +506505726179 get_address +506505986926 cupsdLogMessage +506506008280 check_log_file +506506240383 cupsdGetDateTime diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index 9a66bad0d..d9618adb5 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -1,5 +1,5 @@ /* - * "$Id: dirsvc.c 6538 2007-05-17 18:26:05Z mike $" + * "$Id: dirsvc.c 6590 2007-06-21 18:22:22Z mike $" * * Directory services routines for the Common UNIX Printing System (CUPS). * @@ -199,7 +199,7 @@ cupsdDeregisterPrinter( */ if (!Browsing || !p->shared || - (p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))) + (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))) return; /* @@ -318,7 +318,7 @@ cupsdLoadRemoteCache(void) p->accepting = 1; p->state = IPP_PRINTER_IDLE; - p->type |= CUPS_PRINTER_REMOTE; + p->type |= CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED; p->browse_time = now; p->browse_expire = now + BrowseTimeout; @@ -359,7 +359,7 @@ cupsdLoadRemoteCache(void) p->accepting = 1; p->state = IPP_PRINTER_IDLE; - p->type |= CUPS_PRINTER_REMOTE; + p->type |= CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED; p->browse_time = now; p->browse_expire = now + BrowseTimeout; @@ -626,7 +626,7 @@ void cupsdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ { if (!Browsing || !BrowseLocalProtocols || !BrowseInterval || !NumBrowsers || - (p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))) + (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))) return; #ifdef HAVE_LIBSLP @@ -719,7 +719,7 @@ cupsdSaveRemoteCache(void) * Skip local destinations... */ - if (!(printer->type & CUPS_PRINTER_REMOTE)) + if (!(printer->type & CUPS_PRINTER_DISCOVERED)) continue; /* @@ -830,7 +830,7 @@ cupsdSendBrowseList(void) for (count = 0, p = (cupsd_printer_t *)cupsArrayFirst(Printers); count < max_count && p != NULL; p = (cupsd_printer_t *)cupsArrayNext(Printers)) - if (!(p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) && + if (!(p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) && p->shared && p->browse_time < ut) count ++; @@ -856,8 +856,7 @@ cupsdSendBrowseList(void) if (!p) break; - else if ((p->external_type & (CUPS_PRINTER_REMOTE | - CUPS_PRINTER_IMPLICIT)) || + else if ((p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) || !p->shared) continue; else if (p->browse_time < ut) @@ -904,7 +903,7 @@ cupsdSendBrowseList(void) * If this is a remote queue, see if it needs to be timed out... */ - if (p->type & CUPS_PRINTER_REMOTE) + if (p->type & CUPS_PRINTER_DISCOVERED) { if (p->browse_expire < to) { @@ -1740,7 +1739,7 @@ process_browse_data( * See if we already have it listed in the Printers list, and add it if not... */ - type |= CUPS_PRINTER_REMOTE; + type |= CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED; type &= ~CUPS_PRINTER_IMPLICIT; update = 0; hptr = strchr(host, '.'); @@ -3803,5 +3802,5 @@ update_polling(void) /* - * End of "$Id: dirsvc.c 6538 2007-05-17 18:26:05Z mike $". + * End of "$Id: dirsvc.c 6590 2007-06-21 18:22:22Z mike $". */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 9c8e50276..2ba651038 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 6541 2007-05-23 20:18:00Z mike $" + * "$Id: ipp.c 6593 2007-06-21 21:30:49Z mike $" * * IPP routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -26,7 +26,8 @@ * * Contents: * - * cupsdProcessIPPRequest() - Process an incoming IPP request... + * cupsdProcessIPPRequest() - Process an incoming IPP request. + * cupsdTimeoutJob() - Timeout a job waiting on job files. * accept_jobs() - Accept print jobs to a printer. * add_class() - Add a class to the system. * add_file() - Add a file to a job. @@ -229,7 +230,7 @@ static int validate_user(cupsd_job_t *job, cupsd_client_t *con, /* - * 'cupsdProcessIPPRequest()' - Process an incoming IPP request... + * 'cupsdProcessIPPRequest()' - Process an incoming IPP request. */ int /* O - 1 on success, 0 on failure */ @@ -731,6 +732,45 @@ cupsdProcessIPPRequest( } +/* + * 'cupsdTimeoutJob()' - Timeout a job waiting on job files. + */ + +void +cupsdTimeoutJob(cupsd_job_t *job) /* I - Job to timeout */ +{ + cupsd_printer_t *printer; /* Destination printer or class */ + ipp_attribute_t *attr; /* job-sheets attribute */ + int kbytes; /* Kilobytes in banner */ + + + job->pending_timeout = 0; + + /* + * See if we need to add the ending sheet... + */ + + printer = cupsdFindDest(job->dest); + attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME); + + if (printer && + !(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) && + attr && attr->num_values > 1) + { + /* + * Yes... + */ + + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Adding end banner page \"%s\".", + job->id, attr->values[1].string.text); + + kbytes = copy_banner(NULL, job, attr->values[1].string.text); + + cupsdUpdateQuota(printer, job->username, 0, kbytes); + } +} + + /* * 'accept_jobs()' - Accept print jobs to a printer. */ @@ -1061,6 +1101,10 @@ add_class(cupsd_client_t *con, /* I - Client connection */ set_printer_defaults(con, pclass); + if ((attr = ippFindAttribute(con->request, "auth-info-required", + IPP_TAG_KEYWORD)) != NULL) + cupsdSetAuthInfoRequired(pclass, NULL, attr); + /* * Update the printer class attributes and return... */ @@ -1130,8 +1174,8 @@ add_file(cupsd_client_t *con, /* I - Connection to client */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_file(con=%p[%d], job=%d, filetype=%s/%s, compression=%d)", - con, con->http.fd, job->id, filetype->super, filetype->type, - compression); + con, con ? con->http.fd : -1, job->id, filetype->super, + filetype->type, compression); /* * Add the file to the job... @@ -1155,8 +1199,10 @@ add_file(cupsd_client_t *con, /* I - Connection to client */ { cupsdCancelJob(job, 1, IPP_JOB_ABORTED); - send_ipp_status(con, IPP_INTERNAL_ERROR, - _("Unable to allocate memory for file types!")); + if (con) + send_ipp_status(con, IPP_INTERNAL_ERROR, + _("Unable to allocate memory for file types!")); + return (-1); } @@ -1714,8 +1760,8 @@ add_job(cupsd_client_t *con, /* I - Client connection */ if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))) { cupsdLogMessage(CUPSD_LOG_INFO, - "Adding start banner page \"%s\" to job %d.", - attr->values[0].string.text, job->id); + "[Job %d] Adding start banner page \"%s\".", + job->id, attr->values[0].string.text); kbytes = copy_banner(con, job, attr->values[0].string.text); @@ -2071,7 +2117,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ { http_status_t status; /* Policy status */ int i; /* Looping var */ - char method[HTTP_MAX_URI], /* Method portion of URI */ + char scheme[HTTP_MAX_URI], /* Method portion of URI */ username[HTTP_MAX_URI], /* Username portion of URI */ host[HTTP_MAX_URI], /* Host portion of URI */ resource[HTTP_MAX_URI]; /* Resource portion of URI */ @@ -2085,6 +2131,8 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ int modify; /* Non-zero if we are modifying */ char newname[IPP_MAX_NAME]; /* New printer name */ int need_restart_job; /* Need to restart job? */ + int set_device_uri, /* Did we set the device URI? */ + set_port_monitor; /* Did we set the port monitor? */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer(%p[%d], %s)", con, @@ -2094,8 +2142,8 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ * Do we have a valid URI? */ - httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, method, - sizeof(method), username, sizeof(username), host, + httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme, + sizeof(scheme), username, sizeof(username), host, sizeof(host), &port, resource, sizeof(resource)); if (strncmp(resource, "/printers/", 10) || strlen(resource) == 10) @@ -2221,6 +2269,8 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ IPP_TAG_TEXT)) != NULL) cupsdSetString(&printer->info, attr->values[0].string.text); + set_device_uri = 0; + if ((attr = ippFindAttribute(con->request, "device-uri", IPP_TAG_URI)) != NULL) { @@ -2230,11 +2280,11 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ need_restart_job = 1; - httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text, method, - sizeof(method), username, sizeof(username), host, + httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text, scheme, + sizeof(scheme), username, sizeof(username), host, sizeof(host), &port, resource, sizeof(resource)); - if (!strcmp(method, "file")) + if (!strcmp(scheme, "file")) { /* * See if the administrator has enabled file devices... @@ -2260,7 +2310,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ * See if the backend exists and is executable... */ - snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin, method); + snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin, scheme); if (access(srcfile, X_OK)) { /* @@ -2282,10 +2332,13 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ sizeof(resource))); cupsdSetString(&printer->device_uri, attr->values[0].string.text); + set_device_uri = 1; } + set_port_monitor = 0; + if ((attr = ippFindAttribute(con->request, "port-monitor", - IPP_TAG_KEYWORD)) != NULL) + IPP_TAG_NAME)) != NULL) { ipp_attribute_t *supported; /* port-monitor-supported attribute */ @@ -2309,12 +2362,14 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s port-monitor to \"%s\" (was \"%s\".)", printer->name, attr->values[0].string.text, - printer->port_monitor); + printer->port_monitor ? printer->port_monitor : "none"); if (strcmp(attr->values[0].string.text, "none")) cupsdSetString(&printer->port_monitor, attr->values[0].string.text); else cupsdClearString(&printer->port_monitor); + + set_port_monitor = 1; } if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", @@ -2373,6 +2428,10 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ set_printer_defaults(con, printer); + if ((attr = ippFindAttribute(con->request, "auth-info-required", + IPP_TAG_KEYWORD)) != NULL) + cupsdSetAuthInfoRequired(printer, NULL, attr); + /* * See if we have all required attributes... */ @@ -2519,6 +2578,47 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ } } + /* + * If we set the device URI but not the port monitor, check which port + * monitor to use by default... + */ + + if (set_device_uri && !set_port_monitor) + { + ppd_file_t *ppd; /* PPD file */ + ppd_attr_t *ppdattr; /* cupsPortMonitor attribute */ + + + httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme, + sizeof(scheme), username, sizeof(username), host, + sizeof(host), &port, resource, sizeof(resource)); + + snprintf(srcfile, sizeof(srcfile), "%s/ppd/%s.ppd", ServerRoot, + printer->name); + if ((ppd = ppdOpenFile(srcfile)) != NULL) + { + for (ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL); + ppdattr; + ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL)) + if (!strcmp(scheme, ppdattr->spec)) + { + cupsdLogMessage(CUPSD_LOG_INFO, + "Setting %s port-monitor to \"%s\" (was \"%s\".)", + printer->name, ppdattr->value, + printer->port_monitor ? printer->port_monitor : "none"); + + if (strcmp(ppdattr->value, "none")) + cupsdSetString(&printer->port_monitor, ppdattr->value); + else + cupsdClearString(&printer->port_monitor); + + break; + } + + ppdClose(ppd); + } + } + /* * Update the printer attributes and return... */ @@ -2814,7 +2914,7 @@ authenticate_job(cupsd_client_t *con, /* I - Client connection */ cupsdReleaseJob(job); - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was authenticated by \"%s\".", jobid, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Authenticated by \"%s\".", jobid, con->username); } @@ -3131,7 +3231,7 @@ cancel_job(cupsd_client_t *con, /* I - Client connection */ cupsdCancelJob(job, 0, IPP_JOB_CANCELED); cupsdCheckJobs(); - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was canceled by \"%s\".", jobid, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Canceled by \"%s\".", jobid, username); con->response->request.status.status_code = IPP_OK; @@ -3721,7 +3821,8 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)", - con, con->http.fd, job, job->id, name ? name : "(null)"); + con, con ? con->http.fd : -1, job, job->id, + name ? name : "(null)"); /* * Find the banner; return if not found or "none"... @@ -4529,7 +4630,7 @@ copy_printer_attrs( * Add the CUPS-specific printer-type attribute... */ - type = printer->external_type; + type = printer->type; if (printer == DefaultPrinter) type |= CUPS_PRINTER_DEFAULT; @@ -4709,13 +4810,15 @@ create_job(cupsd_client_t *con, /* I - Client connection */ if ((job = add_job(con, printer, NULL)) == NULL) return; + job->pending_timeout = 1; + /* * Save and log the job... */ cupsdSaveJob(job); - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d created on \"%s\" by \"%s\".", + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Queued on \"%s\" by \"%s\".", job->id, job->dest, job->username); } @@ -6774,7 +6877,7 @@ hold_job(cupsd_client_t *con, /* I - Client connection */ "Job job-hold-until value changed by user."); } - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was held by \"%s\".", jobid, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Held by \"%s\".", jobid, username); con->response->request.status.status_code = IPP_OK; @@ -7341,30 +7444,15 @@ print_job(cupsd_client_t *con, /* I - Client connection */ * See if we need to add the ending sheet... */ - attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME); - - if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) && - attr && attr->num_values > 1) - { - /* - * Yes... - */ - - cupsdLogMessage(CUPSD_LOG_INFO, "Adding end banner page \"%s\" to job %d.", - attr->values[1].string.text, job->id); - - kbytes = copy_banner(con, job, attr->values[1].string.text); - - cupsdUpdateQuota(printer, job->username, 0, kbytes); - } + cupsdTimeoutJob(job); /* * Log and save the job... */ - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d queued on \"%s\" by \"%s\".", job->id, - job->dest, job->username); - cupsdLogMessage(CUPSD_LOG_DEBUG, "Job %d hold_until = %d", job->id, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Queued on \"%s\" by \"%s\".", + job->id, job->dest, job->username); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] hold_until = %d", job->id, (int)job->hold_until); cupsdSaveJob(job); @@ -7774,7 +7862,7 @@ release_job(cupsd_client_t *con, /* I - Client connection */ cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job, "Job released by user."); - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was released by \"%s\".", jobid, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Released by \"%s\".", jobid, username); con->response->request.status.status_code = IPP_OK; @@ -7994,7 +8082,7 @@ restart_job(cupsd_client_t *con, /* I - Client connection */ cupsdRestartJob(job); - cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was restarted by \"%s\".", jobid, + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Restarted by \"%s\".", jobid, username); con->response->request.status.status_code = IPP_OK; @@ -8011,10 +8099,11 @@ save_auth_info( cupsd_job_t *job, /* I - Job */ ipp_attribute_t *auth_info) /* I - auth-info attribute, if any */ { - int i; /* Looping var */ - char filename[1024]; /* Job authentication filename */ - cups_file_t *fp; /* Job authentication file */ - char line[2048]; /* Line for file */ + int i; /* Looping var */ + char filename[1024]; /* Job authentication filename */ + cups_file_t *fp; /* Job authentication file */ + char line[2048]; /* Line for file */ + cupsd_printer_t *dest; /* Destination printer/class */ /* @@ -8043,6 +8132,9 @@ save_auth_info( if (RunUser) return; + if ((dest = cupsdFindDest(job->dest)) == NULL) + return; + /* * Create the authentication file and change permissions... */ @@ -8059,20 +8151,34 @@ save_auth_info( fchown(cupsFileNumber(fp), 0, 0); fchmod(cupsFileNumber(fp), 0400); - if (auth_info) + if (auth_info && auth_info->num_values == dest->num_auth_info_required) { /* - * Write 1 to 4 auth values... + * Write 1 to 3 auth values... */ + cupsdClearString(&job->auth_username); + cupsdClearString(&job->auth_domain); + cupsdClearString(&job->auth_password); + for (i = 0; i < auth_info->num_values; i ++) { httpEncode64_2(line, sizeof(line), auth_info->values[i].string.text, strlen(auth_info->values[i].string.text)); cupsFilePrintf(fp, "%s\n", line); + + if (!strcmp(dest->auth_info_required[i], "username")) + cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", + auth_info->values[i].string.text); + else if (!strcmp(dest->auth_info_required[i], "domain")) + cupsdSetStringf(&job->auth_domain, "AUTH_DOMAIN=%s", + auth_info->values[i].string.text); + else if (!strcmp(dest->auth_info_required[i], "password")) + cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", + auth_info->values[i].string.text); } } - else + else if (con->username[0]) { /* * Write the authenticated username... @@ -8081,12 +8187,17 @@ save_auth_info( httpEncode64_2(line, sizeof(line), con->username, strlen(con->username)); cupsFilePrintf(fp, "%s\n", line); + cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", con->username); + cupsdClearString(&job->auth_domain); + /* * Write the authenticated password... */ httpEncode64_2(line, sizeof(line), con->password, strlen(con->password)); cupsFilePrintf(fp, "%s\n", line); + + cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", con->password); } /* @@ -8103,7 +8214,10 @@ save_auth_info( cupsFileClose(fp); #if defined(HAVE_GSSAPI) && defined(HAVE_KRB5_H) - save_krb5_creds(con, job); + if (con->gss_have_creds) + save_krb5_creds(con, job); + else if (job->ccname) + cupsdClearString(&(job->ccname)); #endif /* HAVE_GSSAPI && HAVE_KRB5_H */ } @@ -8148,7 +8262,9 @@ save_krb5_creds(cupsd_client_t *con, /* I - Client connection */ return; } -# ifdef HAVE_HEIMDAL +# ifdef HAVE_KRB5_CC_RESOLVE + if (krb5_cc_resolve(krb5_context, "MEMORY:", &ccache)) +# elif defined(HAVE_HEIMDAL) if (krb5_cc_gen_new(krb_context, &krb5_fcc_ops, &ccache)) # else if (krb5_cc_gen_new(krb_context, &ccache)) @@ -8169,8 +8285,14 @@ save_krb5_creds(cupsd_client_t *con, /* I - Client connection */ return; } +#ifdef HAVE_KRB5_CC_RESOLVE + cupsdSetStringf(&(job->ccname), "KRB5CCNAME=MEMORY:%s", + krb5_cc_get_name(krb_context, ccache)); +#else cupsdSetStringf(&(job->ccname), "KRB5CCNAME=FILE:%s", krb5_cc_get_name(krb_context, ccache)); +#endif /* HAVE_KRB5_CC_RESOLVE */ + krb5_cc_close(krb_context, ccache); } #endif /* HAVE_GSSAPI && HAVE_KRB5_H */ @@ -8489,24 +8611,7 @@ send_document(cupsd_client_t *con, /* I - Client connection */ * See if we need to add the ending sheet... */ - if (printer && - !(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) && - (attr = ippFindAttribute(job->attrs, "job-sheets", - IPP_TAG_ZERO)) != NULL && - attr->num_values > 1) - { - /* - * Yes... - */ - - cupsdLogMessage(CUPSD_LOG_INFO, - "Adding end banner page \"%s\" to job %d.", - attr->values[1].string.text, job->id); - - kbytes = copy_banner(con, job, attr->values[1].string.text); - - cupsdUpdateQuota(printer, job->username, 0, kbytes); - } + cupsdTimeoutJob(job); if (job->state_value == IPP_JOB_STOPPED) { @@ -9750,5 +9855,5 @@ validate_user(cupsd_job_t *job, /* I - Job */ /* - * End of "$Id: ipp.c 6541 2007-05-23 20:18:00Z mike $". + * End of "$Id: ipp.c 6593 2007-06-21 21:30:49Z mike $". */ diff --git a/scheduler/job.c b/scheduler/job.c index 90434af16..e8a6fd457 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1,5 +1,5 @@ /* - * "$Id: job.c 6462 2007-04-23 19:25:13Z mike $" + * "$Id: job.c 6600 2007-06-22 18:19:20Z mike $" * * Job management routines for the Common UNIX Printing System (CUPS). * @@ -229,6 +229,10 @@ cupsdCancelJob(cupsd_job_t *job, /* I - Job to cancel */ snprintf(filename, sizeof(filename), "%s/a%05d", RequestRoot, job->id); unlink(filename); + cupsdClearString(&job->auth_username); + cupsdClearString(&job->auth_domain); + cupsdClearString(&job->auth_password); + /* * Remove the print file for good if we aren't preserving jobs or * files... @@ -353,6 +357,9 @@ cupsdCheckJobs(void) job->hold_until && job->hold_until < time(NULL)) { + if (job->pending_timeout) + cupsdTimeoutJob(job); /* Add trailing banner as needed */ + job->state->values[0].integer = IPP_JOB_PENDING; job->state_value = IPP_JOB_PENDING; } @@ -391,8 +398,8 @@ cupsdCheckJobs(void) */ cupsdLogMessage(CUPSD_LOG_WARN, - "Printer/class %s has gone away; canceling job %d!", - job->dest, job->id); + "[Job %d] Printer/class %s has gone away; canceling job!", + job->id, job->dest); cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job, "Job canceled because the destination printer/class has " @@ -425,9 +432,9 @@ cupsdCheckJobs(void) "job-actual-printer-uri", NULL, printer->uri); } - if ((!(printer->type & CUPS_PRINTER_REMOTE) && /* Printer is local */ + if ((!(printer->type & CUPS_PRINTER_DISCOVERED) && /* Printer is local */ printer->state == IPP_PRINTER_IDLE) || /* and idle */ - ((printer->type & CUPS_PRINTER_REMOTE) && /* Printer is remote */ + ((printer->type & CUPS_PRINTER_DISCOVERED) && /* Printer is remote */ !printer->job)) /* and not printing */ start_job(job, printer); } @@ -465,13 +472,15 @@ void cupsdFinishJob(cupsd_job_t *job) /* I - Job */ { cupsd_printer_t *printer; /* Current printer */ + ipp_attribute_t *attr; /* job-hold-until attribute */ cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] File %d is complete.", job->id, job->current_file - 1); - cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishJob: job->status is %d", - job->status); + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "[Job %d] cupsdFinishJob: job->status is %d", + job->id, job->status); if (job->status_buffer && (job->status < 0 || job->current_file >= job->num_files)) @@ -483,8 +492,8 @@ cupsdFinishJob(cupsd_job_t *job) /* I - Job */ cupsdRemoveSelect(job->status_buffer->fd); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdFinishJob: Closing status pipes [ %d %d ]...", - job->status_pipes[0], job->status_pipes[1]); + "[Job %d] cupsdFinishJob: Closing status pipes [ %d %d ]...", + job->id, job->status_pipes[0], job->status_pipes[1]); cupsdClosePipe(job->status_pipes); cupsdStatBufDelete(job->status_buffer); @@ -577,8 +586,8 @@ cupsdFinishJob(cupsd_job_t *job) /* I - Job */ */ cupsdLogMessage(CUPSD_LOG_ERROR, - "Canceling job %d since it could not be sent " - "after %d tries.", + "[Job %d] Canceling job since it could not be " + "sent after %d tries.", job->id, JobRetryLimit); cupsdCancelJob(job, 0, IPP_JOB_ABORTED); @@ -657,7 +666,18 @@ cupsdFinishJob(cupsd_job_t *job) /* I - Job */ case CUPS_BACKEND_AUTH_REQUIRED : cupsdStopJob(job, 0); - cupsdSetJobHoldUntil(job, "authenticated"); + cupsdSetJobHoldUntil(job, "auth-info-required"); + + if ((attr = ippFindAttribute(job->attrs, "job-hold-until", + IPP_TAG_KEYWORD)) == NULL) + attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME); + + if (attr) + { + attr->value_tag = IPP_TAG_KEYWORD; + cupsdSetString(&(attr->values[0].string.text), + "auth-info-required"); + } job->state->values[0].integer = IPP_JOB_HELD; job->state_value = IPP_JOB_HELD; @@ -917,7 +937,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ cups_file_t *fp; /* Job file */ int fileid; /* Current file ID */ ipp_attribute_t *attr; /* Job attribute */ - const char *dest; /* Destination */ + const char *dest; /* Destination name */ + cupsd_printer_t *destptr; /* Pointer to destination */ mime_type_t **filetypes; /* New filetypes array */ int *compressions; /* New compressions array */ @@ -932,7 +953,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ if ((job->attrs = ippNew()) == NULL) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Ran out of memory for job attributes!"); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Ran out of memory for job attributes!", job->id); return; } @@ -940,15 +962,14 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ * Load job attributes... */ - cupsdLogMessage(CUPSD_LOG_DEBUG, "Loading attributes for job %d...", - job->id); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] Loading attributes...", job->id); snprintf(jobfile, sizeof(jobfile), "%s/c%05d", RequestRoot, job->id); if ((fp = cupsFileOpen(jobfile, "r")) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to open job control file \"%s\" - %s!", - jobfile, strerror(errno)); + "[Job %d] Unable to open job control file \"%s\" - %s!", + job->id, jobfile, strerror(errno)); ippDelete(job->attrs); job->attrs = NULL; return; @@ -956,8 +977,9 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ if (ippReadIO(fp, (ipp_iocb_t)cupsFileRead, 1, NULL, job->attrs) != IPP_DATA) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to read job control file \"%s\"!", - jobfile); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to read job control file \"%s\"!", + job->id, jobfile); cupsFileClose(fp); ippDelete(job->attrs); job->attrs = NULL; @@ -975,9 +997,9 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ IPP_TAG_ENUM)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Missing or bad job-state attribute in control " - "file \"%s\"!", - jobfile); + "[Job %d] Missing or bad job-state attribute in " + "control file!", + job->id); ippDelete(job->attrs); job->attrs = NULL; unlink(jobfile); @@ -992,8 +1014,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ IPP_TAG_URI)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "No job-printer-uri attribute in control file \"%s\"!", - jobfile); + "[Job %d] No job-printer-uri attribute in control file!", + job->id); ippDelete(job->attrs); job->attrs = NULL; unlink(jobfile); @@ -1001,11 +1023,11 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ } if ((dest = cupsdValidateDest(attr->values[0].string.text, &(job->dtype), - NULL)) == NULL) + &destptr)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to queue job for destination \"%s\"!", - attr->values[0].string.text); + "[Job %d] Unable to queue job for destination \"%s\"!", + job->id, attr->values[0].string.text); ippDelete(job->attrs); job->attrs = NULL; unlink(jobfile); @@ -1014,6 +1036,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ cupsdSetString(&job->dest, dest); } + else + destptr = cupsdFindDest(job->dest); job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed", IPP_TAG_INTEGER); @@ -1025,8 +1049,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ IPP_TAG_INTEGER)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Missing or bad job-priority attribute in control " - "file \"%s\"!", jobfile); + "[Job %d] Missing or bad job-priority attribute in " + "control file!", job->id); ippDelete(job->attrs); job->attrs = NULL; unlink(jobfile); @@ -1042,8 +1066,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ IPP_TAG_NAME)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Missing or bad job-originating-user-name attribute " - "in control file \"%s\"!", jobfile); + "[Job %d] Missing or bad job-originating-user-name " + "attribute in control file!", job->id); ippDelete(job->attrs); job->attrs = NULL; unlink(jobfile); @@ -1091,8 +1115,9 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ if (access(jobfile, 0)) break; - cupsdLogMessage(CUPSD_LOG_DEBUG, "Auto-typing document file \"%s\"...", - jobfile); + cupsdLogMessage(CUPSD_LOG_DEBUG, + "[Job %d] Auto-typing document file \"%s\"...", + job->id, jobfile); if (fileid > job->num_files) { @@ -1113,7 +1138,8 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ if (!compressions || !filetypes) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Ran out of memory for job file types!"); + "[Job %d] Ran out of memory for job file types!", + job->id); return; } @@ -1131,6 +1157,45 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ } } + /* + * Load authentication information as needed... + */ + + if (job->state_value < IPP_JOB_STOPPED) + { + snprintf(jobfile, sizeof(jobfile), "%s/a%05d", RequestRoot, job->id); + + cupsdClearString(&job->auth_username); + cupsdClearString(&job->auth_domain); + cupsdClearString(&job->auth_password); + + if ((fp = cupsFileOpen(jobfile, "r")) != NULL) + { + int i, /* Looping var */ + bytes; /* Size of auth data */ + char line[255], /* Line from file */ + data[255]; /* Decoded data */ + + + for (i = 0; + i < destptr->num_auth_info_required && + cupsFileGets(fp, line, sizeof(line)); + i ++) + { + bytes = sizeof(data); + httpDecode64_2(data, &bytes, line); + + if (!strcmp(destptr->auth_info_required[i], "username")) + cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", data); + else if (!strcmp(destptr->auth_info_required[i], "domain")) + cupsdSetStringf(&job->auth_domain, "AUTH_DOMAIN=%s", data); + else if (!strcmp(destptr->auth_info_required[i], "password")) + cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", data); + } + + cupsFileClose(fp); + } + } job->access_time = time(NULL); } @@ -1334,8 +1399,8 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ if ((fp = cupsFileOpen(filename, "w")) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to create job control file \"%s\" - %s.", - filename, strerror(errno)); + "[Job %d] Unable to create job control file \"%s\" - %s.", + job->id, filename, strerror(errno)); return; } @@ -1346,8 +1411,8 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL, job->attrs) != IPP_DATA) - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to write job control file \"%s\"!", - filename); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to write job control file!", job->id); cupsFileClose(fp); } @@ -1373,7 +1438,7 @@ cupsdSetJobHoldUntil(cupsd_job_t *job, /* I - Job */ second = 0; - if (!strcmp(when, "indefinite") || !strcmp(when, "authenticated")) + if (!strcmp(when, "indefinite") || !strcmp(when, "auth-info-required")) { /* * Hold indefinitely... @@ -1564,8 +1629,8 @@ cupsdStopJob(cupsd_job_t *job, /* I - Job */ int i; /* Looping var */ - cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStopJob: id = %d, force = %d", - job->id, force); + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "[Job %d] cupsdStopJob: force = %d", job->id, force); if (job->state_value != IPP_JOB_PROCESSING) return; @@ -1595,21 +1660,18 @@ cupsdStopJob(cupsd_job_t *job, /* I - Job */ job->backend = 0; } - cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdStopJob: Closing print pipes [ %d %d ]...", - job->print_pipes[0], job->print_pipes[1]); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] Closing print pipes [ %d %d ]...", + job->id, job->print_pipes[0], job->print_pipes[1]); cupsdClosePipe(job->print_pipes); - cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdStopJob: Closing back pipes [ %d %d ]...", - job->back_pipes[0], job->back_pipes[1]); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] Closing back pipes [ %d %d ]...", + job->id, job->back_pipes[0], job->back_pipes[1]); cupsdClosePipe(job->back_pipes); - cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdStopJob: Closing side pipes [ %d %d ]...", - job->side_pipes[0], job->side_pipes[1]); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] Closing side pipes [ %d %d ]...", + job->id, job->side_pipes[0], job->side_pipes[1]); cupsdClosePipe(job->side_pipes); @@ -1622,7 +1684,7 @@ cupsdStopJob(cupsd_job_t *job, /* I - Job */ cupsdRemoveSelect(job->status_buffer->fd); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "cupsdStopJob: Closing status pipes [ %d %d ]...", + "[Job %d] Closing status pipes [ %d %d ]...", job->id, job->status_pipes[0], job->status_pipes[1]); cupsdClosePipe(job->status_pipes); @@ -1697,6 +1759,9 @@ free_job(cupsd_job_t *job) /* I - Job */ { cupsdClearString(&job->username); cupsdClearString(&job->dest); + cupsdClearString(&job->auth_username); + cupsdClearString(&job->auth_domain); + cupsdClearString(&job->auth_password); #ifdef HAVE_GSSAPI cupsdClearString(&job->ccname); #endif /* HAVE_GSSAPI */ @@ -1912,7 +1977,8 @@ load_job_cache(const char *filename) /* I - job.cache filename */ snprintf(jobfile, sizeof(jobfile), "%s/c%05d", RequestRoot, jobid); if (access(jobfile, 0)) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Job %d files have gone away!", jobid); + cupsdLogMessage(CUPSD_LOG_ERROR, "[Job %d] Files have gone away!", + jobid); continue; } @@ -1920,7 +1986,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ if (!job) { cupsdLogMessage(CUPSD_LOG_EMERG, - "Unable to allocate memory for job %d!", jobid); + "[Job %d] Unable to allocate memory for job!", jobid); break; } @@ -1934,7 +2000,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ job->status_pipes[0] = -1; job->status_pipes[1] = -1; - cupsdLogMessage(CUPSD_LOG_DEBUG, "Loading job %d from cache...", job->id); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] Loading from cache...", job->id); } else if (!job) { @@ -2003,7 +2069,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ if (access(jobfile, 0)) { cupsdLogMessage(CUPSD_LOG_INFO, - "Data files for job %d have gone away!", job->id); + "[Job %d] Data files have gone away!", job->id); job->num_files = 0; continue; } @@ -2014,8 +2080,8 @@ load_job_cache(const char *filename) /* I - job.cache filename */ if (!job->filetypes || !job->compressions) { cupsdLogMessage(CUPSD_LOG_EMERG, - "Unable to allocate memory for %d files!", - job->num_files); + "[Job %d] Unable to allocate memory for %d files!", + job->id, job->num_files); break; } } @@ -2054,8 +2120,8 @@ load_job_cache(const char *filename) /* I - job.cache filename */ */ cupsdLogMessage(CUPSD_LOG_ERROR, - "Unknown MIME type %s/%s for file %d of job %d!", - super, type, number + 1, job->id); + "[Job %d] Unknown MIME type %s/%s for file %d!", + job->id, super, type, number + 1); snprintf(jobfile, sizeof(jobfile), "%s/d%05d-%03d", RequestRoot, job->id, number + 1); @@ -2319,7 +2385,7 @@ start_job(cupsd_job_t *job, /* I - Job ID */ title[IPP_MAX_NAME], /* Job title string */ copies[255], /* # copies string */ - *envp[MAX_ENV + 12], + *envp[MAX_ENV + 15], /* Environment variables */ charset[255], /* CHARSET env variable */ class_name[255],/* CLASS env variable */ @@ -2341,12 +2407,12 @@ start_job(cupsd_job_t *job, /* I - Job ID */ static int optlength = 0; /* Length of option buffer */ - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: id = %d, file = %d/%d", + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] start_job: file = %d/%d", job->id, job->current_file, job->num_files); if (job->num_files == 0) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files! Canceling it!", + cupsdLogMessage(CUPSD_LOG_ERROR, "[Job %d] No files, canceling job!", job->id); cupsdCancelJob(job, 0, IPP_JOB_ABORTED); @@ -2385,8 +2451,7 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (!filters) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to convert file %d to printable format for " - "job %d!", + "[Job %d] Unable to convert file %d to printable format!", job->current_file, job->id); cupsdLogMessage(CUPSD_LOG_INFO, "Hint: Do you have ESP Ghostscript installed?"); @@ -2469,11 +2534,10 @@ start_job(cupsd_job_t *job, /* I - Job ID */ cupsArrayDelete(filters); cupsdLogMessage(CUPSD_LOG_INFO, - "Holding job %d because filter limit has been reached.", + "[Job %d] Holding because filter limit has been reached.", job->id); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: id=%d, file=%d, cost=%d, level=%d, " - "limit=%d", + "[Job %d] start_job: file=%d, cost=%d, level=%d, limit=%d", job->id, job->current_file, job->cost, FilterLevel, FilterLimit); return; @@ -2499,8 +2563,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (!cupsArrayInsert(filters, &gziptoany_filter)) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to add decompression filter - %s", - strerror(errno)); + "[Job %d] Unable to add decompression filter - %s", + job->id, strerror(errno)); cupsArrayDelete(filters); @@ -2528,8 +2592,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (!cupsArrayAdd(filters, &port_monitor)) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to add port monitor - %s", - strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to add port monitor - %s", + job->id, strerror(errno)); cupsArrayDelete(filters); @@ -2597,17 +2662,19 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (job->job_sheets == NULL) { - cupsdLogMessage(CUPSD_LOG_DEBUG, "No job-sheets attribute."); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] No job-sheets attribute.", + job->id); if ((job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_ZERO)) != NULL) cupsdLogMessage(CUPSD_LOG_DEBUG, - "... but someone added one without setting job_sheets!"); + "[Job %d] ... but someone added one without setting " + "job_sheets!", job->id); } else if (job->job_sheets->num_values == 1) - cupsdLogMessage(CUPSD_LOG_DEBUG, "job-sheets=%s", - job->job_sheets->values[0].string.text); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] job-sheets=%s", job->id, + job->job_sheets->values[0].string.text); else - cupsdLogMessage(CUPSD_LOG_DEBUG, "job-sheets=%s,%s", + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] job-sheets=%s,%s", job->id, job->job_sheets->values[0].string.text, job->job_sheets->values[1].string.text); @@ -2625,7 +2692,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ else banner_page = 0; - cupsdLogMessage(CUPSD_LOG_DEBUG, "banner_page = %d", banner_page); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] banner_page = %d", job->id, + banner_page); /* * Building the options string is harder than it needs to be, but @@ -2647,8 +2715,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (optptr == NULL) { cupsdLogMessage(CUPSD_LOG_CRIT, - "Unable to allocate %d bytes for option buffer for " - "job %d!", i, job->id); + "[Job %d] Unable to allocate %d bytes for option buffer!", + job->id, i); cupsArrayDelete(filters); @@ -2967,6 +3035,13 @@ start_job(cupsd_job_t *job, /* I - Job ID */ envp[envc ++] = class_name; } + if (job->auth_username) + envp[envc ++] = job->auth_username; + if (job->auth_domain) + envp[envc ++] = job->auth_domain; + if (job->auth_password) + envp[envc ++] = job->auth_password; + #ifdef HAVE_GSSAPI if (job->ccname) envp[envc ++] = job->ccname; @@ -2975,7 +3050,10 @@ start_job(cupsd_job_t *job, /* I - Job ID */ envp[envc] = NULL; for (i = 0; i < envc; i ++) - if (strncmp(envp[i], "DEVICE_URI=", 11)) + if (!strncmp(envp[i], "AUTH_", 5)) + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] envp[%d]=\"AUTH_%c****\"", + job->id, i, envp[i][5]); + else if (strncmp(envp[i], "DEVICE_URI=", 11)) cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] envp[%d]=\"%s\"", job->id, i, envp[i]); else @@ -3000,8 +3078,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ { if (cupsdOpenPipe(job->status_pipes)) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create job status pipes - %s.", - strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to create job status pipes - %s.", + job->id, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to create status pipes - %s.", strerror(errno)); @@ -3014,11 +3093,13 @@ start_job(cupsd_job_t *job, /* I - Job ID */ goto abort_job; } - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: status_pipes = [ %d %d ]", - job->status_pipes[0], job->status_pipes[1]); + cupsdLogMessage(CUPSD_LOG_DEBUG2, + "[Job %d] start_job: status_pipes = [ %d %d ]", + job->id, job->status_pipes[0], job->status_pipes[1]); job->status_buffer = cupsdStatBufNew(job->status_pipes[0], "[Job %d]", job->id); + job->status_level = CUPSD_LOG_INFO; } job->status = 0; @@ -3039,8 +3120,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (cupsdOpenPipe(filterfds[slot])) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to create job filter pipes - %s.", - strerror(errno)); + "[Job %d] Unable to create job filter pipes - %s.", + job->id, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to create filter pipes - %s.", strerror(errno)); cupsdAddPrinterHistory(printer); @@ -3061,8 +3142,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (cupsdOpenPipe(job->print_pipes)) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to create job backend pipes - %s.", - strerror(errno)); + "[Job %d] Unable to create job backend pipes - %s.", + job->id, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to create backend pipes - %s.", strerror(errno)); cupsdAddPrinterHistory(printer); @@ -3098,8 +3179,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (job->print_pipes[1] < 0) { cupsdLogMessage(CUPSD_LOG_ERROR, - "Unable to open output file \"%s\" - %s.", - printer->device_uri, strerror(errno)); + "[Job %d] Unable to open output file \"%s\" - %s.", + job->id, printer->device_uri, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to open output file \"%s\" - %s.", printer->device_uri, strerror(errno)); @@ -3117,19 +3198,19 @@ start_job(cupsd_job_t *job, /* I - Job ID */ } cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: print_pipes = [ %d %d ]", - job->print_pipes[0], job->print_pipes[1]); + "[Job %d] start_job: print_pipes = [ %d %d ]", + job->id, job->print_pipes[0], job->print_pipes[1]); } filterfds[slot][0] = job->print_pipes[0]; filterfds[slot][1] = job->print_pipes[1]; } - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: filter=\"%s\"", - command); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] start_job: filter=\"%s\"", + job->id, command); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: filterfds[%d]=[ %d %d ]", - slot, filterfds[slot][0], filterfds[slot][1]); + "[Job %d] start_job: filterfds[%d]=[ %d %d ]", + job->id, slot, filterfds[slot][0], filterfds[slot][1]); pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0], filterfds[slot][1], job->status_pipes[1], @@ -3137,16 +3218,17 @@ start_job(cupsd_job_t *job, /* I - Job ID */ job->filters + i); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing filter pipes for slot %d " + "[Job %d] start_job: Closing filter pipes for slot %d " "[ %d %d ]...", - !slot, filterfds[!slot][0], filterfds[!slot][1]); + job->id, !slot, filterfds[!slot][0], filterfds[!slot][1]); cupsdClosePipe(filterfds[!slot]); if (pid == 0) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to start filter \"%s\" - %s.", - filter->filter, strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to start filter \"%s\" - %s.", + job->id, filter->filter, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to start filter \"%s\" - %s.", filter->filter, strerror(errno)); @@ -3160,8 +3242,8 @@ start_job(cupsd_job_t *job, /* I - Job ID */ goto abort_job; } - cupsdLogMessage(CUPSD_LOG_INFO, "Started filter %s (PID %d) for job %d.", - command, pid, job->id); + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Started filter %s (PID %d)", + job->id, command, pid); argv[6] = NULL; slot = !slot; @@ -3196,10 +3278,10 @@ start_job(cupsd_job_t *job, /* I - Job ID */ filterfds[slot][0] = -1; filterfds[slot][1] = -1; - cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: backend=\"%s\"", - command); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] start_job: backend=\"%s\"", + job->id, command); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: filterfds[%d] = [ %d %d ]", + "[Job %d] start_job: filterfds[%d] = [ %d %d ]", job->id, slot, filterfds[slot][0], filterfds[slot][1]); pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0], @@ -3209,8 +3291,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (pid == 0) { - cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to start backend \"%s\" - %s.", - method, strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, + "[Job %d] Unable to start backend \"%s\" - %s.", + job->id, method, strerror(errno)); snprintf(printer->state_message, sizeof(printer->state_message), "Unable to start backend \"%s\" - %s.", method, strerror(errno)); @@ -3223,35 +3306,34 @@ start_job(cupsd_job_t *job, /* I - Job ID */ } else { - cupsdLogMessage(CUPSD_LOG_INFO, - "Started backend %s (PID %d) for job %d.", - command, pid, job->id); + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Started backend %s (PID %d)", + job->id, command, pid); } } if (job->current_file == job->num_files) { cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing print pipes [ %d %d ]...", - job->print_pipes[0], job->print_pipes[1]); + "[Job %d] start_job: Closing print pipes [ %d %d ]...", + job->id, job->print_pipes[0], job->print_pipes[1]); cupsdClosePipe(job->print_pipes); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing back pipes [ %d %d ]...", - job->back_pipes[0], job->back_pipes[1]); + "[Job %d] start_job: Closing back pipes [ %d %d ]...", + job->id, job->back_pipes[0], job->back_pipes[1]); cupsdClosePipe(job->back_pipes); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing side pipes [ %d %d ]...", - job->side_pipes[0], job->side_pipes[1]); + "[Job %d] start_job: Closing side pipes [ %d %d ]...", + job->id, job->side_pipes[0], job->side_pipes[1]); cupsdClosePipe(job->side_pipes); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing status output pipe %d...", - job->status_pipes[1]); + "[Job %d] start_job: Closing status output pipe %d...", + job->id, job->status_pipes[1]); close(job->status_pipes[1]); job->status_pipes[1] = -1; @@ -3265,14 +3347,14 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (job->current_file == job->num_files) { cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing print pipes [ %d %d ]...", - job->print_pipes[0], job->print_pipes[1]); + "[Job %d] start_job: Closing print pipes [ %d %d ]...", + job->id, job->print_pipes[0], job->print_pipes[1]); cupsdClosePipe(job->print_pipes); cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing status output pipe %d...", - job->status_pipes[1]); + "[Job %d] start_job: Closing status output pipe %d...", + job->id, job->status_pipes[1]); close(job->status_pipes[1]); job->status_pipes[1] = -1; @@ -3280,9 +3362,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ } cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing filter pipes for slot %d " + "[Job %d] start_job: Closing filter pipes for slot %d " "[ %d %d ]...", - slot, filterfds[slot][0], filterfds[slot][1]); + job->id, slot, filterfds[slot][0], filterfds[slot][1]); cupsdClosePipe(filterfds[slot]); if (printer->remote && job->num_files > 1) @@ -3312,15 +3394,15 @@ start_job(cupsd_job_t *job, /* I - Job ID */ for (slot = 0; slot < 2; slot ++) { cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing filter pipes for slot %d " + "[Job %d] start_job: Closing filter pipes for slot %d " "[ %d %d ]...", - slot, filterfds[slot][0], filterfds[slot][1]); + job->id, slot, filterfds[slot][0], filterfds[slot][1]); cupsdClosePipe(filterfds[slot]); } cupsdLogMessage(CUPSD_LOG_DEBUG2, - "start_job: Closing status pipes [ %d %d ]...", - job->status_pipes[0], job->status_pipes[1]); + "[Job %d] start_job: Closing status pipes [ %d %d ]...", + job->id, job->status_pipes[0], job->status_pipes[1]); cupsdClosePipe(job->status_pipes); cupsdStatBufDelete(job->status_buffer); @@ -3350,7 +3432,7 @@ unload_job(cupsd_job_t *job) /* I - Job */ if (!job->attrs) return; - cupsdLogMessage(CUPSD_LOG_DEBUG, "Unloading job %d...", job->id); + cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] Unloading...", job->id); ippDelete(job->attrs); @@ -3366,7 +3448,7 @@ unload_job(cupsd_job_t *job) /* I - Job */ */ void -update_job(cupsd_job_t *job) /* I - Job to check */ +update_job(cupsd_job_t *job) /* I - Job to check */ { int i; /* Looping var */ int copies; /* Number of copies printed */ @@ -3419,8 +3501,8 @@ update_job(cupsd_job_t *job) /* I - Job to check */ */ cupsdLogMessage(CUPSD_LOG_INFO, - "Job %d canceled: pages exceed user %s quota " - "limit on printer %s (%s).", + "[Job %d] Canceled because pages exceed user %s " + "quota limit on printer %s (%s).", job->id, job->username, job->printer->name, job->printer->info); @@ -3440,9 +3522,14 @@ update_job(cupsd_job_t *job) /* I - Job to check */ } else if (loglevel == CUPSD_LOG_STATE) { - cupsdSetPrinterReasons(job->printer, message); - cupsdAddPrinterHistory(job->printer); - event |= CUPSD_EVENT_PRINTER_STATE_CHANGED; + if (!strcmp(message, "paused")) + cupsdStopPrinter(job->printer, 1); + else + { + cupsdSetPrinterReasons(job->printer, message); + cupsdAddPrinterHistory(job->printer); + event |= CUPSD_EVENT_PRINTER_STATE_CHANGED; + } } else if (loglevel == CUPSD_LOG_ATTR) { @@ -3504,12 +3591,14 @@ update_job(cupsd_job_t *job) /* I - Job to check */ event |= CUPSD_EVENT_PRINTER_STATE_CHANGED; } #endif /* __APPLE__ */ - else if (loglevel <= CUPSD_LOG_INFO) + else if (loglevel <= job->status_level) { /* * Some message to show in the printer-state-message attribute... */ + job->status_level = loglevel; + strlcpy(job->printer->state_message, message, sizeof(job->printer->state_message)); cupsdAddPrinterHistory(job->printer); @@ -3552,5 +3641,5 @@ update_job(cupsd_job_t *job) /* I - Job to check */ /* - * End of "$Id: job.c 6462 2007-04-23 19:25:13Z mike $". + * End of "$Id: job.c 6600 2007-06-22 18:19:20Z mike $". */ diff --git a/scheduler/job.h b/scheduler/job.h index 7b145f9de..caf9374b5 100644 --- a/scheduler/job.h +++ b/scheduler/job.h @@ -1,9 +1,9 @@ /* - * "$Id: job.h 6376 2007-03-21 06:39:10Z mike $" + * "$Id: job.h 6593 2007-06-21 21:30:49Z mike $" * * Print job definitions for the Common UNIX Printing System (CUPS) scheduler. * - * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -31,6 +31,7 @@ typedef struct cupsd_job_s int id, /* Job ID */ priority; /* Job priority */ ipp_jstate_t state_value; /* Cached job-state */ + int pending_timeout;/* Non-zero if the job was created and waiting on files */ char *username; /* Printing user */ char *dest; /* Destination printer or class */ cups_ptype_t dtype; /* Destination type (class/remote bits) */ @@ -49,6 +50,7 @@ typedef struct cupsd_job_s side_pipes[2], /* Sidechannel pipes */ status_pipes[2];/* Status pipes */ cupsd_statbuf_t *status_buffer; /* Status buffer for this job */ + int status_level; /* Highest log level in a status message */ int cost; /* Filtering cost */ int filters[MAX_FILTERS + 1]; /* Filter process IDs, 0 terminated */ @@ -56,6 +58,9 @@ typedef struct cupsd_job_s int status; /* Status code from filters */ cupsd_printer_t *printer; /* Printer this job is assigned to */ int tries; /* Number of tries for this job */ + char *auth_username, /* AUTH_USERNAME environment variable, if any */ + *auth_domain, /* AUTH_DOMAIN environment variable, if any */ + *auth_password; /* AUTH_PASSWORD environment variable, if any */ #ifdef HAVE_GSSAPI char *ccname; /* KRB5CCNAME environment variable */ #endif /* HAVE_GSSAPI */ @@ -122,8 +127,9 @@ extern void cupsdSetJobHoldUntil(cupsd_job_t *job, const char *when); extern void cupsdSetJobPriority(cupsd_job_t *job, int priority); extern void cupsdStopAllJobs(int force); extern void cupsdStopJob(cupsd_job_t *job, int force); +extern void cupsdTimeoutJob(cupsd_job_t *job); /* - * End of "$Id: job.h 6376 2007-03-21 06:39:10Z mike $". + * End of "$Id: job.h 6593 2007-06-21 21:30:49Z mike $". */ diff --git a/scheduler/main.c b/scheduler/main.c index eb82e1ddb..1cff1f1dd 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,5 +1,5 @@ /* - * "$Id: main.c 6514 2007-05-07 18:59:25Z mike $" + * "$Id: main.c 6564 2007-06-18 23:40:38Z mike $" * * Scheduler main loop for the Common UNIX Printing System (CUPS). * @@ -166,6 +166,14 @@ main(int argc, /* I - Number of command-line args */ fg = 0; +#ifdef HAVE_LAUNCHD + if (getenv("CUPSD_LAUNCHD")) + { + Launchd = 1; + fg = 1; + } +#endif /* HAVE_LAUNCHD */ + for (i = 1; i < argc; i ++) if (argv[i][0] == '-') for (opt = argv[i] + 1; *opt != '\0'; opt ++) @@ -1777,5 +1785,5 @@ usage(int status) /* O - Exit status */ /* - * End of "$Id: main.c 6514 2007-05-07 18:59:25Z mike $". + * End of "$Id: main.c 6564 2007-06-18 23:40:38Z mike $". */ diff --git a/scheduler/printers.c b/scheduler/printers.c index 2acdd7eb4..14fb04ad8 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c 6539 2007-05-23 15:08:29Z mike $" + * "$Id: printers.c 6595 2007-06-21 22:29:57Z mike $" * * Printer routines for the Common UNIX Printing System (CUPS). * @@ -35,6 +35,7 @@ * cupsdRenamePrinter() - Rename a printer. * cupsdSaveAllPrinters() - Save all printer definitions to the * printers.conf file. + * cupsdSetAuthInfoRequired() - Set the required authentication info. * cupsdSetPrinterAttrs() - Set printer attributes based upon the PPD * file. * cupsdSetPrinterReasons() - Set/update the reasons strings. @@ -66,19 +67,6 @@ #include -/* - * Currently Bonjour printers that are shared by CUPS servers are added - * manually by the user on Mac OS X systems. While these printers *are* - * remote queues, the current print dialog will not show them if they - * (correctly) have the CUPS_PRINTER_REMOTE bit set. This may change - * in future releases, however the code to do this is currently disabled. - * - * Define BONJOUR_IS_REMOTE to 1 to get the correct behavior... - */ - -#define BONJOUR_IS_REMOTE 0 - - /* * Local functions... */ @@ -1390,7 +1378,7 @@ cupsdSaveAllPrinters(void) * Skip remote destinations and printer classes... */ - if ((printer->type & CUPS_PRINTER_REMOTE) || + if ((printer->type & CUPS_PRINTER_DISCOVERED) || (printer->type & CUPS_PRINTER_CLASS) || (printer->type & CUPS_PRINTER_IMPLICIT)) continue; @@ -1579,6 +1567,8 @@ cupsdSetAuthInfoRequired( } else return (0); + + values = (*end) ? end + 1 : end; } if (p->num_auth_info_required == 0) @@ -1587,6 +1577,16 @@ cupsdSetAuthInfoRequired( p->num_auth_info_required = 1; } + /* + * Update the printer-type value as needed... + */ + + if (p->num_auth_info_required > 1 || + strcmp(p->auth_info_required[0], "none")) + p->type |= CUPS_PRINTER_AUTHENTICATED; + else + p->type &= ~CUPS_PRINTER_AUTHENTICATED; + return (1); } @@ -1597,6 +1597,16 @@ cupsdSetAuthInfoRequired( if (!attr || attr->num_values > 4) return (0); + /* + * Update the printer-type value as needed... + */ + + if (attr->num_values > 1 || + strcmp(attr->values[0].string.text, "none")) + p->type |= CUPS_PRINTER_AUTHENTICATED; + else + p->type &= ~CUPS_PRINTER_AUTHENTICATED; + for (i = 0; i < attr->num_values; i ++) { if (!strcmp(attr->values[i].string.text, "none")) @@ -1657,7 +1667,6 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ int num_media; /* Number of media options */ cupsd_location_t *auth; /* Pointer to authentication element */ const char *auth_supported; /* Authentication supported */ - cups_ptype_t printer_type; /* Printer type data */ ppd_file_t *ppd; /* PPD file data */ ppd_option_t *input_slot, /* InputSlot options */ *media_type, /* MediaType options */ @@ -1700,7 +1709,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ */ auth_supported = "requesting-user-name"; - if (!(p->type & CUPS_PRINTER_REMOTE)) + if (!(p->type & CUPS_PRINTER_DISCOVERED)) { if (p->type & CUPS_PRINTER_CLASS) snprintf(resource, sizeof(resource), "/classes/%s", p->name); @@ -1788,7 +1797,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "auth-info-required", NULL, "none"); - if (cupsArrayCount(Banners) > 0 && !(p->type & CUPS_PRINTER_REMOTE)) + if (cupsArrayCount(Banners) > 0 && !(p->type & CUPS_PRINTER_DISCOVERED)) { /* * Setup the job-sheets-default attribute... @@ -1806,12 +1815,10 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ } } - printer_type = p->type; - p->raw = 0; p->remote = 0; - if (p->type & CUPS_PRINTER_REMOTE) + if (p->type & CUPS_PRINTER_DISCOVERED) { /* * Tell the client this is a remote printer of some type... @@ -2155,10 +2162,9 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ * Show current and available port monitors for this printer... */ - ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "port-monitor", + ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor", NULL, p->port_monitor ? p->port_monitor : "none"); - for (i = 1, ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL); ppdattr; i ++, ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL)); @@ -2171,7 +2177,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ i ++; } - attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, + attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor-supported", i, NULL, NULL); attr->values[0].string.text = _cupsStrAlloc("none"); @@ -2193,28 +2199,14 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ cupsdSetString(&p->product, ppd->product); #endif /* HAVE_DNSSD */ -#if BONJOUR_IS_REMOTE - ppdattr = ppdFindAttr(ppd, "APRemoteQueueID", NULL); -#endif /* BONJOUR_IS_REMOTE */ + if (ppdFindAttr(ppd, "APRemoteQueueID", NULL)) + p->type |= CUPS_PRINTER_REMOTE; /* * Close the PPD and set the type... */ ppdClose(ppd); - - printer_type = p->type; - -#if BONJOUR_IS_REMOTE - if (ppdattr) - { - /* - * This is a shared Bonjour printer... - */ - - printer_type |= CUPS_PRINTER_REMOTE; - } -#endif /* BONJOUR_IS_REMOTE */ } else if (!access(filename, 0)) { @@ -2282,7 +2274,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ * Tell the client this is really a hard-wired remote printer. */ - printer_type |= CUPS_PRINTER_REMOTE; + p->type |= CUPS_PRINTER_REMOTE; /* * Point the printer-uri-supported attribute to the @@ -2327,21 +2319,11 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ } } - /* - * Save the local printer type value, which may have the CUPS_PRINTER_REMOTE - * bit set. We use this value when sending the printer-type attribute to - * clients so they know whether the printer is really remote. Doing it - * this way prevents the browsing code from timing out hardwired remote - * printers... - */ - - p->external_type = printer_type; - /* * Copy the printer options into a browse attributes string we can re-use. */ - if (!(printer_type & CUPS_PRINTER_REMOTE)) + if (!(p->type & CUPS_PRINTER_DISCOVERED)) { const char *valptr; /* Pointer into value */ char *attrptr; /* Pointer into attribute string */ @@ -2608,7 +2590,7 @@ cupsdSetPrinterState( * Can't set status of remote printers... */ - if (p->type & CUPS_PRINTER_REMOTE) + if (p->type & CUPS_PRINTER_DISCOVERED) return; /* @@ -2737,7 +2719,8 @@ cupsdUpdatePrinters(void) * Remove remote printers if we are no longer browsing... */ - if (!Browsing && (p->type & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_REMOTE))) + if (!Browsing && + (p->type & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_DISCOVERED))) { if (p->type & CUPS_PRINTER_IMPLICIT) cupsArrayRemove(ImplicitPrinters, p); @@ -2759,7 +2742,7 @@ cupsdUpdatePrinters(void) * Update printer attributes as needed... */ - if (!(p->type & CUPS_PRINTER_REMOTE)) + if (!(p->type & CUPS_PRINTER_DISCOVERED)) cupsdSetPrinterAttrs(p); } } @@ -2854,7 +2837,7 @@ cupsdValidateDest( if (dtype) *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT | - CUPS_PRINTER_REMOTE); + CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED); return (p->name); } @@ -2913,7 +2896,7 @@ cupsdValidateDest( if (dtype) *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT | - CUPS_PRINTER_REMOTE); + CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED); return (p->name); } @@ -3751,5 +3734,5 @@ write_irix_state(cupsd_printer_t *p) /* I - Printer to update */ /* - * End of "$Id: printers.c 6539 2007-05-23 15:08:29Z mike $". + * End of "$Id: printers.c 6595 2007-06-21 22:29:57Z mike $". */ diff --git a/scheduler/printers.h b/scheduler/printers.h index 64dc34f07..15ebb1233 100644 --- a/scheduler/printers.h +++ b/scheduler/printers.h @@ -1,5 +1,5 @@ /* - * "$Id: printers.h 6541 2007-05-23 20:18:00Z mike $" + * "$Id: printers.h 6590 2007-06-21 18:22:22Z mike $" * * Printer definitions for the Common UNIX Printing System (CUPS) scheduler. * @@ -63,8 +63,7 @@ typedef struct cupsd_printer_s char *reasons[16]; /* printer-state-reasons strings */ time_t state_time; /* Time at this state */ char *job_sheets[2]; /* Banners/job sheets */ - cups_ptype_t type, /* Printer type (color, small, etc.) */ - external_type; /* Printer type that is advertised */ + cups_ptype_t type; /* Printer type (color, small, etc.) */ char *browse_attrs; /* Attributes sent with browse data */ time_t browse_expire; /* Expiration time for printer */ time_t browse_time; /* Last time update was sent/received */ @@ -178,5 +177,5 @@ extern void cupsdWritePrintcap(void); /* - * End of "$Id: printers.h 6541 2007-05-23 20:18:00Z mike $". + * End of "$Id: printers.h 6590 2007-06-21 18:22:22Z mike $". */ diff --git a/scripting/php/Makefile b/scripting/php/Makefile index 3960571b3..ec1e3ebc3 100644 --- a/scripting/php/Makefile +++ b/scripting/php/Makefile @@ -3,7 +3,7 @@ # # PHP Makefile for the Common UNIX Printing System (CUPS). # -# Copyright 1997-2006 by Easy Software Products, all rights reserved. +# Copyright 1997-2007 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the # property of Easy Software Products and are protected by Federal @@ -78,6 +78,10 @@ install: all echo Installing $(PHPCUPS) in $(PHPDIR) $(INSTALL_DIR) $(PHPDIR) $(INSTALL_BIN) $(PHPCUPS) $(PHPDIR) + if test "x$(SYMROOT)" != x; then \ + $(INSTALL_DIR) $(SYMROOT); \ + cp $(PHPCUPS) $(SYMROOT); \ + fi # @@ -96,7 +100,7 @@ uninstall: phpcups.so: $(OBJS) ../../Makedefs echo Linking $@... if test `uname` = Darwin; then \ - DSOFLAGS="-bundle -flat_namespace -undefined suppress"; \ + DSOFLAGS="-bundle -flat_namespace -undefined suppress $(RC_CFLAGS)"; \ else \ DSOFLAGS="$(DSOFLAGS)"; \ fi; \ diff --git a/systemv/Makefile b/systemv/Makefile index 053fe2b6b..c9be899b0 100644 --- a/systemv/Makefile +++ b/systemv/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5627 2006-06-05 15:24:20Z mike $" +# "$Id: Makefile 6574 2007-06-19 23:52:37Z mike $" # # System V commands makefile for the Common UNIX Printing System (CUPS). # @@ -79,6 +79,12 @@ install: all $(INSTALL_BIN) lpoptions $(BINDIR) $(INSTALL_BIN) lpstat $(BINDIR) $(INSTALL_BIN) -m 4755 -o root lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR) + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + for file in $(TARGETS); do \ + cp $$file $(SYMROOT); \ + done \ + fi # @@ -149,9 +155,9 @@ cupstestdsc: cupstestdsc.o ../cups/$(LIBCUPS) # cupstestppd # -cupstestppd: cupstestppd.o ../cups/$(LIBCUPS) +cupstestppd: cupstestppd.o ../cups/$(LIBCUPS) ../filter/$(LIBCUPSIMAGE) echo Linking $@... - $(CC) $(LDFLAGS) -o $@ cupstestppd.o $(LIBS) + $(CC) $(LDFLAGS) -o $@ cupstestppd.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) # @@ -225,5 +231,5 @@ include Dependencies # -# End of "$Id: Makefile 5627 2006-06-05 15:24:20Z mike $". +# End of "$Id: Makefile 6574 2007-06-19 23:52:37Z mike $". # diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index e2f203e19..4f4c6964f 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -1,5 +1,5 @@ /* - * "$Id: cupstestppd.c 6533 2007-05-15 15:54:23Z mike $" + * "$Id: cupstestppd.c 6574 2007-06-19 23:52:37Z mike $" * * PPD test program for the Common UNIX Printing System (CUPS). * @@ -27,10 +27,16 @@ * * Contents: * - * main() - Main entry for test program. - * show_conflicts() - Show option conflicts in a PPD file. - * usage() - Show program usage... - * valid_utf8() - Check whether a string contains valid UTF-8 text. + * main() - Main entry for test program. + * check_basics() - Check for CR LF, mixed line endings, and blank lines. + * check_constraints() - Check UIConstraints in the PPD file. + * check_defaults() - Check default option keywords in the PPD file. + * check_filters() - Check filters in the PPD file. + * check_translations() - Check translations in the PPD file. + * show_conflicts() - Show option conflicts in a PPD file. + * test_raster() - Test PostScript commands for raster printers. + * usage() - Show program usage... + * valid_utf8() - Check whether a string contains valid UTF-8 text. */ /* @@ -40,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -101,6 +108,7 @@ static int check_filters(ppd_file_t *ppd, const char *root, int errors, static int check_translations(ppd_file_t *ppd, int errors, int verbose,\ int warn); static void show_conflicts(ppd_file_t *ppd); +static int test_raster(ppd_file_t *ppd, int verbose); static void usage(void); static int valid_utf8(const char *s); @@ -367,6 +375,14 @@ main(int argc, /* I - Number of command-line args */ attr->value) ppdversion = (int)(10 * atof(attr->value) + 0.5); + for (j = 0; j < ppd->num_filters; j ++) + if (strstr(ppd->filters[j], "application/vnd.cups-raster")) + { + if (!test_raster(ppd, verbose)) + errors ++; + break; + } + /* * Look for default keywords with no matching option... */ @@ -1206,9 +1222,12 @@ main(int argc, /* I - Number of command-line args */ if (!strcmp(attr->name, "DefaultColorSpace") || !strcmp(attr->name, "DefaultColorSep") || !strcmp(attr->name, "DefaultFont") || + !strcmp(attr->name, "DefaultHalftoneType") || !strcmp(attr->name, "DefaultImageableArea") || + !strcmp(attr->name, "DefaultLeadingEdge") || !strcmp(attr->name, "DefaultOutputOrder") || !strcmp(attr->name, "DefaultPaperDimension") || + !strcmp(attr->name, "DefaultResolution") || !strcmp(attr->name, "DefaultScreenProc") || !strcmp(attr->name, "DefaultTransfer")) continue; @@ -1543,6 +1562,14 @@ main(int argc, /* I - Number of command-line args */ } } + _cupsLangPrintf(stdout, " num_consts = %d\n", + ppd->num_consts); + for (j = 0; j < ppd->num_consts; j ++) + _cupsLangPrintf(stdout, + " consts[%d] = *%s %s *%s %s\n", + j, ppd->consts[j].option1, ppd->consts[j].choice1, + ppd->consts[j].option2, ppd->consts[j].choice2); + _cupsLangPrintf(stdout, " num_profiles = %d\n", ppd->num_profiles); for (j = 0; j < ppd->num_profiles; j ++) @@ -1781,7 +1808,9 @@ check_defaults(ppd_file_t *ppd, /* I - PPD file */ if (!strcmp(attr->name, "DefaultColorSpace") || !strcmp(attr->name, "DefaultFont") || + !strcmp(attr->name, "DefaultHalftoneType") || !strcmp(attr->name, "DefaultImageableArea") || + !strcmp(attr->name, "DefaultLeadingEdge") || !strcmp(attr->name, "DefaultOutputOrder") || !strcmp(attr->name, "DefaultPaperDimension") || !strcmp(attr->name, "DefaultResolution") || @@ -2044,6 +2073,9 @@ check_translations(ppd_file_t *ppd, /* I - PPD file */ option; option = ppdNextOption(ppd)) { + if (!strcmp(option->keyword, "PageRegion")) + continue; + snprintf(keyword, sizeof(keyword), "%s.Translation", langstart); snprintf(llkeyword, sizeof(llkeyword), "%s.Translation", ll); @@ -2346,6 +2378,35 @@ show_conflicts(ppd_file_t *ppd) /* I - PPD to check */ } +/* + * 'test_raster()' - Test PostScript commands for raster printers. + */ + +static int /* O - 1 on success, 0 on failure */ +test_raster(ppd_file_t *ppd, /* I - PPD file */ + int verbose) /* I - Verbosity */ +{ + cups_page_header2_t header; /* Page header */ + + + ppdMarkDefaults(ppd); + if (cupsRasterInterpretPPD(&header, ppd, 0, NULL, 0)) + { + if (!verbose) + _cupsLangPuts(stdout, _(" FAIL\n")); + + if (verbose >= 0) + _cupsLangPrintf(stdout, + _(" **FAIL** Default option code cannot be " + "interpreted: %s\n"), cupsRasterErrorString()); + + return (0); + } + else + return (1); +} + + /* * 'usage()' - Show program usage... */ @@ -2449,5 +2510,5 @@ valid_utf8(const char *s) /* I - String to check */ /* - * End of "$Id: cupstestppd.c 6533 2007-05-15 15:54:23Z mike $". + * End of "$Id: cupstestppd.c 6574 2007-06-19 23:52:37Z mike $". */ diff --git a/systemv/lpstat.c b/systemv/lpstat.c index 4830117c1..be86072ab 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -1,5 +1,5 @@ /* - * "$Id: lpstat.c 6084 2006-11-14 14:35:53Z mike $" + * "$Id: lpstat.c 6559 2007-06-18 21:09:03Z mike $" * * "lpstat" command for the Common UNIX Printing System (CUPS). * @@ -1397,9 +1397,11 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ int ranking, /* I - Show job ranking? */ const char *which) /* I - Show which jobs? */ { + int i; /* Looping var */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - ipp_attribute_t *attr; /* Current attribute */ + ipp_attribute_t *attr, /* Current attribute */ + *reasons; /* Job state reasons attribute */ const char *dest, /* Pointer into job-printer-uri */ *username, /* Pointer to job-originating-user-name */ *title; /* Pointer to job-name */ @@ -1420,7 +1422,8 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ "job-name", "time-at-creation", "job-printer-uri", - "job-originating-user-name" + "job-originating-user-name", + "job-state-reasons" }; @@ -1495,6 +1498,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ dest = NULL; jobtime = 0; title = "no title"; + reasons = NULL; while (attr != NULL && attr->group_tag == IPP_TAG_JOB) { @@ -1523,6 +1527,10 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ attr->value_tag == IPP_TAG_NAME) title = attr->values[0].string.text; + if (!strcmp(attr->name, "job-state-reasons") && + attr->value_tag == IPP_TAG_KEYWORD) + reasons = attr; + attr = attr->next; } @@ -1665,7 +1673,17 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ temp, username ? username : "unknown", 1024.0 * size, date); if (long_status) + { + if (reasons) + { + _cupsLangPuts(stdout, _("\tAlerts:")); + for (i = 0; i < reasons->num_values; i ++) + _cupsLangPrintf(stdout, " %s", + reasons->values[i].string.text); + _cupsLangPuts(stdout, "\n"); + } _cupsLangPrintf(stdout, _("\tqueued for %s\n"), dest); + } } } @@ -2249,5 +2267,5 @@ show_scheduler(http_t *http) /* I - HTTP connection to server */ /* - * End of "$Id: lpstat.c 6084 2006-11-14 14:35:53Z mike $". + * End of "$Id: lpstat.c 6559 2007-06-18 21:09:03Z mike $". */ diff --git a/templates/printers.tmpl b/templates/printers.tmpl index bb9f953bc..56e4abce5 100644 --- a/templates/printers.tmpl +++ b/templates/printers.tmpl @@ -10,7 +10,7 @@
Table 1: Supported Page Device AttributesTable 2: Supported Page Device Attributes
Name(s) Description: {printer_info}
Location: {printer_location}
-Pritner Driver: {printer_make_and_model}
+Printer Driver: {printer_make_and_model}
Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, {printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {printer_is_shared=0?not:} published. {?device_uri=?:
Device URI: {device_uri}} diff --git a/test/create-job-timeout.test b/test/create-job-timeout.test index b0e035797..514924d42 100644 --- a/test/create-job-timeout.test +++ b/test/create-job-timeout.test @@ -19,10 +19,10 @@ GROUP job ATTR integer copies 1 + ATTR name job-sheets unclassified,unclassified # What statuses are OK? - STATUS ok - STATUS ok-subst + STATUS successful-ok # What attributes do we expect? EXPECT job-id @@ -50,6 +50,5 @@ FILE ../data/testprint.ps # What statuses are OK? - STATUS ok - STATUS ok-subst + STATUS successful-ok } diff --git a/test/create-job.test b/test/create-job.test index 3cfaac532..61336c63b 100644 --- a/test/create-job.test +++ b/test/create-job.test @@ -20,8 +20,7 @@ ATTR integer copies 1 # What statuses are OK? - STATUS ok - STATUS ok-subst + STATUS successful-ok # What attributes do we expect? EXPECT job-id @@ -49,6 +48,5 @@ FILE ../data/testprint.ps # What statuses are OK? - STATUS ok - STATUS ok-subst + STATUS successful-ok } diff --git a/test/get-jobs.test b/test/get-jobs.test index 2d2e5a7dd..1b4ed2010 100644 --- a/test/get-jobs.test +++ b/test/get-jobs.test @@ -14,7 +14,7 @@ ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri - ATTR keyword which-jobs completed +# ATTR keyword which-jobs completed # What statuses are OK? STATUS successful-ok -- 2.39.2