scanf("%x") knows to eat up this prefix[1][2], so we don't need to do this
ourselves.
[1] K&R's "The C Programming Language" documents "%x" as "hexadecimal
integer (with or without leading 0x or 0X)"
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.
Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
sscanf() returns EOF when it reaches the end of the string. Our code
erroneously interprets this as if a number was read. The fix: we test for an
explicit '1'.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
hex.c: In function 'mc_search__hex_translate_to_regex':
hex.c:79:39: error: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=]
if (sscanf (tmp_str + loop, "%x%n", &val, &ptr))
^
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Hexadecimal values like "2d f0" can be used as well as "0x2d 0xf0"
in all search dialogs where hexadecimal search is supported.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
(mc_search__hex_translate_to_regex): don't use length of original string
after leading whitespace trim.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* moved src/global.h into lib/global.h
* moved glibcompat.[ch] from ./src/ into ./lib/
* moved fs.h from ./src/ into ./lib/
Signed-off-by: Slava Zanko <slavazanko@gmail.com>