Skip to content

Commit

Permalink
Lowercase some help messages
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 7, 2018
1 parent 15ed604 commit 1bbc4e6
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 46 deletions.
5 changes: 2 additions & 3 deletions libr/bin/bin.c
Expand Up @@ -431,7 +431,7 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, int fd, ut64 baseaddr,
// this thing works for 2GB ELF core from vbox
if (!buf_bytes) {
if (sz < 1) {
eprintf ("Cannot allocate %d bytes\n", (int)(sz + 1));
eprintf ("Cannot allocate %d bytes\n", (int)(sz));
return false;
}
buf_bytes = calloc (1, sz);
Expand All @@ -445,7 +445,6 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, int fd, ut64 baseaddr,
}
}
#endif

if (bin->use_xtr && !name && (st64)sz > 0) {
// XXX - for the time being this is fine, but we may want to
// change the name to something like
Expand All @@ -465,7 +464,7 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, int fd, ut64 baseaddr,
(void) iob->fd_read_at (io, tfd, 0, buf_bytes, sz);
}
}
//DOUBLECLOSE UAF : iob->fd_close (io, tfd);
// DOUBLECLOSE UAF : iob->fd_close (io, tfd);
tfd = -1; // marking it closed
} else if (sz != file_sz) {
(void) iob->read_at (io, 0LL, buf_bytes, sz);
Expand Down
80 changes: 40 additions & 40 deletions libr/core/cmd_help.c
Expand Up @@ -21,54 +21,54 @@ static ut32 vernum(const char *s) {
}

static const char *help_msg_root[] = {
"%var", "=value", "Alias for 'env' command",
"*", "[?] off[=[0x]value]", "Pointer read/write data/values (see ?v, wx, wv)",
"(macro arg0 arg1)", "", "Manage scripting macros",
"%var", "=value", "alias for 'env' command",
"*", "[?] off[=[0x]value]", "pointer read/write data/values (see ?v, wx, wv)",
"(macro arg0 arg1)", "", "manage scripting macros",
".", "[?] [-|(m)|f|!sh|cmd]", "Define macro or load r2, cparse or rlang file",
"=","[?] [cmd]", "Send/Listen for Remote Commands (rap://, http://, <fd>)",
"<","[...]", "Push escaped string into the RCons.readChar buffer",
"/","[?]", "Search for bytes, regexps, patterns, ..",
"!","[?] [cmd]", "Run given command as in system(3)",
"=","[?] [cmd]", "send/listen for remote commands (rap://, http://, <fd>)",
"<","[...]", "push escaped string into the RCons.readChar buffer",
"/","[?]", "search for bytes, regexps, patterns, ..",
"!","[?] [cmd]", "run given command as in system(3)",
"#","[?] !lang [..]", "Hashbang to run an rlang script",
"a","[?]", "Analysis commands",
"b","[?]", "Display or change the block size",
"c","[?] [arg]", "Compare block with given data",
"C","[?]", "Code metadata (comments, format, hints, ..)",
"d","[?]", "Debugger commands",
"e","[?] [a[=b]]", "List/get/set config evaluable vars",
"f","[?] [name][sz][at]", "Add flag at current address",
"g","[?] [arg]", "Generate shellcodes with r_egg",
"i","[?] [file]", "Get info about opened file from r_bin",
"k","[?] [sdb-query]", "Run sdb-query. see k? for help, 'k *', 'k **' ...",
"a","[?]", "analysis commands",
"b","[?]", "display or change the block size",
"c","[?] [arg]", "compare block with given data",
"C","[?]", "code metadata (comments, format, hints, ..)",
"d","[?]", "debugger commands",
"e","[?] [a[=b]]", "list/get/set config evaluable vars",
"f","[?] [name][sz][at]", "add flag at current address",
"g","[?] [arg]", "generate shellcodes with r_egg",
"i","[?] [file]", "get info about opened file from r_bin",
"k","[?] [sdb-query]", "run sdb-query. see k? for help, 'k *', 'k **' ...",
"L","[?] [-] [plugin]", "list, unload load r2 plugins",
"m","[?]", "Mountpoints commands",
"o","[?] [file] ([offset])", "Open file at optional address",
"p","[?] [len]", "Print current block with format and length",
"P","[?]", "Project management utilities",
"q","[?] [ret]", "Quit program with a return value",
"r","[?] [len]", "Resize file",
"s","[?] [addr]", "Seek to address (also for '0x', '0x1' == 's 0x1')",
"S","[?]", "Io section manipulation information",
"t","[?]", "Types, noreturn, signatures, C parser and more",
"m","[?]", "mountpoints commands",
"o","[?] [file] ([offset])", "open file at optional address",
"p","[?] [len]", "print current block with format and length",
"P","[?]", "project management utilities",
"q","[?] [ret]", "quit program with a return value",
"r","[?] [len]", "resize file",
"s","[?] [addr]", "seek to address (also for '0x', '0x1' == 's 0x1')",
"S","[?]", "io section manipulation information",
"t","[?]", "types, noreturn, signatures, C parser and more",
"T","[?] [-] [num|msg]", "Text log utility",
"u","[?]", "uname/undo seek/write",
"V","", "Visual mode (V! = panels, VV = fcngraph, VVV = callgraph)",
"w","[?] [str]", "Multiple write operations",
"x","[?] [len]", "Alias for 'px' (print hexadecimal)",
"V","", "visual mode (V! = panels, VV = fcngraph, VVV = callgraph)",
"w","[?] [str]", "multiple write operations",
"x","[?] [len]", "alias for 'px' (print hexadecimal)",
"y","[?] [len] [[[@]addr", "Yank/paste bytes from/to memory",
"z", "[?]", "Zignatures management",
"z", "[?]", "zignatures management",
"?[??]","[expr]", "Help or evaluate math expression",
"?$?", "", "Show available '$' variables and aliases",
"?@?", "", "Misc help for '@' (seek), '~' (grep) (see ~?""?)",
"?>?", "", "Output redirection",
"?$?", "", "show available '$' variables and aliases",
"?@?", "", "misc help for '@' (seek), '~' (grep) (see ~?""?)",
"?>?", "", "output redirection",
NULL
};

static const char *help_msg_question[] = {
"Usage: ?[?[?]] expression", "", "",
"?", " eip-0x804800", "show hex and dec result for this math expr",
"?:", "", "list core cmd plugins",
"[cmd]?*", "", "Recursive help for the given cmd",
"[cmd]?*", "", "recursive help for the given cmd",
"?!", " [cmd]", "run cmd if $? == 0",
"?$", "", "show value all the variables ($)",
"?+", " [cmd]", "run cmd if $? > 0",
Expand Down Expand Up @@ -121,7 +121,7 @@ static const char *help_msg_question_v[] = {
"$$", "", "here (current virtual seek)",
"$$$", "", "current non-temporary virtual seek",
"$?", "", "last comparison value",
"$alias", "=value", "Alias commands (simple macros)",
"$alias", "=value", "alias commands (simple macros)",
"$b", "", "block size",
"$B", "", "base address (aligned lowest map address)",
"$f", "", "jump fail address (e.g. jz 0x10 => next instruction)",
Expand Down Expand Up @@ -171,11 +171,11 @@ static const char *help_msg_question_V[] = {
};

static const char *help_msg_greater_sign[] = {
"Usage:", "[cmd]>[file]", "Redirects the console output of 'cmd' to 'file'",
"[cmd] > [file]", "", "Redirects STDOUT of 'cmd' to 'file'",
"[cmd] H> [file]", "", "Redirects html output of 'cmd' to 'file'",
"[cmd] 2> [file]", "", "Redirects STDERR of 'cmd' to 'file'",
"[cmd] 2> /dev/null", "", "Omits the STDERR output of 'cmd'",
"Usage:", "[cmd]>[file]", "redirects console from 'cmd' output to 'file'",
"[cmd] > [file]", "", "redirect STDOUT of 'cmd' to 'file'",
"[cmd] H> [file]", "", "redirect html output of 'cmd' to 'file'",
"[cmd] 2> [file]", "", "redirect STDERR of 'cmd' to 'file'",
"[cmd] 2> /dev/null", "", "omit the STDERR output of 'cmd'",
NULL
};

Expand Down
6 changes: 5 additions & 1 deletion libr/io/p/io_default.c
Expand Up @@ -226,10 +226,14 @@ static int r_io_def_mmap_read(RIO *io, RIODesc *fd, ut8 *buf, int count) {
free (a_buf);
return count;
}
if (lseek (mmo->fd, io->off, SEEK_SET) < 0) {
return -1;
}
return read (mmo->fd, buf, count);
}
if (mmo->buf->length < io->off)
if (mmo->buf->length < io->off) {
io->off = mmo->buf->length;
}
return r_buf_read_at (mmo->buf, io->off, buf, count);
}

Expand Down
4 changes: 3 additions & 1 deletion libr/util/buf.c
Expand Up @@ -208,7 +208,9 @@ R_API ut64 r_buf_size (RBuffer *b) {
R_API RBuffer *r_buf_mmap (const char *file, int flags) {
int rw = flags & R_IO_WRITE ? true : false;
RBuffer *b = r_buf_new ();
if (!b) return NULL;
if (!b) {
return NULL;
}
b->mmap = r_file_mmap (file, rw, 0);
if (b->mmap) {
b->buf = b->mmap->buf;
Expand Down
4 changes: 3 additions & 1 deletion libr/util/file.c
Expand Up @@ -828,7 +828,9 @@ static RMmap *r_file_mmap_other (RMmap *m) {
R_API RMmap *r_file_mmap (const char *file, bool rw, ut64 base) {
RMmap *m = NULL;
int fd = -1;
if (!rw && !r_file_exists (file)) return m;
if (!rw && !r_file_exists (file)) {
return m;
}
fd = r_sandbox_open (file, rw? O_RDWR: O_RDONLY, 0644);
if (fd == -1 && !rw) {
eprintf ("r_file_mmap: file does not exis.\n");
Expand Down

0 comments on commit 1bbc4e6

Please sign in to comment.