home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / beav132s.arj / SPAWN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-08  |  1.4 KB  |  66 lines

  1. /*
  2. *    MS-DOS spawn command.com
  3. */
  4. #include        "def.h"
  5.  
  6. extern    char    MSG_shell[];
  7. extern    char    MSG_def_shell[];
  8. extern    char    MSG_pmpt[];
  9. extern    char    MSG_pt[];
  10. extern    char    MSG_pme[];
  11. extern    char    MSG_null[];
  12.  
  13. /* #include     <dos.h> */
  14. #if MSDOS
  15. #include        "process.h"
  16. #endif
  17. char   *cspec = NULL;           /* Command string.      */
  18. char   *pspec = NULL;
  19.  
  20. /*
  21. * Create a subjob with a copy
  22. * of the command intrepreter in it. When the
  23. * command interpreter exits, mark the screen as
  24. * garbage so that you do a full repaint.
  25. */
  26. bool spawncli (f, n, k)
  27. {
  28. #if MSDOS
  29.  
  30.     char   *getenv ();
  31.     char    old_prompt[NCOL];
  32.     char    prompt_line[NCOL];
  33.  
  34.     ttcolor (CTEXT);            /* Normal color.        */
  35.     ttmove (nrow - 1, 0);       /* Last line.           */
  36.     ttflush ();
  37.     ttcooked ();
  38. #ifndef IBM
  39.     strcpy (prompt_line, MSG_pmpt);
  40.     pspec = getenv (MSG_pt);
  41.     strcpy (old_prompt, pspec);
  42.     strcat (prompt_line, pspec);
  43.     if (strlen (prompt_line - strlen (MSG_pme)) >= 64)
  44.     /* VERY rude, but setenv not found */
  45.     {
  46.         if (putenv (MSG_pmpt) == -1)
  47.             exit (1);
  48.     }
  49.     else
  50.         if (putenv (prompt_line) == -1)
  51.             exit (1);
  52.  
  53. #endif
  54.     if (!cspec && !(cspec = getenv (MSG_shell)))/* jam */
  55.         cspec = MSG_def_shell;
  56.     spawnl (P_WAIT, cspec, MSG_null, NULL);
  57.     putenv (MSG_pme);
  58.     if (putenv (old_prompt) == -1)
  59.         exit (1);
  60.     ttraw ();
  61.     sgarbf = TRUE;
  62. #endif
  63.     return (TRUE);
  64. }
  65.  
  66.