* hwclock.c: replace interpret_date_string() with parse_date().
Eliminates shell injection vulnerability from popen() date(1).
Removes system dependency on date(1).
Reduction in hwclock execution time.
Significant cleanup of hwclock.c code.
* Bug fix for "hwclock --predict --date 'bad_date'" printing:
hwclock: No usable set-to time. Cannot set clock.
The message now matches date(1) for an invalid --date argument.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
* add lib/parse-date.y to build system
* add necessary autotools stuff to generate .c on the fly
(autotools are smart enough to add generated file to tarball)
* check for bison version by ./autogen.sh
* add non-wanted junk to .gitignore
With some modification by J William Piggott with regard to
moving the parse-date API into timeutils.h
Signed-off-by: J William Piggott <elseifthen@gmx.com>
* include/timeutils.h
Add parse-date API
* lib/parse-date.y - new file
Lib function that parses a date string into a timespec struct.
Derived from gnulib-dd7a871 parse-datetime.y with these changes:
* reduced to a single function API renamed to parse_date()
* removed gnulib dependencies
* removed debugging
* converted to util-linux coding style
* include/cctype.h - new file
Like ctype.h only hard coded to the 'C' locale.
Used by lib/parse-date.y.
Derived from gnulib-dd7a871 c-ctype.h with these changes:
* removed gnulib dependencies
* converted to util-linux coding style
* add requisite util-linux constants
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Now it's impossible to add new column if the table already contains
lines with data. This patch forces library to realloc cell array in
the lines to accept a new column.
Signed-off-by: Karel Zak <kzak@redhat.com>
The man page contains mistakes. The default is to fill columns before
lines:
$ printf 'aaaaaaaaaaaaaaaaaaaaaa\nBBBBBBBBBBBBBBBBBBBBB\nXXXXXXX\nYYYYYYYYYYY\nZZZZZ' > data
$ column --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa XXXXXXX ZZZZZ
BBBBBBBBBBBBBBBBBBBBB YYYYYYYYYYY
$ column --fillrows --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa BBBBBBBBBBBBBBBBBBBBB XXXXXXX
YYYYYYYYYYY ZZZZZ
The patch also rename functions in the code to make it more obvious
for code readers.
Signed-off-by: Karel Zak <kzak@redhat.com>
The length option is used to specify the number of zones to
operate on. To be more consistent with other tools, have this
option use a number of sectors and introduce the --count option
to allow users to specify a number of zones.
The --count and --length options cannot be used together on
the command line.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.
Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Report all zones of the block device when length is not specified
on the command line. To do this, introduce an inner loop in
blkzone_report to repeatedly issue report zone ioctl to the
device.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
If length is 0, operate on all zones starting from offset.
This also fix the maximum length calculation from offset.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.
Signed-off-by: Karel Zak <kzak@redhat.com>
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
according to MASTERNAME. Note that we have to use $build_<mastername>,
the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
$build_ is evaluated and modified by our UL_...() functions.
* add enable-schedutils.conf to have build-system regression test for
this use-case
Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
Else these variables will cause following warning:
libblkid/src/superblocks/superblocks.c:165:29: warning: symbol
'superblocks_drv' was not declared. Should it be static?
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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>
disk-utils/cfdisk.c:1066:29: error: cannot size expression
One should use sizeof() only when variable size can be known at time of
compilation. That is not the case with variable length arrays.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>