1
1
mirror of https://github.com/jarun/nnn.git synced 2024-09-11 13:06:14 +03:00

Revert "Give better names to variables"

This reverts commit 1a2f783b75.
This commit is contained in:
Arun Prakash Jana 2023-01-16 00:18:52 +05:30
parent f9295780ef
commit 653cab9dff

View File

@ -4441,8 +4441,8 @@ static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool page)
int index = 0, flags; int index = 0, flags;
bool ret = FALSE; bool ret = FALSE;
bool have_file = fdout != -1; bool have_file = fdout != -1;
int cmd_in_fd = -1; int prog_in_fd = -1;
int cmd_out_fd = -1; int prog_out_fd = -1;
ssize_t len; ssize_t len;
/* /*
@ -4461,12 +4461,12 @@ static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool page)
if (fdout == -1) if (fdout == -1)
return FALSE; return FALSE;
cmd_in_fd = STDIN_FILENO; prog_in_fd = STDIN_FILENO;
cmd_out_fd = fdout; prog_out_fd = fdout;
} else if (have_file) { } else if (have_file) {
// Case 3 // Case 3
cmd_in_fd = STDIN_FILENO; prog_in_fd = STDIN_FILENO;
cmd_out_fd = fdout; prog_out_fd = fdout;
} else { } else {
// Case 1 // Case 1
if (pipe(pipefd) == -1) if (pipe(pipefd) == -1)
@ -4483,17 +4483,16 @@ static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool page)
fcntl(pipefd[index], F_SETFL, flags); fcntl(pipefd[index], F_SETFL, flags);
} }
cmd_in_fd = pipefd[0]; prog_in_fd = pipefd[0];
cmd_out_fd = pipefd[1]; prog_out_fd = pipefd[1];
} }
pid = fork(); pid = fork();
if (pid == 0) { if (pid == 0) {
/* In child */ close(prog_in_fd);
close(cmd_in_fd); dup2(prog_out_fd, STDOUT_FILENO);
dup2(cmd_out_fd, STDOUT_FILENO); dup2(prog_out_fd, STDERR_FILENO);
dup2(cmd_out_fd, STDERR_FILENO); close(prog_out_fd);
close(cmd_out_fd);
spawn(utils[UTIL_SH_EXEC], file, arg1, arg2, F_MULTI); spawn(utils[UTIL_SH_EXEC], file, arg1, arg2, F_MULTI);
_exit(EXIT_SUCCESS); _exit(EXIT_SUCCESS);