annotate 3rdparty/packages/uemacs/uespawn.c @ 3027:32a23a8c3332

Fix for all ide rbsuper descripters being set for drive 0
author chawks4
date Fri, 12 Dec 2014 20:48:42 -0600
parents 48c646212b1c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
995
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
1 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
2 * The routines in this file are called to create a subjob running a command
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
3 * interpreter. This code is a big fat nothing on CP/M-86. You lose.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
4 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
5 #include <stdio.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
6 #include "ueed.h"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
7
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
8 #ifdef AMIGA
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
9 #define NEW 1006
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
10 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
11
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
12 #ifdef VMS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
13 #define EFN 0 /* Event flag. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
14
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
15 #include <ssdef.h> /* Random headers. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
16 #include <stsdef.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
17 #include <descrip.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
18 #include <iodef.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
19
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
20 extern int oldmode[]; /* In "termio.c" */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
21 extern int newmode[]; /* In "termio.c" */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
22 extern short iochan; /* In "termio.c" */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
23 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
24
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
25 #ifdef MSDOS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
26 #include <dos.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
27 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
28
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
29 #ifdef V7
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
30 #include <signal.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
31 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
32
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
33 #ifdef OSK
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
34 #include <sgstat.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
35 extern struct sgbuf ostate; /* In "termio.c" */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
36 extern struct sgbuf nstate; /* In "termio.c" */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
37 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
38
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
39 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
40 * Create a subjob with a copy of the command intrepreter in it. When the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
41 * command interpreter exits, mark the screen as garbage so that you do a full
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
42 * repaint. Bound to "C-C". The message at the start in VMS puts out a newline.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
43 * Under some (unknown) condition, you don't get one free when DCL starts up.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
44 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
45 spawncli(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
46 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
47 #ifdef AMIGA
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
48 long newcli;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
49
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
50 newcli = Open("CON:1/1/639/199/MicroEmacs Subprocess", NEW);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
51 mlwrite("[Starting new CLI]");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
52 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
53 Execute("", newcli, 0);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
54 Close(newcli);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
55 return(TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
56 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
57 #ifdef VMS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
58 movecursor(term.t_nrow, 0); /* In last line. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
59 mlputs("[Starting DCL]\r\n");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
60 (*term.t_flush)(); /* Ignore "ttcol". */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
61 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
62 return (sys(NULL)); /* NULL => DCL. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
63 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
64 #ifdef CPM
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
65 mlwrite("Not in CP/M-86");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
66 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
67 #ifdef MSDOS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
68 movecursor(term.t_nrow, 0); /* Seek to last line. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
69 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
70 sys("\\command.com", ""); /* Run CLI. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
71 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
72 return(TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
73 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
74 #ifdef V7
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
75 register char *cp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
76 char *getenv();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
77 movecursor(term.t_nrow, 0); /* Seek to last line. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
78 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
79 ttclose(); /* stty to old settings */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
80 if ((cp = getenv("SHELL")) != NULL && *cp != '\0')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
81 system(cp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
82 else
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
83 system("exec /bin/sh");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
84 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
85 sleep(2);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
86 ttopen();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
87 return(TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
88 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
89 #ifdef OSK
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
90 register char *cp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
91 char *getenv();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
92 movecursor(term.t_nrow, 0); /* Seek to last line. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
93 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
94 setstat(0, 0, &ostate); /* stty to old settings */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
95 if ((cp = getenv("SHELL")) != NULL && *cp != '\0')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
96 system(cp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
97 else
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
98 system("shell");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
99 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
100 setstat(0, 0, &nstate);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
101 return(TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
102 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
103 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
104
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
105 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
106 * Run a one-liner in a subjob. When the command returns, wait for a single
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
107 * character to be typed, then mark the screen as garbage so a full repaint is
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
108 * done. Bound to "C-X !".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
109 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
110 spawn(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
111 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
112 register int s;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
113 char line[NLINE];
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
114 #ifdef AMIGA
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
115 long newcli;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
116
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
117 newcli = Open("CON:1/1/639/199/MicroEmacs Subprocess", NEW);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
118 if ((s=mlreply("CLI command: ", line, NLINE)) != TRUE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
119 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
120 Execute(line,0,newcli);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
121 Close(newcli);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
122 while ((*term.t_getchar)() != '\r') /* Pause. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
123 ;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
124 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
125 return(TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
126 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
127 #ifdef VMS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
128 if ((s=mlreply("DCL command: ", line, NLINE)) != TRUE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
129 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
130 (*term.t_putchar)('\n'); /* Already have '\r' */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
131 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
132 s = sys(line); /* Run the command. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
133 mlputs("\r\n\n[End]"); /* Pause. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
134 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
135 while ((*term.t_getchar)() != '\r')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
136 ;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
137 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
138 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
139 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
140 #ifdef CPM
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
141 mlwrite("Not in CP/M-86");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
142 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
143 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
144 #ifdef MSDOS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
145 if ((s=mlreply("MS-DOS command: ", line, NLINE)) != TRUE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
146 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
147 system(line);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
148 while ((*term.t_getchar)() != '\r') /* Pause. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
149 ;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
150 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
151 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
152 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
153 #ifdef V7
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
154 if ((s=mlreply("! ", line, NLINE)) != TRUE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
155 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
156 (*term.t_putchar)('\n'); /* Already have '\r' */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
157 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
158 ttclose(); /* stty to old modes */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
159 system(line);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
160 sleep(2);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
161 ttopen();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
162 mlputs("[End]"); /* Pause. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
163 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
164 while ((s = (*term.t_getchar)()) != '\r' && s != ' ')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
165 ;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
166 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
167 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
168 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
169 #ifdef OSK
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
170 if ((s=mlreply("! ", line, NLINE)) != TRUE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
171 return (s);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
172 (*term.t_putchar)('\l'); /* Already have '\r' */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
173 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
174 setstat(0, 0, &ostate); /* stty to old modes */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
175 s=system(line);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
176 setstat(0, 0, &nstate);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
177 mlputs("[End]"); /* Pause. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
178 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
179 while ((s = (*term.t_getchar)()) != '\r' && s != ' ')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
180 ;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
181 sgarbf = TRUE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
182 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
183 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
184 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
185
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
186 #ifdef VMS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
187 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
188 * Run a command. The "cmd" is a pointer to a command string, or NULL if you
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
189 * want to run a copy of DCL in the subjob (this is how the standard routine
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
190 * LIB$SPAWN works. You have to do wierd stuff with the terminal on the way in
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
191 * and the way out, because DCL does not want the channel to be in raw mode.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
192 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
193 sys(cmd)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
194 register char *cmd;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
195 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
196 struct dsc$descriptor cdsc;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
197 struct dsc$descriptor *cdscp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
198 long status;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
199 long substatus;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
200 long iosb[2];
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
201
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
202 status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
203 oldmode, sizeof(oldmode), 0, 0, 0, 0);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
204 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
205 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
206 cdscp = NULL; /* Assume DCL. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
207 if (cmd != NULL) { /* Build descriptor. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
208 cdsc.dsc$a_pointer = cmd;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
209 cdsc.dsc$w_length = strlen(cmd);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
210 cdsc.dsc$b_dtype = DSC$K_DTYPE_T;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
211 cdsc.dsc$b_class = DSC$K_CLASS_S;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
212 cdscp = &cdsc;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
213 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
214 status = LIB$SPAWN(cdscp, 0, 0, 0, 0, 0, &substatus, 0, 0, 0);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
215 if (status != SS$_NORMAL)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
216 substatus = status;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
217 status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
218 newmode, sizeof(newmode), 0, 0, 0, 0);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
219 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
220 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
221 if ((substatus&STS$M_SUCCESS) == 0) /* Command failed. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
222 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
223 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
224 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
225 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
226
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
227 #ifdef MSDOS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
228 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
229 * This routine, once again by Bob McNamara, is a C translation of the "system"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
230 * routine in the MWC-86 run time library. It differs from the "system" routine
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
231 * in that it does not unconditionally append the string ".exe" to the end of
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
232 * the command name. We needed to do this because we want to be able to spawn
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
233 * off "command.com". We really do not understand what it does, but if you don't
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
234 * do it exactly "malloc" starts doing very very strange things.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
235 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
236 sys(cmd, tail)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
237 char *cmd;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
238 char *tail;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
239 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
240 #ifdef MWC_86
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
241 register unsigned n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
242 extern char *__end;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
243
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
244 n = __end + 15;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
245 n >>= 4;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
246 n = ((n + dsreg() + 16) & 0xFFF0) + 16;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
247 return(execall(cmd, tail, n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
248 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
249
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
250 #ifdef LATTICE
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
251 return forklp(cmd, tail, NULL);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
252 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
253 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
254 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
255
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
256