CHANGES IN CUPS V1.3.6
- Documentation updates (STR #2646, STR #2647, STR #2649)
+ - The cups-polld program did not exit if the scheduler crashed
+ (STR #2640)
+ - The scheduler would crash if you tried to set the port-monitor
+ on a raw queue (STR #2639)
+ - The scheduler could crash if a polled remote printer was
+ converted to a class (STR #2656)
+ - The web interface and cupsctl did not correctly reflect
+ the "allow printing from the Internet" state (STR #2650)
+ - The scheduler incorrectly treated MIME types as case-
+ sensitive (STR #2657)
+ - The Java support classes did not send UTF-8 strings to
+ the scheduler (STR #2651)
+ - The CGI code did not handle interrupted POST requests
+ properly (STR #2652)
+ - The PostScript filter incorrectly handled number-up when
+ the number of pages was evenly divisible by the number-up
+ value.
- The PDF filter incorrectly filtered pages when page-ranges
and number-up were both specified (STR #2643)
- The IPP backend did not handle printing of pictwps files
-CHANGES.txt - 2008-01-03
+CHANGES.txt - 2008-01-07
------------------------
CHANGES IN CUPS V1.4b1
+ - Bonjour printer registrations now advertise as local or
+ global based on the current access policies for the
+ printer.
+ - cupsGetDests*() and cupsSetDests*() now track the last
+ used printer preference on Mac OS X.
- Added a new streaming request API (STR #2261)
- Added a new cupsGetNamedDest() function to the CUPS
library for faster printing with lp and lpr (STR #2638)
$(RANLIB) $@
-#
-# ieee1394
-#
-
-ieee1394: ieee1394.o ieee1394-linux.o
- echo Linking $@...
- $(CC) $(LDFLAGS) -o ieee1394 ieee1394.o ieee1394-linux.o -lraw1394 $(LIBS)
-
-ieee1394.o: ieee1394.h
-ieee1394-linux.o: ieee1394.h
-
-
#
# ipp
#
+++ /dev/null
-/*
- * "$Id: ieee1394-linux.c 6649 2007-07-11 21:46:42Z mike $"
- *
- * Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 2002 by Easy Software Products, all rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the
- * following conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use
- * of this software must display the following
- * acknowledgement:
- *
- * This product includes software developed by Easy
- * Software Products.
- *
- * 4. The name of Easy Software Products may not be used to
- * endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Contents:
- *
- * get_device_id() - Get the IEEE-1284 device ID for a node...
- * get_unit_type() - Get the unit type for a node...
- * show_data() - Show a data node...
- * show_dir() - Show a directory list...
- * ieee1394_list() - List the available printer devices.
- * ieee1394_open() - Open a printer device.
- * ieee1394_close() - Close a printer device.
- * ieee1394_read() - Read from a printer device.
- * ieee1394_write() - Write data to a printer device.
- * ieee1394_error() - Return the last error.
- */
-
-/*
- * Include necessary headers.
- */
-
-#include "ieee1394.h"
-#include <cups/debug.h>
-#include <libraw1394/raw1394.h>
-#include <libraw1394/csr.h>
-
-
-/*
- * Limits...
- */
-
-#define MAX_NODES 100
-
-
-/*
- * Structures...
- */
-
-typedef struct
-{
- char uri[HTTP_MAX_URI],/* URI for this node... */
- description[128],/* Description of port */
- make_model[128];/* Make and model */
- int port, /* Port where this node is found */
- node; /* Node number */
- unsigned long long addr; /* Management address */
-} linux1394_node_t;
-
-typedef struct
-{
- raw1394handle_t handle; /* Handle for printer device */
- int node; /* Node number for printer device */
- unsigned long long addr; /* Management address */
-} linux1394_dev_t;
-
-
-/*
- * ORB messages for communication with the device...
- */
-
-typedef struct /**** Login ORB Message */
-{
- unsigned char passwd_addr[8]; /* Password address */
- unsigned char resp_addr[8]; /* Login response address */
- unsigned char notify_excl; /* Notify and exclusive bits */
- unsigned char recon_func; /* Reconnect time and function */
- unsigned char lun[2]; /* Logical unit number */
- unsigned char passwd_len[2]; /* Length of password */
- unsigned char resp_len[2]; /* Length of login response */
- unsigned char fifo_addr[8]; /* Local status FIFO address */
-} login_orb_t;
-
-typedef struct /**** Login Response Message ****/
-{
- unsigned char length[2]; /* Length of response */
- unsigned char login_id[2]; /* Login ID */
- unsigned char cmd_addr[8]; /* Command block agent address */
- unsigned char reserved[2]; /* Reserved (0) */
- unsigned char recon_hold[2]; /* Number of seconds to hold login */
-} login_resp_t;
-
-
-/*
- * Local globals...
- */
-
-static char error_string[1024] = "";
-static int num_nodes;
-static linux1394_node_t nodes[MAX_NODES];
-
-
-/*
- * 'get_device_id()' - Get the IEEE-1284 device ID for a node...
- */
-
-static char * /* O - Device ID */
-get_device_id(raw1394handle_t handle,/* I - Handle for device */
- int node, /* I - Node number */
- unsigned long long offset,/* I - Offset to directory */
- char *id, /* O - ID string */
- int idlen) /* I - Size of ID string */
-{
- unsigned char data[1024], /* Data from ROM */
- *dataptr; /* Pointer into data */
- int length; /* Length of directory */
- int datalen; /* Length of data */
- unsigned long long dataoff; /* Offset of data */
-
-
- DEBUG_printf(("get_device_id(handle = %p, node = %d, offset = %llx, id = %p, idlen = %d)\n",
- handle, node, offset, id, idlen));
-
- *id = '\0';
-
- /*
- * Read the directory length from the first quadlet...
- */
-
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (NULL);
-
- offset += 4;
-
- /*
- * The length is in the upper 16 bits...
- */
-
- length = (data[0] << 8) | data[1];
-
- DEBUG_printf((" length = %d\n", length));
-
- /*
- * Then read the directory, looking for unit directory or device tags...
- */
-
- while (length > 0)
- {
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (NULL);
-
- DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
- data[2], data[3]));
-
- if (data[0] == 0xd1)
- {
- /*
- * Found the unit directory...
- */
-
- offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
-
- return (get_device_id(handle, node, offset, id, idlen));
- }
- else if (data[0] == 0x81)
- {
- /*
- * Found potential IEEE-1284 device ID...
- */
-
- dataoff = offset + (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
-
- if (raw1394_read(handle, 0xffc0 | node, dataoff, 4, (quadlet_t *)data) < 0)
- return (NULL);
-
- dataoff += 4;
-
- /*
- * Read the leaf value...
- */
-
- datalen = (data[0] << 8) | data[1];
-
- if (datalen > (sizeof(data) / 4))
- datalen = sizeof(data) / 4;
-
- for (dataptr = data; datalen > 0; datalen --, dataptr += 4, dataoff += 4)
- if (raw1394_read(handle, 0xffc0 | node, dataoff, 4,
- (quadlet_t *)dataptr) < 0)
- return (NULL);
-
- if (data[0] == 0 && memcmp(data + 8, "MFG:", 4) == 0)
- {
- /*
- * Found the device ID...
- */
-
- datalen = dataptr - data - 8;
- if (datalen >= idlen)
- datalen --;
-
- memcpy(id, data + 8, datalen);
- id[datalen] = '\0';
-
- return (id);
- }
- }
-
- offset += 4;
- length --;
- }
-
- return (NULL);
-}
-
-
-/*
- * 'get_man_addr()' - Get the management address for a node...
- */
-
-static int /* O - Unit type */
-get_man_addr(raw1394handle_t handle, /* I - Handle for device */
- int node, /* I - Node number */
- unsigned long long offset) /* I - Offset to directory */
-{
- unsigned char data[4]; /* Data from ROM */
- int length; /* Length of directory */
-
-
- DEBUG_printf(("get_man_addr(handle = %p, node = %d, offset = %llx)\n",
- handle, node, offset));
-
- /*
- * Read the directory length from the first quadlet...
- */
-
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (-1);
-
- offset += 4;
-
- /*
- * The length is in the upper 16 bits...
- */
-
- length = (data[0] << 8) | data[1];
-
- DEBUG_printf((" length = %d\n", length));
-
- /*
- * Then read the directory, looking for unit directory or type tags...
- */
-
- while (length > 0)
- {
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (-1);
-
- DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
- data[2], data[3]));
-
- if (data[0] == 0xd1)
- {
- /*
- * Found the unit directory...
- */
-
- offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
-
- return (get_man_addr(handle, node, offset));
- }
- else if (data[0] == 0x54)
- {
- /*
- * Found the management address...
- */
-
- return (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
- }
-
- offset += 4;
- length --;
- }
-
- return (-1);
-}
-
-
-/*
- * 'get_unit_type()' - Get the unit type for a node...
- */
-
-static int /* O - Unit type */
-get_unit_type(raw1394handle_t handle,/* I - Handle for device */
- int node, /* I - Node number */
- unsigned long long offset)/* I - Offset to directory */
-{
- unsigned char data[4]; /* Data from ROM */
- int length; /* Length of directory */
-
-
- DEBUG_printf(("get_unit_type(handle = %p, node = %d, offset = %llx)\n",
- handle, node, offset));
-
- /*
- * Read the directory length from the first quadlet...
- */
-
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (-1);
-
- offset += 4;
-
- /*
- * The length is in the upper 16 bits...
- */
-
- length = (data[0] << 8) | data[1];
-
- DEBUG_printf((" length = %d\n", length));
-
- /*
- * Then read the directory, looking for unit directory or type tags...
- */
-
- while (length > 0)
- {
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return (-1);
-
- DEBUG_printf((" data = %02X %02X %02X %02X\n", data[0], data[1],
- data[2], data[3]));
-
- if (data[0] == 0xd1)
- {
- /*
- * Found the unit directory...
- */
-
- offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
-
- return (get_unit_type(handle, node, offset));
- }
- else if (data[0] == 0x14)
- {
- /*
- * Found the unit type...
- */
-
- return (data[1] & 0x1f);
- }
-
- offset += 4;
- length --;
- }
-
- return (-1);
-}
-
-
-#ifdef DEBUG
-/*
- * 'show_data()' - Show a data node...
- */
-
-static void
-show_data(raw1394handle_t handle, /* I - Handle for device */
- int node, /* I - Node number */
- unsigned long long offset, /* I - Offset to directory */
- int indent) /* Amount to indent */
-{
- int i; /* Looping var */
- unsigned char data[4]; /* Data from ROM */
- int length; /* Length of data */
-
-
- /*
- * Read the data length from the first quadlet...
- */
-
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return;
-
- offset += 4;
-
- /*
- * The length is in the upper 16 bits...
- */
-
- length = (data[0] << 8) | data[1];
-
- /*
- * Then read the data...
- */
-
- for (i = 0; i < indent; i ++)
- putchar(' ');
-
- printf("LEAF (%d quadlets)\n", length);
-
- while (length > 0)
- {
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return;
-
- for (i = 0; i < indent; i ++)
- putchar(' ');
-
- printf("%02X %02X %02X %02X '%c%c%c%c'\n",
- data[0], data[1], data[2], data[3],
- (data[0] < ' ' || data[0] >= 0x7f) ? '.' : data[0],
- (data[1] < ' ' || data[1] >= 0x7f) ? '.' : data[1],
- (data[2] < ' ' || data[2] >= 0x7f) ? '.' : data[2],
- (data[3] < ' ' || data[3] >= 0x7f) ? '.' : data[3]);
-
- offset += 4;
- length --;
- }
-}
-
-
-/*
- * 'show_dir()' - Show a directory list...
- */
-
-static void
-show_dir(raw1394handle_t handle, /* I - Handle for device */
- int node, /* I - Node number */
- unsigned long long offset, /* I - Offset to directory */
- int indent) /* Amount to indent */
-{
- int i; /* Looping var */
- unsigned char data[4]; /* Data from ROM */
- int length; /* Length of directory */
- int value; /* Value in directory */
-
-
- /*
- * Read the directory length from the first quadlet...
- */
-
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return;
-
- offset += 4;
-
- /*
- * The length is in the upper 16 bits...
- */
-
- length = (data[0] << 8) | data[1];
-
- /*
- * Then read the directory...
- */
-
- while (length > 0)
- {
- if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
- return;
-
- for (i = 0; i < indent; i ++)
- putchar(' ');
-
- printf("%02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
-
- value = (((data[1] << 8) | data[2]) << 8) | data[3];
-
- switch (data[0] & 0xc0)
- {
- case 0x00 :
- for (i = -4; i < indent; i ++)
- putchar(' ');
-
- printf("IMMEDIATE %d\n", value);
- break;
-
- case 0x40 :
- for (i = -4; i < indent; i ++)
- putchar(' ');
-
- printf("CSR OFFSET +%06X\n", value);
- break;
-
- case 0x80 :
- show_data(handle, node, offset + value * 4, indent + 4);
- break;
-
- case 0xc0 :
- show_dir(handle, node, offset + value * 4, indent + 4);
- break;
- }
-
- offset += 4;
- length --;
- }
-}
-#endif /* DEBUG */
-
-
-/*
- * 'ieee1394_list()' - List the available printer devices.
- */
-
-ieee1394_info_t * /* O - Printer information */
-ieee1394_list(int *num_devices) /* O - Number of printers */
-{
- int i, j; /* Looping vars */
- raw1394handle_t handle; /* 1394 handle */
- int num_ports; /* Number of ports */
- struct raw1394_portinfo ports[100]; /* Port data... */
- unsigned char guid[8]; /* Global unique ID */
- int vendor; /* Vendor portion of GUID */
- int unit_type; /* Unit type */
- int addr; /* Management address offset */
- char id[1024], /* Device ID string */
- *idptr, /* Pointer into ID string */
- *idsep; /* Pointer to separator */
- ieee1394_info_t *devices; /* Device list */
-
-
- /*
- * Connect to the user-mode driver interface...
- */
-
- handle = raw1394_new_handle();
- num_ports = raw1394_get_port_info(handle, ports,
- sizeof(ports) / sizeof(ports[0]));
-
- DEBUG_printf(("num_ports = %d\n", num_ports));
-
- /*
- * Loop through the ports to discover what nodes are available.
- */
-
- num_nodes = 0;
-
- for (i = 0; i < num_ports; i ++)
- {
- DEBUG_printf(("ports[%d] = { nodes = %d, name = \"%s\" }\n", i,
- ports[i].nodes, ports[i].name));
-
- raw1394_set_port(handle, i);
-
- for (j = 0; j < ports[i].nodes; j ++)
- {
- if (raw1394_read(handle, 0xffc0 | j,
- CSR_REGISTER_BASE + CSR_CONFIG_ROM + 12, 4,
- (quadlet_t *)guid) < 0)
- {
- DEBUG_printf((" Node #%d: Unable to contact (%s)!\n", j,
- strerror(errno)));
- continue;
- }
- else
- {
- raw1394_read(handle, 0xffc0 | j,
- CSR_REGISTER_BASE + CSR_CONFIG_ROM + 16, 4,
- (quadlet_t *)(guid + 4));
-
- DEBUG_printf((" Node #%d: GUID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
- j, guid[0], guid[1], guid[2], guid[3], guid[4],
- guid[5], guid[6], guid[7]));
-
- vendor = (((guid[0] << 8) | guid[1]) << 8) | guid[2];
- unit_type = get_unit_type(handle, j,
- CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
-
- DEBUG_printf(("vendor = %x, unit_type = %d\n", vendor, unit_type));
-
- if (unit_type == 2 && num_nodes < MAX_NODES)
- {
- /*
- * Found a printer device; add it to the nodes list...
- */
-
-#ifdef DEBUG
- show_dir(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20, 0);
-#endif /* DEBUG */
-
- memset(nodes + num_nodes, 0, sizeof(linux1394_node_t));
-
- sprintf(nodes[num_nodes].uri, "ieee1394://%02X%02X%02X%02X%02X%02X%02X%02X",
- guid[0], guid[1], guid[2], guid[3], guid[4],
- guid[5], guid[6], guid[7]);
-
- nodes[num_nodes].port = i;
- nodes[num_nodes].node = j;
-
- addr = get_man_addr(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
-
- if (addr < 0)
- continue;
-
- nodes[num_nodes].addr = CSR_REGISTER_BASE + addr;
-
- DEBUG_printf(("Node address = %llx\n", nodes[num_nodes].addr));
-
- get_device_id(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20,
- id, sizeof(id));
-
- if (id[0])
- {
- /*
- * Grab the manufacturer and model name from the device ID
- * string...
- */
-
- idptr = id + 4;
- idsep = strchr(id, ';');
- if (idsep)
- *idsep++ = '\0';
- else
- idsep = idptr;
-
- snprintf(nodes[num_nodes].description,
- sizeof(nodes[num_nodes].description),
- "%s Firewire Printer", idptr);
-
- if ((idptr = strstr(idsep, "DES:")) == NULL)
- idptr = strstr(idsep, "MDL:");
-
- if (idptr == NULL)
- strcpy(nodes[num_nodes].make_model, "Unknown");
- else
- {
- /*
- * Grab the DES or MDL code...
- */
-
- idptr += 4;
- idsep = strchr(idptr, ';');
- if (idsep)
- *idsep = '\0';
-
- if (strncmp(id + 4, idptr, strlen(id + 4)) == 0)
- {
- /*
- * Use the description directly...
- */
-
- strlcpy(nodes[num_nodes].make_model, idptr,
- sizeof(nodes[num_nodes].make_model));
- }
- else
- {
- /*
- * Add the manufacturer to the front of the name...
- */
-
- snprintf(nodes[num_nodes].make_model,
- sizeof(nodes[num_nodes].make_model),
- "%s %s", id + 4, idptr);
- }
- }
- }
- else
- {
- /*
- * Flag it as an unknown printer...
- */
-
- sprintf(nodes[num_nodes].description,
- "Unknown%06X Firewire Printer", vendor);
- strcpy(nodes[num_nodes].make_model, "Unknown");
- }
-
- num_nodes ++;
- }
- }
- }
- }
-
- /*
- * Done querying the Firewire bus...
- */
-
- raw1394_destroy_handle(handle);
-
- /*
- * Build an array of device info structures as needed...
- */
-
- if (num_devices == NULL)
- return (NULL);
-
- *num_devices = num_nodes;
-
- if (num_nodes)
- {
- if ((devices = calloc(sizeof(ieee1394_info_t), num_nodes)) != NULL)
- {
- for (i = 0; i < num_nodes; i ++)
- {
- strcpy(devices[i].uri, nodes[i].uri);
- strcpy(devices[i].description, nodes[i].description);
- strcpy(devices[i].make_model, nodes[i].make_model);
- }
- }
-
- return (devices);
- }
- else
- return (NULL);
-}
-
-
-/*
- * 'ieee1394_open()' - Open a printer device.
- */
-
-ieee1394_dev_t /* O - Printer device or NULL */
-ieee1394_open(const char *uri) /* I - Device URI */
-{
- int i; /* Looping var */
- linux1394_dev_t *ldev; /* Linux device */
-
-
- /*
- * Return early if we can't see any printers...
- */
-
- if (num_nodes == 0)
- ieee1394_list(NULL);
-
- if (num_nodes == 0)
- {
- strcpy(error_string, "No IEEE-1394 printers found!");
- return (NULL);
- }
-
- /*
- * Look for the URI...
- */
-
- for (i = 0; i < num_nodes; i ++)
- if (strcmp(nodes[i].uri, uri) == 0)
- break;
-
- if (i >= num_nodes)
- {
- snprintf(error_string, sizeof(error_string), "Device %s not found!", uri);
- return (NULL);
- }
-
- /*
- * Now create a new device structure...
- */
-
- if ((ldev = calloc(sizeof(linux1394_dev_t), 1)) == NULL)
- {
- strcpy(error_string, "Out of memory!");
- return (NULL);
- }
-
- ldev->handle = raw1394_new_handle();
- ldev->node = nodes[i].node;
- ldev->addr = nodes[i].addr;
-
- raw1394_set_port(ldev->handle, nodes[i].port);
-
- error_string[0] = '\0';
-
- return ((ieee1394_dev_t)ldev);
-}
-
-
-/*
- * 'ieee1394_close()' - Close a printer device.
- */
-
-int /* O - 0 on success, -1 on failure */
-ieee1394_close(ieee1394_dev_t dev) /* I - Printer device */
-{
- linux1394_dev_t *ldev; /* Linux device */
-
-
- ldev = (linux1394_dev_t *)dev;
-
- raw1394_destroy_handle(ldev->handle);
-
- free(ldev);
-
- return (0);
-}
-
-
-/*
- * 'ieee1394_read()' - Read from a printer device.
- */
-
-int /* O - Number of bytes read or -1 */
-ieee1394_read(ieee1394_dev_t dev, /* I - Printer device */
- char *buffer, /* I - Read buffer */
- int len) /* I - Max bytes to read */
-{
- linux1394_dev_t *ldev; /* Linux device */
-
-
- ldev = (linux1394_dev_t *)dev;
-
-
- return (0);
-}
-
-
-/*
- * 'ieee1394_write()' - Write data to a printer device.
- */
-
-int /* O - Number of bytes written or -1 */
-ieee1394_write(ieee1394_dev_t dev, /* I - Printer device */
- char *buffer, /* I - Buffer to write */
- int len) /* I - Number of bytes to write */
-{
- linux1394_dev_t *ldev; /* Linux device */
-
-
- ldev = (linux1394_dev_t *)dev;
-
-
-/* if (raw1394_write(handle, 0xffc0 | j, 0, ,
- (quadlet_t *)guid) < 0)*/
-
- return (len);
-}
-
-
-/*
- * 'ieee1394_error()' - Return the last error.
- */
-
-const char * /* O - Error string or NULL */
-ieee1394_error(void)
-{
- if (error_string[0])
- return (error_string);
- else
- return (NULL);
-}
-
-
-/*
- * End of "$Id: ieee1394-linux.c 6649 2007-07-11 21:46:42Z mike $".
- */
+++ /dev/null
-/*
- * "$Id: ieee1394.c 6649 2007-07-11 21:46:42Z mike $"
- *
- * IEEE-1394 backend for the Common UNIX Printing System (CUPS).
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 2002 by Easy Software Products, all rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the
- * following conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use
- * of this software must display the following
- * acknowledgement:
- *
- * This product includes software developed by Easy
- * Software Products.
- *
- * 4. The name of Easy Software Products may not be used to
- * endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Contents:
- *
- * main() - Send a file to the printer.
- * list_devices() - List all known printer devices...
- */
-
-/*
- * Include necessary headers.
- */
-
-#include "ieee1394.h"
-
-
-/*
- * Local functions...
- */
-
-void list_devices(void);
-
-
-/*
- * 'main()' - Send a file to the printer.
- *
- * Usage:
- *
- * printer-uri job-id user title copies options [file]
- */
-
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments (6 or 7) */
- char *argv[]) /* I - Command-line arguments */
-{
- ieee1394_dev_t dev; /* Printer device */
- int fp; /* Print file */
- int copies; /* Number of copies to print */
- int rbytes; /* Number of bytes read from device */
- size_t nbytes, /* Number of bytes read from file */
- tbytes; /* Total number of bytes written */
- char buffer[8192]; /* Input/output buffer */
-#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
-
-
- /*
- * Make sure status messages are not buffered...
- */
-
- setbuf(stderr, NULL);
-
- /*
- * Check command-line...
- */
-
- if (argc == 1)
- {
- list_devices();
-
- return (0);
- }
- else if (argc < 6 || argc > 7)
- {
- fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
- argv[0]);
- return (1);
- }
-
- /*
- * If we have 7 arguments, print the file named on the command-line.
- * Otherwise, send stdin instead...
- */
-
- if (argc == 6)
- {
- fp = 0;
- copies = 1;
- }
- else
- {
- /*
- * Try to open the print file...
- */
-
- if ((fp = open(argv[6], O_RDONLY)) < 0)
- {
- perror("ERROR: unable to open print file");
- return (1);
- }
-
- copies = atoi(argv[4]);
- }
-
- /*
- * Try to open the printer device...
- */
-
- fputs("STATE: +connecting-to-device\n", stderr);
-
- do
- {
- if ((dev = ieee1394_open(argv[0])) == NULL)
- {
- fputs("INFO: Firewire printer busy; will retry in 30 seconds...\n", stderr);
- sleep(30);
- }
- }
- while (dev == NULL);
-
- fputs("STATE: -connecting-to-device\n", stderr);
-
- /*
- * Now that we are "connected" to the port, ignore SIGTERM so that we
- * can finish out any page data the driver sends (e.g. to eject the
- * current page... Only ignore SIGTERM if we are printing data from
- * stdin (otherwise you can't cancel raw jobs...)
- */
-
- if (argc < 7)
- {
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
- sigset(SIGTERM, SIG_IGN);
-#elif defined(HAVE_SIGACTION)
- memset(&action, 0, sizeof(action));
-
- sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction(SIGTERM, &action, NULL);
-#else
- signal(SIGTERM, SIG_IGN);
-#endif /* HAVE_SIGSET */
- }
-
- /*
- * Finally, send the print file...
- */
-
- while (copies > 0)
- {
- copies --;
-
- if (fp != 0)
- {
- fputs("PAGE: 1 1\n", stderr);
- lseek(fp, 0, SEEK_SET);
- }
-
- tbytes = 0;
- while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
- {
- /*
- * Write the print data to the printer...
- */
-
- tbytes += nbytes;
-
- if (ieee1394_write(dev, buffer, nbytes) < 0)
- {
- perror("ERROR: Unable to send print file to printer");
- break;
- }
-
- if ((rbytes = ieee1394_read(dev, buffer, sizeof(buffer))) > 0)
- fprintf(stderr, "INFO: Read %d bytes from printer...\n", rbytes);
-
- if (argc > 6)
- fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
- (unsigned long)tbytes);
- }
- }
-
- /*
- * Close the printer device and input file and return...
- */
-
- ieee1394_close(dev);
-
- if (fp != 0)
- close(fp);
-
- fputs("INFO: Ready to print.\n", stderr);
-
- return (0);
-}
-
-
-/*
- * 'list_devices()' - List all known devices...
- */
-
-void
-list_devices(void)
-{
- int i, /* Looping var */
- num_info; /* Number of devices */
- ieee1394_info_t *info; /* Devices... */
-
-
- /*
- * Get the available devices...
- */
-
- info = ieee1394_list(&num_info);
-
- /*
- * List them as needed...
- */
-
- if (num_info > 0)
- {
- for (i = 0; i < num_info; i ++)
- printf("direct %s \"%s\" \"%s\"\n", info[i].uri,
- info[i].make_model, info[i].description);
-
- free(info);
- }
-}
-
-
-/*
- * End of "$Id: ieee1394.c 6649 2007-07-11 21:46:42Z mike $".
- */
+++ /dev/null
-/*
- * "$Id: ieee1394.h 6649 2007-07-11 21:46:42Z mike $"
- *
- * IEEE-1394 header for the Common UNIX Printing System (CUPS).
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 2002 by Easy Software Products, all rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the
- * following conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use
- * of this software must display the following
- * acknowledgement:
- *
- * This product includes software developed by Easy
- * Software Products.
- *
- * 4. The name of Easy Software Products may not be used to
- * endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
-
-/*
- * Include necessary headers.
- */
-
-#include <cups/cups.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <cups/string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#ifdef WIN32
-# include <io.h>
-#else
-# include <unistd.h>
-# include <fcntl.h>
-#endif /* WIN32 */
-
-
-/*
- * Device information structure...
- */
-
-typedef struct
-{
- char uri[HTTP_MAX_URI], /* Device URI */
- description[128], /* Description of port */
- make_model[128]; /* Make and model */
-} ieee1394_info_t;
-
-
-/*
- * Private device connection information...
- */
-
-typedef void *ieee1394_dev_t;
-
-
-/*
- * Prototypes for standard IEEE-1394 interface...
- */
-
-extern ieee1394_info_t *ieee1394_list(int *num_devices);
-extern ieee1394_dev_t ieee1394_open(const char *uri);
-extern int ieee1394_close(ieee1394_dev_t dev);
-extern int ieee1394_read(ieee1394_dev_t dev, char *buffer, int len);
-extern int ieee1394_write(ieee1394_dev_t dev, char *buffer, int len);
-extern const char *ieee1394_error(void);
-
-
-/*
- * End of "$Id: ieee1394.h 6649 2007-07-11 21:46:42Z mike $".
- */
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
- perror("ERROR: unable to create temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
{
- perror("ERROR: unable to open temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to open temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (cupsFileWrite(fp, buffer, bytes) < bytes)
{
- perror("ERROR: unable to write to temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
cupsFileClose(fp);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
else if (!strncmp(reason, "moving-to-paused", 16) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
- message = _("Printer off-line.");
+ message = _("Printer offline.");
else if (!strncmp(reason, "toner-low", 9))
message = _("Toner low.");
else if (!strncmp(reason, "toner-empty", 11))
*
* Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
- perror("ERROR: unable to create temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (write(fd, buffer, bytes) < bytes)
{
- perror("ERROR: unable to write to temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
if (lpd_write(fd, buf, bytes) < bytes)
{
- perror("ERROR: Unable to send LPD command");
+ _cupsLangPrintError(_("ERROR: Unable to send LPD command"));
return (-1);
}
if ((fd = socket(addr->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
{
- perror("ERROR: Unable to create socket");
+ _cupsLangPrintError(_("ERROR: Unable to create socket"));
sleep(1);
continue;
if ((fd = rresvport_af(&lport, addr->addr.addr.sa_family)) < 0)
{
- perror("ERROR: Unable to reserve port");
+ _cupsLangPrintError(_("ERROR: Unable to reserve port"));
sleep(1);
continue;
httpAddrFreeList(addrlist);
close(fd);
- perror("ERROR: unable to stat print file");
+ _cupsLangPrintError(_("ERROR: unable to stat print file"));
return (CUPS_BACKEND_FAILED);
}
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
- perror("ERROR: Unable to write control file");
+ _cupsLangPrintError(_("ERROR: Unable to write control file"));
}
else
{
if (lpd_write(fd, buffer, nbytes) < nbytes)
{
- perror("ERROR: Unable to send print file to printer");
+ _cupsLangPrintError(_("ERROR: Unable to send print file to printer"));
break;
}
else
status = errno;
else if (lpd_write(fd, "", 1) < 1)
{
- perror("ERROR: Unable to send trailing nul to printer");
+ _cupsLangPrintError(_("ERROR: Unable to send trailing nul to printer"));
status = errno;
}
else
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
{
status = errno;
- perror("ERROR: Unable to write control file");
+ _cupsLangPrintError(_("ERROR: Unable to write control file"));
}
else
{
if (argc < 6 || argc > 7)
{
- fprintf(stderr, "argc = %d\n", argc);
- for (err = 0; err < argc; err++) {
- fprintf(stderr, "%02d:%s\n", err, argv[err]);
- }
- fprintf(stderr, "Usage: pap job-id user title copies options [file]\n");
- exit(EINVAL);
+ _cupsLangPrintf(stderr,
+ _("Usage: %s job-id user title copies options [file]\n"),
+ argv[0]);
+ return (CUPS_BACKEND_FAILED);
}
/* If we have 7 arguments, print the file named on the command-line.
_cupsLangPrintf(stderr,
_("ERROR: Unable to open print file \"%s\": %s\n"),
argv[6], strerror(errno));
- return (1);
+ return (CUPS_BACKEND_FAILED);
}
copies = atoi(argv[4]);
/* Make sure it's okay to use appletalk */
if (!okayToUseAppleTalk())
{
- fprintf(stderr, "INFO: AppleTalk disabled in System Preferences\n");
+ _cupsLangPuts(stderr, _("INFO: AppleTalk disabled in System Preferences\n"));
return -1; /* Network is down */
}
if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
{
- perror("ERROR: Unable to get default AppleTalk zone");
+ _cupsLangPrintError(_("ERROR: Unable to get default AppleTalk zone"));
return -2;
}
memcpy(zone, at_zone.str, MIN(at_zone.len, sizeof(zone)-1));
zone[MIN(at_zone.len, sizeof(zone)-1)] = '\0';
- fprintf(stderr, "INFO: Using default AppleTalk zone \"%s\"\n", zone);
+ _cupsLangPrintf(stderr, _("INFO: Using default AppleTalk zone \"%s\"\n"),
+ zone);
addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
if ((numberFound = nbp_lookup(&entity, buf, MAX_PRINTERS, &retry)) < 0)
{
- perror("ERROR: Unable to lookup AppleTalk printers");
+ _cupsLangPrintError(_("ERROR: Unable to lookup AppleTalk printers"));
return numberFound;
}
if (numberFound >= MAX_PRINTERS)
- fprintf(stderr, "WARNING: Adding only the first %d printers found", MAX_PRINTERS);
+ _cupsLangPrintf(stderr,
+ _("WARNING: Adding only the first %d printers found"),
+ MAX_PRINTERS);
/* Not required but sort them so they look nice */
qsort(buf, numberFound, sizeof(at_nbptuple_t), nbptuple_compare);
/* try to find our printer */
if ((err = nbp_make_entity(&entity, name, type, zone)) != noErr)
{
- fprintf(stderr, "ERROR: Unable to make AppleTalk address: %s\n", strerror(errno));
+ _cupsLangPrintError(_("ERROR: Unable to make AppleTalk address"));
goto Exit;
}
if ((err = papOpen(&tuple, &gConnID, &gSockfd, &gSessionAddr, &flowQuantum)) == 0)
break;
- fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(err));
+ _cupsLangPrintf(stderr, _("WARNING: Unable to open \"%s:%s\": %s\n"),
+ name, zone, strerror(err));
}
else
{
retry.interval = 2;
retry.retries = 3;
fprintf(stderr, "STATE: +apple-nbp-lookup-warning\n");
- fprintf(stderr, "WARNING: Printer not responding\n");
+ _cupsLangPuts(stderr, _("WARNING: Printer not responding\n"));
}
}
}
else
{
fprintf(stderr, "STATE: +apple-appletalk-disabled-warning\n");
- fprintf(stderr, "INFO: AppleTalk disabled in System Preferences.\n");
+ _cupsLangPuts(stderr,
+ _("INFO: AppleTalk disabled in System Preferences.\n"));
}
elasped_time = time(NULL) - start_time;
if (connect_timeout && elasped_time > connect_timeout)
{
- fprintf(stderr, "ERROR: Printer not responding\n");
+ _cupsLangPuts(stderr, _("ERROR: Printer not responding\n"));
err = ETIMEDOUT;
goto Exit; /* Waiting too long... */
}
#endif /* HAVE_SIGSET */
- fprintf(stderr, "INFO: Sending data\n");
+ _cupsLangPuts(stderr, _("INFO: Sending data\n"));
sendDataAddr = tuple.enu_addr;
/* Start the tickle packets and set a timeout alarm */
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_TICKLE, 0, false, false)) < 0)
{
- perror("ERROR: Unable to send PAP tickle request");
+ _cupsLangPrintError(_("ERROR: Unable to send PAP tickle request"));
goto Exit;
}
signal(SIGALRM, signalHandler);
/* Prime the pump with an initial send-data packet */
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0)
{
- perror("ERROR: Unable to send initial PAP send data request");
+ _cupsLangPrintError(_("ERROR: Unable to send initial PAP send data request"));
goto Exit;
}
/* Wait here for something interesting to happen */
if ((err = select(maxfdp1, &readSet, 0, 0, timeoutPtr)) < 0)
{
- perror("ERROR: select");
+ _cupsLangPrintError(_("ERROR: select() failed"));
break;
}
{
/* Time to send a status request */
if ((err = papSendRequest(gSockfd, &tuple.enu_addr, 0, AT_PAP_TYPE_SEND_STATUS, 0x01, false, false)) < 0)
- perror("WARNING: Unable to send PAP status request");
+ _cupsLangPrintError(_("WARNING: Unable to send PAP status request"));
if (gStatusInterval)
nextStatusTime = time(NULL) + gStatusInterval;
{
if ((rc = atp_look(gSockfd)) < 0)
{
- perror("ERROR: Unable to look for PAP response");
+ _cupsLangPrintError(_("ERROR: Unable to look for PAP response"));
break;
}
if ((err = atp_getresp(gSockfd, &tid, &resp)) < 0)
{
- perror("ERROR: Unable to get PAP response");
+ _cupsLangPrintError(_("ERROR: Unable to get PAP response"));
break;
}
userdata = resp.userdata[0];
reqlen = sizeof(atpReqBuf);
if ((err = atp_getreq(gSockfd, &src, atpReqBuf, &reqlen, &userdata, &xo, &tid, &bitmap, 0)) < 0)
{
- perror("ERROR: Unable to get PAP request");
+ _cupsLangPrintError(_("ERROR: Unable to get PAP request"));
break;
}
}
goto Exit;
else
{
- fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
+ _cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
}
}
if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0)
{
- fprintf(stderr, "ERROR: Error %d sending PAPSendData resuest: %s\n", err, strerror(errno));
+ _cupsLangPrintf(stderr,
+ _("ERROR: Error %d sending PAPSendData request: %s\n"),
+ err, strerror(errno));
goto Exit;
}
break;
/* If this is EOF then were we expecting it? */
if (fileEOFSent == true)
{
- fprintf(stderr, "WARNING: Printer sent unexpected EOF\n");
+ _cupsLangPuts(stderr, _("WARNING: Printer sent unexpected EOF\n"));
}
else
{
- fprintf(stderr, "ERROR: Printer sent unexpected EOF\n");
+ _cupsLangPuts(stderr, _("ERROR: Printer sent unexpected EOF\n"));
}
goto Exit;
break;
case AT_PAP_TYPE_OPEN_CONN_REPLY: /* Open-Connection-Reply packet */
case AT_PAP_TYPE_SEND_STATUS: /* Send-Status packet */
case AT_PAP_TYPE_CLOSE_CONN_REPLY: /* Close-Connection-Reply packet */
- fprintf(stderr, "WARNING: Unexpected PAP packet of type %d\n", TYPE_OF(userdata));
+ _cupsLangPrintf(stderr, _("WARNING: Unexpected PAP packet of type %d\n"),
+ TYPE_OF(userdata));
break;
default:
- fprintf(stderr, "WARNING: Unknown PAP packet of type %d\n", TYPE_OF(userdata));
+ _cupsLangPrintf(stderr, _("WARNING: Unknown PAP packet of type %d\n"),
+ TYPE_OF(userdata));
break;
}
socketfd = 0;
puserdata = (u_char *)&userdata;
- fprintf(stderr, "INFO: Opening connection\n");
+ _cupsLangPuts(stderr, _("INFO: Opening connection\n"));
if ((*fd = atp_open(&socketfd)) < 0)
return -1;
}
else
{
- fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value);
+ _cupsLangPrintf(stderr,
+ _("WARNING: Boolean expected for waiteof option \"%s\"\n"),
+ value);
}
}
else if (!strcasecmp(optionName, "status"))
statusInterval = atoi(value);
if (value[0] < '0' || value[0] > '9' || statusInterval < 0)
{
- fprintf(stderr, "WARNING: number expected for status option \"%s\"\n",
- value);
+ _cupsLangPrintf(stderr,
+ _("WARNING: number expected for status option \"%s\"\n"),
+ value);
}
else
{
*/
static void signalHandler(int sigraised)
{
- fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n");
+ _cupsLangPuts(stderr, _("ERROR: There was a timeout error while sending data to the printer\n"));
papClose();
*
* Parallel port backend for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
- perror("ERROR: unable to open print file");
+ _cupsLangPrintf(stderr,
+ _("ERROR: Unable to open print file \"%s\": %s\n"),
+ argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
if (errno == ENXIO && offline != 1)
{
fputs("STATE: +offline-error\n", stderr);
- _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
+ _cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
offline = 1;
}
else if (errno == EINTR && total_bytes == 0)
if (offline)
{
fputs("STATE: -offline-error\n", stderr);
- _cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
+ _cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
offline = 0;
}
if ((fp = open(argv[6], O_RDONLY)) < 0)
{
- perror("ERROR: unable to open print file");
+ _cupsLangPrintf(stderr,
+ _("ERROR: Unable to open print file \"%s\": %s\n"),
+ argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
- perror("ERROR: unable to open print file");
+ _cupsLangPrintf(stderr,
+ _("ERROR: Unable to open print file \"%s\": %s\n"),
+ argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
if (errno != EAGAIN || errno != EINTR)
{
- perror("ERROR: Unable to read print data");
+ _cupsLangPrintError(_("ERROR: Unable to read print data"));
tcsetattr(device_fd, TCSADRAIN, &origopts);
if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
{
- perror("ERROR: Unable to write print data");
+ _cupsLangPrintError(_("ERROR: Unable to write print data"));
tcsetattr(device_fd, TCSADRAIN, &origopts);
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
{
- perror("ERROR: unable to open print file");
+ _cupsLangPrintf(stderr,
+ _("ERROR: Unable to open print file \"%s\": %s\n"),
+ argv[6], strerror(errno));
return (CUPS_BACKEND_FAILED);
}
/*
* "$Id: usb-darwin.c 6993 2007-09-28 18:05:28Z mike $"
*
-* Copyright � 2005-2007 Apple Inc. All rights reserved.
+* Copyright � 2005-2008 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
if (errno != EAGAIN || errno != EINTR)
{
- perror("ERROR: Unable to read print data");
+ _cupsLangPrintError(_("ERROR: Unable to read print data"));
return CUPS_BACKEND_STOP;
}
if (!keepLooking && g.status_timer != NULL)
{
fputs("STATE: -offline-error\n", stderr);
- _cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
+ _cupsLangPuts(stderr, _("INFO: Printer is now online.\n"));
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
CFRelease(g.status_timer);
g.status_timer = NULL;
void *info)
{
fputs("STATE: +offline-error\n", stderr);
- _cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
+ _cupsLangPuts(stderr, _("INFO: Printer is currently offline.\n"));
if (getenv("CLASS") != NULL)
{
execv("/usr/libexec/cups/backend/usb", my_argv);
- perror("/usr/libexec/cups/backend/usb");
+ _cupsLangPrintError(_("ERROR: Unable to exec /usr/libexec/cups/backend/usb"));
exit(errno);
}
else if (child_pid < 0)
* Error - couldn't fork a new process!
*/
- perror("fork");
+ _cupsLangPrintError(_("ERROR: Unable to fork"));
exit(errno);
}
remaining = sizeof(value) - (valptr - value);
if (!strcmp(attr->values[i].string.text, "printer-stopped"))
- strlcpy(valptr, _("Printer Stopped"), remaining);
+ strlcpy(valptr, _("Printer Paused"), remaining);
else if (!strcmp(attr->values[i].string.text, "printer-added"))
strlcpy(valptr, _("Printer Added"), remaining);
else if (!strcmp(attr->values[i].string.text, "printer-modified"))
for (tbytes = 0; tbytes < length; tbytes += nbytes)
if ((nbytes = read(0, data + tbytes, length - tbytes)) < 0)
+ {
if (errno != EAGAIN)
{
free(data);
return (0);
}
+ else
+ nbytes = 0;
+ }
data[length] = '\0';
# Restrict access to the server...
<Location />
Order allow,deny
- Allow localhost
</Location>
# Restrict access to the admin pages...
<Location /admin>
@ENCRYPTION_REQUIRED@
Order allow,deny
- Allow localhost
</Location>
# Restrict access to configuration files...
AuthType Default
Require user @SYSTEM
Order allow,deny
- Allow localhost
</Location>
# Set the default printer/job policies...
LEGACY_BACKENDS=""
BACKLIBS="-framework IOKit"
CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
- LIBS="-framework CoreFoundation $LIBS"
-
- dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
- AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
- if test "$uname" = "Darwin" -a $uversion -ge 70; then
- AC_DEFINE(HAVE_CF_LOCALE_ID)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
+ LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
dnl Check for framework headers...
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
#undef HAVE_CFBUNDLEPRIV_H
-/*
- * Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
- */
-
-#undef HAVE_CF_LOCALE_ID
-
-
/*
* Do we have MacOSX 10.4's mbr_XXX functions()?
*/
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
in_admin_location = 0;
in_location = 0;
}
- else if (!strcasecmp(line, "Allow") && in_admin_location &&
+ else if (!strcasecmp(line, "Allow") &&
strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
#ifdef AF_LOCAL
&& *value != '/'
#endif /* AF_INET6 */
)
{
- remote_admin = 1;
-
- if (!strcasecmp(value, "all"))
+ if (in_admin_location)
+ remote_admin = 1;
+ else if (!strcasecmp(value, "all"))
remote_any = 1;
}
else if (line[0] != '<' && !in_location && !in_policy)
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
*
* Contents:
*
- * cupsAddDest() - Add a destination to the list of destinations.
- * cupsFreeDests() - Free the memory used by the list of
- * destinations.
- * cupsGetDest() - Get the named destination from the list.
- * cupsGetDests() - Get the list of destinations from the default
- * server.
- * cupsGetDests2() - Get the list of destinations from the
- * specified server.
- * cupsGetNamedDest() - Get options for the named destination.
- * cupsRemoveDest() - Remove a destination from the destination list.
- * cupsDestSetDefaultDest() - Set the default destination.
- * cupsSetDests() - Set the list of destinations for the default
- * server.
- * cupsSetDests2() - Set the list of destinations for the specified
- * server.
- * cups_get_dests() - Get destinations from a file.
- * cups_get_sdests() - Get destinations from a server.
+ * cupsAddDest() - Add a destination to the list of destinations.
+ * cupsFreeDests() - Free the memory used by the list of destinations.
+ * cupsGetDest() - Get the named destination from the list.
+ * cupsGetDests() - Get the list of destinations from the default
+ * server.
+ * cupsGetDests2() - Get the list of destinations from the specified
+ * server.
+ * cupsGetNamedDest() - Get options for the named destination.
+ * cupsRemoveDest() - Remove a destination from the destination list.
+ * cupsSetDefaultDest() - Set the default destination.
+ * cupsSetDests() - Save the list of destinations for the default
+ * server.
+ * cupsSetDests2() - Save the list of destinations for the specified
+ * server.
+ * appleGetDefault() - Get the default printer for this location.
+ * appleGetLocations() - Get the location history array.
+ * appleGetNetwork() - Get the network ID for the current location.
+ * appleGetPrinter() - Get a printer from the history array.
+ * appleSetDefault() - Set the default printer for this location.
+ * appleUseLastPrinter() - Get the default printer preference value.
+ * cups_get_default() - Get the default destination from an lpoptions file.
+ * cups_get_dests() - Get destinations from a file.
+ * cups_get_sdests() - Get destinations from a server.
*/
/*
# include <notify.h>
#endif /* HAVE_NOTIFY_H */
+#ifdef __APPLE__
+# include <sys/cdefs.h>
+# include <CoreFoundation/CoreFoundation.h>
+# include <SystemConfiguration/SystemConfiguration.h>
+# define kLocationHistoryArrayKey CFSTR("kLocationHistoryArrayKeyTMP")
+# define kLocationNetworkKey CFSTR("kLocationNetworkKey")
+# define kLocationPrinterIDKey CFSTR("kLocationPrinterIDKey")
+# define kPMPrintingPreferences CFSTR("com.apple.print.PrintingPrefs")
+# define kUseLastPrinterAsCurrentPrinterKey CFSTR("UseLastPrinterAsCurrentPrinter")
+#endif /* __APPLE__ */
+
/*
* Local functions...
*/
-static const char *cups_get_default(const char *filename, char *namebuf,
+#ifdef __APPLE__
+static char *appleGetDefault(char *name, int namesize);
+static CFArrayRef appleGetLocations(void);
+static CFStringRef appleGetNetwork(void);
+static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network,
+ CFIndex *locindex);
+static void appleSetDefault(const char *name);
+static int appleUseLastPrinter(void);
+#endif /* __APPLE__ */
+static char *cups_get_default(const char *filename, char *namebuf,
size_t namesize, const char **instance);
static int cups_get_dests(const char *filename, const char *match_name,
const char *match_inst, int num_dests,
* Grab the default destination...
*/
- if ((defprinter = cupsGetDefault2(http)) != NULL)
+#ifdef __APPLE__
+ if ((defprinter = appleGetDefault(name, sizeof(name))) == NULL)
+#endif /* __APPLE__ */
+ defprinter = cupsGetDefault2(http);
+
+ if (defprinter)
{
/*
* Grab printer and instance name...
*/
+#ifdef __APPLE__
+ if (name != defprinter)
+#endif /* __APPLE__ */
strlcpy(name, defprinter, sizeof(name));
if ((instance = strchr(name, '/')) != NULL)
fclose(fp);
+#ifdef __APPLE__
+ /*
+ * Set the default printer for this location - this allows command-line
+ * and GUI applications to share the same default destination...
+ */
+
+ if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
+ appleSetDefault(dest->name);
+#endif /* __APPLE__ */
+
#ifdef HAVE_NOTIFY_POST
/*
* Send a notification so that MacOS X applications can know about the
}
+#ifdef __APPLE__
+/*
+ * 'appleGetDefault()' - Get the default printer for this location.
+ */
+
+static char * /* O - Name or NULL if no default */
+appleGetDefault(char *name, /* I - Name buffer */
+ int namesize) /* I - Size of name buffer */
+{
+ CFStringRef network; /* Network location */
+ CFArrayRef locations; /* Location array */
+ CFStringRef locprinter; /* Current printer */
+
+
+ /*
+ * Use location-based defaults if "use last printer" is selected in the
+ * system preferences...
+ */
+
+ if (!appleUseLastPrinter())
+ {
+ DEBUG_puts("appleGetDefault: Not using last printer as default...");
+ return (NULL);
+ }
+
+ /*
+ * Get the current location...
+ */
+
+ if ((network = appleGetNetwork()) == NULL)
+ {
+ DEBUG_puts("appleGetDefault: Unable to get current network...");
+ return (NULL);
+ }
+
+#ifdef DEBUG
+ CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
+ printf("appleGetDefault: network=\"%s\"\n", name);
+#endif /* DEBUG */
+
+ /*
+ * Lookup the network in the preferences...
+ */
+
+ if ((locations = appleGetLocations()) == NULL)
+ {
+ /*
+ * Missing or bad location array, so no location-based default...
+ */
+
+ DEBUG_puts("appleGetDefault: Missing or bad location history array...");
+
+ CFRelease(network);
+ return (NULL);
+ }
+
+ DEBUG_printf(("appleGetDefault: Got location, %d entries...\n",
+ (int)CFArrayGetCount(locations)));
+
+ if ((locprinter = appleGetPrinter(locations, network, NULL)) != NULL)
+ CFStringGetCString(locprinter, name, namesize, kCFStringEncodingUTF8);
+ else
+ name[0] = '\0';
+
+ CFRelease(locations);
+ CFRelease(network);
+
+ DEBUG_printf(("appleGetDefault: Returning \"%s\"...\n", name));
+
+ return (*name ? name : NULL);
+}
+
+
+/*
+ * 'appleGetLocations()' - Get the location history array.
+ */
+
+static CFArrayRef /* O - Location array or NULL */
+appleGetLocations(void)
+{
+ CFArrayRef locations; /* Location array */
+
+
+ /*
+ * Look up the location array in the preferences...
+ */
+
+ if ((locations = CFPreferencesCopyAppValue(kLocationHistoryArrayKey,
+ kPMPrintingPreferences)) == NULL)
+ return (NULL);
+
+ if (CFGetTypeID(locations) != CFArrayGetTypeID())
+ {
+ CFRelease(locations);
+ return (NULL);
+ }
+
+ return (locations);
+}
+
+
+/*
+ * 'appleGetNetwork()' - Get the network ID for the current location.
+ */
+
+static CFStringRef /* O - Network ID */
+appleGetNetwork(void)
+{
+ SCDynamicStoreRef dynamicStore; /* System configuration data */
+ CFStringRef key; /* Current network configuration key */
+ CFDictionaryRef ip_dict; /* Network configuration data */
+ CFStringRef network = NULL; /* Current network ID */
+
+
+ if ((dynamicStore = SCDynamicStoreCreate(NULL, CFSTR("Printing"), NULL,
+ NULL)) != NULL)
+ {
+ if ((key = SCDynamicStoreKeyCreateNetworkGlobalEntity(
+ NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4)) != NULL)
+ {
+ if ((ip_dict = SCDynamicStoreCopyValue(dynamicStore, key)) != NULL)
+ {
+ if ((network = CFDictionaryGetValue(ip_dict,
+ kSCPropNetIPv4Router)) != NULL)
+ CFRetain(network);
+
+ CFRelease(ip_dict);
+ }
+
+ CFRelease(key);
+ }
+
+ CFRelease(dynamicStore);
+ }
+
+ return (network);
+}
+
+
+/*
+ * 'appleGetPrinter()' - Get a printer from the history array.
+ */
+
+static CFStringRef /* O - Printer name or NULL */
+appleGetPrinter(CFArrayRef locations, /* I - Location array */
+ CFStringRef network, /* I - Network name */
+ CFIndex *locindex) /* O - Index in array */
+{
+ CFIndex i, /* Looping var */
+ count; /* Number of locations */
+ CFDictionaryRef location; /* Current location */
+ CFStringRef locnetwork, /* Current network */
+ locprinter; /* Current printer */
+
+
+ for (i = 0, count = CFArrayGetCount(locations); i < count; i ++)
+ if ((location = CFArrayGetValueAtIndex(locations, i)) != NULL &&
+ CFGetTypeID(location) == CFDictionaryGetTypeID())
+ {
+ if ((locnetwork = CFDictionaryGetValue(location,
+ kLocationNetworkKey)) != NULL &&
+ CFGetTypeID(locnetwork) == CFStringGetTypeID() &&
+ CFStringCompare(network, locnetwork, 0) == kCFCompareEqualTo &&
+ (locprinter = CFDictionaryGetValue(location,
+ kLocationPrinterIDKey)) != NULL &&
+ CFGetTypeID(locprinter) == CFStringGetTypeID())
+ {
+ if (locindex)
+ *locindex = i;
+
+ return (locprinter);
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*
+ * 'appleSetDefault()' - Set the default printer for this location.
+ */
+
+static void
+appleSetDefault(const char *name) /* I - Default printer/class name */
+{
+ CFStringRef network; /* Current network */
+ CFArrayRef locations; /* Old locations array */
+ CFIndex locindex; /* Index in locations array */
+ CFStringRef locprinter; /* Current printer */
+ CFMutableArrayRef newlocations; /* New locations array */
+ CFMutableDictionaryRef newlocation; /* New location */
+ CFStringRef newprinter; /* New printer */
+
+
+ /*
+ * Get the current location...
+ */
+
+ if ((network = appleGetNetwork()) == NULL)
+ {
+ DEBUG_puts("appleSetDefault: Unable to get current network...");
+ return;
+ }
+
+#ifdef DEBUG
+ CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
+ printf("appleSetDefault: network=\"%s\"\n", name);
+#endif /* DEBUG */
+
+ if ((newprinter = CFStringCreateWithCString(kCFAllocatorDefault, name,
+ kCFStringEncodingUTF8)) == NULL)
+ {
+ CFRelease(network);
+ return;
+ }
+
+ /*
+ * Lookup the network in the preferences...
+ */
+
+ if ((locations = appleGetLocations()) != NULL)
+ locprinter = appleGetPrinter(locations, network, &locindex);
+ else
+ {
+ locprinter = NULL;
+ locindex = -1;
+ }
+
+ if (!locprinter ||
+ CFStringCompare(locprinter, newprinter, 0) != kCFCompareEqualTo)
+ {
+ /*
+ * Need to change the locations array...
+ */
+
+ if (locations)
+ {
+ newlocations = CFArrayCreateMutableCopy(kCFAllocatorDefault, 0,
+ locations);
+
+ if (locprinter)
+ CFArrayRemoveValueAtIndex(newlocations, locindex);
+ }
+ else
+ newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
+
+ newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ if (newlocation && newlocations)
+ {
+ /*
+ * Put the new location at the front of the array...
+ */
+
+ CFDictionaryAddValue(newlocation, kLocationNetworkKey, network);
+ CFDictionaryAddValue(newlocation, kLocationPrinterIDKey, newprinter);
+ CFArrayInsertValueAtIndex(newlocations, 0, newlocation);
+
+ /*
+ * Limit the number of locations to 10...
+ */
+
+ while (CFArrayGetCount(newlocations) > 10)
+ CFArrayRemoveValueAtIndex(newlocations, 10);
+
+ /*
+ * Push the changes out...
+ */
+
+ CFPreferencesSetAppValue(kLocationHistoryArrayKey, newlocations,
+ kPMPrintingPreferences);
+ CFPreferencesAppSynchronize(kPMPrintingPreferences);
+ }
+
+ if (newlocations)
+ CFRelease(newlocations);
+
+ if (newlocation)
+ CFRelease(newlocation);
+ }
+
+ CFRelease(locations);
+ CFRelease(network);
+ CFRelease(newprinter);
+}
+
+
+/*
+ * 'appleUseLastPrinter()' - Get the default printer preference value.
+ */
+
+static int /* O - 1 to use last printer, 0 otherwise */
+appleUseLastPrinter(void)
+{
+ CFPropertyListRef uselast; /* Use last printer preference value */
+
+
+ if ((uselast = CFPreferencesCopyAppValue(kUseLastPrinterAsCurrentPrinterKey,
+ kPMPrintingPreferences)) != NULL)
+ {
+ CFRelease(uselast);
+
+ if (uselast == kCFBooleanFalse)
+ return (0);
+ }
+
+ return (1);
+}
+#endif /* __APPLE__ */
+
+
/*
* 'cups_get_default()' - Get the default destination from an lpoptions file.
*/
-static const char * /* O - Default destination or NULL */
+static char * /* O - Default destination or NULL */
cups_get_default(const char *filename, /* I - File to read */
char *namebuf, /* I - Name buffer */
size_t namesize, /* I - Size of name buffer */
*
* (Private) localization support for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
extern void _cupsCharmapFree(const cups_encoding_t encoding);
extern void *_cupsCharmapGet(const cups_encoding_t encoding);
extern const char *_cupsEncodingName(cups_encoding_t encoding);
+extern void _cupsLangPrintError(const char *message);
extern int _cupsLangPrintf(FILE *fp, const char *message, ...)
# ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 2, 3)))
* Localized printf/puts functions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 2002-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
#include <stdio.h>
#include "globals.h"
+#include <errno.h>
+
+
+/*
+ * '_cupsLangPrintError()' - Print a message followed by a standard error.
+ */
+
+void
+_cupsLangPrintError(const char *message)/* I - Message */
+{
+ int bytes; /* Number of bytes formatted */
+ int last_errno; /* Last error */
+ char buffer[2048], /* Message buffer */
+ output[8192]; /* Output buffer */
+ _cups_globals_t *cg; /* Global data */
+
+
+ /*
+ * Range check...
+ */
+
+ if (!message)
+ return;
+
+ /*
+ * Save the errno value...
+ */
+
+ last_errno = errno;
+
+ /*
+ * Get the message catalog...
+ */
+
+ cg = _cupsGlobals();
+
+ if (!cg->lang_default)
+ cg->lang_default = cupsLangDefault();
+
+ /*
+ * Format the message...
+ */
+
+ bytes = snprintf(buffer, sizeof(buffer), "%s: %s",
+ _cupsLangString(cg->lang_default, message),
+ strerror(last_errno));
+
+ /*
+ * Convert and write to stderr...
+ */
+
+ bytes = cupsUTF8ToCharset(output, (cups_utf8_t *)buffer, sizeof(output),
+ cg->lang_default->encoding);
+
+ if (bytes > 0)
+ fwrite(output, 1, bytes, stderr);
+}
/*
__cupsEncodingName
__cupsGetPassword
__cupsGlobals
+__cupsLangPrintError
__cupsLangPrintf
__cupsLangPuts
__cupsLangString
* Finish up the last page(s)...
*/
- if (number && !is_first_page(number) && cupsArrayLast(doc->pages))
+ if (number && is_not_last_page(number) && cupsArrayLast(doc->pages) &&
+ check_range(doc, (number - 1) / doc->number_up + 1))
{
pageinfo = (pstops_page_t *)cupsArrayLast(doc->pages);
msgid ""
msgstr ""
-"Project-Id-Version: CUPS 1.3\n"
+"Project-Id-Version: CUPS 1.4\n"
"Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
"POT-Creation-Date: 2007-07-27 14:55-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
msgstr ""
#: backend/runloop.c:233 backend/runloop.c:333 backend/usb-darwin.c:1112
-msgid "INFO: Printer is currently off-line.\n"
+msgid "INFO: Printer is currently offline.\n"
msgstr ""
#: backend/runloop.c:355 backend/usb-darwin.c:1094
-msgid "INFO: Printer is now on-line.\n"
+msgid "INFO: Printer is now online.\n"
msgstr ""
#: backend/parallel.c:235 backend/usb-unix.c:128
msgstr ""
#: cgi-bin/ipp-var.c:848
-msgid "Printer Stopped"
+msgid "Printer Paused"
msgstr ""
#: backend/ipp.c:1434
-msgid "Printer off-line."
+msgid "Printer offline."
msgstr ""
#: cups/notify.c:126
*
* Authorization routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* This file contains Kerberos support code, copyright 2006 by
* cupsdAddName() - Add a name to a location...
* cupsdAllowHost() - Add a host name that is allowed to access the
* location.
- * cupsdAllowIP() - Add an IP address or network that is allowed
- * to access the location.
+ * cupsdAllowIP() - Add an IP address or network that is allowed to
+ * access the location.
* cupsdAuthorize() - Validate any authorization credentials.
+ * cupsdCheckAccess() - Check whether the given address is allowed to
+ * access a location.
* cupsdCheckAuth() - Check authorization masks.
* cupsdCheckGroup() - Check for a user's group membership.
* cupsdCopyLocation() - Make a copy of a location...
* cupsdIsAuthorized() - Check to see if the user is authorized...
* add_allow() - Add an allow mask to the location.
* add_deny() - Add a deny mask to the location.
+ * check_authref() - Check if an authorization services reference
+ * has the supplied right.
* compare_locations() - Compare two locations.
* cups_crypt() - Encrypt the password using the DES or MD5
* algorithms, as needed.
* get_md5_password() - Get an MD5 password.
* pam_func() - PAM conversation function.
* to64() - Base64-encode an integer value...
- * check_authref() - Check an authorization services reference.
*/
/*
}
+/*
+ * 'cupsdCheckAccess()' - Check whether the given address is allowed to
+ * access a location.
+ */
+
+int /* O - 1 if allowed, 0 otherwise */
+cupsdCheckAccess(
+ unsigned ip[4], /* I - Client address */
+ char *name, /* I - Client hostname */
+ int namelen, /* I - Length of hostname */
+ cupsd_location_t *loc) /* I - Location to check */
+{
+ int allow; /* 1 if allowed, 0 otherwise */
+
+
+ if (!strcasecmp(name, "localhost"))
+ {
+ /*
+ * Access from localhost (127.0.0.1 or ::1) is always allowed...
+ */
+
+ return (1);
+ }
+ else
+ {
+ /*
+ * Do authorization checks on the domain/address...
+ */
+
+ switch (loc->order_type)
+ {
+ default :
+ allow = 0; /* anti-compiler-warning-code */
+ break;
+
+ case AUTH_ALLOW : /* Order Deny,Allow */
+ allow = 1;
+
+ if (cupsdCheckAuth(ip, name, namelen, loc->num_deny, loc->deny))
+ allow = 0;
+
+ if (cupsdCheckAuth(ip, name, namelen, loc->num_allow, loc->allow))
+ allow = 1;
+ break;
+
+ case AUTH_DENY : /* Order Allow,Deny */
+ allow = 0;
+
+ if (cupsdCheckAuth(ip, name, namelen, loc->num_allow, loc->allow))
+ allow = 1;
+
+ if (cupsdCheckAuth(ip, name, namelen, loc->num_deny, loc->deny))
+ allow = 0;
+ break;
+ }
+ }
+
+ return (allow);
+}
+
+
/*
* 'cupsdCheckAuth()' - Check authorization masks.
*/
hostlen = strlen(con->http.hostname);
- if (!strcasecmp(con->http.hostname, "localhost"))
- {
- /*
- * Access from localhost (127.0.0.1 or ::1) is always allowed...
- */
-
- auth = AUTH_ALLOW;
- }
- else
- {
- /*
- * Do authorization checks on the domain/address...
- */
-
- switch (best->order_type)
- {
- default :
- auth = AUTH_DENY; /* anti-compiler-warning-code */
- break;
-
- case AUTH_ALLOW : /* Order Deny,Allow */
- auth = AUTH_ALLOW;
-
- if (cupsdCheckAuth(address, con->http.hostname, hostlen,
- best->num_deny, best->deny))
- auth = AUTH_DENY;
-
- if (cupsdCheckAuth(address, con->http.hostname, hostlen,
- best->num_allow, best->allow))
- auth = AUTH_ALLOW;
- break;
-
- case AUTH_DENY : /* Order Allow,Deny */
- auth = AUTH_DENY;
-
- if (cupsdCheckAuth(address, con->http.hostname, hostlen,
- best->num_allow, best->allow))
- auth = AUTH_ALLOW;
-
- if (cupsdCheckAuth(address, con->http.hostname, hostlen,
- best->num_deny, best->deny))
- auth = AUTH_DENY;
- break;
- }
- }
+ auth = cupsdCheckAccess(address, con->http.hostname, hostlen, best)
+ ? AUTH_ALLOW : AUTH_DENY;
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: auth=AUTH_%s...",
auth ? "DENY" : "ALLOW");
* Authorization definitions for the Common UNIX Printing System (CUPS)
* scheduler.
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
extern void cupsdAllowIP(cupsd_location_t *loc, unsigned address[4],
unsigned netmask[4]);
extern void cupsdAuthorize(cupsd_client_t *con);
+extern int cupsdCheckAccess(unsigned ip[4], char *name,
+ int namelen, cupsd_location_t *loc);
extern int cupsdCheckAuth(unsigned ip[4], char *name, int namelen,
int num_masks, cupsd_authmask_t *masks);
extern int cupsdCheckGroup(const char *username,
* Loop forever, asking for available printers and classes...
*/
- for (http = NULL;;)
+ for (http = NULL; !ferror(stderr);)
{
/*
* Open a connection to the server...
if (remain > 0 && !restart_polling)
sleep(remain);
}
+
+ return (1);
}
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
*
* Contents:
*
- * cupsdDeregisterPrinter() - Stop sending broadcast information for a
- * local printer and remove any pending
- * references to remote printers.
- * cupsdLoadRemoteCache() - Load the remote printer cache.
- * cupsdRegisterPrinter() - Start sending broadcast information for a
- * printer update the broadcast contents.
- * cupsdSaveRemoteCache() - Save the remote printer cache.
- * cupsdSendBrowseList() - Send new browsing information as necessary.
- * cupsdStartBrowsing() - Start sending and receiving broadcast
- * information.
- * cupsdStartPolling() - Start polling servers as needed.
- * cupsdStopBrowsing() - Stop sending and receiving broadcast
- * information.
- * cupsdStopPolling() - Stop polling servers as needed.
- * cupsdUpdateDNSSDBrowse() - Handle DNS-SD queries.
- * cupsdUpdateLDAPBrowse() - Scan for new printers via LDAP...
- * cupsdUpdateSLPBrowse() - Get browsing information via SLP.
- * dnssdBuildTxtRecord() - Build a TXT record from printer info.
- * dnssdDeregisterPrinter() - Stop sending broadcast information for a
- * printer.
- * dnssdPackTxtRecord() - Pack an array of key/value pairs into the
- * TXT record format.
- * dnssdRegisterCallback() - DNSServiceRegister callback.
- * dnssdRegisterPrinter() - Start sending broadcast information for a
- * printer or update the broadcast contents.
- * dequote() - Remote quotes from a string.
- * process_browse_data() - Process new browse data.
- * process_implicit_classes() - Create/update implicit classes as needed.
- * send_cups_browse() - Send new browsing information using the
- * CUPS protocol.
- * send_ldap_browse() - Send LDAP printer registrations.
- * send_slp_browse() - Register the specified printer with SLP.
- * slp_attr_callback() - SLP attribute callback
- * slp_dereg_printer() - SLPDereg() the specified printer
- * slp_get_attr() - Get an attribute from an SLP registration.
- * slp_reg_callback() - Empty SLPRegReport.
- * slp_url_callback() - SLP service url callback
- * update_cups_browse() - Update the browse lists using the CUPS
- * protocol.
- * update_lpd() - Update the LPD configuration as needed.
- * update_polling() - Read status messages from the poll daemons.
- * update_smb() - Update the SMB configuration as needed.
+ * cupsdDeregisterPrinter() - Stop sending broadcast information for a local
+ * printer and remove any pending references to
+ * remote printers.
+ * cupsdLoadRemoteCache() - Load the remote printer cache.
+ * cupsdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+ * cupsdRestartPolling() - Restart polling servers as needed.
+ * cupsdSaveRemoteCache() - Save the remote printer cache.
+ * cupsdSendBrowseList() - Send new browsing information as necessary.
+ * cupsdStartBrowsing() - Start sending and receiving broadcast
+ * information.
+ * cupsdStartPolling() - Start polling servers as needed.
+ * cupsdStopBrowsing() - Stop sending and receiving broadcast
+ * information.
+ * cupsdStopPolling() - Stop polling servers as needed.
+ * cupsdUpdateDNSSDBrowse() - Handle DNS-SD queries.
+ * cupsdUpdateLDAPBrowse() - Scan for new printers via LDAP...
+ * cupsdUpdateSLPBrowse() - Get browsing information via SLP.
+ * dequote() - Remote quotes from a string.
+ * is_local_queue() - Determine whether the URI points at a local
+ * queue.
+ * process_browse_data() - Process new browse data.
+ * dnssdBuildTxtRecord() - Build a TXT record from printer info.
+ * dnssdDeregisterPrinter() - Stop sending broadcast information for a
+ * printer.
+ * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
+ * record format.
+ * dnssdRegisterCallback() - DNSServiceRegister callback.
+ * dnssdRegisterPrinter() - Start sending broadcast information for a
+ * printer or update the broadcast contents.
+ * process_implicit_classes() - Create/update implicit classes as needed.
+ * send_cups_browse() - Send new browsing information using the CUPS
+ * protocol.
+ * send_ldap_browse() - Send LDAP printer registrations.
+ * send_slp_browse() - Register the specified printer with SLP.
+ * slp_attr_callback() - SLP attribute callback
+ * slp_dereg_printer() - SLPDereg() the specified printer
+ * slp_get_attr() - Get an attribute from an SLP registration.
+ * slp_reg_callback() - Empty SLPRegReport.
+ * slp_url_callback() - SLP service url callback
+ * update_cups_browse() - Update the browse lists using the CUPS
+ * protocol.
+ * update_lpd() - Update the LPD configuration as needed.
+ * update_polling() - Read status messages from the poll daemons.
+ * update_smb() - Update the SMB configuration as needed.
*/
/*
if (hptr && !*hptr)
*hptr = '.'; /* Resource FQDN */
- if ((p = cupsdFindClass(name)) == NULL && BrowseShortNames)
+ if ((p = cupsdFindDest(name)) == NULL && BrowseShortNames)
{
- if ((p = cupsdFindClass(resource + 9)) != NULL)
+ if ((p = cupsdFindDest(resource + 9)) != NULL)
{
if (p->hostname && strcasecmp(p->hostname, host))
{
if (hptr && !*hptr)
*hptr = '.'; /* Resource FQDN */
- if ((p = cupsdFindPrinter(name)) == NULL && BrowseShortNames)
+ if ((p = cupsdFindDest(name)) == NULL && BrowseShortNames)
{
- if ((p = cupsdFindPrinter(resource + 10)) != NULL)
+ if ((p = cupsdFindDest(resource + 10)) != NULL)
{
if (p->hostname && strcasecmp(p->hostname, host))
{
*name; /* Service name */
int txt_len, /* TXT record length */
port; /* IPP port number */
- char str_buffer[1024];
+ char resource[1024], /* Resource path for printer */
+ str_buffer[1024];
/* C-string buffer */
const char *computerName; /* Computer name c-string ptr */
const char *regtype; /* Registration type */
+ const char *domain; /* Registration domain */
+ cupsd_location_t *location, /* Printer location */
+ *policy; /* Operation policy for Print-Job */
+ unsigned address[4]; /* INADDR_ANY address */
#ifdef HAVE_COREFOUNDATION_H
CFStringRef computerNameRef;/* Computer name CFString */
CFStringEncoding nameEncoding; /* Computer name encoding */
}
}
+ /*
+ * If 'Allow printing from the Internet' is enabled (i.e. from any address)
+ * let dnssd decide on the domain, otherwise restrict it to ".local".
+ */
+
+ if (p->type & CUPS_PRINTER_CLASS)
+ snprintf(resource, sizeof(resource), "/classes/%s", p->name);
+ else
+ snprintf(resource, sizeof(resource), "/printers/%s", p->name);
+
+ address[0] = address[1] = address[2] = address[3] = 0;
+ location = cupsdFindBest(resource, HTTP_POST);
+ policy = cupsdFindPolicyOp(p->op_policy_ptr, IPP_PRINT_JOB);
+
+ if ((location && !cupsdCheckAccess(address, "", 0, location)) ||
+ (policy && !cupsdCheckAccess(address, "", 0, policy)))
+ domain = "local.";
+ else
+ domain = NULL;
+
/*
* Use the _fax subtype for fax queues...
*/
regtype = (p->type & CUPS_PRINTER_FAX) ? dnssdIPPFaxRegType :
dnssdIPPRegType;
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) type is \"%s\"",
- p->name, regtype);
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "dnssdRegisterPrinter(%s) type, domain is \"%s\", \"%s\"",
+ p->name, regtype, domain ? domain : "(null)");
se = DNSServiceRegister(&p->dnssd_ipp_ref, 0, 0, name, regtype,
- NULL, NULL, htons(port), txt_len, txt_record,
+ domain, NULL, htons(port), txt_len, txt_record,
dnssdRegisterCallback, p);
/*
supported = ippFindAttribute(printer->attrs, "port-monitor-supported",
IPP_TAG_NAME);
- for (i = 0; i < supported->num_values; i ++)
- if (!strcmp(supported->values[i].string.text,
- attr->values[0].string.text))
- break;
+ if (supported)
+ {
+ for (i = 0; i < supported->num_values; i ++)
+ if (!strcmp(supported->values[i].string.text,
+ attr->values[0].string.text))
+ break;
+ }
- if (i >= supported->num_values)
+ if (!supported || i >= supported->num_values)
{
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"!"),
attr->values[0].string.text);
int i; /* Result of comparison */
- if ((i = strcmp(t0->super, t1->super)) == 0)
- i = strcmp(t0->type, t1->type);
+ if ((i = strcasecmp(t0->super, t1->super)) == 0)
+ i = strcasecmp(t0->type, t1->type);
return (i);
}
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
// ------------
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
// ------------
a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
"attributes-charset" );
- a.addString( "", "iso-8859-1" );
+ a.addString( "", "utf-8" );
ipp.addAttribute(a);
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2002 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
{
IPPValue val;
int bytes = 0; // Start with one for the group tag.
-
+ Charset utf8 = Charset::forName("UTF-8");
+ ByteBuffer temp;
+
//
// Add 1 if first time, or group tag changes.
//
case IPPDefs.TAG_CHARSET:
case IPPDefs.TAG_LANGUAGE:
case IPPDefs.TAG_MIMETYPE:
+ temp = utf8.encode(val.text);
bytes += 2;
- bytes += val.text.length();
+ if (temp.capacity() > 32767)
+ bytes += 32767;
+ else
+ bytes += temp.capacity();
break;
case IPPDefs.TAG_DATE :
case IPPDefs.TAG_TEXTLANG :
case IPPDefs.TAG_NAMELANG :
+ temp = utf8.encode(val.text);
bytes += 6; // 2 overall len, 2 charset len, 2 text len
- bytes += val.charset.length() +
- val.text.length();
+ bytes += val.charset.length();
+ if (temp.capacity() > 32767)
+ bytes += 32767;
+ else
+ bytes += temp.capacity();
break;
default :
int i,j, n;
int bi = 0; // Start with one for the group tag.
byte[] bytes = new byte[sz];
+ Charset utf8 = Charset::forName("UTF-8");
+ ByteBuffer temp;
if (group_tag != last_group)
{
case IPPDefs.TAG_CHARSET :
case IPPDefs.TAG_LANGUAGE :
case IPPDefs.TAG_MIMETYPE :
- bytes[bi++] = (byte)((val.text.length() & 0xff00) >> 8);
- bytes[bi++] = (byte)(val.text.length() & 0xff);
- for (j=0; j < val.text.length(); j++)
- {
- bytes[bi++] = (byte)val.text.charAt(j);
- }
+ temp = utf8.encode(val.text);
+ n = temp.capacity();
+
+ if (n > 32767)
+ n = 32767;
+
+ bytes[bi++] = (byte)((n & 0x7f00) >> 8);
+ bytes[bi++] = (byte)(n & 0xff);
+ temp.get(bytes, bi, n);
+ bi += n;
break;
case IPPDefs.TAG_DATE:
case IPPDefs.TAG_TEXTLANG :
case IPPDefs.TAG_NAMELANG :
- n = val.charset.length() +
- val.text.length() + 4;
- bytes[bi++] = (byte)((n & 0xff00) >> 8);
+ temp = utf8.encode(val.text);
+ n = temp.capacity() + val.charset.length() + 4;
+
+ if (n > 32767)
+ n = 32767;
+
+ bytes[bi++] = (byte)((n & 0x7f00) >> 8);
bytes[bi++] = (byte)(n & 0xff);
n = val.charset.length();
- bytes[bi++] = (byte)((n & 0xff00) >> 8);
+ bytes[bi++] = (byte)((n & 0x7f00) >> 8);
bytes[bi++] = (byte)(n & 0xff);
for (j=0; j < val.charset.length(); j++)
bytes[bi++] = (byte)val.charset.charAt(j);
-
- n = val.text.length();
- bytes[bi++] = (byte)((n & 0xff00) >> 8);
+
+ n = temp.capacity();
+
+ if (n > 32767)
+ n = 32767;
+
+ bytes[bi++] = (byte)((n & 0x7f00) >> 8);
bytes[bi++] = (byte)(n & 0xff);
- for (j=0; j < (byte)val.text.length(); j++)
- bytes[bi++] = (byte)val.text.charAt(j);
-
+ temp.get(bytes, bi, n);
+ bi += n;
break;
default :
<IMG SRC="/images/classes.png" WIDTH="128" HEIGHT="128" ALT=""></A> </TD>
<TD VALIGN=TOP><B>Description:</B> {printer_info}<BR>
<B>Location:</B> {printer_location}<BR>
-<B>Class State:</B> {printer_state=3?idle:{printer_state=4?processing:stopped}},
-{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {server_is_sharing_printers=0?not:{printer_is_shared=0?not:}} shared{default_name={printer_name}?, default printer:}.
+<B>Class State:</B> {printer_state=3?idle:{printer_state=4?processing:paused}},
+{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {server_is_sharing_printers=0?not:{printer_is_shared=0?not:}} shared{default_name={printer_name}?, server default:}.
{?member_uris=?:<BR>Members: {member_uris}}
<P><TABLE CLASS="inset" WIDTH="100%" SUMMARY="Maintenance Commands">
<CAPTION>Maintenance Commands</CAPTION>
<TR><TD><FORM ACTION="{printer_uri_supported}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="print-test-page"><INPUT TYPE="SUBMIT" VALUE="Print Test Page"></FORM>
{printer_state=5?
-<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="start-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Start Class"></FORM>
-:<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="stop-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Stop Class"></FORM>
+<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="start-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Resume Class"></FORM>
+:<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="stop-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Pause Class"></FORM>
}
{printer_is_accepting_jobs=0?
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="accept-jobs"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Accept Jobs"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="modify-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Modify Class"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-class-options"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Set Printer Options"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="delete-class"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Delete Class"></FORM>
-<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-as-default"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Set As Default"></FORM>
+<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-as-default"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Set As Server Default"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-allowed-users"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}<INPUT TYPE="HIDDEN" NAME="is_class" VALUE="Y"><INPUT TYPE="SUBMIT" VALUE="Set Allowed Users"></FORM></TD></TR>
</TABLE>
</TD>
<TD VALIGN="TOP"><B>Description:</B> {printer_info}<BR>
<B>Location:</B> {printer_location}<BR>
<B>Printer Driver:</B> {printer_make_and_model} ({color_supported=1?color:grayscale}{sides_supported?, 2-sided printing:})<BR>
-<B>Printer State:</B> {printer_state=3?idle:{printer_state=4?processing:stopped}},
-{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {server_is_sharing_printers=0?not:{printer_is_shared=0?not:}} shared{default_name={printer_name}?, default printer:}.<BR>
+<B>Printer State:</B> {printer_state=3?idle:{printer_state=4?processing:paused}},
+{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {server_is_sharing_printers=0?not:{printer_is_shared=0?not:}} shared{default_name={printer_name}?, server default:}.<BR>
<B>Default Options:</B> job-sheets={job_sheets_default}
media={media_default?{media_default}:unknown}
{sides_default?sides={sides_default}:}
{?cupscommand=1?<FORM ACTION="{printer_uri_supported}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="clean-print-heads"><INPUT TYPE="SUBMIT" VALUE="Clean Print Heads"></FORM>
<FORM ACTION="{printer_uri_supported}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="print-self-test-page"><INPUT TYPE="SUBMIT" VALUE="Print Self Test Page"></FORM>:}
{printer_state=5?
-<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="start-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Start Printer"></FORM>
-:<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="stop-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Stop Printer"></FORM>
+<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="start-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Resume Printer"></FORM>
+:<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="stop-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Pause Printer"></FORM>
}
{printer_is_accepting_jobs=0?
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="accept-jobs"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Accept Jobs"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="modify-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Modify Printer"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-printer-options"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Set Printer Options"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="delete-printer"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Delete Printer"></FORM>
-<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-as-default"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Set As Default"></FORM>
+<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-as-default"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Set As Server Default"></FORM>
<FORM ACTION="{admin_uri}" METHOD="POST"><INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-allowed-users"><INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{%printer_name}"><INPUT TYPE="SUBMIT" VALUE="Set Allowed Users"></FORM></TD></TR>
</TABLE>
</TD>