]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/ppd-mark.c
Update adminutil.c
[thirdparty/cups.git] / cups / ppd-mark.c
index 3b0c51306109aa5974de7b9ee90c932e0d94e707..7ec0df473951a40cfc5beb0e12fbf656e8cd149e 100644 (file)
@@ -1,18 +1,13 @@
 /*
  * Option marking routines for CUPS.
  *
- * Copyright 2007-2015 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
- * These coded instructions, statements, and computer programs are the
- * 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/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  *
  * PostScript is a trademark of Adobe Systems, Inc.
- *
- * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -21,6 +16,7 @@
 
 #include "cups-private.h"
 #include "ppd-private.h"
+#include "debug-internal.h"
 
 
 /*
@@ -113,7 +109,7 @@ cupsMarkOptions(
     * InputSlot, etc.) is not also set.
     *
     * For PageSize, we also check for an empty option value since some versions
-    * of MacOS X use it to specify auto-selection of the media based solely on
+    * of macOS use it to specify auto-selection of the media based solely on
     * the size.
     */
 
@@ -253,6 +249,7 @@ cupsMarkOptions(
   */
 
   for (i = num_options, optptr = options; i > 0; i --, optptr ++)
+  {
     if (!_cups_strcasecmp(optptr->name, "media") ||
         !_cups_strcasecmp(optptr->name, "output-bin") ||
        !_cups_strcasecmp(optptr->name, "output-mode") ||
@@ -341,6 +338,19 @@ cupsMarkOptions(
       ppd_mark_option(ppd, "MirrorPrint", optptr->value);
     else
       ppd_mark_option(ppd, optptr->name, optptr->value);
+  }
+
+  if (print_quality)
+  {
+    int pq = atoi(print_quality);       /* print-quaity value */
+
+    if (pq == IPP_QUALITY_DRAFT)
+      ppd_mark_option(ppd, "cupsPrintQuality", "Draft");
+    else if (pq == IPP_QUALITY_HIGH)
+      ppd_mark_option(ppd, "cupsPrintQuality", "High");
+    else
+      ppd_mark_option(ppd, "cupsPrintQuality", "Normal");
+  }
 
   ppd_debug_marked(ppd, "After...");
 
@@ -561,7 +571,7 @@ ppdMarkOption(ppd_file_t *ppd,              /* I - PPD file record */
  *
  * Options are returned from all groups in ascending alphanumeric order.
  *
- * @since CUPS 1.2/OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
  */
 
 ppd_option_t *                         /* O - First option or @code NULL@ */
@@ -579,7 +589,7 @@ ppdFirstOption(ppd_file_t *ppd)             /* I - PPD file */
  *
  * Options are returned from all groups in ascending alphanumeric order.
  *
- * @since CUPS 1.2/OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
  */
 
 ppd_option_t *                         /* O - Next option or @code NULL@ */
@@ -770,7 +780,7 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
                ppd, option, choice));
 
  /*
-  * AP_D_InputSlot is the "default input slot" on MacOS X, and setting
+  * AP_D_InputSlot is the "default input slot" on macOS, and setting
   * it clears the regular InputSlot choices...
   */
 
@@ -841,6 +851,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
 
         switch (cparam->type)
        {
+         case PPD_CUSTOM_UNKNOWN :
+             break;
+
          case PPD_CUSTOM_CURVE :
          case PPD_CUSTOM_INVCURVE :
          case PPD_CUSTOM_REAL :
@@ -876,9 +889,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
          case PPD_CUSTOM_PASSWORD :
          case PPD_CUSTOM_STRING :
              if (cparam->current.custom_string)
-               _cupsStrFree(cparam->current.custom_string);
+               free(cparam->current.custom_string);
 
-             cparam->current.custom_string = _cupsStrAlloc(choice + 7);
+             cparam->current.custom_string = strdup(choice + 7);
              break;
        }
       }
@@ -918,6 +931,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
 
        switch (cparam->type)
        {
+         case PPD_CUSTOM_UNKNOWN :
+             break;
+
          case PPD_CUSTOM_CURVE :
          case PPD_CUSTOM_INVCURVE :
          case PPD_CUSTOM_REAL :
@@ -953,9 +969,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
          case PPD_CUSTOM_PASSWORD :
          case PPD_CUSTOM_STRING :
              if (cparam->current.custom_string)
-               _cupsStrFree(cparam->current.custom_string);
+               free(cparam->current.custom_string);
 
-             cparam->current.custom_string = _cupsStrRetain(val->value);
+             cparam->current.custom_string = strdup(val->value);
              break;
        }
       }