srogue: use functions from mdport.c.
Shell escape, passwd entries, terminal settings, and most signal handling is now done with the more portable md_* functions.
This commit is contained in:
parent
de1e0f2759
commit
791df4324f
10 changed files with 34 additions and 115 deletions
|
|
@ -369,8 +369,10 @@ quit(int a)
|
|||
/*
|
||||
* Reset the signal in case we got here via an interrupt
|
||||
*/
|
||||
#ifdef SIGINT
|
||||
if (signal(SIGINT, quit) != quit)
|
||||
mpos = 0;
|
||||
#endif
|
||||
msg("Really quit? [y/n/s]");
|
||||
/* ch = tolower(readchar());*/
|
||||
ch = readchar();
|
||||
|
|
@ -395,7 +397,9 @@ quit(int a)
|
|||
}
|
||||
}
|
||||
else {
|
||||
#ifdef SIGINT
|
||||
signal(SIGINT, quit);
|
||||
#endif
|
||||
wmove(cw, 0, 0);
|
||||
wclrtoeol(cw);
|
||||
draw(cw);
|
||||
|
|
@ -637,46 +641,15 @@ shell()
|
|||
/*
|
||||
* Fork and do a shell
|
||||
*/
|
||||
#ifndef __DJGPP__
|
||||
while((pid = fork()) < 0)
|
||||
sleep(1);
|
||||
if (pid == 0) {
|
||||
setuid(playuid); /* Set back to original user */
|
||||
setgid(playgid);
|
||||
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0);
|
||||
perror("No shelly");
|
||||
byebye(-1);
|
||||
}
|
||||
else {
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
while (wait(&ret_status) != pid)
|
||||
continue;
|
||||
signal(SIGINT, quit);
|
||||
signal(SIGQUIT, endit);
|
||||
|
||||
#else
|
||||
{
|
||||
char shell[PATH_MAX];
|
||||
|
||||
if (sh && *sh)
|
||||
strncpy(shell,sh,PATH_MAX);
|
||||
else
|
||||
sprintf(shell, "%s\\bin\\sh.exe", getenv("DJDIR"));
|
||||
|
||||
if (spawnl(P_WAIT,shell, "shell", "-i", 0) == -1)
|
||||
msg("No shelly: %s", shell);
|
||||
|
||||
#endif
|
||||
printf("\n%s", retstr);
|
||||
fflush(stdout);
|
||||
nonl();
|
||||
noecho();
|
||||
crmode();
|
||||
in_shell = FALSE;
|
||||
wait_for(cw, '\n');
|
||||
restscr(cw);
|
||||
}
|
||||
md_shellescape();
|
||||
printf("\n%s", retstr);
|
||||
fflush(stdout);
|
||||
nonl();
|
||||
noecho();
|
||||
crmode();
|
||||
in_shell = FALSE;
|
||||
wait_for(cw, '\n');
|
||||
restscr(cw);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue