1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: shell.c 807 2007-11-09 01:21:33Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2006-2007 University of Washington
8 * Copyright 2013-2014 Eduardo Chappa
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
23 #include "../estruct.h"
28 #include "../keydefs.h"
41 /* internal prototypes */
43 RETSIGTYPE
rtfrmshell(int);
50 * bktoshell - suspend and wait to be woken up
53 bktoshell(int f
, int n
)
63 if(!Pmaster
->suspend
){
68 if((*Pmaster
->suspend
)() == NO_OP_COMMAND
){
78 rv
= (*Pmaster
->showmsg
)('x');
81 if(rv
) /* Did showmsg corrupt the display? */
82 pico_refresh(0, 1); /* Yes, repaint */
92 pclear(0, term
.t_nrow
);
106 printf("\n\n\nUse \"exit\" to return to Pi%s\n",
107 (gmode
& MDBRONLY
) ? "lot" : "co");
108 system((shell
= (char *)getenv("SHELL")) ? shell
: "/bin/csh");
109 rtfrmshell(dummy
); /* fixup tty */
112 movecursor(term
.t_nrow
-1, 0);
114 movecursor(term
.t_nrow
, 0);
116 movecursor(term
.t_nrow
, 0);
117 printf("\n\n\nUse \"fg\" to return to Pi%s\n",
118 (gmode
& MDBRONLY
) ? "lot" : "co");
120 movecursor(term
.t_nrow
, 0);
124 signal(SIGCONT
, rtfrmshell
); /* prepare to restart */
125 signal(SIGTSTP
, SIG_DFL
); /* prepare to stop */
134 bktoshell(int f
, int n
)
143 if(!Pmaster
->suspend
){
147 (*Pmaster
->suspend
)();
154 #endif /* _WINDOWS */
160 * rtfrmshell - back from shell, fix modes and return
165 signal(SIGCONT
, SIG_DFL
);
168 pclear(0, term
.t_nrow
);