]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add -q option to cupstestppd.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 24 Jan 2003 21:32:14 +0000 (21:32 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 24 Jan 2003 21:32:14 +0000 (21:32 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@3150 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
man/cupstestppd.man
systemv/cupstestppd.c

index cf351a570fbddade03b4e3b57a248d4c01389b17..1b7a38af9f74805097d65281cc49c520b507377e 100644 (file)
@@ -3,6 +3,8 @@ CHANGES.txt - 01/24/2003
 
 CHANGES IN CUPS V1.1.19
 
+       - The cupstestppd utility now supports the "-q" option
+         (quiet) for use in scripts, etc.
        - Merged several weight-reducing changes into the CUPS
          baseline donated by Apple.
        - Added preliminary support for CDSA; patch provided by
index 412db1e67f38b7576ca54c4c201a78dc25aa7456..a13ca4811092e33570667149ca489833c07b76c6 100644 (file)
@@ -1,5 +1,5 @@
 .\"
-.\" "$Id: cupstestppd.man,v 1.2 2002/12/17 18:59:56 swdev Exp $"
+.\" "$Id: cupstestppd.man,v 1.3 2003/01/24 21:32:13 mike Exp $"
 .\"
 .\"   cupstestppd man page for the Common UNIX Printing System (CUPS).
 .\"
 cupstestppd \- test conformance of ppd files
 .SH SYNOPSIS
 .B cupstestppd
-[ -v ] filename.ppd [ ... filenameN.ppd ]
+[ -q ] [ -v ] filename.ppd [ ... filenameN.ppd ]
 .br
 .B cupstestppd
-[ -v ] -
+[ -q ] [ -v ] -
 .SH DESCRIPTION
 \fIcupstestppd\fR tests the conformance of PPD files to the
 Adobe PostScript Printer Description file format specification
@@ -42,8 +42,12 @@ on the command-line. The second form lists the PPD file provided
 on the standard input. The second form can be used to test
 compressed PPD files using the appropriate utility.
 .LP
+The \fI-q\fR option specifies that no information should be displayed.
+.LP
 The \fI-v\fR option specifies that all information in the PPD file
 should be displayed in addition to the conformance testing results.
+.LP
+The \fI-q\fR and \fI-v\fR options are mutually exclusive.
 .SH EXIT STATUS
 \fIcupstestppd\fR returns zero on success and non-zero on error. The
 error codes are as follows:
@@ -63,6 +67,14 @@ The PPD file contains format errors that cannot be skipped.
 4
 .br
 The PPD file does not conform to the Adobe PPD specification.
+.SH EXAMPLES
+The following command will test all PPD files in the current directory
+and print the names of each file that does not conform:
+.nf
+
+    find . -name \\*.ppd -exec cupstestppd -q '{}' \\; -print
+
+.fi
 .SH SEE ALSO
 CUPS Software Administrators Manual,
 CUPS Software Programmers Manual,
@@ -70,5 +82,5 @@ http://localhost:631/documentation.html
 .SH COPYRIGHT
 Copyright 1993-2003 by Easy Software Products, All Rights Reserved.
 .\"
-.\" End of "$Id: cupstestppd.man,v 1.2 2002/12/17 18:59:56 swdev Exp $".
+.\" End of "$Id: cupstestppd.man,v 1.3 2003/01/24 21:32:13 mike Exp $".
 .\"
index 3c526f2c1d9bc13eb03a5e8113fde17b444ef3ac..06ffc19460324c7809b6b3d7e4da90dc06db001b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cupstestppd.c,v 1.2 2002/12/17 19:00:20 swdev Exp $"
+ * "$Id: cupstestppd.c,v 1.3 2003/01/24 21:32:14 mike Exp $"
  *
  *   PPD test program for the Common UNIX Printing System (CUPS).
  *
@@ -83,8 +83,28 @@ main(int  argc,                      /* I - Number of command-line arguments */
   status  = ERROR_NONE;
 
   for (i = 1; i < argc; i ++)
-    if (strcmp(argv[i], "-v") == 0)
+    if (strcmp(argv[i], "-q") == 0)
+    {
+      if (verbose > 0)
+      {
+        fputs("cupstestppd: The -q option is incompatible with the -v option.\n",
+             stderr);
+       return (1);
+      }
+
+      verbose --;
+    }
+    else if (strcmp(argv[i], "-v") == 0)
+    {
+      if (verbose < 0)
+      {
+        fputs("cupstestppd: The -v option is incompatible with the -q option.\n",
+             stderr);
+       return (1);
+      }
+
       verbose ++;
+    }
     else if (argv[i][0] == '-' && argv[i][1])
     {
       ppd = NULL;
@@ -102,7 +122,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         * Read from stdin...
        */
 
-        puts("FILE: (stdin)\n");
+        if (verbose >= 0)
+          puts("FILE: (stdin)\n");
 
         ppd = ppdOpen(stdin);
       }
@@ -112,7 +133,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         * Read from a file...
        */
 
-        printf("FILE: %s\n\n", argv[i]);
+        if (verbose >= 0)
+          printf("FILE: %s\n\n", argv[i]);
 
         ppd = ppdOpenFile(argv[i]);
       }
@@ -122,12 +144,16 @@ main(int  argc,                   /* I - Number of command-line arguments */
         if (errno)
        {
          status = ERROR_FILE_OPEN;
-         printf("    Unable to open PPD file - %s\n\n", strerror(errno));
+
+          if (verbose >= 0)
+           printf("    Unable to open PPD file - %s\n\n", strerror(errno));
        }
        else
        {
          status = ERROR_PPD_FORMAT;
-         puts("    Unable to open PPD file using CUPS functions!\n");
+
+          if (verbose >= 0)
+           puts("    Unable to open PPD file using CUPS functions!\n");
         }
 
        continue;
@@ -138,7 +164,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
       * only by what the CUPS PPD functions actually load...)
       */
 
-      puts("    CONFORMANCE TESTS:");
+      if (verbose >= 0)
+        puts("    CONFORMANCE TESTS:");
 
       errors = 0;
 
@@ -146,107 +173,163 @@ main(int  argc,                 /* I - Number of command-line arguments */
        for (k = 0, option = group->options; k < group->num_options; k ++, option ++)
          if (option->defchoice[0])
          {
-           printf("        PASS    Default%s\n", option->keyword);
+           if (verbose >= 0)
+             printf("        PASS    Default%s\n", option->keyword);
          }
          else
          {
            errors ++;
-           printf("      **FAIL**  REQUIRED Default%s\n", option->keyword);
+
+           if (verbose >= 0)
+             printf("      **FAIL**  REQUIRED Default%s\n", option->keyword);
          }
 
       if (ppd->num_fonts)
-       puts("        PASS    Fonts");
+      {
+        if (verbose >= 0)
+         puts("        PASS    Fonts");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED Fonts");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED Fonts");
       }
 
       if (ppd->lang_encoding != NULL)
-       puts("        PASS    LanguageEncoding");
+      {
+       if (verbose >= 0)
+         puts("        PASS    LanguageEncoding");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED LanguageEncoding");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED LanguageEncoding");
       }
 
       if (ppd->lang_version != NULL)
-       puts("        PASS    LanguageVersion");
+      {
+       if (verbose >= 0)
+         puts("        PASS    LanguageVersion");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED LanguageVersion");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED LanguageVersion");
       }
 
       if (ppd->manufacturer != NULL)
