krpors / hx Goto Github PK
View Code? Open in Web Editor NEWHex editor for the terminal using plain C99 + POSIX libs.
License: MIT License
Hex editor for the terminal using plain C99 + POSIX libs.
License: MIT License
Not sure if it's just my machine or not... backspace does not seem to work. Changing KEY_BACKSPACE to 0x08 (\b in the ASCII table actually) seems to work fine for me.
Not much to say as this this shows it all.
Reading files from the /proc/
filesystem (e.g. /proc/cpuinfo
) returns 0 bytes, whereas using cat
on it actually works. Ideally these should just be at least read properly.
There is Append ASCII mode, Insert ASCII mode and just plain replace mode without ASCII, can you add this? Thanks.
To reproduce:
hx
./
to search for a string which does not occur in a file (e.g. akljahlekfahlkdjfh
)N
to search backwardsBacktrace:
#0 __memcmp_ssse3 () at ../sysdeps/x86_64/multiarch/memcmp-ssse3.S:1933
#1 0x0000000000402743 in editor_process_search (e=e@entry=0xfc5010, str=<optimized out>, str@entry=0xfc511c "asdfklj", dir=dir@entry=SEARCH_BACKWARD) at editor.c:740
#2 0x0000000000402e92 in editor_process_keypress (e=0xfc5010) at editor.c:923
#3 0x00000000004012de in main (argc=0x2, argv=<optimized out>) at hx.c:177
I wouldn't mind giving non-ASCII byte searching a shot. Though I'm not sure what the intented syntax is. editor.c seems to imply any search string starting with "0x" should be regarded as a hex byte sequence though of course this means searching for "0x" is impossible.
Here are the options I think could be possible... the existing input buffer size is 80 and I might make reference to that.
A separate search command
That is, instead of /, some other key.
Advantages
Disadvantages
\x regards the entire search stirng as byte values
So "/\xabcf" searches for 0xab follow by 0xcf.
Advantages
Disadvantages
\x regards the following two bytes as a byte value
So "/a\x41b" searches for a followed by 0x41 followed by b.
Advantages
Disadvantages
\x can be replaced by 0x though I think making 0 an escape character would be frustrating as it isn't standard (as far as I've seen at least).
In Vim, :wq
writes the file and closes (:wq!
also works). It would be great to support that command combination in hx also.
When a file's contents is emptied (by deleting all bytes), and the a
command is used to append a byte, a segfault occurs.
A great milestone would be to make hx comply with the Debian packaging standard and such, so it can eventually be included into their repository.
Would you like to add more error handling for return values from functions like the following?
The comments in the project use /** which is used by tools like doxygen to distinguish between normal comments and comments which are designed to be used for generating documentation. This can confuse certain syntax highlighting and if the project ever wishes to switch to doxygen (unlikely because this is not a library but who knows) then this will need to be done anyway.
Additionally some multi line comments are done using C99 style //
comments. It might be worthwhile to switch to using one style throughout the project if the comments are to be changed to normal /*
comments.
Just wanted to say that old projects never die. I just made hx my hex viewer in my file manager.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.