sep; /* Separator character */
int snmp_fd, /* SNMP socket */
start_count, /* Page count via SNMP at start */
- page_count; /* Page count via SNMP */
+ page_count, /* Page count via SNMP */
+ have_supplies; /* Printer supports supply levels? */
int num_files; /* Number of files to print */
char **files, /* Files to print */
*filename; /* Pointer to single filename */
else
s = argv[0];
- printf("network %s \"Unknown\" \"Internet Printing Protocol (%s)\"\n",
- s, s);
+ printf("network %s \"Unknown\" \"%s (%s)\"\n",
+ s, _cupsLangString(cupsLangDefault(),
+ _("Internet Printing Protocol")), s);
return (CUPS_BACKEND_OK);
}
else if (argc < 6)
do
{
- _cupsLangPrintf(stderr, _("INFO: Connecting to %s on port %d...\n"),
- hostname, port);
+ fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
+ hostname, port);
+ _cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
{
}
fputs("STATE: -connecting-to-device\n", stderr);
- _cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
+ _cupsLangPuts(stderr, _("INFO: Connected to printer...\n"));
#ifdef AF_INET6
if (http->hostaddr->addr.sa_family == AF_INET6)
*/
if ((snmp_fd = _cupsSNMPOpen(http->hostaddr->addr.sa_family)) >= 0)
- {
- if (backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count, NULL))
- {
- /*
- * No, close it...
- */
-
- _cupsSNMPClose(snmp_fd);
- snmp_fd = -1;
- }
- }
+ have_supplies = !backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count,
+ NULL);
else
- start_count = 0;
+ have_supplies = start_count = 0;
/*
* Build a URI for the printer and fill the standard IPP attributes for
}
else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
ipp_status == IPP_PRINTER_BUSY)
- break;
+ continue;
else
copies_remaining --;
* Collect the final page count as needed...
*/
- if (snmp_fd >= 0 &&
+ if (have_supplies &&
!backendSNMPSupplies(snmp_fd, http->hostaddr, &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
else if (!strncmp(reason, "media-jam", 9))
message = _("Media jam!");
else if (!strncmp(reason, "moving-to-paused", 16) ||
+ !strncmp(reason, "offline", 7) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
message = _("Printer offline.");