mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-01 11:11:56 +00:00
Handle <directory> in r2 as an alias for cd /path;r2 --
Remove noisy eprintf and fix another crash
This commit is contained in:
parent
ebbe450f38
commit
1a73f5e807
@ -424,7 +424,12 @@ int main(int argc, char **argv, char **envp) {
|
||||
r_core_cmd0 (&r, "aa");
|
||||
}
|
||||
}
|
||||
if (argv[optind] && !strcmp (argv[optind], "=")) {
|
||||
if (argv[optind] && r_file_is_directory (argv[optind])) {
|
||||
if (chdir (argv[optind])) {
|
||||
eprintf ("Cannot open directory\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (argv[optind] && !strcmp (argv[optind], "=")) {
|
||||
int sz;
|
||||
/* stdin/batch mode */
|
||||
ut8 *buf = (ut8 *)r_stdin_slurp (&sz);
|
||||
|
@ -179,7 +179,7 @@ R_API int r_cmd_call(RCmd *cmd, const char *input) {
|
||||
c = cmd->cmds[((ut8)input[0]) & 0xff];
|
||||
if (c && c->callback) {
|
||||
const char *inp = (input && *input)? input+1: "";
|
||||
ret = c->callback (cmd->data, input+1);
|
||||
ret = c->callback (cmd->data, inp);
|
||||
} else ret = -1;
|
||||
}
|
||||
return ret;
|
||||
|
@ -192,7 +192,7 @@ R_API RIODesc *r_io_open_nomap(RIO *io, const char *file, int flags, int mode) {
|
||||
r_io_desc_add (io, desc);
|
||||
if (io->autofd || !io->desc)
|
||||
r_io_use_desc (io, desc);
|
||||
} else eprintf ("r_io_open_nomap: Unable to open file: %s\n", file);
|
||||
}// else eprintf ("r_io_open_nomap: Unable to open file: %s\n", file);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user