Commit Graph

37 Commits

Author SHA1 Message Date
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Karel Zak 68224d108d include/c: add print_version() macro
Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.

It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 13:47:17 +02:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
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>
2017-06-29 16:54:33 +02:00
Ruediger Meier b305445495 misc: consolidate all --help option descriptions
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:28:36 +02:00
Ruediger Meier 6e1eda6f22 misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
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>
2016-12-19 13:13:34 +01:00
Sami Kerola 98b4f74e1f
mkfs.bfs: allow creating file system to a file
Most, if not all, linux file systems allow this and there should not be a
reason why bfs could not do the same.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-22 20:56:37 +00:00
Sami Kerola 5fc7694a54
mkfs.bfs: fix block device open race
This fix makes mkfs.bfs also to detect if block device is busy, and warn if
the device is misaligned.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-22 20:56:37 +00:00
Boris Egorov e3ca1312a2 sys-utils/disk-utils/lib: fix printf format types [cppcheck]
Fix 'invalidPrintfArgType' cppcheck warnings

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:45 +02:00
Benno Schulenberg fc14ceba5e textual: grammarize and harmonize the stat error message
The message "stat failed %s" seems to say that stat() failed to
do something, or failed to pass a test, but of course it means
that the statting of something failed.  So say so.  Also make
two very similar messages equal to this one.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 11:27:10 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Karel Zak ee312c654b docs: fix "behaviour" vs. "behavior"
Sometimes we use "behaviour" and "behavior" in the same text, let's
use "behavior" only everywhere.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-06 09:49:35 +02:00
ihno 9d07f58d5f mkfs.bfs: fix 64-Bit and endian problems
[kzak@redhat.com: - use cpu_to_leXX() macros rather than htoleXX()]

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 13:41:14 +02:00
Sami Kerola 0dfd626f54 mkfs.bfs: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:07 +02:00
Karel Zak e421313dc2 textual: use UTIL_LINUX_VERSION everywhere
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-25 12:05:26 +01:00
Sami Kerola add1b8afd0 translation: unify stat error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Karel Zak 33fb5cfd49 disk-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:43:32 +02:00
Sami Kerola 45ca68ece7 disk-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 20:04:39 +02:00
Davidlohr Bueso 88ffbf86e0 mkfs.bfs: add setlocale
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-02-22 11:51:57 +01:00
Karel Zak 7148256802 mkfs.bfs: cleanu p --version output
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-18 17:15:00 +02:00
Karel Zak e5794f549d mkfs.bfs: use err() instead of errx()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-18 17:08:45 +02:00
Sami Kerola 6496cb07b0 mkfs.bfs: coding style fix
Sync with README.devel

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 22:46:21 +02:00
Sami Kerola fa620557cf mkfs.bfs: include-what-you-use header check
The limits.h is added for CHAR_MAX

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 21:25:08 +02:00
Sami Kerola b7e2711704 mkfs.bfs: validate numeric user inputs
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 21:11:49 +02:00
Sami Kerola e0c67b83c3 mkfs.bfs: use xstrdup from xalloc.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 21:11:49 +02:00
Sami Kerola de8b064b8f mkfs.bfs: add long options
Includes new usage output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 21:11:43 +02:00
Sami Kerola c36f105df7 mkfs.bfs: use libc error facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-11 20:32:37 +02:00
Guillem Jover cef0ccd580 Remove now unused <sys/ioctl.h> includes
Those became unused with the switch to the blkdev functions.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2009-10-09 15:17:54 +02:00
Samuel Thibault 098fa6b120 disk-utils: clean up code, use blkdev_* functions
[kzak@redhat.com: split the original patch to small patches]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-07-24 01:15:07 +02:00
Matthias Koenig 2018629905 disk-utils: let mkfs tools open with O_EXCL
Let mkswap, mkfs.bfs, mkfs.minix open with O_EXCL if
used on block devices to prevent writing to the device
even if they are busy (mounted).

Unfortunately, O_EXCL has zero effect for 2.4 kernels where
in-kernel code doesn't use O_EXCL-like access locks. (Tested
on RHEL3.)

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-27 13:39:29 +02:00
Karel Zak baf39af15b Imported from util-linux-2.13-pre2 tarball. 2006-12-07 00:26:58 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak ffc4374869 Imported from util-linux-2.11o tarball. 2006-12-07 00:25:53 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak eb63b9b8f4 Imported from util-linux-2.10f tarball. 2006-12-07 00:25:41 +01:00