| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* avoid divide by zero in mountly() dues to wrong months_in_row
* make sure months_in_row is at least 1
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.
Reported-by: Nuno Silva <nunojsilva@ist.utl.pt>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
The need to calculate with whole years when go back for --span.
Addresses: https://github.com/karelzak/util-linux/issues/677
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file. That inspired me to look if there are more
strings that does not need translation project attention. This change
removes at least some of them, if not all.
Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
| |
The test program follows CAL_TEST_TIME=<sec> rather than libc time().
It allows to use cal(1) in regression tests in cases where output
depends on the current time.
(We already use the same for example for logger.)
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
* modify number of months in row according to the terminal width
* don't print blank space behind last char on row
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having the -3 option set months_in_row causes ordinal days
to wrap; it overrides the automatic handling of months_in_row
that falls back to 2 month columns for ordinal days.
Before:
cal -3j 2020
2020
July August September
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
182 183 184 185 186 187 213 214 215 244 245 246 247 248 249 250
188 189 190 191 192 193 194 216 217 218 219 220 221 222 251 252 253 254 255 256 257
195 196 197 198 199 200 201 223 224 225 226 227 228 229 258 259 260 261 262 263 264
202 203 204 205 206 207 208 230 231 232 233 234 235 236 265 266 267 268 269 270 271
209 210 211 212 237 238 239 240 241 242 243 272 273
Patched:
cal -3j 2020
2020
December January
Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat
335 336 337 338 339 340 341 1 2 3 4
342 343 344 345 346 347 348 5 6 7 8 9 10 11
349 350 351 352 353 354 355 12 13 14 15 16 17 18
356 357 358 359 360 361 362 19 20 21 22 23 24 25
363 364 365 26 27 28 29 30 31
February
Sun Mon Tue Wed Thu Fri Sat
32
33 34 35 36 37 38 39
40 41 42 43 44 45 46
47 48 49 50 51 52 53
54 55 56 57 58 59 60
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I don't know if this was an oversight or an overzealous
interpretation of POSIX. Just in case, I'll address the
POSIX possibility. POSIX description for cal(1) says:
If only the year operand is given, cal shall produce a
calendar for all twelve months in the given calendar year.
It also says that cal(1) has no options, so in that context
if an option is given then it should be expected to override
POSIX behavior.
Before patched all of these command displayed a full year:
cal -1 2020
cal -3 2020
cal -n6 2020
Patched the number of months options are honored.
This patch also fixes the -1 option which was a no-op.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit efafeaf set 1 Jan as week 1, but the change
was missed in week_to_day() and in the man page.
Before
cal --week=40 --iso 1752
October 1752
Su Mo Tu We Th Fr Sa
41 1 2 3 4 5 6 7
42 8 9 10 11 12 13 14
43 15 16 17 18 19 20 21
44 22 23 24 25 26 27 28
45 29 30 31
Patched
cal --week=40 --iso 1752
September 1752
Su Mo Tu We Th Fr Sa
36 1 2
37 3 4 5 6 7 8 9
38 10 11 12 13 14 15 16
39 17 18 19 20 21 22 23
40 24 25 26 27 28 29 30
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
cal --week=39 1752
September 1752
Su Mo Tu We Th Fr Sa
36 1 2 14 15 16
37 17 18 19 20 21 22 23
38 24 25 26 27 28 29 30
Patched:
cal --week=39 1752
October 1752
Su Mo Tu We Th Fr Sa
39 1 2 3 4 5 6 7
40 8 9 10 11 12 13 14
41 15 16 17 18 19 20 21
42 22 23 24 25 26 27 28
43 29 30 31
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
| |
cal: use ALTMON_* and _NL_ABALTMON_* constants to display
months in a standalone form correctly. These constants have just
been newly added to glibc. ALTMON_x has been used in BSD family
since 1990s and has been accepted as the future POSIX extension.
_NL_ABALTMON_* is exclusively a GNU extension but it is expected
to be added to POSIX in future.
More info: https://sourceware.org/bugzilla/show_bug.cgi?id=10871
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
cal --r julian 31 12 2147483646
December 2147483646
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Patched:
cal --r julian 31 12 2147483646
December 2147483646
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Create the new option: --reform <1752|gregorian|iso|julian>
This adds the capability to display either the proleptic Gregorian or
the Julian calendar systems exclusively.
Also create the option --iso as alias of --reform=gregorian.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Sun, Dec 17, 2017 at 07:47:49PM -0500, J William Piggott wrote
> * it contains multi-byte characters (which is what drew me to reading it).
> * it truncates one very important piece of the formula: ". . . (mod 7)."
> * it explains the values for 'e', but there is no 'e' in the code.
> * it doesn't include a row resolving 'e' in the table, so it is not
> obvious what it relates to in the code.
> * without citing it as an external reference, the comment language is confusing.
Co-Author: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
It was mistake, we use extra rule for date < 1752 from the beginning
and another calculations depends on this.
This reverts commit b9bd8dc267a71611859496bff29e329868273714.
|
|
|
|
|
|
| |
Based on BERNDT E.SCHWERDTFEGER papers.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Gregorian rule for leap years has been adopted by reformation in year
1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.)
don't care about it and apply the new rule for all year -- including
years before the reformation.
It's better to be compatible with another tools than try to be perfect :-)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
|
|
|
|
|
| |
Here we fix all cases where we have usage(FILE*)
functions.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Original patch and commit message edited by Rudi.)
gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra.
This warning can be silenced by using comment /* fallthrough */
which is also recognized by other tools like coverity. There are
also other valid comments (see man gcc-7) but we consolidate this
style now.
We could have also used __attribute__((fallthrough)) but the comment
looks nice and does not need to be ifdef'ed for compatibility.
Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Suggested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
| |
* assume ncursesw headers in ncursesw/ directory only
* prefer long paths, <term.h> and <ncurses.h> should be last
possibility
* fix typos
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
* use proper paths to term.h
* keep ncurses support optional
* link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses)
* don't include unnecessary ncurses.h (term.h is enough)
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
| |
|
|
|
|
|
|
|
|
| |
The current default is to print all usage() output. This is overkill
in many case.
Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
# command used was:
$ ~/src/codespell/codespell \
-w -D /home/rudi/src/codespell/build/lib/codespell_lib/data/dictionary.txt \
$(git ls-files | grep -v "^po/\|\.xz$\|\.gz$\|\.bz2$\|\.img$\|^Documentation/releases/")
BTW some manually grammer fixes:
s/uses/used/
s/begin/beginning/
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
For example 'cal August' to print August for the current year.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
| |
|
|
|
|
|
|
|
| |
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
|
|
|
|
|
|
|
|
| |
For example
$ cal '2 weeks ago'
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
For example:
$ cal August 2016
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
It seems that people are crazy enough to assume that "cal 16" is the
year 2016, rather than 16 (2000 years ago).
This patch makes it more clear as the output is 0016.
Addresses: https://github.com/karelzak/util-linux/issues/320
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
Missed in commit b4566a8a8d0cf345e637194f9c95091a1ef4dfe0.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
| |
When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
It is unlikely anyone is going to build this project on system where
libtermcap is available. Fedora project obsoleted libtermcap 2007-12-12 in
favour of ncurses. Debian made same move 2005.
Reference: https://fedoraproject.org/wiki/Deprecated_packages
Reference: https://www.debian.org/doc/manuals/debian-faq/ch-compat.en.html#s-termcap
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
This allows the date spanning behaviour of -3 to be used with other
month ranges.
Signed-off-by: Deiz <silverwraithii@gmail.com>
|
|
|
|
|
|
|
|
| |
This fixes a minor issue where cal -n 3 would mirror the spanning
behaviour of cal -3 with Gregorian calendars, instead of starting with
the current month.
Signed-off-by: Deiz <silverwraithii@gmail.com>
|
|
|
|
|
|
|
| |
This allows Sunday based week 54 be highlighted, and deny week 54 for
Monday based weeks when year has only 52 weeks.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
| |
This makes it easier to know what the values in guestion represent.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
| |
Jan 1 is always First week, and year always has 53 weeks. The week 53
may be cut short, e.g., it may and often has fewer than 7 days. Every
year 28 year intervals US week numbering continues all the way to 54th
week, such as 1972, 2000, and 2028.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1249486
Reported-by: Michal Toth
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|