summaryrefslogtreecommitdiff
path: root/systemv
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-05-22 13:54:15 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-05-22 13:54:15 +0000
commit554aa7b74970cc720302f38c819a309a5a6ede68 (patch)
tree00034ea1c955312bae68667e5a5c3b0fce920f28 /systemv
parentcf3d4dd6dc3e66f48c6d6453843ffa3eebe7a499 (diff)
Dates in non-UTF-8 locales did not display correctly (STR #4388)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11889 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'systemv')
-rw-r--r--systemv/lpstat.c77
1 files changed, 27 insertions, 50 deletions
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index 084fc55c0..985db37b7 100644
--- a/systemv/lpstat.c
+++ b/systemv/lpstat.c
@@ -649,7 +649,6 @@ show_accepting(const char *printers, /* I - Destinations */
*message; /* Printer device URI */
int accepting; /* Accepting requests? */
time_t ptime; /* Printer state time */
- struct tm *pdate; /* Printer state date & time */
char printer_state_time[255];/* Printer state time */
static const char *pattrs[] = /* Attributes we need for printers... */
{
@@ -772,8 +771,7 @@ show_accepting(const char *printers, /* I - Destinations */
if (match_list(printers, printer))
{
- pdate = localtime(&ptime);
- strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
+ _cupsStrDate(printer_state_time, sizeof(printer_state_time), ptime);
if (accepting)
_cupsLangPrintf(stdout, _("%s accepting requests since %s"),
@@ -1278,7 +1276,6 @@ show_jobs(const char *dests, /* I - Destinations */
jobid, /* job-id */
size; /* job-k-octets */
time_t jobtime; /* time-at-creation */
- struct tm *jobdate; /* Date & time */
char temp[255], /* Temporary buffer */
date[255]; /* Date buffer */
static const char *jattrs[] = /* Attributes we need for jobs... */
@@ -1436,60 +1433,42 @@ show_jobs(const char *dests, /* I - Destinations */
if (match_list(dests, dest) && match_list(users, username))
{
- jobdate = localtime(&jobtime);
snprintf(temp, sizeof(temp), "%s-%d", dest, jobid);
- if (long_status == 3)
- {
- /*
- * Show the consolidated output format for the SGI tools...
- */
+ _cupsStrDate(date, sizeof(date), jobtime);
- if (!strftime(date, sizeof(date), "%b %d %H:%M", jobdate))
- strlcpy(date, "Unknown", sizeof(date));
-
- _cupsLangPrintf(stdout, "%s;%s;%d;%s;%s",
- temp, username ? username : "unknown",
- size, title ? title : "unknown", date);
- }
+ if (ranking)
+ _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",
+ temp, username ? username : "unknown",
+ 1024.0 * size, date);
+ if (long_status)
{
- if (!strftime(date, sizeof(date), "%c", jobdate))
- strlcpy(date, "Unknown", sizeof(date));
-
- if (ranking)
- _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",
- temp, username ? username : "unknown",
- 1024.0 * size, date);
- if (long_status)
- {
- if (message)
- _cupsLangPrintf(stdout, _("\tStatus: %s"), message);
-
- if (reasons)
- {
- char alerts[1024], /* Alerts string */
- *aptr; /* Pointer into alerts string */
+ if (message)
+ _cupsLangPrintf(stdout, _("\tStatus: %s"), message);
- for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
- {
- if (i)
- snprintf(aptr, sizeof(alerts) - (size_t)(aptr - alerts), " %s", reasons->values[i].string.text);
- else
- strlcpy(alerts, reasons->values[i].string.text, sizeof(alerts));
+ if (reasons)
+ {
+ char alerts[1024], /* Alerts string */
+ *aptr; /* Pointer into alerts string */
- aptr += strlen(aptr);
- }
+ for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
+ {
+ if (i)
+ snprintf(aptr, sizeof(alerts) - (size_t)(aptr - alerts), " %s", reasons->values[i].string.text);
+ else
+ strlcpy(alerts, reasons->values[i].string.text, sizeof(alerts));
- _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
+ aptr += strlen(aptr);
}
- _cupsLangPrintf(stdout, _("\tqueued for %s"), dest);
+ _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
}
+
+ _cupsLangPrintf(stdout, _("\tqueued for %s"), dest);
}
}
@@ -1532,7 +1511,6 @@ show_printers(const char *printers, /* I - Destinations */
ipp_pstate_t pstate; /* Printer state */
cups_ptype_t ptype; /* Printer type */
time_t ptime; /* Printer state time */
- struct tm *pdate; /* Printer state date & time */
int jobid; /* Job ID of current job */
char printer_uri[HTTP_MAX_URI],
/* Printer URI */
@@ -1776,8 +1754,7 @@ show_printers(const char *printers, /* I - Destinations */
* Display it...
*/
- pdate = localtime(&ptime);
- strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
+ _cupsStrDate(printer_state_time, sizeof(printer_state_time), ptime);
switch (pstate)
{