]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.4svn-r7199.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 8 Jan 2008 00:39:02 +0000 (00:39 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 8 Jan 2008 00:39:02 +0000 (00:39 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@577 a1ca3aef-8c08-0410-bb20-df032aa958be

37 files changed:
CHANGES-1.3.txt
CHANGES.txt
backend/Makefile
backend/ieee1394-linux.c [deleted file]
backend/ieee1394.c [deleted file]
backend/ieee1394.h [deleted file]
backend/ipp.c
backend/lpd.c
backend/pap.c
backend/parallel.c
backend/runloop.c
backend/scsi.c
backend/serial.c
backend/socket.c
backend/usb-darwin.c
cgi-bin/ipp-var.c
cgi-bin/var.c
conf/cupsd.conf.in
config-scripts/cups-common.m4
config.h.in
cups/adminutil.c
cups/dest.c
cups/i18n.h
cups/langprintf.c
cups/libcups.exp
filter/pstops.c
locale/cups.pot
scheduler/auth.c
scheduler/auth.h
scheduler/cups-polld.c
scheduler/dirsvc.c
scheduler/ipp.c
scheduler/type.c
scripting/java/src/com/easysw/cups/Cups.java
scripting/java/src/com/easysw/cups/IPPAttribute.java
templates/classes.tmpl
templates/printers.tmpl

index c9e71da748cf825fa07230a5d1d300395c8aac08..bd9682755d600cf30aa68a860b7c3d67d8661a90 100644 (file)
@@ -4,6 +4,23 @@ CHANGES-1.3.txt
 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
index 3678d81640c974839948f9c4cfb6a7592b767d77..c9bcee7f977a00e8e1676b6fe3987c0d2d56247e 100644 (file)
@@ -1,8 +1,13 @@
-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)
index e02c2753877429b7b2c05121ca65416bcc4355b4..79654eb627b75f598ccead50ff6ac8af6ad30ec7 100644 (file)
@@ -113,18 +113,6 @@ libbackend.a:      $(LIBOBJS)
        $(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
 #
diff --git a/backend/ieee1394-linux.c b/backend/ieee1394-linux.c
deleted file mode 100644 (file)
index 2fc273a..0000000
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * "$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 $".
- */
diff --git a/backend/ieee1394.c b/backend/ieee1394.c
deleted file mode 100644 (file)
index f45bd96..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * "$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 $".
- */
diff --git a/backend/ieee1394.h b/backend/ieee1394.h
deleted file mode 100644 (file)
index 6f397fe..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * "$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 $".
- */
index 3348cd5cf8975951902487f7736b8b01e2c8072b..84bf27fc6e0973b8aa0aff7b1517a263ab4583c7 100644 (file)
@@ -407,13 +407,13 @@ main(int  argc,                           /* I - Number of command-line args */
 
     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);
@@ -422,7 +422,7 @@ main(int  argc,                             /* I - Number of command-line args */
     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);
@@ -1485,7 +1485,7 @@ report_printer_state(ipp_t *ipp,  /* I - IPP response */
     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))
index 926033a54188441924b3c85bc47ed8d1d980ec3e..100868f980522367399827bc5d8961e9b71d1166 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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
@@ -433,14 +433,14 @@ main(int  argc,                           /* I - Number of command-line arguments (6 or 7) */
 
     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);
@@ -580,7 +580,7 @@ lpd_command(int  fd,                /* I - Socket connection to LPD host */
 
   if (lpd_write(fd, buf, bytes) < bytes)
   {
-    perror("ERROR: Unable to send LPD command");
+    _cupsLangPrintError(_("ERROR: Unable to send LPD command"));
     return (-1);
   }
 
@@ -745,7 +745,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
 
        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;
@@ -762,7 +762,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
 
        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;
@@ -898,7 +898,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
        httpAddrFreeList(addrlist);
        close(fd);
 
-       perror("ERROR: unable to stat print file");
+       _cupsLangPrintError(_("ERROR: unable to stat print file"));
        return (CUPS_BACKEND_FAILED);
       }
 
@@ -981,7 +981,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
       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
       {
@@ -1045,7 +1045,7 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
 
          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
@@ -1059,7 +1059,7 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
          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
@@ -1112,7 +1112,7 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
       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
       {
index df177bb4a3b35bfb9d866fbcd0a71486dcda52ae..4cad781ec549321ba8d38350e22584c10b7ea213 100644 (file)
@@ -214,12 +214,10 @@ int main (int argc, const char * argv[])
 
   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.
@@ -240,7 +238,7 @@ int main (int argc, const char * argv[])
       _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]);
@@ -286,20 +284,21 @@ static int listDevices(void)
   /* 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));
 
@@ -311,12 +310,14 @@ static int listDevices(void)
 
   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);
@@ -439,7 +440,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
   /* 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;
   }
 
@@ -480,7 +481,8 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
         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
       {
@@ -490,14 +492,15 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
          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;
@@ -507,7 +510,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
 
     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... */
     }
