]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/testcups.c
Remove all of the Subversion keywords from various source files.
[thirdparty/cups.git] / cups / testcups.c
index 00a22965ac3ede77122745fe7905783941538d8a..b6bf78fa31c29f678194da3b783577027b1215aa 100644 (file)
@@ -1,23 +1,16 @@
 /*
- * "$Id$"
+ * CUPS API test program for CUPS.
  *
- *   CUPS API test program for CUPS.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007 by Easy Software Products.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 2007 by Easy Software Products.
+ * 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/".
- *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   main()        - Main entry.
- *   dests_equal() - Determine whether two destinations are equal.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -171,10 +164,27 @@ main(int  argc,                           /* I - Number of command-line arguments */
       else
        puts("No password entered.");
     }
+    else if (!strcmp(argv[1], "ppd") && argc == 3)
+    {
+     /*
+      * ./testcups ppd printer
+      */
+
+      http_status_t    http_status;    /* Status */
+      char             buffer[1024];   /* PPD filename */
+      time_t           modtime = 0;    /* Last modified */
+
+      if ((http_status = cupsGetPPD3(CUPS_HTTP_DEFAULT, argv[2], &modtime,
+                                     buffer, sizeof(buffer))) != HTTP_STATUS_OK)
+        printf("Unable to get PPD: %d (%s)\n", (int)http_status,
+               cupsLastErrorString());
+      else
+        puts(buffer);
+    }
     else if (!strcmp(argv[1], "print") && argc == 5)
     {
      /*
-      * ./testcups printer file interval
+      * ./testcups print printer file interval
       */
 
       int              interval,       /* Interval between writes */
@@ -210,15 +220,14 @@ main(int  argc,                           /* I - Number of command-line arguments */
       {
        printf("Writing %d bytes...\n", (int)bytes);
 
-       if (cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer,
-                                bytes) != HTTP_STATUS_CONTINUE)
+       if (cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, (size_t)bytes) != HTTP_STATUS_CONTINUE)
        {
          puts("Unable to write bytes!");
          return (1);
        }
 
         if (interval > 0)
-         sleep(interval);
+         sleep((unsigned)interval);
       }
 
       cupsFileClose(fp);
@@ -246,6 +255,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
       puts("");
       puts("    ./testcups password");
       puts("");
+      puts("Get the PPD file:");
+      puts("");
+      puts("    ./testcups ppd printer");
+      puts("");
       puts("Print a file (interval controls delay between buffers in seconds):");
       puts("");
       puts("    ./testcups print printer file interval");
@@ -511,6 +524,8 @@ enum_cb(void        *user_data,             /* I - User data (unused) */
   cups_option_t        *option;                /* Current option */
 
 
+  (void)user_data;
+
   if (flags & CUPS_DEST_FLAGS_REMOVED)
     printf("Removed '%s':\n", dest->name);
   else
@@ -565,8 +580,3 @@ show_diffs(cups_dest_t *a,          /* I - First destination */
       printf("    %-20.20s  %-20.20s  %-20.20s\n", aoption->name,
              aoption->value, bval ? bval : "(null)");
 }
-
-
-/*
- * End of "$Id$".
- */