Mercurial > emacs
comparison src/sysdep.c @ 19699:ce0b47a57e23
(sys_subshell) [DOS_NT]: Save and restore parent's
working directory.
(sys_subshell) [WINDOWSNT]: Share MSDOS code. Don't take console.
(init_sys_modes, reset_sys_modes) [WINDOWSNT]: Do it even with
a read_socket_hook.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Wed, 03 Sep 1997 00:37:00 +0000 |
parents | fb3c3590498e |
children | de9483a63b12 |
comparison
equal
deleted
inserted
replaced
19698:fea1ad59e248 | 19699:ce0b47a57e23 |
---|---|
712 /* Fork a subshell. */ | 712 /* Fork a subshell. */ |
713 | 713 |
714 sys_subshell () | 714 sys_subshell () |
715 { | 715 { |
716 #ifndef VMS | 716 #ifndef VMS |
717 #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ | 717 #ifdef DOS_NT /* Demacs 1.1.2 91/10/20 Manabu Higashida */ |
718 int st; | 718 int st; |
719 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ | 719 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */ |
720 #endif | 720 #endif |
721 int pid; | 721 int pid; |
722 struct save_signal saved_handlers[5]; | 722 struct save_signal saved_handlers[5]; |
750 bcopy (XSTRING (dir)->data, str, len); | 750 bcopy (XSTRING (dir)->data, str, len); |
751 if (str[len - 1] != '/') str[len++] = '/'; | 751 if (str[len - 1] != '/') str[len++] = '/'; |
752 str[len] = 0; | 752 str[len] = 0; |
753 xyzzy: | 753 xyzzy: |
754 | 754 |
755 #ifdef WINDOWSNT | 755 #ifdef DOS_NT |
756 pid = -1; | |
757 #else /* not WINDOWSNT */ | |
758 | |
759 #ifdef MSDOS | |
760 pid = 0; | 756 pid = 0; |
761 #if __DJGPP__ > 1 | 757 #if __DJGPP__ > 1 |
762 save_signal_handlers (saved_handlers); | 758 save_signal_handlers (saved_handlers); |
763 synch_process_alive = 1; | 759 synch_process_alive = 1; |
764 #endif /* __DJGPP__ > 1 */ | 760 #endif /* __DJGPP__ > 1 */ |
767 if (pid == -1) | 763 if (pid == -1) |
768 error ("Can't spawn subshell"); | 764 error ("Can't spawn subshell"); |
769 #endif | 765 #endif |
770 | 766 |
771 if (pid == 0) | 767 if (pid == 0) |
772 #endif /* not WINDOWSNT */ | |
773 { | 768 { |
774 char *sh = 0; | 769 char *sh = 0; |
775 | 770 |
776 #ifdef MSDOS /* MW, Aug 1993 */ | 771 #ifdef DOS_NT /* MW, Aug 1993 */ |
777 getwd (oldwd); | 772 getwd (oldwd); |
778 if (sh == 0) | 773 if (sh == 0) |
779 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ | 774 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ |
780 #endif | 775 #endif |
781 if (sh == 0) | 776 if (sh == 0) |
809 #endif | 804 #endif |
810 #else /* not MSDOS */ | 805 #else /* not MSDOS */ |
811 #ifdef WINDOWSNT | 806 #ifdef WINDOWSNT |
812 /* Waits for process completion */ | 807 /* Waits for process completion */ |
813 pid = _spawnlp (_P_WAIT, sh, sh, NULL); | 808 pid = _spawnlp (_P_WAIT, sh, sh, NULL); |
809 chdir (oldwd); | |
814 if (pid == -1) | 810 if (pid == -1) |
815 write (1, "Can't execute subshell", 22); | 811 write (1, "Can't execute subshell", 22); |
816 | |
817 take_console (); | |
818 #else /* not WINDOWSNT */ | 812 #else /* not WINDOWSNT */ |
819 execlp (sh, sh, 0); | 813 execlp (sh, sh, 0); |
820 write (1, "Can't execute subshell", 22); | 814 write (1, "Can't execute subshell", 22); |
821 _exit (1); | 815 _exit (1); |
822 #endif /* not WINDOWSNT */ | 816 #endif /* not WINDOWSNT */ |
827 #if !defined (MSDOS) || __DJGPP__ == 1 | 821 #if !defined (MSDOS) || __DJGPP__ == 1 |
828 save_signal_handlers (saved_handlers); | 822 save_signal_handlers (saved_handlers); |
829 synch_process_alive = 1; | 823 synch_process_alive = 1; |
830 #endif | 824 #endif |
831 | 825 |
832 #ifndef MSDOS | 826 #ifndef DOS_NT |
833 wait_for_termination (pid); | 827 wait_for_termination (pid); |
834 #endif | 828 #endif |
835 restore_signal_handlers (saved_handlers); | 829 restore_signal_handlers (saved_handlers); |
836 synch_process_alive = 0; | 830 synch_process_alive = 0; |
837 #endif /* !VMS */ | 831 #endif /* !VMS */ |
1548 setbuf (stdout, _sobuf); | 1542 setbuf (stdout, _sobuf); |
1549 #endif | 1543 #endif |
1550 #ifdef HAVE_WINDOW_SYSTEM | 1544 #ifdef HAVE_WINDOW_SYSTEM |
1551 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1545 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
1552 needs the initialization code below. */ | 1546 needs the initialization code below. */ |
1553 if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1547 if (EQ (Vwindow_system, Qnil) |
1548 #ifndef WINDOWSNT | |
1549 /* When running in tty mode on NT/Win95, we have a read_socket | |
1550 hook, but still need the rest of the initialization code below. */ | |
1551 && (! read_socket_hook) | |
1552 #endif | |
1553 ) | |
1554 #endif | 1554 #endif |
1555 set_terminal_modes (); | 1555 set_terminal_modes (); |
1556 | 1556 |
1557 if (term_initted && no_redraw_on_reenter) | 1557 if (term_initted && no_redraw_on_reenter) |
1558 { | 1558 { |
1689 if (!term_initted) | 1689 if (!term_initted) |
1690 return; | 1690 return; |
1691 #ifdef HAVE_WINDOW_SYSTEM | 1691 #ifdef HAVE_WINDOW_SYSTEM |
1692 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1692 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
1693 needs the clean-up code below. */ | 1693 needs the clean-up code below. */ |
1694 if (read_socket_hook || !EQ (Vwindow_system, Qnil)) | 1694 if (!EQ (Vwindow_system, Qnil) |
1695 #ifndef WINDOWSNT | |
1696 /* When running in tty mode on NT/Win95, we have a read_socket | |
1697 hook, but still need the rest of the clean-up code below. */ | |
1698 || read_socket_hook | |
1699 #endif | |
1700 ) | |
1695 return; | 1701 return; |
1696 #endif | 1702 #endif |
1697 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0); | 1703 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0); |
1698 clear_end_of_line (FRAME_WIDTH (selected_frame)); | 1704 clear_end_of_line (FRAME_WIDTH (selected_frame)); |
1699 /* clear_end_of_line may move the cursor */ | 1705 /* clear_end_of_line may move the cursor */ |