@@ -550,14 +553,14 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
 
 #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);
@@ -566,7 +569,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
   /* 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;
   }
 
@@ -615,7 +618,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
     /* Wait here for something interesting to happen */
     if ((err = select(maxfdp1, &readSet, 0, 0, timeoutPtr)) < 0)
     {
-      perror("ERROR: select");
+      _cupsLangPrintError(_("ERROR: select() failed"));
       break;
     }
 
@@ -623,7 +626,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
     {
       /* 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;
@@ -674,7 +677,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
     {
       if ((rc = atp_look(gSockfd)) < 0)
       {
-        perror("ERROR: Unable to look for PAP response");
+        _cupsLangPrintError(_("ERROR: Unable to look for PAP response"));
         break;
       }
   
@@ -687,7 +690,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
   
         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];
@@ -698,7 +701,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
         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;
         }
       }
@@ -817,13 +820,15 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
             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;
@@ -838,11 +843,11 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
         /* 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;
@@ -851,11 +856,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
       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;
       }
     
@@ -911,7 +918,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
   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;
@@ -1443,7 +1450,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
         }
         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"))
@@ -1455,8 +1464,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
         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
         {
@@ -1675,7 +1685,7 @@ static int connectTimeout()
  */
 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();
 
index 3167d4a994b3cfee196ada903cb6d1746eaaf390..121f9f46bb9108fe50071e98fc273412c2e73bed 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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
@@ -146,7 +146,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
     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);
     }
 
index 2e32fd4b72183eb7f705d3ea882903f9b67c2f99..a4a8c4bbf0e64f178d46a81ca75547ce965ada2b 100644 (file)
@@ -230,7 +230,7 @@ backendRunLoop(
        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)
@@ -352,7 +352,7 @@ backendRunLoop(
        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;
        }
 
index 3be80c0ded1c454eb7b14c77c758abff96ec93c6..54833277234dae0d3d8f8c46a51916a04026b92e 100644 (file)
@@ -177,7 +177,9 @@ main(int  argc,             /* I - Number of command-line arguments (6 or 7) */
 
     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);
     }
 
index 08ee0193384fe2ccbd99fe152546a38f63fffd93..7a775259dbb2f4d6e5a3c0641940d4ed97e29992 100644 (file)
@@ -185,7 +185,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
     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);
     }
 
@@ -601,7 +603,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
          if (errno != EAGAIN || errno != EINTR)
          {
-           perror("ERROR: Unable to read print data");
+           _cupsLangPrintError(_("ERROR: Unable to read print data"));
 
             tcsetattr(device_fd, TCSADRAIN, &origopts);
 
@@ -677,7 +679,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
          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);
 
index 5d66a160616bbbe92c67d48c898a1cb98e58ec7f..66bc529216fe751929ed80e9ac4f119d77022427 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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
@@ -146,7 +146,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
     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);
     }
 
index d92591455d6904a14f183c2699d46c1b70eab7a2..88a7a40766e71302578013945ec6e5593ef426dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
 * "$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
