aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c81
1 files changed, 71 insertions, 10 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index bdac188ed64..5f6b13f3da4 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -64,6 +64,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
64#include <sys/stat.h> 64#include <sys/stat.h>
65#include <errno.h> 65#include <errno.h>
66 66
67#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
68#include <dos.h>
69#include "dosfns.h"
70#include "msdos.h"
71#include <sys/param.h>
72#endif
73
67extern int errno; 74extern int errno;
68#ifndef VMS 75#ifndef VMS
69extern char *sys_errlist[]; 76extern char *sys_errlist[];
@@ -113,7 +120,9 @@ extern char *sys_errlist[];
113#undef FASYNC 120#undef FASYNC
114#endif 121#endif
115 122
123#ifndef MSDOS
116#include <sys/ioctl.h> 124#include <sys/ioctl.h>
125#endif
117#include "systty.h" 126#include "systty.h"
118#include "syswait.h" 127#include "syswait.h"
119 128
@@ -217,8 +226,13 @@ discard_tty_input ()
217 ioctl (input_fd, TIOCFLUSH, &zero); 226 ioctl (input_fd, TIOCFLUSH, &zero);
218 } 227 }
219#else /* not Apollo */ 228#else /* not Apollo */
229#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
230 while (dos_keyread () != -1)
231 ;
232#else /* not MSDOS */
220 EMACS_GET_TTY (input_fd, &buf); 233 EMACS_GET_TTY (input_fd, &buf);
221 EMACS_SET_TTY (input_fd, &buf, 0); 234 EMACS_SET_TTY (input_fd, &buf, 0);
235#endif /* not MSDOS */
222#endif /* not Apollo */ 236#endif /* not Apollo */
223#endif /* not VMS */ 237#endif /* not VMS */
224} 238}
@@ -247,6 +261,9 @@ init_baud_rate ()
247 ospeed = 0; 261 ospeed = 0;
248 else 262 else
249 { 263 {
264#ifdef MSDOS
265 ospeed = 15;
266#else
250#ifdef VMS 267#ifdef VMS
251 struct sensemode sg; 268 struct sensemode sg;
252 269
@@ -281,6 +298,7 @@ init_baud_rate ()
281#endif /* not HAVE_TERMIO */ 298#endif /* not HAVE_TERMIO */
282#endif /* not HAVE_TERMIOS */ 299#endif /* not HAVE_TERMIOS */
283#endif /* not VMS */ 300#endif /* not VMS */
301#endif /* not MSDOS */
284 } 302 }
285 303
286 baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0] 304 baud_rate = (ospeed < sizeof baud_convert / sizeof baud_convert[0]
@@ -441,6 +459,7 @@ flush_pending_output (channel)
441child_setup_tty (out) 459child_setup_tty (out)
442 int out; 460 int out;
443{ 461{
462#ifndef MSDOS
444 struct emacs_tty s; 463 struct emacs_tty s;
445 464
446 EMACS_GET_TTY (out, &s); 465 EMACS_GET_TTY (out, &s);
@@ -524,6 +543,7 @@ child_setup_tty (out)
524 ioctl (out, FIOASYNC, &zero); 543 ioctl (out, FIOASYNC, &zero);
525 } 544 }
526#endif /* RTU */ 545#endif /* RTU */
546#endif /* not MSDOS */
527} 547}
528#endif /* not VMS */ 548#endif /* not VMS */
529 549
@@ -547,6 +567,10 @@ struct save_signal
547 567
548sys_suspend () 568sys_suspend ()
549{ 569{
570#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
571 int st;
572 char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS. */
573#endif
550#ifdef VMS 574#ifdef VMS
551 /* "Foster" parentage allows emacs to return to a subprocess that attached 575 /* "Foster" parentage allows emacs to return to a subprocess that attached
552 to the current emacs as a cheaper than starting a whole new process. This 576 to the current emacs as a cheaper than starting a whole new process. This
@@ -588,7 +612,7 @@ sys_suspend ()
588 } 612 }
589 return -1; 613 return -1;
590#else 614#else
591#ifdef SIGTSTP 615#if defined(SIGTSTP) && !defined(MSDOS)
592 616
593 { 617 {
594 int pgrp = EMACS_GETPGRP (0); 618 int pgrp = EMACS_GETPGRP (0);
@@ -624,9 +648,13 @@ sys_suspend ()
624 { 648 {
625 char *sh; 649 char *sh;
626 650
651#ifdef MSDOS /* MW, Aug 1993 */
652 getwd (oldwd);
653#endif
627 sh = (char *) egetenv ("SHELL"); 654 sh = (char *) egetenv ("SHELL");
628 if (sh == 0) 655 if (sh == 0)
629 sh = "sh"; 656 sh = "sh";
657
630 /* Use our buffer's default directory for the subshell. */ 658 /* Use our buffer's default directory for the subshell. */
631 { 659 {
632 Lisp_Object dir; 660 Lisp_Object dir;
@@ -637,7 +665,7 @@ sys_suspend ()
637 which somehow wedges the hp compiler. So instead... */ 665 which somehow wedges the hp compiler. So instead... */
638 666
639 dir = intern ("default-directory"); 667 dir = intern ("default-directory");
640 /* Can't use NULL */ 668 /* Can't use NILP */
641 if (XFASTINT (Fboundp (dir)) == XFASTINT (Qnil)) 669 if (XFASTINT (Fboundp (dir)) == XFASTINT (Qnil))
642 goto xyzzy; 670 goto xyzzy;
643 dir = Fsymbol_value (dir); 671 dir = Fsymbol_value (dir);
@@ -665,9 +693,16 @@ sys_suspend ()
665 } 693 }
666#endif 694#endif
667 695
696#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
697 st = system (sh);
698 chdir (oldwd);
699 if (st)
700 report_file_error ("Can't execute subshell", Fcons (build_string (sh), Qnil));
701#else /* not MSDOS */
668 execlp (sh, sh, 0); 702 execlp (sh, sh, 0);
669 write (1, "Can't execute subshell", 22); 703 write (1, "Can't execute subshell", 22);
670 _exit (1); 704 _exit (1);
705#endif /* not MSDOS */
671 } 706 }
672 707
673 save_signal_handlers (saved_handlers); 708 save_signal_handlers (saved_handlers);
@@ -852,10 +887,11 @@ emacs_get_tty (fd, settings)
852 return -1; 887 return -1;
853 888
854#else 889#else
890#ifndef MSDOS
855 /* I give up - I hope you have the BSD ioctls. */ 891 /* I give up - I hope you have the BSD ioctls. */
856 if (ioctl (fd, TIOCGETP, &settings->main) < 0) 892 if (ioctl (fd, TIOCGETP, &settings->main) < 0)
857 return -1; 893 return -1;
858 894#endif /* not MSDOS */
859#endif 895#endif
860#endif 896#endif
861#endif 897#endif
@@ -943,9 +979,11 @@ emacs_set_tty (fd, settings, waitp)
943 return -1; 979 return -1;
944 980
945#else 981#else
982#ifndef MSDOS
946 /* I give up - I hope you have the BSD ioctls. */ 983 /* I give up - I hope you have the BSD ioctls. */
947 if (ioctl (fd, (waitp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) 984 if (ioctl (fd, (waitp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
948 return -1; 985 return -1;
986#endif /* not MSDOS */
949 987
950#endif 988#endif
951#endif 989#endif
@@ -1154,10 +1192,12 @@ init_sys_modes ()
1154 tty.main.tt_char &= ~TT$M_TTSYNC; 1192 tty.main.tt_char &= ~TT$M_TTSYNC;
1155 tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; 1193 tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
1156#else /* not VMS (BSD, that is) */ 1194#else /* not VMS (BSD, that is) */
1195#ifndef MSDOS
1157 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); 1196 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
1158 if (meta_key) 1197 if (meta_key)
1159 tty.main.sg_flags |= ANYP; 1198 tty.main.sg_flags |= ANYP;
1160 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; 1199 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
1200#endif
1161#endif /* not VMS (BSD, that is) */ 1201#endif /* not VMS (BSD, that is) */
1162#endif /* not HAVE_TERMIO */ 1202#endif /* not HAVE_TERMIO */
1163 1203
@@ -1195,6 +1235,10 @@ init_sys_modes ()
1195#ifdef HAVE_LTCHARS 1235#ifdef HAVE_LTCHARS
1196 tty.ltchars = new_ltchars; 1236 tty.ltchars = new_ltchars;
1197#endif /* HAVE_LTCHARS */ 1237#endif /* HAVE_LTCHARS */
1238#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
1239 internal_terminal_init ();
1240 dos_ttraw ();
1241#endif
1198 1242
1199 EMACS_SET_TTY (input_fd, &tty, 0); 1243 EMACS_SET_TTY (input_fd, &tty, 0);
1200 1244
@@ -1336,10 +1380,14 @@ get_frame_size (widthp, heightp)
1336 *widthp = tty.scr_wid; 1380 *widthp = tty.scr_wid;
1337 *heightp = tty.scr_len; 1381 *heightp = tty.scr_len;
1338 1382
1383#else
1384#ifdef MSDOS
1385 *widthp = ScreenCols ();
1386 *heightp = ScreenRows ();
1339#else /* system doesn't know size */ 1387#else /* system doesn't know size */
1340
1341 *widthp = 0; 1388 *widthp = 0;
1342 *heightp = 0; 1389 *heightp = 0;
1390#endif
1343 1391
1344#endif /* not VMS */ 1392#endif /* not VMS */
1345#endif /* not SunOS-style */ 1393#endif /* not SunOS-style */
@@ -1403,6 +1451,10 @@ reset_sys_modes ()
1403 while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR) 1451 while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR)
1404 ; 1452 ;
1405 1453
1454#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
1455 dos_ttcooked ();
1456#endif
1457
1406#ifdef AIX 1458#ifdef AIX
1407 hft_reset (); 1459 hft_reset ();
1408#endif 1460#endif
@@ -2031,6 +2083,9 @@ select (nfds, rfds, wfds, efds, timeout)
2031#ifdef FIONREAD 2083#ifdef FIONREAD
2032 status = ioctl (fd, FIONREAD, &avail); 2084 status = ioctl (fd, FIONREAD, &avail);
2033#else /* no FIONREAD */ 2085#else /* no FIONREAD */
2086#ifdef MSDOS
2087 abort (); /* I don't think we need it. */
2088#else /* not MSDOS */
2034 /* Hoping it will return -1 if nothing available 2089 /* Hoping it will return -1 if nothing available
2035 or 0 if all 0 chars requested are read. */ 2090 or 0 if all 0 chars requested are read. */
2036 if (proc_buffered_char[fd] >= 0) 2091 if (proc_buffered_char[fd] >= 0)
@@ -2041,6 +2096,7 @@ select (nfds, rfds, wfds, efds, timeout)
2041 if (avail > 0) 2096 if (avail > 0)
2042 proc_buffered_char[fd] = buf; 2097 proc_buffered_char[fd] = buf;
2043 } 2098 }
2099#endif /* not MSDOS */
2044#endif /* no FIONREAD */ 2100#endif /* no FIONREAD */
2045 } 2101 }
2046 if (status >= 0 && avail > 0) 2102 if (status >= 0 && avail > 0)
@@ -2061,6 +2117,10 @@ select (nfds, rfds, wfds, efds, timeout)
2061 while (select_alarmed == 0 && *local_timeout != 0 2117 while (select_alarmed == 0 && *local_timeout != 0
2062 && process_tick == update_tick) 2118 && process_tick == update_tick)
2063 { 2119 {
2120#ifdef MSDOS
2121 sleep_or_kbd_hit (SELECT_PAUSE, (orfds & 1) != 0);
2122 select_alarm ();
2123#else /* not MSDOS */
2064 /* If we are interested in terminal input, 2124 /* If we are interested in terminal input,
2065 wait by reading the terminal. 2125 wait by reading the terminal.
2066 That makes instant wakeup for terminal input at least. */ 2126 That makes instant wakeup for terminal input at least. */
@@ -2072,6 +2132,7 @@ select (nfds, rfds, wfds, efds, timeout)
2072 } 2132 }
2073 else 2133 else
2074 pause (); 2134 pause ();
2135#endif /* not MSDOS */
2075 } 2136 }
2076 (*local_timeout) -= SELECT_PAUSE; 2137 (*local_timeout) -= SELECT_PAUSE;
2077 /* Reset the old alarm if there was one */ 2138 /* Reset the old alarm if there was one */
@@ -3276,17 +3337,17 @@ rmdir (dpath)
3276 dup2 (fd, 1); 3337 dup2 (fd, 1);
3277 dup2 (fd, 2); 3338 dup2 (fd, 2);
3278 } 3339 }
3279 execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
3280 _exit (-1); /* Can't exec /bin/mkdir */
3281
3282 default: /* Parent process */
3283 wait_for_termination (cpid); 3340 wait_for_termination (cpid);
3341 if (synch_process_death != 0 || synch_process_retcode != 0)
3342 return -1; /* /bin/rmdir failed */
3343 default: /* Parent process */
3344 while (cpid != wait (&status)); /* Wait for kid to finish */
3284 } 3345 }
3285 3346
3286 if (synch_process_death != 0 || synch_process_retcode != 0) 3347 if (WIFSIGNALED (status) || WEXITSTATUS (status) != 0)
3287 { 3348 {
3288 errno = EIO; /* We don't know why, but */ 3349 errno = EIO; /* We don't know why, but */
3289 return -1; /* /bin/rmdir failed */ 3350 return -1; /* /bin/mkdir failed */
3290 } 3351 }
3291 3352
3292 return 0; 3353 return 0;