home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / beav1402.zip / spawn.c < prev    next >
Text File  |  1993-04-16  |  2KB  |  76 lines

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