Commit Graph

37 Commits

Author SHA1 Message Date
Daniel Drake 1f10f4afec isosize: move ISO size functions into a shared header
Move the helper functions that parse ISO data & sector size info into
a separate, shared header.

These will addtionally be used by libblkid's iso9660 parser.

Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
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 1da83869cf isosize: usage() and coding style cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:16:51 +02:00
Karel Zak c380180289 isosize: iterate over all arguments even when something fails
Earlier the command exit too early if one of the arguments failed.  After
this change all arguments are examined, and command return value will have
information what happen during processing.

Based on patch from Sami Kerola <kerolasa@iki.fi>

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:11:11 +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 b1a294c448 misc: introduce print_usage_help_options()
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>
2017-06-27 12:26:19 +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
Sami Kerola e3e0054f5a isosize: avoid reading more data than what is needed
In same go fix error reporting when input file is not long enough.

$ touch empty
$ isosize empty
isosize: empty: might not be an ISO filesystem
isosize: read error on empty: Success

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:18:27 +02:00
Sami Kerola 8791804065 misc: do not use plain 0 as NULL [smatch scan]
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>
2017-02-20 12:58:49 +01: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
Karel Zak 17dd04c92a isosize: fix read() result check 2016-10-04 20:15:09 +02:00
Karel Zak 4c906abea2 isosize: don't ignore read() result [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-04 15:56:59 +02:00
Sami Kerola 5a2ed45309 isosize: stop unmeaningful printing errno message
Earlier printout had strange looking 'Success'.

$ isosize --sectors /dev/urandom
isosize: /dev/urandom: might not be an ISO filesystem
isosize: 733error: le=-1971599244 be=1633181607: Success
...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-03-14 13:15:12 +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 be091dee66 isosize: make --divisor to require argument
Silly bug, only the short option -d allowed divisor argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:16:21 +01:00
Sami Kerola 799e584245 isosize: move file name printing after error determination
Earlier the filename printing was buffered, and exit at error made output
to appear in front of prompt.  Output below demonstrates the brokenness.

prompt> isosize /etc /
isosize: /etc: might not be an ISO filesystem
isosize: read error on /etc: Is a directory
/etc: prompt>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:41 +01:00
Benno Schulenberg b548a8c989 textual: improve an error message and a help text
* disk-utils/isosize.c: Improve grammar of error message, and in the
help text make use of the standard angular brackets for arguments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-30 16:06:23 +01:00
Sami Kerola bb2d1ea559 isosize: inform if file does not look like iso file system
$ isosize /dev/urandom
isosize: /dev/urandom: might not be iso file system
-67690643227260

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-19 11:05:04 +01:00
Sami Kerola bb7ea8d81a isosize: fix usage() -h option print out
Fixes usage() bug from commit 4eba43a7 which claimed sort option for
--help being -H.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-19 11:05:02 +01:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Bernhard Voelker 455fe9a075 Fix typos found by misspellings
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:

  $ git ls-files | grep -v ^po/ | misspellings -f -

* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-04-23 13:16:35 +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
Sami Kerola 6f81751a85 isosize: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-30 22:11:32 +02:00
Sami Kerola e457fb854e isosize: include-what-you-use header check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-30 22:02:18 +02:00
Sami Kerola ab3a34ffc9 isosize: check user input to be numeric
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-30 22:02:10 +02:00
Sami Kerola 4eba43a768 isosize: use long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-30 21:52:18 +02:00
Sami Kerola 67a450ceaf isosize: remove global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-30 20:59:46 +02:00
Karel Zak f10788cfc5 iosize: fix gcc warning
isosize.c: In function ‘main’:
isosize.c:168:8: warning: unused variable ‘p’

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 12:37:57 +02:00
Francesco Cosoleto 9404cc7f65 elvtune, isosize: print usage text in case of invalid option
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-04-12 12:36:48 +02:00
Francesco Cosoleto 4c0ecdd4e8 isosize: use program_invocation_short_name
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-04-12 12:36:48 +02:00
Francesco Cosoleto 7361184326 isosize: simplify some error messages
perror() and fprintf() are replaced with err() calls

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 12:31:15 +02:00
Francesco Cosoleto d35c34e9fc elvtune, isosize: remove redundant message in case of invalid option
This leaves getopt() only to print a similar error message on invalid
options.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-04-12 12:15:04 +02:00
lizf 122db55d60 blockdev: fix: opened file leaving unclosed
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
2007-10-26 01:02:45 +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