diff options
| author | Richard M. Stallman | 1995-09-02 16:22:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-09-02 16:22:17 +0000 |
| commit | 7964ba9e0760b140153174d92636bd8d4c9ffcd9 (patch) | |
| tree | 58ab07ac10d5e61da9c5b718baf109700d2e8db4 /src | |
| parent | 91b0b37e2aec81015f6db3a43c80103d4e7a8375 (diff) | |
| download | emacs-7964ba9e0760b140153174d92636bd8d4c9ffcd9.tar.gz emacs-7964ba9e0760b140153174d92636bd8d4c9ffcd9.zip | |
(sys_subshell) [MSDOS]: Handle SUSPEND env var.
Disable error report from subshell if system returns non-zero.
Don't call vfork before calling system.
Don't call wait_for_termination.
(sys_select): Turn it off if MSDOS.
(reset_sys_modes): Support EMACSCOLORS env var.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 8b77362b98f..0b46d965f25 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -720,19 +720,26 @@ sys_subshell () | |||
| 720 | #ifdef WINDOWSNT | 720 | #ifdef WINDOWSNT |
| 721 | pid = -1; | 721 | pid = -1; |
| 722 | #else /* not WINDOWSNT */ | 722 | #else /* not WINDOWSNT */ |
| 723 | #ifdef MSDOS | ||
| 724 | pid = 0; | ||
| 725 | #else | ||
| 723 | pid = vfork (); | 726 | pid = vfork (); |
| 724 | |||
| 725 | if (pid == -1) | 727 | if (pid == -1) |
| 726 | error ("Can't spawn subshell"); | 728 | error ("Can't spawn subshell"); |
| 729 | #endif | ||
| 730 | |||
| 727 | if (pid == 0) | 731 | if (pid == 0) |
| 728 | #endif /* not WINDOWSNT */ | 732 | #endif /* not WINDOWSNT */ |
| 729 | { | 733 | { |
| 730 | char *sh; | 734 | char *sh = 0; |
| 731 | 735 | ||
| 732 | #ifdef MSDOS /* MW, Aug 1993 */ | 736 | #ifdef MSDOS /* MW, Aug 1993 */ |
| 733 | getwd (oldwd); | 737 | getwd (oldwd); |
| 738 | if (sh == 0) | ||
| 739 | sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ | ||
| 734 | #endif | 740 | #endif |
| 735 | sh = (char *) egetenv ("SHELL"); | 741 | if (sh == 0) |
| 742 | sh = (char *) egetenv ("SHELL"); | ||
| 736 | if (sh == 0) | 743 | if (sh == 0) |
| 737 | sh = "sh"; | 744 | sh = "sh"; |
| 738 | 745 | ||
| @@ -756,8 +763,10 @@ sys_subshell () | |||
| 756 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ | 763 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ |
| 757 | st = system (sh); | 764 | st = system (sh); |
| 758 | chdir (oldwd); | 765 | chdir (oldwd); |
| 766 | #if 0 /* This is also reported if last command executed in subshell failed, KFS */ | ||
| 759 | if (st) | 767 | if (st) |
| 760 | report_file_error ("Can't execute subshell", Fcons (build_string (sh), Qnil)); | 768 | report_file_error ("Can't execute subshell", Fcons (build_string (sh), Qnil)); |
| 769 | #endif | ||
| 761 | #else /* not MSDOS */ | 770 | #else /* not MSDOS */ |
| 762 | #ifdef WINDOWSNT | 771 | #ifdef WINDOWSNT |
| 763 | /* Waits for process completion */ | 772 | /* Waits for process completion */ |
| @@ -776,7 +785,9 @@ sys_subshell () | |||
| 776 | 785 | ||
| 777 | save_signal_handlers (saved_handlers); | 786 | save_signal_handlers (saved_handlers); |
| 778 | synch_process_alive = 1; | 787 | synch_process_alive = 1; |
| 788 | #ifndef MSDOS | ||
| 779 | wait_for_termination (pid); | 789 | wait_for_termination (pid); |
| 790 | #endif | ||
| 780 | restore_signal_handlers (saved_handlers); | 791 | restore_signal_handlers (saved_handlers); |
| 781 | #endif /* !VMS */ | 792 | #endif /* !VMS */ |
| 782 | } | 793 | } |
| @@ -1607,10 +1618,14 @@ reset_sys_modes () | |||
| 1607 | #ifdef MSDOS | 1618 | #ifdef MSDOS |
| 1608 | if (!EQ (Vwindow_system, Qnil)) | 1619 | if (!EQ (Vwindow_system, Qnil)) |
| 1609 | { | 1620 | { |
| 1610 | /* Change to grey on white. */ | 1621 | char *colors = getenv("EMACSCOLORS"); |
| 1622 | int color = 0x07; /* Change to white on black */ | ||
| 1623 | if (colors && strlen (colors) >= 5 && colors[2] == ';') | ||
| 1624 | color = ((colors[4] & 0x07) << 4) || (colors[3] & 0x07); | ||
| 1625 | if ((stdout)->_cnt < 3) fflush(stdout); /* avoid call to _flsbuf */ | ||
| 1611 | putchar ('\e'); | 1626 | putchar ('\e'); |
| 1612 | putchar ('A'); | 1627 | putchar ('A'); |
| 1613 | putchar (7); | 1628 | putchar (color); |
| 1614 | } | 1629 | } |
| 1615 | #endif | 1630 | #endif |
| 1616 | clear_end_of_line (FRAME_WIDTH (selected_frame)); | 1631 | clear_end_of_line (FRAME_WIDTH (selected_frame)); |
| @@ -2211,6 +2226,7 @@ init_system_name () | |||
| 2211 | } | 2226 | } |
| 2212 | } | 2227 | } |
| 2213 | 2228 | ||
| 2229 | #ifndef MSDOS | ||
| 2214 | #ifndef VMS | 2230 | #ifndef VMS |
| 2215 | #if !defined (HAVE_SELECT) || defined (BROKEN_SELECT_NON_X) | 2231 | #if !defined (HAVE_SELECT) || defined (BROKEN_SELECT_NON_X) |
| 2216 | 2232 | ||
| @@ -2331,9 +2347,6 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2331 | #ifdef FIONREAD | 2347 | #ifdef FIONREAD |
| 2332 | status = ioctl (fd, FIONREAD, &avail); | 2348 | status = ioctl (fd, FIONREAD, &avail); |
| 2333 | #else /* no FIONREAD */ | 2349 | #else /* no FIONREAD */ |
| 2334 | #ifdef MSDOS | ||
| 2335 | abort (); /* I don't think we need it. */ | ||
| 2336 | #else /* not MSDOS */ | ||
| 2337 | /* Hoping it will return -1 if nothing available | 2350 | /* Hoping it will return -1 if nothing available |
| 2338 | or 0 if all 0 chars requested are read. */ | 2351 | or 0 if all 0 chars requested are read. */ |
| 2339 | if (proc_buffered_char[fd] >= 0) | 2352 | if (proc_buffered_char[fd] >= 0) |
| @@ -2344,7 +2357,6 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2344 | if (avail > 0) | 2357 | if (avail > 0) |
| 2345 | proc_buffered_char[fd] = buf; | 2358 | proc_buffered_char[fd] = buf; |
| 2346 | } | 2359 | } |
| 2347 | #endif /* not MSDOS */ | ||
| 2348 | #endif /* no FIONREAD */ | 2360 | #endif /* no FIONREAD */ |
| 2349 | } | 2361 | } |
| 2350 | if (status >= 0 && avail > 0) | 2362 | if (status >= 0 && avail > 0) |
| @@ -2365,10 +2377,6 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2365 | while (select_alarmed == 0 && *local_timeout != 0 | 2377 | while (select_alarmed == 0 && *local_timeout != 0 |
| 2366 | && process_tick == update_tick) | 2378 | && process_tick == update_tick) |
| 2367 | { | 2379 | { |
| 2368 | #ifdef MSDOS | ||
| 2369 | sleep_or_kbd_hit (SELECT_PAUSE, FD_ISSET (0, &orfds) != 0); | ||
| 2370 | select_alarm (); | ||
| 2371 | #else /* not MSDOS */ | ||
| 2372 | /* If we are interested in terminal input, | 2380 | /* If we are interested in terminal input, |
| 2373 | wait by reading the terminal. | 2381 | wait by reading the terminal. |
| 2374 | That makes instant wakeup for terminal input at least. */ | 2382 | That makes instant wakeup for terminal input at least. */ |
| @@ -2380,7 +2388,6 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2380 | } | 2388 | } |
| 2381 | else | 2389 | else |
| 2382 | pause (); | 2390 | pause (); |
| 2383 | #endif /* not MSDOS */ | ||
| 2384 | } | 2391 | } |
| 2385 | (*local_timeout) -= SELECT_PAUSE; | 2392 | (*local_timeout) -= SELECT_PAUSE; |
| 2386 | /* Reset the old alarm if there was one */ | 2393 | /* Reset the old alarm if there was one */ |
| @@ -2473,6 +2480,7 @@ read_input_waiting () | |||
| 2473 | 2480 | ||
| 2474 | #endif /* not HAVE_SELECT */ | 2481 | #endif /* not HAVE_SELECT */ |
| 2475 | #endif /* not VMS */ | 2482 | #endif /* not VMS */ |
| 2483 | #endif /* not MSDOS */ | ||
| 2476 | 2484 | ||
| 2477 | #ifdef BSD4_1 | 2485 | #ifdef BSD4_1 |
| 2478 | /* | 2486 | /* |