2 * "$Id: testsupplies.c 9771 2011-05-12 05:21:56Z mike $"
4 * SNMP supplies test program for CUPS.
6 * Copyright 2008-2011 by Apple Inc.
8 * These coded instructions, statements, and computer programs are the
9 * property of Apple Inc. and are protected by Federal copyright
10 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
11 * "LICENSE" which should have been included with this file. If this
12 * file is missing or damaged, see the license at "http://www.cups.org/".
14 * This file is subject to the Apple OS-Developed Software exception.
18 * main() - Show the supplies state of a printer.
22 * Include necessary headers.
25 #include "backend-private.h"
29 * 'main()' - Show the supplies state of a printer.
32 int /* O - Exit status */
33 main(int argc, /* I - Number of command-line args */
34 char *argv[]) /* I - Command-line arguments */
36 http_addrlist_t *host; /* Host addresses */
37 int snmp_fd; /* SNMP socket */
38 int page_count, /* Current page count */
39 printer_state; /* Current printer state */
44 puts("Usage: testsupplies ip-or-hostname");
48 if ((host = httpAddrGetList(argv[1], AF_UNSPEC, "9100")) == NULL)
54 if ((snmp_fd = _cupsSNMPOpen(host->addr.addr.sa_family)) < 0)
62 fputs("backendSNMPSupplies: ", stdout);
64 if (backendSNMPSupplies(snmp_fd, &(host->addr), &page_count,
71 printf("backendSNMPSupplies: %s (page_count=%d, printer_state=%d)\n",
72 page_count < 0 || printer_state < CUPS_TC_other ||
73 printer_state > CUPS_TC_warmup ? "FAIL" : "PASS",
74 page_count, printer_state);
82 * End of "$Id: testsupplies.c 9771 2011-05-12 05:21:56Z mike $".