mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Remove unused StartLogShell function.
Based upon a patch by Tobias Stoeckmann Small code size reduction, text data bss dec hex filename 620412 19144 8544 648100 9e3a4 src/.libs/wmaker 621347 19152 8544 649043 9e753 src/.libs/wmaker.old
This commit is contained in:
committed by
Carlos R. Mafra
parent
f516213bf3
commit
38074e7bd5
81
src/main.c
81
src/main.c
@@ -328,87 +328,6 @@ ExecuteShellCommand(WScreen *scr, char *command)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* StartLogShell
|
||||
* Start a shell that will receive all stdin and stdout from processes
|
||||
* forked by wmaker.
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
StartLogShell(WScreen *scr)
|
||||
{
|
||||
int in_fd[2];
|
||||
int out_fd[2];
|
||||
int err_fd[2];
|
||||
pid_t pid;
|
||||
|
||||
SetupEnvironment(scr);
|
||||
|
||||
if (pipe(in_fd) < 0) {
|
||||
wsyserror("could not create pipe for log shell\n");
|
||||
return;
|
||||
}
|
||||
if (pipe(out_fd) < 0) {
|
||||
wsyserror("could not create pipe for log shell\n");
|
||||
close(in_fd[0]);
|
||||
close(in_fd[1]);
|
||||
return;
|
||||
}
|
||||
if (pipe(err_fd) < 0) {
|
||||
wsyserror("could not create pipe for log shell\n");
|
||||
close(out_fd[0]);
|
||||
close(out_fd[1]);
|
||||
close(in_fd[0]);
|
||||
close(in_fd[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
wsyserror("could not fork a new process for log shell\n");
|
||||
return;
|
||||
} else if (pid == 0) {
|
||||
close(in_fd[0]);
|
||||
close(out_fd[1]);
|
||||
close(err_fd[1]);
|
||||
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
|
||||
if (dup2(in_fd[1], 0) < 0) {
|
||||
wsyserror("could not redirect stdin for log shell\n");
|
||||
exit(1);
|
||||
}
|
||||
if (dup2(out_fd[1], 1) < 0) {
|
||||
wsyserror("could not redirect stdout for log shell\n");
|
||||
exit(1);
|
||||
}
|
||||
if (dup2(err_fd[1], 2) < 0) {
|
||||
wsyserror("could not redirect stderr for log shell\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(in_fd[1]);
|
||||
close(out_fd[1]);
|
||||
close(err_fd[1]);
|
||||
|
||||
execl("/bin/sh", "/bin/sh", "-c", wPreferences.logger_shell, NULL);
|
||||
wsyserror("could not execute %s\n", wPreferences.logger_shell);
|
||||
exit(1);
|
||||
} else {
|
||||
close(in_fd[1]);
|
||||
close(out_fd[0]);
|
||||
close(err_fd[0]);
|
||||
|
||||
LogStdIn = in_fd[1];
|
||||
LogStdOut = out_fd[0];
|
||||
LogStdErr = err_fd[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------
|
||||
* wAbort--
|
||||
|
||||
Reference in New Issue
Block a user