mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-11 00:06:19 +00:00
Implement rj
##json (#17443)
This commit is contained in:
parent
17a1cf6a77
commit
549784d73f
@ -268,6 +268,7 @@ static const char *help_msg_k[] = {
|
||||
static const char *help_msg_r[] = {
|
||||
"Usage:", "r[+-][ size]", "Resize file",
|
||||
"r", "", "display file size",
|
||||
"rj", "", "display the file size in JSON format",
|
||||
"r", " size", "expand or truncate file to given size",
|
||||
"r-", "num", "remove num bytes, move following data down",
|
||||
"r+", "num", "insert num bytes, move following data up",
|
||||
@ -1823,6 +1824,18 @@ static int cmd_resize(void *data, const char *input) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case 'j': { // "rj"
|
||||
PJ * pj = pj_new ();
|
||||
pj_o (pj);
|
||||
if (oldsize != -1) {
|
||||
pj_kn (pj, "size", oldsize);
|
||||
}
|
||||
pj_end (pj);
|
||||
char *s = pj_drain (pj);
|
||||
r_cons_println (s);
|
||||
free (s);
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
if (core->file) {
|
||||
if (oldsize != -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user