Skip to content

Commit

Permalink
Show flagname and realname in json format for fnj and such ##json
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored Oct 28, 2019
1 parent 6190995 commit e0e593c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 11 additions & 8 deletions libr/core/cmd_flag.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,15 +1235,17 @@ static int cmd_flag(void *data, const char *input) {
case '*': // "f*"
case 'j': // "fj"
case 'q': // "fq"
switch (input[1]) {
case 'j':
case 'q':
case 'n':
case '*':
input++;
break;
if (input[0]) {
switch (input[1]) {
case 'j':
case 'q':
case 'n':
case '*':
input++;
break;
}
}
if (input[1] == '.') {
if (input[0] && input[1] == '.') {
const int mode = input[2];
const RList *list = r_flag_get_list (core->flags, core->offset);
PJ *pj = NULL;
Expand All @@ -1262,6 +1264,7 @@ static int cmd_flag(void *data, const char *input) {
{
pj_o (pj);
pj_ks (pj, "name", item->name);
pj_ks (pj, "realname", item->realname);
pj_kn (pj, "offset", item->offset);
pj_kn (pj, "size", item->size);
pj_end (pj);
Expand Down
5 changes: 4 additions & 1 deletion libr/flag/flag.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ static bool print_flag_json(RFlagItem *flag, void *user) {
return true;
}
pj_o (u->pj);
pj_ks (u->pj, "name", u->real ? flag->realname : flag->name);
pj_ks (u->pj, "name", flag->name);
if (flag->name != flag->realname) {
pj_ks (u->pj, "realname", flag->realname);
}
pj_ki (u->pj, "size", flag->size);
if (flag->alias) {
pj_ks (u->pj, "alias", flag->alias);
Expand Down

0 comments on commit e0e593c

Please sign in to comment.