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