diff --git a/p2p.c b/p2p.c index bf6e844..d01ba20 100644 --- a/p2p.c +++ b/p2p.c @@ -27,6 +27,31 @@ int run_system(struct sigma_dut *dut, const char *cmd) } +int run_system_wrapper(struct sigma_dut *dut, const char *cmd, ...) +{ + va_list ap; + char *buf; + int bytes_required; + int res; + + va_start(ap, cmd); + bytes_required = vsnprintf(NULL, 0, cmd, ap); + bytes_required += 1; + va_end(ap); + buf = malloc(bytes_required); + if (!buf) { + printf("ERROR!! No memory\n"); + return -1; + } + va_start(ap, cmd); + vsnprintf(buf, bytes_required, cmd, ap); + va_end(ap); + res = run_system(dut, buf); + free(buf); + return res; +} + + static int get_60g_freq(int chan) { int freq = 0; diff --git a/sigma_dut.h b/sigma_dut.h index ad39efe..f718da2 100644 --- a/sigma_dut.h +++ b/sigma_dut.h @@ -668,6 +668,7 @@ int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf, int ath6kl_client_uapsd(struct sigma_dut *dut, const char *intf, int uapsd); int is_ip_addr(const char *str); int run_system(struct sigma_dut *dut, const char *cmd); +int run_system_wrapper(struct sigma_dut *dut, const char *cmd, ...); int cmd_wlantest_set_channel(struct sigma_dut *dut, struct sigma_conn *conn, struct sigma_cmd *cmd); void sniffer_close(struct sigma_dut *dut);