Root/package/util-linux/patches/000-compile.patch

1--- a/misc-utils/cal.c
2+++ b/misc-utils/cal.c
3@@ -291,41 +291,6 @@ main(int argc, char **argv) {
4     }
5 #endif
6 
7-/*
8- * The traditional Unix cal utility starts the week at Sunday,
9- * while ISO 8601 starts at Monday. We read the start day from
10- * the locale database, which can be overridden with the
11- * -s (Sunday) or -m (Monday) options.
12- */
13-#if HAVE_DECL__NL_TIME_WEEK_1STDAY
14- /*
15- * You need to use 2 locale variables to get the first day of the week.
16- * This is needed to support first_weekday=2 and first_workday=1 for
17- * the rare case where working days span across 2 weeks.
18- * This shell script shows the combinations and calculations involved:
19- *
20- * for LANG in en_US ru_RU fr_FR csb_PL POSIX; do
21- * printf "%s:\t%s + %s -1 = " $LANG $(locale week-1stday first_weekday)
22- * date -d"$(locale week-1stday) +$(($(locale first_weekday)-1))day" +%w
23- * done
24- *
25- * en_US: 19971130 + 1 -1 = 0 #0 = sunday
26- * ru_RU: 19971130 + 2 -1 = 1
27- * fr_FR: 19971201 + 1 -1 = 1
28- * csb_PL: 19971201 + 2 -1 = 2
29- * POSIX: 19971201 + 7 -1 = 0
30- */
31- {
32- int wfd;
33- union { unsigned int word; char *string; } val;
34- val.string = nl_langinfo(_NL_TIME_WEEK_1STDAY);
35-
36- wfd = val.word;
37- wfd = day_in_week(wfd % 100, (wfd / 100) % 100, wfd / (100 * 100));
38- weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7;
39- }
40-#endif
41-
42     yflag = 0;
43     while ((ch = getopt_long(argc, argv, "13mjsyVh", longopts, NULL)) != -1)
44         switch(ch) {
45

Archive Download this file



interactive