]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Update cupstestppd to support the FormatVersion attribute, since the
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 14 Feb 2003 21:08:29 +0000 (21:08 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 14 Feb 2003 21:08:29 +0000 (21:08 +0000)
Manufacturer and ShortNickName attributes were added/made required in
version 4.3 but not in previous versions of the PPD spec.  This allows
otherwise conformant files to pass...

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@3367 7a7537e8-13f0-0310-91df-b6672ffda945

systemv/cupstestppd.c

index a6a630868b52ca6d692c5f859a48dbcee2a4acbd..8f04f33cc894cfbe5ed3d693728f9efac9e98606 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cupstestppd.c,v 1.7 2003/02/14 20:01:26 mike Exp $"
+ * "$Id: cupstestppd.c,v 1.8 2003/02/14 21:08:29 mike Exp $"
  *
  *   PPD test program for the Common UNIX Printing System (CUPS).
  *
@@ -74,6 +74,7 @@ main(int  argc,                       /* I - Number of command-line arguments */
   int          verbose;        /* Want verbose output? */
   int          status;         /* Exit status */
   int          errors;         /* Number of conformance errors */
+  int          ppdversion;     /* PPD spec version in PPD file */
   ppd_status_t error;          /* Status of ppdOpen*() */
   int          line;           /* Line number for error */
   ppd_file_t   *ppd;           /* PPD file record */
@@ -217,7 +218,16 @@ main(int  argc,                    /* I - Number of command-line arguments */
       if (verbose > 0)
         puts("\n    CONFORMANCE TESTS:");
 
-      errors = 0;
+      errors     = 0;
+      ppdversion = 43;
+      
+      if ((ptr = ppdFindAttr(ppd, "FormatVersion", NULL)) != NULL)
+      {
+        ppdversion = (int)(10 * atof(ptr) + 0.5);
+
+       if (ppdversion < 43 && verbose > 0)
+         printf("        WARN    Obsolete PPD version %s!\n", ptr);
+      }
 
       if (ppdFindAttr(ppd, "DefaultImageableArea", NULL) != NULL)
       {
@@ -317,6 +327,11 @@ main(int  argc,                    /* I - Number of command-line arguments */
        if (verbose > 0)
          puts("        PASS    Manufacturer");
       }
+      else if (ppdversion < 43)
+      {
+       if (verbose > 0)
+         puts("        WARN    REQUIRED Manufacturer");
+      }
       else
       {
        errors ++;
@@ -468,6 +483,11 @@ main(int  argc,                    /* I - Number of command-line arguments */
        else if (verbose > 0)
          puts("        PASS    ShortNickName");
       }
+      else if (ppdversion < 43)
+      {
+       if (verbose > 0)
+         puts("        WARN    REQUIRED ShortNickName");
+      }
       else
       {
        errors ++;
@@ -636,5 +656,5 @@ usage(void)
 
 
 /*
- * End of "$Id: cupstestppd.c,v 1.7 2003/02/14 20:01:26 mike Exp $".
+ * End of "$Id: cupstestppd.c,v 1.8 2003/02/14 21:08:29 mike Exp $".
  */