void doshell() { setpgrp(); /* relinquish control terminal */ getslave(); (void) close(master); (void) fclose(fscript); (void) dup2(slave, 0); (void) dup2(slave, 1); (void) dup2(slave, 2); (void) close(slave); execl(shell, shell, "-i", (char *)0); perror(shell); fail(); }
void doshell(void) { char *shname; getslave(); close(master); if (close_stream(fscript) != 0) errx(EXIT_FAILURE, _("write error")); dup2(slave, STDIN_FILENO); dup2(slave, STDOUT_FILENO); dup2(slave, STDERR_FILENO); close(slave); master = -1; shname = strrchr(shell, '/'); if (shname) shname++; else shname = shell; /* * When invoked from within /etc/csh.login, script spawns a csh shell * that spawns programs that cannot be killed with a SIGTERM. This is * because csh has a documented behaviour wherein it disables all * signals when processing the /etc/csh.* files. * * Let's restore the default behavior. */ signal(SIGTERM, SIG_DFL); if (cflg) execl(shell, shname, "-c", cflg, NULL); else execl(shell, shname, "-i", NULL); warn(_("failed to execute %s"), shell); fail(); }
void doshell() { char *shname; #if 0 int t; t = open(_PATH_DEV_TTY, O_RDWR); if (t >= 0) { (void) ioctl(t, TIOCNOTTY, (char *)0); (void) close(t); } #endif getslave(); (void) close(master); (void) fclose(fscript); (void) dup2(slave, 0); (void) dup2(slave, 1); (void) dup2(slave, 2); (void) close(slave); master = -1; shname = strrchr(shell, '/'); if (shname) shname++; else shname = shell; if (cflg) execl(shell, shname, "-c", cflg, NULL); else execl(shell, shname, "-i", NULL); perror(shell); fail(); }
void doshell(void) { char *shname; #if 0 int t; t = open(_PATH_DEV_TTY, O_RDWR); if (t >= 0) { ioctl(t, TIOCNOTTY, (char *)0); close(t); } #endif getslave(); close(master); fclose(fscript); dup2(slave, STDIN_FILENO); dup2(slave, STDOUT_FILENO); dup2(slave, STDERR_FILENO); close(slave); master = -1; shname = strrchr(shell, '/'); if (shname) shname++; else shname = shell; if (cflg) execl(shell, shname, "-c", cflg, NULL); else execl(shell, shname, "-i", NULL); warn(_("failed to execute %s"), shell); fail(); }
void doshell (int game, char *username) { getslave (); (void) close (master); (void) fclose (fscript); (void) dup2 (slave, 0); (void) dup2 (slave, 1); (void) dup2 (slave, 2); (void) close (slave); /* if (myconfig[game]->mkdir) (void) mkdir(myconfig[game]->mkdir, 0755); if (myconfig[game]->chdir) (void) chdir(myconfig[game]->chdir); */ execvp (myconfig[game]->game_path, myconfig[game]->bin_args); fail (); }