mirror of
https://github.com/radareorg/r0.git
synced 2026-11-07 06:25:57 -10:00
A bit more constified
This commit is contained in:
1 parent
0fce443275
commit
7139b88824
4 files changed
+16
-16
No files matched your search
@@ -22,7 +22,7 @@ r0d: r0d.o
|
||||
${CC} ${CFLAGS} r0d.o -o r0d
|
||||
|
||||
r0.js:
|
||||
emcc -DUSE_DISASM_X32=1 -Os -o r0.js r0.c
|
||||
emcc -s FORCE_FILESYSTEM=1 -lnodefs.js -s EXPORTED_FUNCTIONS='["_r0_open", "_r0_cmd"]' -DUSE_DISASM_X32=1 -Os -o r0.js r0.c
|
||||
|
||||
r0.arm:
|
||||
$(CC) -DUSE_DISASM_ARM=1 r0.c -o r0.arm
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
static int cmd_hexdump(char *arg) {
|
||||
static int cmd_hexdump(const char *arg) {
|
||||
int len = bsize;
|
||||
ut8 *buf = getcurblk(arg, &len);
|
||||
if(buf && len>0) {
|
||||
@@ -32,7 +32,7 @@ static int cmd_hexdump(char *arg) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int cmd_print(char *arg) {
|
||||
static int cmd_print(const char *arg) {
|
||||
ut8 *buf;
|
||||
int len = bsize;
|
||||
if(*arg) {
|
||||
@@ -49,7 +49,7 @@ static int cmd_print(char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_system(char *arg) {
|
||||
static int cmd_system(const char *arg) {
|
||||
int len = bsize;
|
||||
char str[1024];
|
||||
ut8 *buf;
|
||||
@@ -162,7 +162,7 @@ static int cmd_search(const char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_bsize(char *arg) {
|
||||
static int cmd_bsize(const char *arg) {
|
||||
if(!*arg) printf("%d\n", bsize);
|
||||
else if(*arg=='+') bsize += (int)calc(arg+1);
|
||||
else if(*arg=='-') bsize -= (int)calc(arg+1);
|
||||
@@ -172,7 +172,7 @@ static int cmd_bsize(char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_seek(char *arg) {
|
||||
static int cmd_seek(const char *arg) {
|
||||
if(!*arg) printf("%"LLF"d\n", curseek);
|
||||
else if(*arg=='+') curseek += calc(arg+1);
|
||||
else if(*arg=='-') curseek -= calc(arg+1);
|
||||
@@ -181,7 +181,7 @@ static int cmd_seek(char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_dump(char *file) {
|
||||
static int cmd_dump(const char *file) {
|
||||
int len = bsize;
|
||||
ut8 *buf = getcurblk("", &len);
|
||||
if(len<1 || buf) {
|
||||
@@ -200,7 +200,7 @@ static int cmd_dump(char *file) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_load(char *file) {
|
||||
static int cmd_load(const char *file) {
|
||||
FILE *fd = fopen(file, "rb");
|
||||
if(fd) {
|
||||
void *buf = malloc(bsize);
|
||||
@@ -246,7 +246,7 @@ static int cmd_write(const char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_help(char *arg) {
|
||||
static int cmd_help(const char *arg) {
|
||||
if(*arg) {
|
||||
ut64 ret = r_num_calc (NULL, arg, NULL);
|
||||
printf("0x%"LLF"x %"LLF"d 0%"LLF"o\n", ret, ret, ret);
|
||||
@@ -270,7 +270,7 @@ static int cmd_help(char *arg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cmd_resize(char *arg) {
|
||||
static int cmd_resize(const char *arg) {
|
||||
ut8 *buf;
|
||||
ut64 tail, n;
|
||||
int i, len, ret = 0;
|
||||
|
||||
@@ -11,7 +11,7 @@ static int cmdn = 0;
|
||||
static char **cmds = 0;
|
||||
static ut64 oldseek, curseek = 0LL;
|
||||
static int obsize, bsize = 256;
|
||||
static int r0_cmd(char *cmd); // XXX : recursive depenency
|
||||
int r0_cmd(const char *cmd); // XXX : recursive depenency
|
||||
#if defined(__WATCOMC__)
|
||||
#define HAVE_FTRUNCATE 0
|
||||
#define BUFSZ 1024
|
||||
@@ -50,8 +50,8 @@ static int r0_interpret(const char *file) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int r0_cmd(char *cmd) {
|
||||
char *arg = cmd+1;
|
||||
int r0_cmd(const char *cmd) {
|
||||
const char *arg = cmd+1;
|
||||
SKIPSPACES(arg);
|
||||
switch(*cmd) {
|
||||
case 'q': return 0;
|
||||
@@ -104,7 +104,7 @@ static int r0_prompt() {
|
||||
return r0_cmd(at);
|
||||
}
|
||||
|
||||
static int r0_open(const char *file) {
|
||||
int r0_open(const char *file) {
|
||||
int ret = io_open(file);
|
||||
if(ret != -1) {
|
||||
oldseek = 0;
|
||||
|
||||
@@ -18,9 +18,9 @@ static inline void hexdump(const ut8 *buf, unsigned int len, int w) {
|
||||
}
|
||||
|
||||
#define u(x) ((unsigned long)(x&0xff))
|
||||
static void print_fmt(const ut8 *buf, char *fmt, unsigned int len) {
|
||||
static void print_fmt(const ut8 *buf, const char *fmt, unsigned int len) {
|
||||
unsigned int i, up, inc = 0, lup = 0, rep = 0;
|
||||
char *ofmt = fmt;
|
||||
const char *ofmt = fmt;
|
||||
do { /* TODO: needs cleanup */
|
||||
for(;(*fmt||rep);fmt++) {
|
||||
up = rep?rep:*fmt;
|
||||
|
||||
Reference in new issue
Block a user