]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/cupstestppd.c
Remove all remnants of the old private PWG APIs and structures.
[thirdparty/cups.git] / systemv / cupstestppd.c
index 30d92b47de1e00401a65b1b958228ea7454bf83c..8c48d801f62b51f1785e4609ed1af02d410650f4 100644 (file)
@@ -1,40 +1,18 @@
 /*
- * "$Id$"
+ * PPD test program for CUPS.
  *
- *   PPD test program for CUPS.
+ * Copyright 2007-2016 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   Copyright 2007-2013 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/".
  *
- *   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/".
+ * PostScript is a trademark of Adobe Systems, Inc.
  *
- *   PostScript is a trademark of Adobe Systems, Inc.
- *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   main()               - Main entry for test program.
- *   check_basics()       - Check for CR LF, mixed line endings, and blank
- *                          lines.
- *   check_constraints()  - Check UIConstraints in the PPD file.
- *   check_case()         - Check that there are no duplicate groups, options,
- *                          or choices that differ only by case.
- *   check_defaults()     - Check default option keywords in the PPD file.
- *   check_duplex()       - Check duplex keywords in the PPD file.
- *   check_filters()      - Check filters in the PPD file.
- *   check_profiles()     - Check ICC color profiles in the PPD file.
- *   check_sizes()        - Check media sizes in the PPD file.
- *   check_translations() - Check translations in the PPD file.
- *   show_conflicts()     - Show option conflicts in a PPD file.
- *   test_raster()        - Test PostScript commands for raster printers.
- *   usage()              - Show program usage.
- *   valid_path()         - Check whether a path has the correct capitalization.
- *   valid_utf8()         - Check whether a string contains valid UTF-8 text.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -2391,8 +2369,40 @@ check_filters(ppd_file_t *ppd,           /* I - PPD file */
 
       if (!warn)
         errors ++;
+
+      continue;
     }
-    else if (strcmp(program, "-"))
+
+    if (!strncmp(program, "maxsize(", 8))
+    {
+      char     *mptr;                  /* Pointer into maxsize(nnnn) program */
+
+      strtoll(program + 8, &mptr, 10);
+
+      if (*mptr != ')')
+      {
+       if (!warn && !errors && !verbose)
+         _cupsLangPuts(stdout, _(" FAIL"));
+
+       if (verbose >= 0)
+         _cupsLangPrintf(stdout,
+                         _("      %s  Bad cupsFilter value \"%s\"."),
+                         prefix, attr->value);
+
+       if (!warn)
+         errors ++;
+
+       continue;
+      }
+
+      mptr ++;
+      while (_cups_isspace(*mptr))
+       mptr ++;
+
+      _cups_strcpy(program, mptr);
+    }
+
+    if (strcmp(program, "-"))
     {
       if (program[0] == '/')
        snprintf(pathprog, sizeof(pathprog), "%s%s", root, program);
@@ -2477,8 +2487,40 @@ check_filters(ppd_file_t *ppd,           /* I - PPD file */
 
       if (!warn)
         errors ++;
+
+      continue;
     }
-    else if (strcmp(program, "-"))
+
+    if (!strncmp(program, "maxsize(", 8))
+    {
+      char     *mptr;                  /* Pointer into maxsize(nnnn) program */
+
+      strtoll(program + 8, &mptr, 10);
+
+      if (*mptr != ')')
+      {
+       if (!warn && !errors && !verbose)
+         _cupsLangPuts(stdout, _(" FAIL"));
+
+       if (verbose >= 0)
+         _cupsLangPrintf(stdout,
+                         _("      %s  Bad cupsFilter2 value \"%s\"."),
+                         prefix, attr->value);
+
+       if (!warn)
+         errors ++;
+
+       continue;
+      }
+
+      mptr ++;
+      while (_cups_isspace(*mptr))
+       mptr ++;
+
+      _cups_strcpy(program, mptr);
+    }
+
+    if (strcmp(program, "-"))
     {
       if (strncmp(program, "maxsize(", 8) &&
           (ptr = strchr(program + 8, ')')) != NULL)
@@ -3080,7 +3122,7 @@ check_sizes(ppd_file_t *ppd,              /* I - PPD file */
   const char   *prefix;                /* WARN/FAIL prefix */
   ppd_option_t *page_size,             /* PageSize option */
                *page_region;           /* PageRegion option */
-  _pwg_media_t *pwg_media;             /* PWG media */
+  pwg_media_t  *pwg_media;             /* PWG media */
   char         buf[PPD_MAX_NAME];      /* PapeSize name that is supposed to be */
   const char   *ptr;                   /* Pointer into string */
   int          width_2540ths,          /* PageSize width in 2540ths */
@@ -3218,8 +3260,8 @@ check_sizes(ppd_file_t *ppd,              /* I - PPD file */
       pwg_media      = pwgMediaForSize(width_2540ths, length_2540ths);
 
       if (pwg_media &&
-          (fabs(pwg_media->width - width_2540ths) > 34 ||
-           fabs(pwg_media->length - length_2540ths) > 34))
+          (abs(pwg_media->width - width_2540ths) > 34 ||
+           abs(pwg_media->length - length_2540ths) > 34))
         pwg_media = NULL;              /* Only flag matches within a point */
 
       if (pwg_media && pwg_media->ppd &&
@@ -3989,8 +4031,3 @@ valid_utf8(const char *s)         /* I - String to check */
 
   return (1);
 }
-
-
-/*
- * End of "$Id$".
- */