]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/encode.c
Import CUPS 1.4svn-r7226.
[thirdparty/cups.git] / cups / encode.c
index 686fb648a4863c10ce092ec05533983394cf1944..9ac62b870d99dd23f061704f45bba046041a406f 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: encode.c 6386 2007-03-23 19:03:01Z mike $"
+ * "$Id: encode.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   Option encoding routines for the Common UNIX Printing System (CUPS).
  *
+ *   Copyright 2007 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -109,6 +100,7 @@ static const _ipp_option_t ipp_options[] =
   { "page-top-default",                IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
   { "penwidth",                        IPP_TAG_INTEGER,        IPP_TAG_JOB },
   { "penwidth-default",                IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
+  { "port-monitor",             IPP_TAG_NAME,           IPP_TAG_PRINTER },
   { "ppi",                     IPP_TAG_INTEGER,        IPP_TAG_JOB },
   { "ppi-default",             IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
   { "prettyprint",             IPP_TAG_BOOLEAN,        IPP_TAG_JOB },
@@ -404,10 +396,44 @@ cupsEncodeOptions2(
       * Find the end of this value and mark it if needed...
       */
 
-      if ((sep = strchr(val, ',')) != NULL)
+      for (sep = val; *sep; sep ++)
+      {
+       if (*sep == '\'')
+       {
+        /*
+         * Skip quoted option value...
+         */
+
+         sep ++;
+
+         while (*sep && *sep != '\'')
+           sep ++;
+
+         if (!*sep)
+           sep --;
+       }
+       else if (*sep == '\"')
+       {
+        /*
+         * Skip quoted option value...
+         */
+
+         sep ++;
+
+         while (*sep && *sep != '\"')
+           sep ++;
+
+         if (!*sep)
+           sep --;
+       }
+       else if (*sep == ',')
+         break;
+       else if (*sep == '\\' && sep[1])
+         sep ++;
+      }
+
+      if (*sep == ',')
        *sep++ = '\0';
-      else
-       sep = val + strlen(val);
 
      /*
       * Copy the option value(s) over as needed by the type...
@@ -573,5 +599,5 @@ compare_ipp_options(_ipp_option_t *a,       /* I - First option */
 
 
 /*
- * End of "$Id: encode.c 6386 2007-03-23 19:03:01Z mike $".
+ * End of "$Id: encode.c 6649 2007-07-11 21:46:42Z mike $".
  */