sh: Simplify setinteractive().
setsignal() does nothing if the signal disposition is already set correctly.
This commit is contained in:
parent
6e5e4dbd06
commit
3be4e97d2b
@ -131,7 +131,7 @@ procargs(int argc, char **argv)
|
||||
void
|
||||
optschanged(void)
|
||||
{
|
||||
setinteractive(iflag);
|
||||
setinteractive();
|
||||
#ifndef NO_HISTORY
|
||||
histedit();
|
||||
#endif
|
||||
|
@ -478,19 +478,14 @@ dotrap(void)
|
||||
|
||||
|
||||
/*
|
||||
* Controls whether the shell is interactive or not.
|
||||
* Controls whether the shell is interactive or not based on iflag.
|
||||
*/
|
||||
void
|
||||
setinteractive(int on)
|
||||
setinteractive(void)
|
||||
{
|
||||
static int is_interactive = -1;
|
||||
|
||||
if (on == is_interactive)
|
||||
return;
|
||||
setsignal(SIGINT);
|
||||
setsignal(SIGQUIT);
|
||||
setsignal(SIGTERM);
|
||||
is_interactive = on;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,6 @@ void ignoresig(int);
|
||||
int issigchldtrapped(void);
|
||||
void onsig(int);
|
||||
void dotrap(void);
|
||||
void setinteractive(int);
|
||||
void setinteractive(void);
|
||||
void exitshell(int) __dead2;
|
||||
void exitshell_savedstatus(void) __dead2;
|
||||
|
Loading…
Reference in New Issue
Block a user