1
#if !defined(lint) && !defined(DOS)
2
static char rcsid[] = "$Id: shell.c 165 2006-10-04 01:09:47Z jpf@u.washington.edu $";
6
* ========================================================================
7
* Copyright 2006 University of Washington
9
* Licensed under the Apache License, Version 2.0 (the "License");
10
* you may not use this file except in compliance with the License.
11
* You may obtain a copy of the License at
13
* http://www.apache.org/licenses/LICENSE-2.0
15
* ========================================================================
22
#include "../estruct.h"
27
#include "../keydefs.h"
33
/* internal prototypes */
35
RETSIGTYPE rtfrmshell(int);
42
* bktoshell - suspend and wait to be woken up
45
bktoshell(void) /* suspend MicroEMACS and wait to wake up */
48
emlwrite("\007Unknown command: ^Z", NULL);
53
if(!Pmaster->suspend){
54
emlwrite("\007Unknown command: ^Z", NULL);
58
if((*Pmaster->suspend)() == NO_OP_COMMAND){
68
rv = (*Pmaster->showmsg)('x');
71
if(rv) /* Did showmsg corrupt the display? */
72
pico_refresh(0, 1); /* Yes, repaint */
82
pclear(0, term.t_nrow);
96
printf("\n\n\nUse \"exit\" to return to Pi%s\n",
97
(gmode & MDBRONLY) ? "lot" : "co");
98
system((shell = (char *)getenv("SHELL")) ? shell : "/bin/csh");
99
rtfrmshell(dummy); /* fixup tty */
102
movecursor(term.t_nrow-1, 0);
104
movecursor(term.t_nrow, 0);
106
movecursor(term.t_nrow, 0);
107
printf("\n\n\nUse \"fg\" to return to Pi%s\n",
108
(gmode & MDBRONLY) ? "lot" : "co");
110
movecursor(term.t_nrow, 0);
114
signal(SIGCONT, rtfrmshell); /* prepare to restart */
115
signal(SIGTSTP, SIG_DFL); /* prepare to stop */
127
emlwrite("\007Unknown command: ^Z", NULL);
131
if(!Pmaster->suspend){
132
emlwrite("\007Unknown command: ^Z", NULL);
135
(*Pmaster->suspend)();
142
#endif /* _WINDOWS */
148
* rtfrmshell - back from shell, fix modes and return
153
signal(SIGCONT, SIG_DFL);
156
pclear(0, term.t_nrow);