Re: [dev] a suckless hex editor

From: Matthew of Boswell <mordervomubel+suckless_AT_lockmail.us>
Date: Fri, 13 Nov 2015 13:50:39 -0500

On Fri, 13 Nov 2015 11:28:36 -0500
Greg Reagle <greg.reagle_AT_umbc.edu> wrote:

> What do you think?

I personally wouldn't use it over hexer, but it's an interesting idea.

Pros:
- very minimal; great for embedded (assuming no dependence on vim)

Cons:
- can't edit the ascii values on the right; everything is parsed
from the hex.
- no syntax checking, since the editor sees it as plain text
- can't edit very large files in-place; must parse/copy the entire file

> I was afraid to overwrite the infile so I make the
> user specify an outfile. Maybe if I did better error checking it would
> be okay to overwrite?

"xxd -r" doesn't do any syntax checking, according to the manpage. So,
overwriting the file would be like playing with fire. However, how
often do you hex edit a file without creating a backup first? Hex
editing is an error-prone operation regardless of the tool. If
outfile matches infile, consider moving/renaming the original file and
making it the backup. Might have to watch for permissions/"mount -ro"
errors, though.

-- 
Matt Boswell
Received on Fri Nov 13 2015 - 19:50:39 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 13 2015 - 20:00:12 CET