Commit Graph

47 Commits

Author SHA1 Message Date
Chris Hofstaedtler d0aa83147a hexdump: automatically use -C when called as hd
When invoking hexdump as hd enable the "Canonical" format to by
default, implying the -C option.

This is historic behaviour on Debian and apparently also on FreeBSD.
Some Debian users have asked for this to be restored, after Debian
switched to util-linux' hexdump and hd.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2020-07-23 12:23:56 +02:00
Karel Zak f1970cc557 docs: improve size arguments description in --help output
Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 11:01:36 +01: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
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 86be6a32d3 misc: cosmetics, remove argument from usage(FILE*)
This patch is trivial and changes nothing, because
we were always using usage(stdout)

Now all our usage() functions look very similar. If wanted we
could auto-generate another big cosmetical patch to remove all
the useless "FILE *out" constants and use printf and puts
rather than their f* friends. Such patch could be automatically
synchronized with the translation project (newlines!) to not
make the translators sick.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier 0caad87fdb misc: remove superfluous null pointer checks for optarg
This is only needed for optional arguments.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 02:56:57 +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
Phil Ruffwind 925ced8353 hexdump: certain long options should not accept arguments
As documented in the manual and the usage info, the long options
--one-byte-char, --canonical, and --two-bytes-octal should not accept
any arguments.

Signed-off-by: Phil Ruffwind <rf@rufflewind.com>
2016-03-06 13:47:32 -05:00
Karel Zak 5d51dc2a7f colors: cleanup man pages, add hint to usage()
cfdisk, fdisk, calm dmesg and hexdump

Signed-off-by: Karel Zak <kzak@redhat.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-25 12:40:06 +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 bf60e9f12d hexdump: remove deprecation message
Message 'calling hexdump as od has been deprecated in favor of GNU
coreutils od' has informed the hexdump not to be used like that for three
and half years, and five releases.  It is time to get rid of notice.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:12 +02:00
Benno Schulenberg 1d23119072 textual: remove some inconsistent periods from error messages
While doing so, also improve translatability and some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-11 14:51:54 +02:00
Ondrej Oprala d0c9ddc3cc lib/colors: check for /etc/terminal-colors.d/[util].disable
[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>
2014-03-11 09:38:09 +01:00
Ondrej Oprala 098ab0778f hexdump: add highlighting support
[kzak@redhat.com: - fix coding style,
                  - use xalloc in all code,
		  - fix strtol usage]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 16:01:37 +01:00
Andrew Vagin 917c3733f8 hexdump: don't access hex after freeing it
[kzak@redhat.com: - remove unnecessary code]

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-06 14:01:04 +01:00
Karel Zak 2152af7289 hexdump: use xcalloc()
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-06 13:54:48 +01:00
Ondrej Oprala 1f77e9c3ad hexdump: Create struct hexdump containing previously global variables.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:24 +01:00
Ondrej Oprala bb8ae572ef hexdump: rename struct _fs to struct hexdump_fs and remove its typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:23 +01:00
Ondrej Oprala 046921da22 hexdump: rename struct _fu to struct hexdump_fu and remove its typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:22 +01:00
Ondrej Oprala 4c73d29c06 hexdump: Rename struct _pr to struct hexdump_pr and remove it's typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:21 +01:00
Ondrej Oprala 9f399910f2 hexdump: rename rewrite to rewrite_rules
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:21 +01:00
Ondrej Oprala 9fa53cebe4 hexdump: rename add to add_fmt
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:20 +01:00
Ondrej Oprala d4646ea4b0 hexdump: Merge hexsyntax.c into hexdump.c
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:19 +01:00
Ondrej Oprala d2740b0ef6 hexdump: catch memory leaks
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 14:16:29 +01:00
Ondrej Oprala 2f83c8f032 hexdump: simplify newsyntax arguments
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 12:54:53 +01:00
Ondrej Oprala bbc8c1531f hexdump: rename next{fs,fu,pr} to {fs,fu,pr}list
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 12:54:52 +01:00
Ondrej Oprala d6e5614e5d hexdump: formatting and variable name cleanup
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 12:54:52 +01:00
Ondrej Oprala cbc6c0da30 hexdump: cleanup of redundant symbols/repeating literals
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 12:54:52 +01:00
Ondrej Oprala 9db5120719 hexdump: use list.h queues and rewrite redundant for cycles
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-11-08 12:54:52 +01:00
Sami Kerola 4ccf113704 hexdump: revert global exitval variable change
The change f2a037fb7b had unfavorable
effect of making hexdump to return non-zero exit value always.

This happen because oversight when 'exitval' gets to be set.  By clance,
one might expect main() to call next() which will return value for
'exitval'.  That assessment misses later call chain main() -> display()
-> get() -> next(), which in reverse should return correct value for
'exitval'.

It was mentioned in util-linux maillist that Ondrej Oprala is working on
major renewal of the hexdump .  That in mind it seems best to simply to
revert the global 'exitval' and avoid conflict with Ondrej's work.

Reference: http://markmail.org/message/sbnvuhkboreujj5p
Reported-by: Dave Reisner <d@falconindy.com>
CC: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-09-10 12:57:31 +02:00
Sami Kerola f2a037fb7b hexdump: remove unnecessary global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-01 11:08:01 +02:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Sami Kerola 89a13b46bd hexdump: fix shadow declaration
text-utils/hexdump.h:84:5: warning: shadowed declaration is here [-Wshadow]
./include/xalloc.h:23:28: warning: declaration of 'size' shadows a global declaration [-Wshadow]
./include/xalloc.h:33:40: warning: declaration of 'size' shadows a global declaration [-Wshadow]
./include/xalloc.h:43:49: warning: declaration of 'size' shadows a global declaration [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26 13:51:22 +02:00
Karel Zak b6b0ea094b hexdump: fix comparison of distinct pointer types
display.c: In function ‘get’:
display.c:262:117: warning: comparison of distinct pointer types lacks
a cast [enabled by default]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-23 10:20:19 +02:00
Sami Kerola b87cbe8486 text-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:45:41 +02:00
Karel Zak 807e40c655 hexdump: use strtosize() for -n and -s
strtosize() is based on uintmax_t and supports all possible suffixes
(B,M,G,T ...)

Reported-by: Simon de Vlieger <simon@ikanobori.jp>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-21 19:35:22 +01:00
Karel Zak 0a0803460c hexdump: don't include err.h directly 2011-04-12 12:58:17 +02:00
Sami Kerola 85bf44b714 hexdump: new usage(), xalloc and err.h stuff
New usage help screen and print version switch. Also fixes to
exit codes, util linux xmalloc replaced emalloc and every error
print is using libc error function.

[kzak@redhat.com: - minor changes in formatting and coding style]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21 14:38:23 +01:00
Sami Kerola 604eb2602c hexdump: remove od functionality in favor to GNU coreutils od
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2010-12-30 23:11:43 +01:00
Karel Zak ffc4374869 Imported from util-linux-2.11o tarball. 2006-12-07 00:25:53 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak 6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00