-       puts("        PASS    Manufacturer");
+      {
+       if (verbose >= 0)
+         puts("        PASS    Manufacturer");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED Manufacturer");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED Manufacturer");
       }
 
       if (ppd->modelname != NULL)
-       puts("        PASS    ModelName");
+      {
+       if (verbose >= 0)
+         puts("        PASS    ModelName");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED ModelName");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED ModelName");
       }
 
       if (ppd->nickname != NULL)
-       puts("        PASS    NickName");
+      {
+       if (verbose >= 0)
+         puts("        PASS    NickName");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED NickName");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED NickName");
       }
 
       if (ppdFindOption(ppd, "PageSize") != NULL)
-       puts("        PASS    PageSize");
+      {
+       if (verbose >= 0)
+         puts("        PASS    PageSize");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED PageSize");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED PageSize");
       }
 
       if (ppdFindOption(ppd, "PageRegion") != NULL)
-       puts("        PASS    PageRegion");
+      {
+       if (verbose >= 0)
+         puts("        PASS    PageRegion");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED PageRegion");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED PageRegion");
       }
 
       if (ppd->product != NULL)
-       puts("        PASS    Product");
+      {
+       if (verbose >= 0)
+         puts("        PASS    Product");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED Product");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED Product");
       }
 
       if (ppd->shortnickname != NULL)
-       puts("        PASS    ShortNickName");
+      {
+       if (verbose >= 0)
+         puts("        PASS    ShortNickName");
+      }
       else
       {
        errors ++;
-       puts("      **FAIL**  REQUIRED ShortNickName");
+
+       if (verbose >= 0)
+         puts("      **FAIL**  REQUIRED ShortNickName");
       }
 
       if (errors)
       {
-        puts("\n    **** CONFORMANCE TESTING FAILED ****");
+        if (verbose >= 0)
+         puts("\n    **** CONFORMANCE TESTING FAILED ****");
+
        status = ERROR_CONFORMANCE;
       }
 
-      puts("");
+      if (verbose >= 0)
+       puts("");
 
      /*
       * Then list the options, if "-v" was provided...
       */ 
 
-      if (verbose)
+      if (verbose > 0)
       {
        puts("");
        puts("    OPTIONS:");     
@@ -363,8 +446,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
   if (!ppd)
   {
-    puts("Usage: cupstestppd [-v] filename1.ppd [... filenameN.ppd]");
-    puts("       program | cupstestppd [-v] -");
+    puts("Usage: cupstestppd [-q] [-v] filename1.ppd [... filenameN.ppd]");
+    puts("       program | cupstestppd [-q] [-v] -");
 
     return (ERROR_USAGE);
   }
@@ -374,5 +457,5 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: cupstestppd.c,v 1.2 2002/12/17 19:00:20 swdev Exp $".
+ * End of "$Id: cupstestppd.c,v 1.3 2003/01/24 21:32:14 mike Exp $".
  */