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>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.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>
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>
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>
[kzak@redhat.com: - add month_in_row to avoid extra meaning of num_month=-3,
- add header_year
- add long option for -Y
- define conflicts between -Y, -y and -n
- remove ctl.yflag]
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/cal.c:811:16: runtime error: signed integer overflow:
2147483645 + 536870911 cannot be represented in type 'int'
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Most of them catched on 32bit gcc and icc.
disk-utils/fsck.cramfs.c: printf format type
lib/boottime.c: unused variables
misc-utils/cal.c: set but never used
sys-utils/losetup.c: set but never used
sys-utils/lscpu-dmi.c: defined but not used
sys-utils/switch_root.c: comparison between signed and unsigned
tests/helpers/test_sysinfo.c: printf format type
Replace all puts, fputs and printf calls by my_putstring() because
we don't want to mix different output channels (buffers).
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
[kzak@redhat.com: - move paths to pathnames.h,
- use static path buffer]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This is done to keep things simple, when considering tests, for both 64
and 32 bit architectures. Setting the upper limit of a year value to to
2^31-1 (2147483646) should be enough for anyone.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Reference: http://www.spinics.net/lists/util-linux-ng/msg08662.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
While prototypes such as 'function(int, int, char, int);' are legal they
do not help when trying to understand how the function is expected to be
used. Adding variable names gives at least a hint when looking the
prototypes.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Runtime configuration is set at the time of command line option parsing,
and other initialization. Later the configuration is read-only. This
should make code a little bit more understandable.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The long option --week still has the optional argument as --week=<wnum>
This was suggested on the mailing list by Padraig Brady and I do agree with that.
Actually, the whole idea of --week=<wnum> came from him.
Signed-off-by: Tommi Kyntola <kynde@iki.fi>
Because many years have two sections of week 52 or 53, the week that
this argument points to is the one that starts during that year (when available).
The week number in argument is also highlighted in addition to possibly visible
current/defined date highlighting.
Signed-off-by: Tommi Kyntola <kynde@iki.fi>
Added week numbers both in ISO-6801 and North America numbering.
The mode is determined by first day of the week, Monday
for ISO and Sunday for North America mode.
ISO week numbers are defined as the first Thursday being part of week 1.
The North America numbering is defined, at least by gcal, as first Sunday
being in the first week.
Signed-off-by: Tommi Kyntola <kynde@iki.fi>