From: Michael D. Lowis Date: Tue, 20 Mar 2018 02:27:45 +0000 (-0400) Subject: removed unused parameters from blocking command execution X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=62a193647ac7084c74ff3af0e124bfc452ec5dc6;p=projs%2Ftide.git removed unused parameters from blocking command execution --- diff --git a/inc/edit.h b/inc/edit.h index f3f47e7..b36232a 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -228,7 +228,7 @@ Rune view_getrune(View* view); *****************************************************************************/ bool exec_reap(void); void exec_job(char** cmd, char* data, size_t ndata, View* dest); -int exec_cmd(char** cmd, char* text, char** out, char** err); +int exec_cmd(char** cmd); int exec_spawn(char** cmd, int* in, int* out); /* Pseudo-Terminal Handling diff --git a/lib/exec.c b/lib/exec.c index 6072dd8..4e014f8 100644 --- a/lib/exec.c +++ b/lib/exec.c @@ -93,24 +93,12 @@ void exec_job(char** cmd, char* data, size_t ndata, View* dest) { } } -int exec_cmd(char** cmd, char* text, char** out, char** err) { +int exec_cmd(char** cmd) { Proc proc; if (execute(cmd, &proc) < 0) { perror("failed to execute"); return -1; } - /* send the input to stdin of the command */ - if (text && write(proc.in, text, strlen(text)) < 0) { - perror("failed to write"); - return -1; - } - close(proc.in); - /* read the stderr of the command */ - if (err) *err = fdgets(proc.err); - close(proc.err); - /* read the stdout of the command */ - if (out) *out = fdgets(proc.out); - close(proc.out); /* wait for the process to finish */ int status; waitpid(proc.pid, &status, 0); diff --git a/tide.c b/tide.c index 612c67d..221d541 100644 --- a/tide.c +++ b/tide.c @@ -213,7 +213,7 @@ void onmouseright(WinRegion id, bool pressed, size_t row, size_t col) { } else { char* text = view_fetch(win_view(id), row, col, risfile); FetchCmd[1] = text; - if (exec_cmd(FetchCmd, NULL, NULL, NULL) != 0) { + if (exec_cmd(FetchCmd) != 0) { SearchDir *= (x11_keymodsset(ModShift) ? -1 : +1); free(SearchTerm); SearchTerm = view_fetch(win_view(id), row, col, risfile);