@@ -600,7 +600,7 @@ print_device(const char *uri,               /* I - Device URI */
 
          if (errno != EAGAIN || errno != EINTR)
          {
-           perror("ERROR: Unable to read print data");
+           _cupsLangPrintError(_("ERROR: Unable to read print data"));
            return CUPS_BACKEND_STOP;
          }
 
@@ -1131,7 +1131,7 @@ static Boolean find_device_cb(void *refcon,
   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;
@@ -1149,7 +1149,7 @@ static void status_timer_cb(CFRunLoopTimerRef timer,
                            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)
   {
@@ -1798,7 +1798,7 @@ static void run_ppc_backend(int argc,
 
       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)
@@ -1807,7 +1807,7 @@ static void run_ppc_backend(int argc,
       * Error - couldn't fork a new process!
       */
 
-      perror("fork");
+      _cupsLangPrintError(_("ERROR: Unable to fork"));
       exit(errno);
     }
 
index e7a26034d9ff7f956f097be7ec30294c496141cb..d949e41f1775c5caf621843fe1ad8ca1dc66dea2 100644 (file)
@@ -845,7 +845,7 @@ cgiSetIPPObjectVars(
         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"))
index 8d4dab9ea618c700ff886a39dcdd91b8a053d71e..a142e9ccb34f0cc2e82517a4544b935833031252 100644 (file)
@@ -784,11 +784,15 @@ cgi_initialize_post(void)
 
   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';
 
index 1660ed44eef26bf3d16261a675219074950ae504..787c3a07a488721780a7711724fec3d863761570 100644 (file)
@@ -29,14 +29,12 @@ DefaultAuthType Basic
 # 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...
@@ -44,7 +42,6 @@ DefaultAuthType Basic
   AuthType Default
   Require user @SYSTEM
   Order allow,deny
-  Allow localhost
 </Location>
 
 # Set the default printer/job policies...
index 17a9f8883a434722584fbac7fab0520a91abba7e..a23014309375a466e2390b693ad2073d6c2b957e 100644 (file)
@@ -203,16 +203,7 @@ case $uname in
                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))
index 168ae55b47361d47e3508ff75299c87d233438ac..65262444e8aeb154605a8550e126c651a3c29127 100644 (file)
 #undef HAVE_CFBUNDLEPRIV_H
 
 
-/*
- * Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
- */
-
-#undef HAVE_CF_LOCALE_ID
-
-
 /*
  * Do we have MacOSX 10.4's mbr_XXX functions()?
  */
index 449feb9f55eccd1131db8f9e4f421944d81fbc44..3eda26dba8823cd0c80fcf7b9f95084ae93a8297 100644 (file)
@@ -4,7 +4,7 @@
  *   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
@@ -1057,7 +1057,7 @@ _cupsAdminGetServerSettings(
        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 != '/'
@@ -1067,9 +1067,9 @@ _cupsAdminGetServerSettings(
 #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)
index 2b89784336fd97aafba70b5433328bac76a3d2c0..d7656bb289c9cbdf16e0667eedf76ae3c1814190 100644 (file)
@@ -4,7 +4,7 @@
  *   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,
@@ -345,12 +371,20 @@ cupsGetDests2(http_t      *http,  /* I - HTTP connection or CUPS_HTTP_DEFAULT */
   * 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)
@@ -870,6 +904,16 @@ cupsSetDests2(http_t      *http,   /* I - HTTP connection or CUPS_HTTP_DEFAULT */
 
   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
@@ -883,11 +927,324 @@ cupsSetDests2(http_t      *http, /* I - HTTP connection or CUPS_HTTP_DEFAULT */
 }
 
 
+#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 */
index 1eacea816f417b1b206f6ed83b0ed323d9581956..5bb0fbd6578b6fd742e9a152f71ae1832042010d 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   (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
@@ -90,6 +90,7 @@ extern void           _cupsCharmapFlush(void);
 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)))
index d9f6fa10f5fd71915a9a09fbf62d86501cf6c1e8..afb189c573911b397b17ce0ddde3088392b68b83 100644 (file)
@@ -4,7 +4,7 @@
  *   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);
+}
 
 
 /*
index f14668ef1ab76d0212b9ec63305735d6447714ce..de8fd50c93dd335a38d085d9db1388e3fac23624 100644 (file)
@@ -8,6 +8,7 @@ __cupsCharmapGet
 __cupsEncodingName
 __cupsGetPassword
 __cupsGlobals
+__cupsLangPrintError
 __cupsLangPrintf
 __cupsLangPuts
 __cupsLangString
index 0064199da42b5e094f4fc4597caf449da9d24e3c..074abe0659ed0871f04fd5be2ff5f51fbc1566eb 100644 (file)
@@ -889,7 +889,8 @@ copy_dsc(cups_file_t  *fp,          /* I - File to read from */
   * 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);
 
index 77cee3257c83ab3e3afe4a9e089d690cd19a1196..bb7cc548c4b5cea292a1b545396ed4dbe79d309e 100644 (file)
@@ -17,7 +17,7 @@
 
 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"
@@ -1980,11 +1980,11 @@ msgid "INFO: Printer is busy; will retry in 5 seconds...\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
@@ -2488,11 +2488,11 @@ msgid "Printer Modified"
 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
index e0563a3f7da3e78283d5e293a9e6b8b83229f57f..78b7a5d3023ab80efcfe03c820f4a510be4649ac 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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...
@@ -40,6 +42,8 @@
  *   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.
@@ -47,7 +51,6 @@
  *   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.
  */
 
 /*
@@ -1094,6 +1097,67 @@ cupsdAuthorize(cupsd_client_t *con)      /* I - Client connection */
 }
 
 
+/*
+ * '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.
  */
