diff --git a/binr/r2r/run.c b/binr/r2r/run.c index 73cb5587dd..5c0b0bbe7d 100644 --- a/binr/r2r/run.c +++ b/binr/r2r/run.c @@ -2,6 +2,18 @@ #include "r2r.h" +#if __wasi__ +static int pipe(int fildes[2]) {return -1;} +static int dup2(int a, int b) {return -1;} +static int waitpid(int a, void *b, int c) {return -1;} +static int kill(int a, int b) {return -1;} +static int execvp(const char *a, char **b) {return -1;} +#define WNOHANG 0 +#define WIFEXITED(x) 0 +#define WEXITSTATUS(x) 0 +#define __SIG_IGN 0 +#endif + #if __WINDOWS__ struct r2r_subprocess_t { HANDLE stdin_write; diff --git a/libr/asm/asm.c b/libr/asm/asm.c index 9e6af92a29..470cfe599c 100644 --- a/libr/asm/asm.c +++ b/libr/asm/asm.c @@ -9,8 +9,8 @@ #define USE_R2 1 #undef S_API #define S_API static -#include "../../shlr/spp/spp.c" -// #include +// #include "../../shlr/spp/spp.c" +#include #include R_LIB_VERSION (r_asm); diff --git a/libr/core/Makefile b/libr/core/Makefile index 0a529165df..0db50849ec 100644 --- a/libr/core/Makefile +++ b/libr/core/Makefile @@ -39,7 +39,7 @@ STATIC_OBJS=$(addprefix $(LTOP)/core/p/,$(STATIC_OBJ)) OBJS+=$(STATIC_OBJS) include $(TOP)/shlr/gdb/deps.mk -include $(LIBR)/util/spp.mk +# include $(LIBR)/util/spp.mk include $(LTOP)/rules.mk include $(STOP)/java/deps.mk diff --git a/libr/include/r_types.h b/libr/include/r_types.h index f020d9b276..85cb4ea93e 100644 --- a/libr/include/r_types.h +++ b/libr/include/r_types.h @@ -324,6 +324,8 @@ typedef int (*PrintfCallback)(const char *str, ...) R_PRINTF_CHECK(1, 2); #endif #endif +#define R_HIDDEN __attribute__((visibility("hidden"))) + #define R_LIB_VERSION_HEADER(x) \ R_API const char *x##_version(void) #define R_LIB_VERSION(x) \ diff --git a/libr/lang/p/spp.c b/libr/lang/p/spp.c index ba087eee69..72ca1687a6 100644 --- a/libr/lang/p/spp.c +++ b/libr/lang/p/spp.c @@ -7,8 +7,8 @@ static RLang *Glang = NULL; #undef S_API -#define S_API static -#include "../../../shlr/spp/spp.c" +// #include "../../../shlr/spp/spp.c" +#include "../../../shlr/spp/spp.h" #include "spp_r2.inc" static bool lang_spp_init(RLang *l) { diff --git a/shlr/Makefile b/shlr/Makefile index a7186f87ae..32b4583dfd 100644 --- a/shlr/Makefile +++ b/shlr/Makefile @@ -71,7 +71,7 @@ endif endif SDB_URL=git://github.com/radareorg/sdb #SDB_URL=/Users/pancake/prg/sdb -SPP_URL=git://github.com/radare/spp +SPP_URL=git://github.com/trufae/spp PWD=$(shell pwd) SDB_CONFIG=${PWD}/sdb-config.mk diff --git a/shlr/spp/spp.c b/shlr/spp/spp.c index edae7ec1b1..a6ccaddef1 100644 --- a/shlr/spp/spp.c +++ b/shlr/spp/spp.c @@ -70,7 +70,7 @@ static char *spp_run_str(char *buf, int *rv) { return b; } -void lbuf_strcat(SppBuf *dst, char *src) { +S_API void lbuf_strcat(SppBuf *dst, char *src) { int len = strlen (src); char *nbuf; if (!dst->lbuf || (len + dst->lbuf_n) > dst->lbuf_s) { @@ -85,7 +85,7 @@ void lbuf_strcat(SppBuf *dst, char *src) { dst->lbuf_n += len; } -int do_fputs(Output *out, char *str) { +S_API int do_fputs(Output *out, char *str) { int i; int printed = 0; for (i = 0; i <= proc->state.ifl; i++) { @@ -334,7 +334,7 @@ S_API void spp_proc_set(SppProc *p, const char *arg, int fail) { } } -void out_printf(Output *out, char *str, ...) { +S_API void out_printf(Output *out, char *str, ...) { va_list ap; va_start (ap, str); if (out->fout) { diff --git a/shlr/w32dbg_wrap/meson.build b/shlr/w32dbg_wrap/meson.build index e04fb5d202..586605959e 100644 --- a/shlr/w32dbg_wrap/meson.build +++ b/shlr/w32dbg_wrap/meson.build @@ -1,4 +1,4 @@ -w32dbg_wrap_inc = include_directories('include') +w32dbg_wrap_inc = include_directories(['include', '../../libr/include']) w32dbg_wrap_src = ['src/w32dbg_wrap.c'] w32dbg_wrap_lib = static_library( 'r2w32dbg_wrap',