/*
- * "$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.
*/
/*
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 */
{
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);
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");
cups_option_t *option; /* Current option */
+ (void)user_data;
+
if (flags & CUPS_DEST_FLAGS_REMOVED)
printf("Removed '%s':\n", dest->name);
else
printf(" %-20.20s %-20.20s %-20.20s\n", aoption->name,
aoption->value, bval ? bval : "(null)");
}
-
-
-/*
- * End of "$Id$".
- */