Commit Graph

25 Commits

Author SHA1 Message Date
Karel Zak dc626a7586 hexdump: add header file guards [lgtm scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-20 16:13:52 +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
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
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 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 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
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
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
Josiah Worcester 95961ee294 fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc.
Signed-off-by: Josiah Worcester <josiahw@gmail.com>
2011-06-14 13:58:33 +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 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +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