diff options
author | Nicholas <nbnoll@eml.cc> | 2021-11-12 09:22:01 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-11-12 09:22:01 -0800 |
commit | ce05175372a9ddca1a225db0765ace1127a39293 (patch) | |
tree | 5988b4d4f6b402e4953945886fc90aae11203df6 /sys/cmd/rc/main.c | |
parent | b375f3cdedb5b0e08745d100b40e38d2f8396a58 (diff) |
chore: simplified organizational structurelaptop
Diffstat (limited to 'sys/cmd/rc/main.c')
-rw-r--r-- | sys/cmd/rc/main.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/sys/cmd/rc/main.c b/sys/cmd/rc/main.c deleted file mode 100644 index 2c0aa42..0000000 --- a/sys/cmd/rc/main.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "rc.h" -#include "parse.h" -#include "exec.h" - -#include <signal.h> -#include <termios.h> - -// ----------------------------------------------------------------------- -// globals - -Thread *runner = nil; -Shell shell = { 0 }; - -// ----------------------------------------------------------------------- -// functions - -void -initshell(void) -{ - if((shell.interactive=isatty(0))){ - while(tcgetpgrp(0) != (shell.pid = getpgrp())) - kill(-shell.pid, SIGTTIN); - - /* ignore job control signals */ - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGTSTP, SIG_IGN); - signal(SIGTTIN, SIG_IGN); - signal(SIGTTOU, SIG_IGN); - /* - * NOTE: if SIGCHLD is set to SIG_IGN then - * 1. children that terminate do not become zombies - * 2. call a to wait() will block until all children have terminated - * 3. the call to wait will fail with errno == ECHILD - * see for discussion: - * https://stackoverflow.com/questions/1608017/no-child-process-error-from-waitpid-when-waiting-for-process-group - */ - // signal(SIGCHLD, SIG_IGN); - - /* take control */ - shell.pid = getpid(); - if(setpgid(shell.pid, shell.pid)<0) - fatal("could not put shell in its own process group"); - - tcsetpgrp(shell.pid, shell.pid); - } -} - -// ----------------------------------------------------------------------- -// main point of entry - -int -main(int argc, char *argv[]) -{ - shell.err = openfd(2); - - initenv(); - initpath(); - initkeywords(); - initshell(); - inithistory(); - - enablevi(); - xboot(argc, argv); - /* unreachable */ -} |