cups-1.5.4-strftime.patch fixes STR #4388 (bnc#873030) OBS-URL: https://build.opensuse.org/request/show/229700 OBS-URL: https://build.opensuse.org/package/show/Printing/cups?expand=0&rev=281
289 lines
9.1 KiB
Diff
289 lines
9.1 KiB
Diff
diff -Nur cups-1.5.4.dist/cgi-bin/ipp-var.c cups-1.5.4/cgi-bin/ipp-var.c
|
||
--- cups-1.5.4.dist/cgi-bin/ipp-var.c 2011-05-20 05:49:49.000000000 +0200
|
||
+++ cups-1.5.4/cgi-bin/ipp-var.c 2014-03-09 13:21:20.065678625 +0100
|
||
@@ -1192,7 +1192,7 @@
|
||
t = (time_t)attr->values[i].integer;
|
||
date = localtime(&t);
|
||
|
||
- strftime(valptr, sizeof(value) - (valptr - value), "%c", date);
|
||
+ _cupsstrftime(valptr, sizeof(value) - (valptr - value), "%c", date);
|
||
}
|
||
else
|
||
snprintf(valptr, sizeof(value) - (valptr - value),
|
||
diff -Nur cups-1.5.4.dist/cups/language-private.h cups-1.5.4/cups/language-private.h
|
||
--- cups-1.5.4.dist/cups/language-private.h 2010-11-20 02:03:46.000000000 +0100
|
||
+++ cups-1.5.4/cups/language-private.h 2014-03-09 13:21:20.073680045 +0100
|
||
@@ -79,6 +79,7 @@
|
||
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
|
||
extern void _cupsSetLocale(char *argv[]);
|
||
|
||
+extern size_t _cupsstrftime(char *s, size_t max, const char *format, const struct tm *tm);
|
||
|
||
# ifdef __cplusplus
|
||
}
|
||
diff -Nur cups-1.5.4.dist/cups/libcups2.def cups-1.5.4/cups/libcups2.def
|
||
--- cups-1.5.4.dist/cups/libcups2.def 2011-09-09 23:55:11.000000000 +0200
|
||
+++ cups-1.5.4/cups/libcups2.def 2014-03-09 13:21:20.077680723 +0100
|
||
@@ -9,6 +9,7 @@
|
||
_cupsLangPrintf
|
||
_cupsLangPuts
|
||
_cupsLangString
|
||
+_cupsstrftime
|
||
_cupsMD5Append
|
||
_cupsMD5Finish
|
||
_cupsMD5Init
|
||
diff -Nur cups-1.5.4.dist/cups/libcups_s.exp cups-1.5.4/cups/libcups_s.exp
|
||
--- cups-1.5.4.dist/cups/libcups_s.exp 2011-04-16 01:38:13.000000000 +0200
|
||
+++ cups-1.5.4/cups/libcups_s.exp 2014-03-09 13:21:20.085681923 +0100
|
||
@@ -7,6 +7,7 @@
|
||
_cupsLangPrintf
|
||
_cupsLangPuts
|
||
_cupsLangString
|
||
+_cupsstrftime
|
||
_cupsMD5Append
|
||
_cupsMD5Finish
|
||
_cupsMD5Init
|
||
diff -Nur cups-1.5.4.dist/cups/Makefile cups-1.5.4/cups/Makefile
|
||
--- cups-1.5.4.dist/cups/Makefile 2011-09-09 18:34:29.000000000 +0200
|
||
+++ cups-1.5.4/cups/Makefile 2014-03-09 13:21:20.089682442 +0100
|
||
@@ -63,6 +63,7 @@
|
||
snmp.o \
|
||
snprintf.o \
|
||
string.o \
|
||
+ strftime.o \
|
||
tempfile.o \
|
||
thread.o \
|
||
transcode.o \
|
||
diff -Nur cups-1.5.4.dist/cups/strftime.c cups-1.5.4/cups/strftime.c
|
||
--- cups-1.5.4.dist/cups/strftime.c 1970-01-01 01:00:00.000000000 +0100
|
||
+++ cups-1.5.4/cups/strftime.c 2014-03-09 13:21:20.093682921 +0100
|
||
@@ -0,0 +1,56 @@
|
||
+/*
|
||
+ * "$Id$"
|
||
+ *
|
||
+ * Localized strftime function for CUPS.
|
||
+ *
|
||
+ *
|
||
+ * Contents:
|
||
+ *
|
||
+ * _cupsstrftime() - format date and time
|
||
+ */
|
||
+
|
||
+/*
|
||
+ * Include necessary headers...
|
||
+ */
|
||
+
|
||
+#include "cups-private.h"
|
||
+
|
||
+
|
||
+/*
|
||
+ * '_cupsstrftime()' - format date and time in current locale and convert to UTF8
|
||
+ */
|
||
+
|
||
+size_t
|
||
+_cupsstrftime(char *s, size_t max, const char *format, const struct tm *tm)
|
||
+{
|
||
+ size_t size=0;
|
||
+ char date[256]; /* Date buffer */
|
||
+ cups_utf8_t utf8[256]; /* Date in utf8 */
|
||
+ _cups_globals_t *cg; /* Global data */
|
||
+
|
||
+ cg = _cupsGlobals();
|
||
+
|
||
+ if (!cg->lang_default)
|
||
+ cg->lang_default = cupsLangDefault();
|
||
+
|
||
+ if ((size=strftime(date, max, format, tm))!=0)
|
||
+ {
|
||
+
|
||
+ if (cg->lang_default->encoding != CUPS_UTF8)
|
||
+ {
|
||
+ cupsCharsetToUTF8(utf8, date, (int)sizeof(utf8), cg->lang_default->encoding);
|
||
+ strncpy(s, utf8, 256);
|
||
+ }
|
||
+ else {
|
||
+ strncpy(s, date, 256);
|
||
+ }
|
||
+ }
|
||
+ return ((size_t)size);
|
||
+}
|
||
+
|
||
+
|
||
+
|
||
+
|
||
+/*
|
||
+ * End of "$Id$".
|
||
+ */
|
||
diff -Nur cups-1.5.4.dist/cups/testipp.c cups-1.5.4/cups/testipp.c
|
||
--- cups-1.5.4.dist/cups/testipp.c 2011-09-14 02:31:10.000000000 +0200
|
||
+++ cups-1.5.4/cups/testipp.c 2014-03-09 13:21:20.101683760 +0100
|
||
@@ -891,7 +891,7 @@
|
||
{
|
||
vtime = ippDateToTime(val->date);
|
||
vdate = localtime(&vtime);
|
||
- strftime(vstring, sizeof(vstring), "%c", vdate);
|
||
+ _cupsstrftime(vstring, sizeof(vstring), "%c", vdate);
|
||
printf(" (%s)", vstring);
|
||
}
|
||
}
|
||
diff -Nur cups-1.5.4.dist/filter/bannertops.c cups-1.5.4/filter/bannertops.c
|
||
--- cups-1.5.4.dist/filter/bannertops.c 2011-05-20 05:49:49.000000000 +0200
|
||
+++ cups-1.5.4/filter/bannertops.c 2014-03-09 13:21:20.105684120 +0100
|
||
@@ -843,7 +843,7 @@
|
||
curtime = (time_t)atoi(option);
|
||
curdate = localtime(&curtime);
|
||
|
||
- strftime(text, sizeof(text), "%c", curdate);
|
||
+ _cupsstrftime(text, sizeof(text), "%c", curdate);
|
||
}
|
||
else
|
||
strlcpy(text, "?", sizeof(text));
|
||
@@ -865,7 +865,7 @@
|
||
curtime = (time_t)atoi(option);
|
||
curdate = localtime(&curtime);
|
||
|
||
- strftime(text, sizeof(text), "%c", curdate);
|
||
+ _cupsstrftime(text, sizeof(text), "%c", curdate);
|
||
}
|
||
else
|
||
strlcpy(text, "?", sizeof(text));
|
||
@@ -1066,7 +1066,7 @@
|
||
|
||
curtime = time(NULL);
|
||
curtm = localtime(&curtime);
|
||
- strftime(curdate, sizeof(curdate), "%c", curtm);
|
||
+ _cupsstrftime(curdate, sizeof(curdate), "%c", curtm);
|
||
|
||
puts("%!PS-Adobe-3.0");
|
||
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", PageLeft, PageBottom,
|
||
diff -Nur cups-1.5.4.dist/filter/imagetops.c cups-1.5.4/filter/imagetops.c
|
||
--- cups-1.5.4.dist/filter/imagetops.c 2011-08-17 23:01:53.000000000 +0200
|
||
+++ cups-1.5.4/filter/imagetops.c 2014-03-09 13:21:20.113684721 +0100
|
||
@@ -618,7 +618,7 @@
|
||
puts("%%DocumentData: Clean7Bit");
|
||
puts("%%DocumentNeededResources: font Helvetica-Bold");
|
||
puts("%%Creator: imagetops/" CUPS_SVERSION);
|
||
- strftime(curdate, sizeof(curdate), "%c", curtm);
|
||
+ _cupsstrftime(curdate, sizeof(curdate), "%c", curtm);
|
||
printf("%%%%CreationDate: %s\n", curdate);
|
||
WriteTextComment("Title", argv[3]);
|
||
WriteTextComment("For", argv[2]);
|
||
diff -Nur cups-1.5.4.dist/filter/texttops.c cups-1.5.4/filter/texttops.c
|
||
--- cups-1.5.4.dist/filter/texttops.c 2010-12-03 07:29:20.000000000 +0100
|
||
+++ cups-1.5.4/filter/texttops.c 2014-03-09 13:21:20.117684961 +0100
|
||
@@ -223,7 +223,7 @@
|
||
|
||
curtime = time(NULL);
|
||
curtm = localtime(&curtime);
|
||
- strftime(curdate, sizeof(curdate), "%c", curtm);
|
||
+ _cupsstrftime(curdate, sizeof(curdate), "%c", curtm);
|
||
|
||
puts("%!PS-Adobe-3.0");
|
||
printf("%%%%BoundingBox: 0 0 %.0f %.0f\n", PageWidth, PageLength);
|
||
diff -Nur cups-1.5.4.dist/scheduler/testsub.c cups-1.5.4/scheduler/testsub.c
|
||
--- cups-1.5.4.dist/scheduler/testsub.c 2010-03-24 01:45:34.000000000 +0100
|
||
+++ cups-1.5.4/scheduler/testsub.c 2014-03-09 13:21:20.125685362 +0100
|
||
@@ -442,7 +442,7 @@
|
||
{
|
||
vtime = ippDateToTime(val->date);
|
||
vdate = localtime(&vtime);
|
||
- strftime(vstring, sizeof(vstring), "%c", vdate);
|
||
+ _cupsstrftime(vstring, sizeof(vstring), "%c", vdate);
|
||
printf(" (%s)", vstring);
|
||
}
|
||
}
|
||
diff -Nur cups-1.5.4.dist/systemv/lpstat.c cups-1.5.4/systemv/lpstat.c
|
||
--- cups-1.5.4.dist/systemv/lpstat.c 2011-10-07 23:41:07.000000000 +0200
|
||
+++ cups-1.5.4/systemv/lpstat.c 2014-03-09 13:21:20.133685662 +0100
|
||
@@ -744,7 +744,7 @@
|
||
if (match_list(printers, printer))
|
||
{
|
||
pdate = localtime(&ptime);
|
||
- strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
|
||
+ _cupsstrftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
|
||
|
||
if (accepting)
|
||
_cupsLangPrintf(stdout, _("%s accepting requests since %s"),
|
||
@@ -1436,7 +1436,7 @@
|
||
* Show the consolidated output format for the SGI tools...
|
||
*/
|
||
|
||
- if (!strftime(date, sizeof(date), "%b %d %H:%M", jobdate))
|
||
+ if (!_cupsstrftime(date, sizeof(date), "%b %d %H:%M", jobdate))
|
||
strcpy(date, "Unknown");
|
||
|
||
_cupsLangPrintf(stdout, "%s;%s;%d;%s;%s",
|
||
@@ -1445,7 +1445,7 @@
|
||
}
|
||
else
|
||
{
|
||
- if (!strftime(date, sizeof(date), "%c", jobdate))
|
||
+ if (!_cupsstrftime(date, sizeof(date), "%c", jobdate))
|
||
strcpy(date, "Unknown");
|
||
|
||
if (ranking)
|
||
@@ -1764,7 +1764,7 @@
|
||
*/
|
||
|
||
pdate = localtime(&ptime);
|
||
- strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
|
||
+ _cupsstrftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
|
||
|
||
switch (pstate)
|
||
{
|
||
--- cups-1.5.4.dist/test/run-stp-tests.sh 2014-03-12 08:35:30.805162912 +0100
|
||
+++ cups-1.5.4/test/run-stp-tests.sh 2014-03-12 09:45:53.668548631 +0100
|
||
@@ -411,6 +411,19 @@
|
||
i=`expr $i + 1`
|
||
done
|
||
|
||
+cat >>/tmp/cups-$user/printers.conf <<EOF
|
||
+<Printer test5.4>
|
||
+Accepting Yes
|
||
+DeviceURI file:/dev/null
|
||
+Info Test raw printer $i
|
||
+JobSheets none none
|
||
+Location CUPS test suite
|
||
+State Idle
|
||
+StateTime 1394607600
|
||
+StateMessage Printer $1 is idle.
|
||
+</Printer>
|
||
+EOF
|
||
+
|
||
if test -f /tmp/cups-$user/printers.conf; then
|
||
cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
|
||
else
|
||
--- cups-1.5.4.dist/test/5.4-lpstat.sh 2014-03-12 08:26:22.738824487 +0100
|
||
+++ cups-1.5.4/test/5.4-lpstat.sh 2014-03-12 09:44:43.838713821 +0100
|
||
@@ -38,6 +38,30 @@
|
||
fi
|
||
echo ""
|
||
|
||
+echo "LPSTAT Test"
|
||
+echo ""
|
||
+echo " lpstat -p"
|
||
+state="`../systemv/lpstat -p test5.4 | head -1 2>&1`"
|
||
+if test $? != 0 -o "x$state" != "xprinter test5.4 is idle. enabled since Wed Mar 12 08:00:00 2014"; then
|
||
+ echo " FAILED"
|
||
+ exit 1
|
||
+else
|
||
+ echo " PASSED"
|
||
+fi
|
||
+echo ""
|
||
+
|
||
+echo "LPSTAT Test2"
|
||
+echo ""
|
||
+echo " LC_ALL=de_DE@euro lpstat -p"
|
||
+state="`LC_ALL=de_DE@euro ../systemv/lpstat -p test5.4 | head -1 2>&1`"
|
||
+if test $? != 0 -o "x$state" != "xprinter test5.4 is idle. enabled since Mi 12 M<>r 2014 08:00:00 CET"; then
|
||
+ echo " FAILED"
|
||
+ exit 1
|
||
+else
|
||
+ echo " PASSED"
|
||
+fi
|
||
+echo ""
|
||
+
|
||
#
|
||
# End of "$Id: 5.4-lpstat.sh 8498 2009-04-13 17:03:15Z mike $".
|
||
#
|