pancake wrote:
> In this case. You just hit one of the missing commands in r2 :) it's in the 
> TODO. do you mind to implement it and send a patch?

I couldn't see it in any of the TODO files.  I'll try implementing the
"r +" in radare first, then take a look at the whole "resize" command
for r2.

> > ired works as intended (syntax "r-#")
> > 
> > In radare2, "r" isn't supported at all.  Commented-out code suggests
> > that it may be handled by a plugin, though I can't see anything relevant
> > in radare2-extras.
> 
> Uhm, which comment?

libr/io/io.c:344
 R_API int r_io_resize(struct r_io_t *io, const char *file, int flags, int 
mode) {
         // XXX not implemented
 #if 0
         /* TODO */
         struct r_io_plugin_t *plugin = r_io_plugin_resolve(file);
...
         return -1;
 }


> I think 'r' must be in core.

Well, the help output doesn't list "r", and anything starting with "r"
at the prompt gives "Invalid command".

> > radare interprets -N wrongly:  get_math() returns unsigned values, and
> > -N becomes (offset - N), so if offset > N, the size is made negative by
> > the following line in radare_resize()
> > ------
> >                size = -size; // be positive
> > ------
> > resulting in the file being extended.
> > 
> 
> Tell me file:line or send patch in diff format.

In hg tip, src/radare.c:1725.  Patch attached.

> > Another feature that I think might be useful here is a matching
> > r +#
> > syntax to insert bytes, shifting the rest of the file up.
> 
> Isnt this already implemented in r1 or ired? In r1 theres also thr eval var 
> write.insert that shifts bytes when using the 'w' command.

OK, file.insert=true was what I was after, thanks.

Glyn
diff -r 84107891680f src/radare.c
--- a/src/radare.c      Wed Jan 12 08:28:12 2011 +0100
+++ b/src/radare.c      Sun Jan 16 12:05:23 2011 +0000
@@ -1722,7 +1722,7 @@
 
        if (arg[0]=='-') {
                ut64 rest;
-               size = -size; // be positive
+               size = get_math(arg+1);
                D eprintf("stripping %lld bytes\n", size);
                rest = config.size - (config.seek -size);
                if (rest > 0) {
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to