home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
2
/
2872
/
spawn.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-27
|
2KB
|
67 lines
/*
* MS-DOS spawn command.com
*/
#include "def.h"
extern char MSG_shell[];
extern char MSG_def_shell[];
extern char MSG_pmpt[];
extern char MSG_pt[];
extern char MSG_pme[];
extern char MSG_null[];
#include "lintfunc.dec"
/* #include <dos.h> */
#if MSDOS
#include "process.h"
#endif
char *cspec = NULL; /* Command string. */
char *pspec = NULL;
/*
* Create a subjob with a copy
* of the command intrepreter in it. When the
* command interpreter exits, mark the screen as
* garbage so that you do a full repaint.
*/
bool spawncli (f, n, k)
{
#if MSDOS
char *getenv ();
char old_prompt[128];
char prompt_line[128];
ttcolor (CTEXT); /* Normal color. */
ttmove (nrow - 1, 0); /* Last line. */
ttflush ();
ttcooked ();
#ifndef IBM
strcpy (prompt_line, MSG_pmpt);
pspec = getenv (MSG_pt);
strcpy (old_prompt, pspec);
strcat (prompt_line, pspec);
if (strlen (prompt_line - strlen (MSG_pme)) >= 64)
/* VERY rude, but setenv not found */
{
if (putenv (MSG_pmpt) == -1)
exit (1);
}
else
if (putenv (prompt_line) == -1)
exit (1);
#endif
if (!cspec && !(cspec = getenv (MSG_shell)))/* jam */
cspec = MSG_def_shell;
spawnl (P_WAIT, cspec, MSG_null, NULL);
putenv (MSG_pme);
if (putenv (old_prompt) == -1)
exit (1);
ttraw ();
sgarbf = TRUE;
#endif
return (TRUE);
}