@@ -1892,51 +1956,8 @@ cupsdIsAuthorized(cupsd_client_t *con,   /* I - Connection */
 
   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");
index e3b83f3a8d3dd8a9befd7cb43600529ce9efa518..6e00a19394347bd1f60715879e912e5e78710015 100644 (file)
@@ -4,7 +4,7 @@
  *   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
@@ -134,6 +134,8 @@ extern void         cupsdAllowHost(cupsd_location_t *loc, char *name);
 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,
index 8e158cd9f24f76f1aff327fe40aec2ea01ebdf06..9ffc46d2cd0acd17de33a38a652980d5ecf1f9ee 100644 (file)
@@ -144,7 +144,7 @@ main(int  argc,                             /* I - Number of command-line args */
   * Loop forever, asking for available printers and classes...
   */
 
-  for (http = NULL;;)
+  for (http = NULL; !ferror(stderr);)
   {
    /*
     * Open a connection to the server...
@@ -180,6 +180,8 @@ main(int  argc,                             /* I - Number of command-line args */
     if (remain > 0 && !restart_polling)
       sleep(remain);
   }
+
+  return (1);
 }
 
 
index f0269e67ff9de670d2f09c75f2156b1cd8387120..ae0ddcb81273abd863aa0e5b9eb80eaecf1717e0 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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.
  */
 
 /*
@@ -1817,9 +1820,9 @@ process_browse_data(
     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))
        {
@@ -1924,9 +1927,9 @@ process_browse_data(
     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))
        {
@@ -2473,10 +2476,15 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
                        *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 */
@@ -2570,6 +2578,26 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
       }
     }
 
+   /*
+    * 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...
     */
@@ -2577,11 +2605,13 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
     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);
 
    /*
index 79ec7b3f12ebfe08e0270eb4fb4fdcc44d78709e..976779dd89d399f62a645539eb570a4abc977e00 100644 (file)
@@ -2407,12 +2407,15 @@ add_printer(cupsd_client_t  *con,       /* I - Client connection */
 
     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);
index 06afd235201c2d17d5d09c939770ef0d50a4334f..30e98d12d5a4c10b59fe1f5f4b571ad300fa1806 100644 (file)
@@ -638,8 +638,8 @@ compare_types(mime_type_t *t0,              /* I - First type */
   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);
 }
index 9b33f6279158587263cb1bea944f397ff4866928..fc0660f6353ba340c4a7f548af5d756731bda3e9 100644 (file)
@@ -7,7 +7,7 @@ package com.easysw.cups;
  *   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
@@ -831,7 +831,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
             
 
@@ -1014,7 +1014,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
             
 
@@ -1091,7 +1091,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
             
 
@@ -1155,7 +1155,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
             
 
@@ -1229,7 +1229,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
 
       // ------------
@@ -1315,7 +1315,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
 
       // ------------
@@ -1375,7 +1375,7 @@ public class Cups
 
       a = new IPPAttribute( IPPDefs.TAG_OPERATION, IPPDefs.TAG_CHARSET,
                             "attributes-charset" );
-      a.addString( "", "iso-8859-1" );  
+      a.addString( "", "utf-8" );  
       ipp.addAttribute(a);
             
 
index 12d993eb031a816f3099fefa23f63a326b8edcd6..201e7b44bc56775984bf17f084cf748edc3bdd84 100644 (file)
@@ -7,7 +7,7 @@ package com.easysw.cups;
  *   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
@@ -263,7 +263,9 @@ public class IPPAttribute
   {
     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.
     //
@@ -308,8 +310,12 @@ public class IPPAttribute
         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 :
@@ -329,9 +335,13 @@ public class IPPAttribute
 
         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 :
@@ -359,6 +369,8 @@ public class IPPAttribute
     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)
     {
@@ -412,12 +424,16 @@ public class IPPAttribute
         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:
@@ -456,23 +472,30 @@ public class IPPAttribute
 
         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 :
index cb6b3f6fb1695bf92f22e9984d8c0886db19e06f..08dda008ee02d0180f2b6f577854ca5f5150ecb5 100644 (file)
@@ -9,16 +9,16 @@
 <IMG SRC="/images/classes.png" WIDTH="128" HEIGHT="128" ALT=""></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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>
@@ -36,7 +36,7 @@
 <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>
index 21782ee03b142b64016db9918b4ecb68b5d6901e..bf5427ee343af908440840a381defb6db31413c0 100644 (file)
@@ -10,8 +10,8 @@
 <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}:}
@@ -23,8 +23,8 @@ media={media_default?{media_default}:unknown}
 {?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>
@@ -43,7 +43,7 @@ media={media_default?{media_default}:unknown}
 <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>