summaryrefslogtreecommitdiff
path: root/systemv/lpstat.c
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2010-11-30 03:16:24 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2010-11-30 03:16:24 +0000
commit0837b7e828b9fc312fcf8f5741d2ba9683742672 (patch)
tree1209ad6c3a50b6fc8c2e7fdc4ce05445f17f1d86 /systemv/lpstat.c
parent1106b00e75e37e7f25a28ee95da560de55520018 (diff)
downloadcups-0837b7e828b9fc312fcf8f5741d2ba9683742672.tar.gz
Merge changes from CUPS 1.5svn-r9385.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@2873 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'systemv/lpstat.c')
-rw-r--r--systemv/lpstat.c311
1 files changed, 175 insertions, 136 deletions
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index d278b2f2d..445588c01 100644
--- a/systemv/lpstat.c
+++ b/systemv/lpstat.c
@@ -99,16 +99,16 @@ main(int argc, /* I - Number of command-line arguments */
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr,
- _("%s: Sorry, no encryption support compiled in\n"),
+ _("%s: Sorry, no encryption support."),
argv[0]);
#endif /* HAVE_SSL */
break;
case 'H' : /* Show server and port */
if (cupsServer()[0] == '/')
- _cupsLangPrintf(stdout, "%s\n", cupsServer());
+ _cupsLangPuts(stdout, cupsServer());
else
- _cupsLangPrintf(stdout, "%s:%d\n", cupsServer(), ippPort());
+ _cupsLangPrintf(stdout, "%s:%d", cupsServer(), ippPort());
break;
case 'P' : /* Show paper types */
@@ -135,7 +135,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected username after "
- "\'-U\' option\n"),
+ "\"-U\" option."),
argv[0]);
return (1);
}
@@ -156,7 +156,7 @@ main(int argc, /* I - Number of command-line arguments */
_cupsLangPrintf(stderr,
_("%s: Error - need \"completed\", "
"\"not-completed\", or \"all\" after "
- "\'-W\' option\n"),
+ "\"-W\" option."),
argv[0]);
return (1);
}
@@ -170,7 +170,7 @@ main(int argc, /* I - Number of command-line arguments */
_cupsLangPrintf(stderr,
_("%s: Error - need \"completed\", "
"\"not-completed\", or \"all\" after "
- "\'-W\' option\n"),
+ "\"-W\" option."),
argv[0]);
return (1);
}
@@ -229,7 +229,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected destination after "
- "\'-b\' option\n"),
+ "\"-b\" option."),
argv[0]);
return (1);
@@ -289,7 +289,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
- "\'-h\' option\n"),
+ "\"-h\" option."),
argv[0]);
return (1);
}
@@ -449,7 +449,7 @@ main(int argc, /* I - Number of command-line arguments */
default :
_cupsLangPrintf(stderr,
- _("%s: Error - unknown option \'%c\'\n"),
+ _("%s: Error - unknown option \"%c\"."),
argv[0], argv[i][1]);
return (1);
}
@@ -501,7 +501,7 @@ check_dest(const char *command, /* I - Command name */
if ((*dests = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer, pptr)) == NULL)
{
_cupsLangPrintf(stderr,
- _("%s: Invalid destination name in list \"%s\"\n"),
+ _("%s: Invalid destination name in list \"%s\"."),
command, name);
exit(1);
}
@@ -540,7 +540,7 @@ check_dest(const char *command, /* I - Command name */
else
{
_cupsLangPrintf(stderr,
- _("%s: Invalid destination name in list \"%s\"\n"),
+ _("%s: Invalid destination name in list \"%s\"."),
command, name);
exit(1);
}
@@ -555,7 +555,7 @@ check_dest(const char *command, /* I - Command name */
if (!cupsGetDest(printer, NULL, *num_dests, *dests))
{
_cupsLangPrintf(stderr,
- _("%s: Unknown destination \"%s\"\n"), command, printer);
+ _("%s: Unknown destination \"%s\"."), command, printer);
exit(1);
}
}
@@ -673,7 +673,7 @@ show_accepting(const char *printers, /* I - Destinations */
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
ippDelete(response);
return (1);
}
@@ -744,27 +744,32 @@ show_accepting(const char *printers, /* I - Destinations */
strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
if (accepting)
- _cupsLangPrintf(stdout, _("%s accepting requests since %s\n"),
+ _cupsLangPrintf(stdout, _("%s accepting requests since %s"),
printer, printer_state_time);
else
- _cupsLangPrintf(stdout, _("%s not accepting requests since %s -\n"
- "\t%s\n"),
- printer, printer_state_time,
+ {
+ _cupsLangPrintf(stdout, _("%s not accepting requests since %s -"),
+ printer, printer_state_time);
+ _cupsLangPrintf(stdout, _("\t%s"),
(message == NULL || !*message) ?
"reason unknown" : message);
+ }
for (i = 0; i < num_dests; i ++)
if (!strcasecmp(dests[i].name, printer) && dests[i].instance)
{
if (accepting)
- _cupsLangPrintf(stdout, _("%s/%s accepting requests since %s\n"),
+ _cupsLangPrintf(stdout, _("%s/%s accepting requests since %s"),
printer, dests[i].instance, printer_state_time);
else
- _cupsLangPrintf(stdout, _("%s/%s not accepting requests since "
- "%s -\n\t%s\n"),
- printer, dests[i].instance, printer_state_time,
+ {
+ _cupsLangPrintf(stdout,
+ _("%s/%s not accepting requests since %s -"),
+ printer, dests[i].instance, printer_state_time);
+ _cupsLangPrintf(stdout, _("\t%s"),
(message == NULL || !*message) ?
"reason unknown" : message);
+ }
}
}
@@ -776,7 +781,7 @@ show_accepting(const char *printers, /* I - Destinations */
}
else
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
return (1);
}
@@ -847,7 +852,7 @@ show_classes(const char *dests) /* I - Destinations */
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
ippDelete(response);
return (1);
}
@@ -959,16 +964,15 @@ show_classes(const char *dests) /* I - Destinations */
if (match_list(dests, printer))
{
- _cupsLangPrintf(stdout, _("members of class %s:\n"), printer);
+ _cupsLangPrintf(stdout, _("members of class %s:"), printer);
if (members)
{
for (i = 0; i < members->num_values; i ++)
- _cupsLangPrintf(stdout, "\t%s\n",
- members->values[i].string.text);
+ _cupsLangPrintf(stdout, "\t%s", members->values[i].string.text);
}
else
- _cupsLangPuts(stdout, "\tunknown\n");
+ _cupsLangPuts(stdout, "\tunknown");
}
if (response2)
@@ -982,7 +986,7 @@ show_classes(const char *dests) /* I - Destinations */
}
else
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
return (1);
}
@@ -1004,10 +1008,10 @@ show_default(cups_dest_t *dest) /* I - Default destination */
if (dest)
{
if (dest->instance)
- _cupsLangPrintf(stdout, _("system default destination: %s/%s\n"),
+ _cupsLangPrintf(stdout, _("system default destination: %s/%s"),
dest->name, dest->instance);
else
- _cupsLangPrintf(stdout, _("system default destination: %s\n"),
+ _cupsLangPrintf(stdout, _("system default destination: %s"),
dest->name);
}
else
@@ -1030,10 +1034,10 @@ show_default(cups_dest_t *dest) /* I - Default destination */
if (printer)
_cupsLangPrintf(stdout,
_("lpstat: error - %s environment variable names "
- "non-existent destination \"%s\"\n"),
+ "non-existent destination \"%s\"."),
val, printer);
else
- _cupsLangPuts(stdout, _("no system default destination\n"));
+ _cupsLangPuts(stdout, _("no system default destination"));
}
}
@@ -1096,7 +1100,7 @@ show_devices(const char *printers, /* I - Destinations */
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
ippDelete(response);
return (1);
}
@@ -1176,16 +1180,16 @@ show_devices(const char *printers, /* I - Destinations */
sizeof(hostname), &port, resource, sizeof(resource));
_cupsLangPrintf(stdout,
_("Output for printer %s is sent to remote "
- "printer %s on %s\n"),
+ "printer %s on %s"),
printer, strrchr(resource, '/') + 1, hostname);
}
else if (!strncmp(device, "file:", 5))
_cupsLangPrintf(stdout,
- _("Output for printer %s is sent to %s\n"),
+ _("Output for printer %s is sent to %s"),
printer, device + 5);
else
_cupsLangPrintf(stdout,
- _("Output for printer %s is sent to %s\n"),
+ _("Output for printer %s is sent to %s"),
printer, device);
for (i = 0; i < num_dests; i ++)
@@ -1194,40 +1198,40 @@ show_devices(const char *printers, /* I - Destinations */
if (device == NULL)
_cupsLangPrintf(stdout,
_("Output for printer %s/%s is sent to "
- "remote printer %s on %s\n"),
+ "remote printer %s on %s"),
printer, dests[i].instance,
strrchr(resource, '/') + 1, hostname);
else if (!strncmp(device, "file:", 5))
_cupsLangPrintf(stdout,
- _("Output for printer %s/%s is sent to %s\n"),
+ _("Output for printer %s/%s is sent to %s"),
printer, dests[i].instance, device + 5);
else
_cupsLangPrintf(stdout,
- _("Output for printer %s/%s is sent to %s\n"),
+ _("Output for printer %s/%s is sent to %s"),
printer, dests[i].instance, device);
}
#else
if (device == NULL)
- _cupsLangPrintf(stdout, _("device for %s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s: %s"),
printer, uri);
else if (!strncmp(device, "file:", 5))
- _cupsLangPrintf(stdout, _("device for %s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s: %s"),
printer, device + 5);
else
- _cupsLangPrintf(stdout, _("device for %s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s: %s"),
printer, device);
for (i = 0; i < num_dests; i ++)
if (!strcasecmp(printer, dests[i].name) && dests[i].instance)
{
if (device == NULL)
- _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s/%s: %s"),
printer, dests[i].instance, uri);
else if (!strncmp(device, "file:", 5))
- _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s/%s: %s"),
printer, dests[i].instance, device + 5);
else
- _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"),
+ _cupsLangPrintf(stdout, _("device for %s/%s: %s"),
printer, dests[i].instance, device);
}
#endif /* __osf__ */
@@ -1241,7 +1245,7 @@ show_devices(const char *printers, /* I - Destinations */
}
else
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
return (1);
}
@@ -1333,7 +1337,7 @@ show_jobs(const char *dests, /* I - Destinations */
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
ippDelete(response);
return (1);
}
@@ -1430,7 +1434,7 @@ show_jobs(const char *dests, /* I - Destinations */
if (!strftime(date, sizeof(date), "%b %d %H:%M", jobdate))
strcpy(date, "Unknown");
- _cupsLangPrintf(stdout, "%s;%s;%d;%s;%s\n",
+ _cupsLangPrintf(stdout, "%s;%s;%d;%s;%s",
temp, username ? username : "unknown",
size, title ? title : "unknown", date);
}
@@ -1440,24 +1444,36 @@ show_jobs(const char *dests, /* I - Destinations */
strcpy(date, "Unknown");
if (ranking)
- _cupsLangPrintf(stdout, "%3d %-21s %-13s %8.0f %s\n",
+ _cupsLangPrintf(stdout, "%3d %-21s %-13s %8.0f %s",
rank, temp, username ? username : "unknown",
1024.0 * size, date);
else
- _cupsLangPrintf(stdout, "%-23s %-13s %8.0f %s\n",
+ _cupsLangPrintf(stdout, "%-23s %-13s %8.0f %s",
temp, username ? username : "unknown",
1024.0 * size, date);
if (long_status)
{
if (reasons)
{
- _cupsLangPuts(stdout, _("\tAlerts:"));
- for (i = 0; i < reasons->num_values; i ++)
- _cupsLangPrintf(stdout, " %s",
- reasons->values[i].string.text);
- _cupsLangPuts(stdout, "\n");
+ char alerts[1024], /* Alerts string */
+ *aptr; /* Pointer into alerts string */
+
+ for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
+ {
+ if (i)
+ snprintf(aptr, sizeof(alerts) - (aptr - alerts), " %s",
+ reasons->values[i].string.text);
+ else
+ strlcpy(alerts, reasons->values[i].string.text,
+ sizeof(alerts));
+
+ aptr += strlen(aptr);
+ }
+
+ _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
}
- _cupsLangPrintf(stdout, _("\tqueued for %s\n"), dest);
+
+ _cupsLangPrintf(stdout, _("\tqueued for %s"), dest);
}
}
}
@@ -1470,7 +1486,7 @@ show_jobs(const char *dests, /* I - Destinations */
}
else
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
return (1);
}
@@ -1569,7 +1585,7 @@ show_printers(const char *printers, /* I - Destinations */
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
ippDelete(response);
return (1);
}
@@ -1746,18 +1762,18 @@ show_printers(const char *printers, /* I - Destinations */
{
case IPP_PRINTER_IDLE :
_cupsLangPrintf(stdout,
- _("printer %s is idle. enabled since %s\n"),
+ _("printer %s is idle. enabled since %s"),
printer, printer_state_time);
break;
case IPP_PRINTER_PROCESSING :
_cupsLangPrintf(stdout,
_("printer %s now printing %s-%d. "
- "enabled since %s\n"),
+ "enabled since %s"),
printer, printer, jobid, printer_state_time);
break;
case IPP_PRINTER_STOPPED :
_cupsLangPrintf(stdout,
- _("printer %s disabled since %s -\n"),
+ _("printer %s disabled since %s -"),
printer, printer_state_time);
break;
}
@@ -1765,88 +1781,100 @@ show_printers(const char *printers, /* I - Destinations */
if ((message && *message) || pstate == IPP_PRINTER_STOPPED)
{
if (!message || !*message)
- _cupsLangPuts(stdout, _("\treason unknown\n"));
+ _cupsLangPuts(stdout, _("\treason unknown"));
else
- _cupsLangPrintf(stdout, "\t%s\n", message);
+ _cupsLangPrintf(stdout, "\t%s", message);
}
if (long_status > 1)
- _cupsLangPuts(stdout,
- _("\tForm mounted:\n"
- "\tContent types: any\n"
- "\tPrinter types: unknown\n"));
+ {
+ _cupsLangPuts(stdout, _("\tForm mounted:"));
+ _cupsLangPuts(stdout, _("\tContent types: any"));
+ _cupsLangPuts(stdout, _("\tPrinter types: unknown"));
+ }
if (long_status)
{
- _cupsLangPrintf(stdout, _("\tDescription: %s\n"),
+ _cupsLangPrintf(stdout, _("\tDescription: %s"),
description ? description : "");
if (reasons)
{
- _cupsLangPuts(stdout, _("\tAlerts:"));
- for (j = 0; j < reasons->num_values; j ++)
- _cupsLangPrintf(stdout, " %s",
- reasons->values[j].string.text);
- _cupsLangPuts(stdout, "\n");
+ char alerts[1024], /* Alerts string */
+ *aptr; /* Pointer into alerts string */
+
+ for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
+ {
+ if (i)
+ snprintf(aptr, sizeof(alerts) - (aptr - alerts), " %s",
+ reasons->values[i].string.text);
+ else
+ strlcpy(alerts, reasons->values[i].string.text,
+ sizeof(alerts));
+
+ aptr += strlen(aptr);
+ }
+
+ _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
}
}
if (long_status > 1)
{
- _cupsLangPrintf(stdout, _("\tLocation: %s\n"),
+ _cupsLangPrintf(stdout, _("\tLocation: %s"),
location ? location : "");
if (ptype & CUPS_PRINTER_REMOTE)
{
- _cupsLangPuts(stdout, _("\tConnection: remote\n"));
+ _cupsLangPuts(stdout, _("\tConnection: remote"));
if (make_model && !strstr(make_model, "System V Printer") &&
!strstr(make_model, "Raw Printer") && uri)
- _cupsLangPrintf(stdout, _("\tInterface: %s.ppd\n"),
+ _cupsLangPrintf(stdout, _("\tInterface: %s.ppd"),
uri);
}
else
{
- _cupsLangPuts(stdout, _("\tConnection: direct\n"));
+ _cupsLangPuts(stdout, _("\tConnection: direct"));
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/interfaces/%s\n"),
+ _("\tInterface: %s/interfaces/%s"),
cg->cups_serverroot, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/ppd/%s.ppd\n"),
+ _("\tInterface: %s/ppd/%s.ppd"),
cg->cups_serverroot, printer);
}
- _cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
- _cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
+ _cupsLangPuts(stdout, _("\tOn fault: no alert"));
+ _cupsLangPuts(stdout, _("\tAfter fault: continue"));
/* TODO update to use printer-error-policy */
if (allowed)
{
- _cupsLangPuts(stdout, _("\tUsers allowed:\n"));
+ _cupsLangPuts(stdout, _("\tUsers allowed:"));
for (j = 0; j < allowed->num_values; j ++)
- _cupsLangPrintf(stdout, "\t\t%s\n",
+ _cupsLangPrintf(stdout, "\t\t%s",
allowed->values[j].string.text);
}
else if (denied)
{
- _cupsLangPuts(stdout, _("\tUsers denied:\n"));
+ _cupsLangPuts(stdout, _("\tUsers denied:"));
for (j = 0; j < denied->num_values; j ++)
- _cupsLangPrintf(stdout, "\t\t%s\n",
+ _cupsLangPrintf(stdout, "\t\t%s",
denied->values[j].string.text);
}
else
{
- _cupsLangPuts(stdout, _("\tUsers allowed:\n"));
- _cupsLangPuts(stdout, _("\t\t(all)\n"));
+ _cupsLangPuts(stdout, _("\tUsers allowed:"));
+ _cupsLangPuts(stdout, _("\t\t(all)"));
}
- _cupsLangPuts(stdout, _("\tForms allowed:\n"));
- _cupsLangPuts(stdout, _("\t\t(none)\n"));
- _cupsLangPuts(stdout, _("\tBanner required\n"));
- _cupsLangPuts(stdout, _("\tCharset sets:\n"));
- _cupsLangPuts(stdout, _("\t\t(none)\n"));
- _cupsLangPuts(stdout, _("\tDefault pitch:\n"));
- _cupsLangPuts(stdout, _("\tDefault page size:\n"));
- _cupsLangPuts(stdout, _("\tDefault port settings:\n"));
+ _cupsLangPuts(stdout, _("\tForms allowed:"));
+ _cupsLangPuts(stdout, _("\t\t(none)"));
+ _cupsLangPuts(stdout, _("\tBanner required"));
+ _cupsLangPuts(stdout, _("\tCharset sets:"));
+ _cupsLangPuts(stdout, _("\t\t(none)"));
+ _cupsLangPuts(stdout, _("\tDefault pitch:"));
+ _cupsLangPuts(stdout, _("\tDefault page size:"));
+ _cupsLangPuts(stdout, _("\tDefault port settings:"));
}
for (i = 0; i < num_dests; i ++)
@@ -1857,20 +1885,20 @@ show_printers(const char *printers, /* I - Destinations */
case IPP_PRINTER_IDLE :
_cupsLangPrintf(stdout,
_("printer %s/%s is idle. "
- "enabled since %s\n"),
+ "enabled since %s"),
printer, dests[i].instance,
printer_state_time);
break;
case IPP_PRINTER_PROCESSING :
_cupsLangPrintf(stdout,
_("printer %s/%s now printing %s-%d. "
- "enabled since %s\n"),
+ "enabled since %s"),
printer, dests[i].instance, printer, jobid,
printer_state_time);
break;
case IPP_PRINTER_STOPPED :
_cupsLangPrintf(stdout,
- _("printer %s/%s disabled since %s -\n"),
+ _("printer %s/%s disabled since %s -"),
printer, dests[i].instance,
printer_state_time);
break;
@@ -1879,88 +1907,99 @@ show_printers(const char *printers, /* I - Destinations */
if ((message && *message) || pstate == IPP_PRINTER_STOPPED)
{
if (!message || !*message)
- _cupsLangPuts(stdout, _("\treason unknown\n"));
+ _cupsLangPuts(stdout, _("\treason unknown"));
else
- _cupsLangPrintf(stdout, "\t%s\n", message);
+ _cupsLangPrintf(stdout, "\t%s", message);
}
if (long_status > 1)
- _cupsLangPuts(stdout,
- _("\tForm mounted:\n"
- "\tContent types: any\n"
- "\tPrinter types: unknown\n"));
+ {
+ _cupsLangPuts(stdout, _("\tForm mounted:"));
+ _cupsLangPuts(stdout, _("\tContent types: any"));
+ _cupsLangPuts(stdout, _("\tPrinter types: unknown"));
+ }
if (long_status)
{
- _cupsLangPrintf(stdout, _("\tDescription: %s\n"),
+ _cupsLangPrintf(stdout, _("\tDescription: %s"),
description ? description : "");
if (reasons)
{
- _cupsLangPuts(stdout, _("\tAlerts:"));
- for (j = 0; j < reasons->num_values; j ++)
- _cupsLangPrintf(stdout, " %s",
- reasons->values[j].string.text);
- _cupsLangPuts(stdout, "\n");
+ char alerts[1024], /* Alerts string */
+ *aptr; /* Pointer into alerts string */
+
+ for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
+ {
+ if (i)
+ snprintf(aptr, sizeof(alerts) - (aptr - alerts), " %s",
+ reasons->values[i].string.text);
+ else
+ strlcpy(alerts, reasons->values[i].string.text,
+ sizeof(alerts));
+
+ aptr += strlen(aptr);
+ }
+
+ _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
}
}
if (long_status > 1)
{
- _cupsLangPrintf(stdout, _("\tLocation: %s\n"),
+ _cupsLangPrintf(stdout, _("\tLocation: %s"),
location ? location : "");
if (ptype & CUPS_PRINTER_REMOTE)
{
- _cupsLangPuts(stdout, _("\tConnection: remote\n"));
+ _cupsLangPuts(stdout, _("\tConnection: remote"));
if (make_model && !strstr(make_model, "System V Printer") &&
!strstr(make_model, "Raw Printer") && uri)
- _cupsLangPrintf(stdout, _("\tInterface: %s.ppd\n"),
- uri);
+ _cupsLangPrintf(stdout, _("\tInterface: %s.ppd"), uri);
}
else
{
- _cupsLangPuts(stdout, _("\tConnection: direct\n"));
+ _cupsLangPuts(stdout, _("\tConnection: direct"));
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/interfaces/%s\n"),
+ _("\tInterface: %s/interfaces/%s"),
cg->cups_serverroot, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/ppd/%s.ppd\n"),
+ _("\tInterface: %s/ppd/%s.ppd"),
cg->cups_serverroot, printer);
}
- _cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
- _cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
+ _cupsLangPuts(stdout, _("\tOn fault: no alert"));
+ _cupsLangPuts(stdout, _("\tAfter fault: continue"));
/* TODO update to use printer-error-policy */
if (allowed)
{
- _cupsLangPuts(stdout, _("\tUsers allowed:\n"));
+ _cupsLangPuts(stdout, _("\tUsers allowed:"));
for (j = 0; j < allowed->num_values; j ++)
- _cupsLangPrintf(stdout, "\t\t%s\n",
+ _cupsLangPrintf(stdout, "\t\t%s",
allowed->values[j].string.text);
}
else if (denied)
{
- _cupsLangPuts(stdout, _("\tUsers denied:\n"));
+ _cupsLangPuts(stdout, _("\tUsers denied:"));
for (j = 0; j < denied->num_values; j ++)
- _cupsLangPrintf(stdout, "\t\t%s\n",
+ _cupsLangPrintf(stdout, "\t\t%s",
denied->values[j].string.text);
}
else
{
- _cupsLangPuts(stdout, _("\tUsers allowed:\n"));
- _cupsLangPuts(stdout, _("\t\t(all)\n"));
+ _cupsLangPuts(stdout, _("\tUsers allowed:"));
+ _cupsLangPuts(stdout, _("\t\t(all)"));
}
- _cupsLangPuts(stdout, _("\tForms allowed:\n"));
- _cupsLangPuts(stdout, _("\t\t(none)\n"));
- _cupsLangPuts(stdout, _("\tBanner required\n"));
- _cupsLangPuts(stdout, _("\tCharset sets:\n"));
- _cupsLangPuts(stdout, _("\t\t(none)\n"));
- _cupsLangPuts(stdout, _("\tDefault pitch:\n"));
- _cupsLangPuts(stdout, _("\tDefault page size:\n"));
- _cupsLangPuts(stdout, _("\tDefault port settings:\n"));
+ _cupsLangPuts(stdout, _("\tForms allowed:"));
+ _cupsLangPuts(stdout, _("\t\t(none)"));
+ _cupsLangPuts(stdout, _("\tBanner required"));
+ _cupsLangPuts(stdout, _("\tCharset sets:"));
+ _cupsLangPuts(stdout, _("\t\t(none)"));
+ _cupsLangPuts(stdout, _("\tDefault pitch:"));
+ _cupsLangPuts(stdout, _("\tDefault page size:"));
+ _cupsLangPuts(stdout, _("\tDefault port settings:"));
}
}
}
@@ -1973,7 +2012,7 @@ show_printers(const char *printers, /* I - Destinations */
}
else
{
- _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
return (1);
}
@@ -1994,11 +2033,11 @@ show_scheduler(void)
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
cupsEncryption())) != NULL)
{
- _cupsLangPuts(stdout, _("scheduler is running\n"));
+ _cupsLangPuts(stdout, _("scheduler is running"));
httpClose(http);
}
else
- _cupsLangPuts(stdout, _("scheduler is not running\n"));
+ _cupsLangPuts(stdout, _("scheduler is not running"));
}